git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Initial commit
efc421cPhil Freeman
prelude/prelude.purs+14−8
@@ -60,8 +60,8 @@ module Prelude where
60 pure :: forall a. a -> f a
60 pure :: forall a. a -> f a
61 (<*>) :: forall a b. f (a -> b) -> f a -> f b
61 (<*>) :: forall a b. f (a -> b) -> f a -> f b
62
62
63− instance functorFromApplicative :: (Applicative f) => Functor f where
63+ liftA1 :: forall f a b. (Applicative f) => (a -> b) -> f a -> f b
64− (<$>) f a = pure f <*> a
64+ liftA1 f a = pure f <*> a
65
65
66 infixl 3 <|>
66 infixl 3 <|>
67
67
@@ -75,12 +75,11 @@ module Prelude where
75 return :: forall a. a -> m a
75 return :: forall a. a -> m a
76 (>>=) :: forall a b. m a -> (a -> m b) -> m b
76 (>>=) :: forall a b. m a -> (a -> m b) -> m b
77
77
78− instance applicativeFromMonad :: (Monad m) => Applicative m where
78+ ap :: forall m a b. (Monad m) => m (a -> b) -> m a -> m b
79− pure = return
80− (<*>) f a = do
79+ ap f a = do
81− f' <- f
80+ f' <- f
82− a' <- a
81+ a' <- a
83− return (f' a')
82+ return (f' a')
84
83
85 infixl 7 *
84 infixl 7 *
86 infixl 7 /
85 infixl 7 /
@@ -368,6 +367,13 @@ module Control.Monad.Eff where
368 \ return f();\
367 \ return f();\
369 \}" :: forall a. Pure a -> a
368 \}" :: forall a. Pure a -> a
370
369
370+ instance functorEff :: Functor (Eff e) where
371+ (<$>) = liftA1
372+
373+ instance applicativeEff :: Applicative (Eff e) where
374+ pure = return
375+ (<*>) = ap
376+
371 instance monadEff :: Monad (Eff e) where
377 instance monadEff :: Monad (Eff e) where
372 return = retEff
378 return = retEff
373 (>>=) = bindEff
379 (>>=) = bindEff
src/Language/PureScript/TypeChecker/Types.hs+3−2
@@ -273,8 +273,9 @@ replaceTypeClassDictionaries mn = everywhereM' (mkM go)
273entails :: Environment -> ModuleName -> [TypeClassDictionaryInScope] -> (Qualified ProperName, [Type]) -> Check Value
273entails :: Environment -> ModuleName -> [TypeClassDictionaryInScope] -> (Qualified ProperName, [Type]) -> Check Value
274entails env moduleName context goal@(className, tys) = do
274entails env moduleName context goal@(className, tys) = do
275 case go goal of
275 case go goal of
276− [] -> throwError . strMsg $ "No " ++ show className ++ " instance found for " ++ intercalate ", " (map prettyPrintType tys)
276+ [] -> throwError . strMsg $ "No instance found for " ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)
277− (dict : _) -> return dict
277+ [dict] -> return dict
278+ _ -> throwError . strMsg $ "Overlapping instances found for " ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)
278 where
279 where
279 go (className', tys') =
280 go (className', tys') =
280 [ mkDictionary (canonicalizeDictionary tcd) args
281 [ mkDictionary (canonicalizeDictionary tcd) args