git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix failing tests
a8108d0Phil Freeman
examples/passing/MonadState.purs+7
@@ -12,6 +12,13 @@ data State s a = State (s -> Tuple s a)
12
12
13runState s (State f) = f s
13runState s (State f) = f s
14
14
15+instance functorState :: Functor (State s) where
16+ (<$>) = liftM1
17+
18+instance appState :: Applicative (State s) where
19+ pure = return
20+ (<*>) = ap
21+
15instance monadState :: Prelude.Monad (State s) where
22instance monadState :: Prelude.Monad (State s) where
16 return a = State $ \s -> Tuple s a
23 return a = State $ \s -> Tuple s a
17 (>>=) f g = State $ \s -> case runState s f of
24 (>>=) f g = State $ \s -> case runState s f of
examples/passing/TypeClasses.purs+21
@@ -21,12 +21,26 @@ instance showData :: (Prelude.Show a) => Prelude.Show (Data a) where
21
21
22test3 = \_ -> show (Data "testing")
22test3 = \_ -> show (Data "testing")
23
23
24+instance functorData :: Functor Data where
25+ (<$>) = liftM1
26+
27+instance appData :: Applicative Data where
28+ pure = return
29+ (<*>) = ap
30+
24instance monadData :: Prelude.Monad Data where
31instance monadData :: Prelude.Monad Data where
25 return = Data
32 return = Data
26 (>>=) (Data a) f = f a
33 (>>=) (Data a) f = f a
27
34
28data Maybe a = Nothing | Just a
35data Maybe a = Nothing | Just a
29
36
37+instance functorMaybe :: Functor Maybe where
38+ (<$>) = liftM1
39+
40+instance appMaybe :: Applicative Maybe where
41+ pure = return
42+ (<*>) = ap
43+
30instance monadMaybe :: Prelude.Monad Maybe where
44instance monadMaybe :: Prelude.Monad Maybe where
31 return = Just
45 return = Just
32 (>>=) Nothing _ = Nothing
46 (>>=) Nothing _ = Nothing
@@ -43,6 +57,13 @@ instance showArray :: (Prelude.Show a) => Prelude.Show [a] where
43
57
44test6 = \_ -> show ["testing"]
58test6 = \_ -> show ["testing"]
45
59
60+instance functorFunction :: Functor ((->) r) where
61+ (<$>) = liftM1
62+
63+instance appFunction :: Applicative ((->) r) where
64+ pure = return
65+ (<*>) = ap
66+
46instance monadFunction :: Prelude.Monad ((->) r) where
67instance monadFunction :: Prelude.Monad ((->) r) where
47 return a r = a
68 return a r = a
48 (>>=) f g r = g (f r) r
69 (>>=) f g r = g (f r) r
src/Language/PureScript/Sugar/TypeClasses.hs+1−1
@@ -152,7 +152,7 @@ typeInstanceDictionaryDeclaration name mn deps className tys decls = do
152 M.lookup (qualify mn className) m
152 M.lookup (qualify mn className) m
153 let instanceTys = map memberToNameAndType tyDecls
153 let instanceTys = map memberToNameAndType tyDecls
154
154
155− let superclasses = TypedValue False (ArrayLiteral [ TypeClassDictionary False (superclass, tyArgs) Nothing
155+ let superclasses = TypedValue False (ArrayLiteral [ Abs (Left (Ident "_")) (TypeClassDictionary False (superclass, tyArgs) Nothing)
156 | (superclass, suTyArgs) <- implies
156 | (superclass, suTyArgs) <- implies
157 , let tyArgs = map (replaceAllTypeVars (zip args tys)) suTyArgs
157 , let tyArgs = map (replaceAllTypeVars (zip args tys)) suTyArgs
158 ]) (TypeApp tyArray unit)
158 ]) (TypeApp tyArray unit)
src/Language/PureScript/TypeChecker/Types.hs+5−3
@@ -355,9 +355,10 @@ entails env moduleName context = solve (sortedNubBy canonicalizeDictionary (filt
355 dictionaryValueToValue (GlobalDictionaryValue fnName) = App (Var fnName) (ObjectLiteral [])
355 dictionaryValueToValue (GlobalDictionaryValue fnName) = App (Var fnName) (ObjectLiteral [])
356 dictionaryValueToValue (DependentDictionaryValue fnName dicts) = foldl App (Var fnName) (map dictionaryValueToValue dicts)
356 dictionaryValueToValue (DependentDictionaryValue fnName dicts) = foldl App (Var fnName) (map dictionaryValueToValue dicts)
357 dictionaryValueToValue (SubclassDictionaryValue dict index) =
357 dictionaryValueToValue (SubclassDictionaryValue dict index) =
358− App (App (Var (Qualified (Just (ModuleName [ProperName C.prelude])) (Ident (C.!!))))
358+ App (App (App (Var (Qualified (Just (ModuleName [ProperName C.prelude])) (Ident (C.!!))))
359− (Accessor C.__superclasses (dictionaryValueToValue dict)))
359+ (Accessor C.__superclasses (dictionaryValueToValue dict)))
360− (NumericLiteral (Left index))
360+ (NumericLiteral (Left index)))
361+ (ObjectLiteral [])
361 -- Ensure that a substitution is valid
362 -- Ensure that a substitution is valid
362 verifySubstitution :: [(String, Type)] -> Maybe [(String, Type)]
363 verifySubstitution :: [(String, Type)] -> Maybe [(String, Type)]
363 verifySubstitution subst = do
364 verifySubstitution subst = do
@@ -383,6 +384,7 @@ entails env moduleName context = solve (sortedNubBy canonicalizeDictionary (filt
383 [] -> ds
384 [] -> ds
384 simple -> simple
385 simple -> simple
385 isSimpleDictionaryValue SubclassDictionaryValue{} = False
386 isSimpleDictionaryValue SubclassDictionaryValue{} = False
387+ isSimpleDictionaryValue (DependentDictionaryValue _ ds) = all isSimpleDictionaryValue ds
386 isSimpleDictionaryValue _ = True
388 isSimpleDictionaryValue _ = True
387
389
388-- |
390-- |