git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Another test
commitd3c5372f5dcf3880abd607deb9916809cec61aee authorPhil Freeman <paf31@cantab.net> dateWed 27 Nov 2013, 15:49 (13 years ago) parent974621e
3 files changed+12−2
examples/passing/Auto.ps+9 src/Language/PureScript/TypeChecker/Types.hs+1 src/Language/PureScript/Types.hs+2−2
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
145145isFunction (TypedValue untyped _) = isFunction untyped
146146isFunction _ = False
147147
148+-- TODO: check skolems don't escape
148149typeOf :: Maybe Ident -> Value -> Check Type
149150typeOf name val = do
150151 (ty, sub, checks) <- runSubst $ case name of
src/Language/PureScript/Types.hs+2−2
@@ -64,9 +64,9 @@ isMonoType ty = isPolyType ty
6464isPolyType :: Type -> Bool
6565isPolyType (Array ty) = isMonoType ty
6666isPolyType (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
6868isPolyType (TypeApp t1 t2) = isMonoType t1 && isMonoType t2
69−isPolyType (SaturatedTypeSynonym _ args) = all isMonoType args
69+isPolyType (SaturatedTypeSynonym _ args) = all isPolyType args
7070isPolyType (ForAll idents ty) = isPolyType ty
7171isPolyType _ = True
7272