git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Initial commit
commitefc421c4352e23953847cfd2e0fed4529c271e80 authorPhil Freeman <paf31@cantab.net> dateThu 3 Apr 2014, 16:00 (13 years ago) parent2309823
2 files changed+17−10
prelude/prelude.purs+14−8 src/Language/PureScript/TypeChecker/Types.hs+3−2
prelude/prelude.purs+14−8
@@ -60,8 +60,8 @@ module Prelude where
6060 pure :: forall a. a -> f a
6161 (<*>) :: forall a b. f (a -> b) -> f a -> f b
6262
63− instance functorFromApplicative :: (Applicative f) => Functor f where
64− (<$>) f a = pure f <*> a
63+ liftA1 :: forall f a b. (Applicative f) => (a -> b) -> f a -> f b
64+ liftA1 f a = pure f <*> a
6565
6666 infixl 3 <|>
6767
@@ -75,12 +75,11 @@ module Prelude where
7575 return :: forall a. a -> m a
7676 (>>=) :: forall a b. m a -> (a -> m b) -> m b
7777
78− instance applicativeFromMonad :: (Monad m) => Applicative m where
79− pure = return
80− (<*>) f a = do
81− f' <- f
82− a' <- a
83− return (f' a')
78+ ap :: forall m a b. (Monad m) => m (a -> b) -> m a -> m b
79+ ap f a = do
80+ f' <- f
81+ a' <- a
82+ return (f' a')
8483
8584 infixl 7 *
8685 infixl 7 /
@@ -368,6 +367,13 @@ module Control.Monad.Eff where
368367 \ return f();\
369368 \}" :: forall a. Pure a -> a
370369
370+ instance functorEff :: Functor (Eff e) where
371+ (<$>) = liftA1
372+
373+ instance applicativeEff :: Applicative (Eff e) where
374+ pure = return
375+ (<*>) = ap
376+
371377 instance monadEff :: Monad (Eff e) where
372378 return = retEff
373379 (>>=) = bindEff
src/Language/PureScript/TypeChecker/Types.hs+3−2
@@ -273,8 +273,9 @@ replaceTypeClassDictionaries mn = everywhereM' (mkM go)
273273entails :: Environment -> ModuleName -> [TypeClassDictionaryInScope] -> (Qualified ProperName, [Type]) -> Check Value
274274entails env moduleName context goal@(className, tys) = do
275275 case go goal of
276− [] -> throwError . strMsg $ "No " ++ show className ++ " instance found for " ++ intercalate ", " (map prettyPrintType tys)
277− (dict : _) -> return dict
276+ [] -> throwError . strMsg $ "No instance found for " ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)
277+ [dict] -> return dict
278+ _ -> throwError . strMsg $ "Overlapping instances found for " ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)
278279 where
279280 go (className', tys') =
280281 [ mkDictionary (canonicalizeDictionary tcd) args