From c9b0d5cbb0f6703576b77abb53120a5c5e6a1b38 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Fri, 8 Nov 2024 15:30:08 -0800 Subject: [PATCH] Remove superfluous bool combinators --- unison-runtime/src/Unison/Runtime/Builtin.hs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/unison-runtime/src/Unison/Runtime/Builtin.hs b/unison-runtime/src/Unison/Runtime/Builtin.hs index e26c5afdb1..73a31e3380 100644 --- a/unison-runtime/src/Unison/Runtime/Builtin.hs +++ b/unison-runtime/src/Unison/Runtime/Builtin.hs @@ -1413,15 +1413,6 @@ arg2To0 instr = where (arg1, arg2) = fresh --- ... -> Bool -argNToBool :: Int -> ForeignOp -argNToBool n instr = - (replicate n BX,) - . TAbss args - $ TFOp instr args - where - args = freshes n - argNDirect :: Int -> ForeignOp argNDirect n instr = (replicate n BX,) @@ -2252,7 +2243,7 @@ declareForeigns = do . mkForeignIOF $ \(mv :: MVar Val, x) -> swapMVar mv x - declareForeign Tracked "MVar.isEmpty" (argNToBool 1) + declareForeign Tracked "MVar.isEmpty" (argNDirect 1) . mkForeign $ \(mv :: MVar Val) -> isEmptyMVar mv @@ -2347,7 +2338,7 @@ declareForeigns = do declareForeign Tracked "Promise.tryRead" argToMaybe . mkForeign $ \(p :: Promise Val) -> tryReadPromise p - declareForeign Tracked "Promise.write" (argNToBool 2) . mkForeign $ + declareForeign Tracked "Promise.write" (argNDirect 2) . mkForeign $ \(p :: Promise Val, a :: Val) -> writePromise p a declareForeign Tracked "Tls.newClient.impl.v3" arg2ToEF . mkForeignTls $ @@ -2783,7 +2774,7 @@ declareForeigns = do declareForeign Untracked "Pattern.run" arg2ToMaybeTup . mkForeign $ \(TPat.CP _ matcher, input :: Text) -> pure $ matcher input - declareForeign Untracked "Pattern.isMatch" (argNToBool 2) . mkForeign $ + declareForeign Untracked "Pattern.isMatch" (argNDirect 2) . mkForeign $ \(TPat.CP _ matcher, input :: Text) -> pure . isJust $ matcher input declareForeign Untracked "Char.Class.any" direct . mkForeign $ \() -> pure TPat.Any @@ -2808,7 +2799,7 @@ declareForeigns = do declareForeign Untracked "Char.Class.symbol" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Symbol) declareForeign Untracked "Char.Class.separator" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Separator) declareForeign Untracked "Char.Class.letter" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Letter) - declareForeign Untracked "Char.Class.is" (argNToBool 2) . mkForeign $ \(cl, c) -> evaluate $ TPat.charPatternPred cl c + declareForeign Untracked "Char.Class.is" (argNDirect 2) . mkForeign $ \(cl, c) -> evaluate $ TPat.charPatternPred cl c declareForeign Untracked "Text.patterns.char" (argNDirect 1) . mkForeign $ \c -> let v = TPat.cpattern (TPat.Char c) in pure v