git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Another test
d3c5372Phil Freeman
examples/passing/Auto.psnew file+9
@@ -0,0 +1,9 @@
1+data Auto s i o = Auto { state :: s, step :: s -> i -> o }
2+
3+type SomeAuto i o = forall r. (forall s. Auto s i o -> r) -> r
4+
5+exists :: forall s1 i o. s1 -> (s1 -> i -> o) -> SomeAuto i o
6+exists = \state step f -> f (Auto { state: state, step: step })
7+
8+run :: forall i o. SomeAuto i o -> i -> o
9+run = \s i -> s (\a -> case a of Auto x -> x.step x.state i)
src/Language/PureScript/TypeChecker/Types.hs+1
@@ -145,6 +145,7 @@ isFunction (Abs _ _) = True
145isFunction (TypedValue untyped _) = isFunction untyped
145isFunction (TypedValue untyped _) = isFunction untyped
146isFunction _ = False
146isFunction _ = False
147
147
148+-- TODO: check skolems don't escape
148typeOf :: Maybe Ident -> Value -> Check Type
149typeOf :: Maybe Ident -> Value -> Check Type
149typeOf name val = do
150typeOf name val = do
150 (ty, sub, checks) <- runSubst $ case name of
151 (ty, sub, checks) <- runSubst $ case name of
src/Language/PureScript/Types.hs+2−2
@@ -64,9 +64,9 @@ isMonoType ty = isPolyType ty
64isPolyType :: Type -> Bool
64isPolyType :: Type -> Bool
65isPolyType (Array ty) = isMonoType ty
65isPolyType (Array ty) = isMonoType ty
66isPolyType (Object ps) = all isPolyType (map snd . fst $ rowToList ps)
66isPolyType (Object ps) = all isPolyType (map snd . fst $ rowToList ps)
67−isPolyType (Function args ret) = all isPolyType args && isMonoType ret
67+isPolyType (Function args ret) = all isPolyType args && isPolyType ret
68isPolyType (TypeApp t1 t2) = isMonoType t1 && isMonoType t2
68isPolyType (TypeApp t1 t2) = isMonoType t1 && isMonoType t2
69−isPolyType (SaturatedTypeSynonym _ args) = all isMonoType args
69+isPolyType (SaturatedTypeSynonym _ args) = all isPolyType args
70isPolyType (ForAll idents ty) = isPolyType ty
70isPolyType (ForAll idents ty) = isPolyType ty
71isPolyType _ = True
71isPolyType _ = True
72
72