git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Additional test
ab7b8abPhil Freeman
examples/passing/MultiArgFunctions.purs+8−1
@@ -4,6 +4,12 @@ import Data.Function
4import Control.Monad.Eff
4import Control.Monad.Eff
5import Debug.Trace
5import Debug.Trace
6
6
7+f = mkFn2 $ \a b -> runFn2 g a b + runFn2 g b a
8+
9+g = mkFn2 $ \a b -> case {} of
10+ _ | a <= 0 || b <= 0 -> b
11+ _ -> runFn2 f (a - 1) (b - 1)
12+
7main = do
13main = do
8 runFn0 (mkFn0 $ \_ -> trace $ show 0)
14 runFn0 (mkFn0 $ \_ -> trace $ show 0)
9 runFn1 (mkFn1 $ \a -> trace $ show a) 1
15 runFn1 (mkFn1 $ \a -> trace $ show a) 1
@@ -11,4 +17,5 @@ main = do
11 runFn3 (mkFn3 $ \a b c -> trace $ show [a, b, c]) 1 2 3
17 runFn3 (mkFn3 $ \a b c -> trace $ show [a, b, c]) 1 2 3
12 runFn4 (mkFn4 $ \a b c d -> trace $ show [a, b, c, d]) 1 2 3 4
18 runFn4 (mkFn4 $ \a b c d -> trace $ show [a, b, c, d]) 1 2 3 4
13 runFn5 (mkFn5 $ \a b c d e -> trace $ show [a, b, c, d, e]) 1 2 3 4 5
19 runFn5 (mkFn5 $ \a b c d e -> trace $ show [a, b, c, d, e]) 1 2 3 4 5
20+ print $ runFn2 g 15 12
14− trace "Done!"
21+ trace "Done!"
src/Language/PureScript/TypeChecker/Types.hs+3−3
@@ -227,9 +227,9 @@ typeForBindingGroupElement moduleName el dict untypedDict =
227 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
227 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
228 -- Check the type with the new names in scope
228 -- Check the type with the new names in scope
229 ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
229 ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
230− val'' <- bindNames dict $ if checkType
230+ val'' <- if checkType
231− then TypedValue True <$> check val' ty' <*> pure ty'
231+ then bindNames dict $ TypedValue True <$> check val' ty' <*> pure ty'
232− else return (TypedValue False val' ty')
232+ else return (TypedValue False val' ty')
233 return (ident, (val'', ty'))
233 return (ident, (val'', ty'))
234 -- Untyped declarations
234 -- Untyped declarations
235 (ident, (val', Nothing)) -> do
235 (ident, (val', Nothing)) -> do