git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Small fixes (#2114)

* Small fixes * we dropped support for old ghc versions * removes references to Prelude.bind * remove traverseEither

commit3fbe01d39182a28f2865cf6f8adbd160f0180b97 authorChristoph Hegemann <kRITZCREEK@users.noreply.github.com> dateFri 13 May 2016, 19:32 (10 years ago) parent51ccb1d
4 files changed+10−15
src/Language/PureScript/Make.hs+1−6 src/Language/PureScript/Sugar.hs+1−1 src/Language/PureScript/Sugar/CaseDeclarations.hs+1−5 src/Language/PureScript/Sugar/DoNotation.hs+7−3
src/Language/PureScript/Make.hs+1−6
@@ -297,11 +297,6 @@ makeIO f io = do
297297readTextFile :: FilePath -> Make String
298298readTextFile path = makeIO (const (ErrorMessage [] $ CannotReadFile path)) $ readUTF8File path
299299
300−-- Traverse (Either e) instance (base 4.7)
301−traverseEither :: Applicative f => (a -> f b) -> Either e a -> f (Either e b)
302−traverseEither _ (Left x) = pure (Left x)
303−traverseEither f (Right y) = Right <$> f y
304−
305300-- |
306301-- A set of make actions that read and write modules from the given directory.
307302--
@@ -317,7 +312,7 @@ buildMakeActions outputDir filePathMap foreigns usePrefix =
317312 getInputTimestamp :: ModuleName -> Make (Either RebuildPolicy (Maybe UTCTime))
318313 getInputTimestamp mn = do
319314 let path = fromMaybe (internalError "Module has no filename in 'make'") $ M.lookup mn filePathMap
320− e1 <- traverseEither getTimestamp path
315+ e1 <- traverse getTimestamp path
321316 fPath <- maybe (return Nothing) getTimestamp $ M.lookup mn foreigns
322317 return $ fmap (max fPath) e1
323318
src/Language/PureScript/Sugar.hs+1−1
@@ -34,7 +34,7 @@ import Language.PureScript.Sugar.TypeDeclarations as S
3434--
3535-- * Desugar operator sections
3636--
37−-- * Desugar do-notation using the @Prelude.Monad@ type class
37+-- * Desugar do-notation
3838--
3939-- * Desugar top-level case declarations into explicit case expressions
4040--
src/Language/PureScript/Sugar/CaseDeclarations.hs+1−5
@@ -9,6 +9,7 @@ module Language.PureScript.Sugar.CaseDeclarations
99
1010import Prelude.Compat
1111
12+import Data.Either (isLeft)
1213import Data.List (nub, groupBy, foldl1')
1314import Data.Maybe (catMaybes, mapMaybe)
1415
@@ -24,11 +25,6 @@ import Language.PureScript.Names
2425import Language.PureScript.Traversals
2526import Language.PureScript.TypeChecker.Monad (guardWith)
2627
27−-- Data.Either.isLeft (base 4.7)
28−isLeft :: Either a b -> Bool
29−isLeft (Left _) = True
30−isLeft (Right _) = False
31−
3228-- |
3329-- Replace all top-level binders in a module with case expressions.
3430--
src/Language/PureScript/Sugar/DoNotation.hs+7−3
@@ -1,6 +1,6 @@
11-- |
22-- This module implements the desugaring pass which replaces do-notation statements with
3−-- appropriate calls to bind from the Prelude.Monad type class.
3+-- appropriate calls to bind.
44--
55module Language.PureScript.Sugar.DoNotation (desugarDoModule) where
66
@@ -17,12 +17,16 @@ import Language.PureScript.Names
1717import qualified Language.PureScript.Constants as C
1818
1919-- |
20−-- Replace all @DoNotationBind@ and @DoNotationValue@ constructors with applications of the Prelude.bind function,
21−-- and all @DoNotationLet@ constructors with let expressions.
20+-- Replace all @DoNotationBind@ and @DoNotationValue@ constructors with
21+-- applications of the bind function in scope, and all @DoNotationLet@
22+-- constructors with let expressions.
2223--
2324desugarDoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module
2425desugarDoModule (Module ss coms mn ds exts) = Module ss coms mn <$> parU ds desugarDo <*> pure exts
2526
27+-- |
28+-- Desugar a single do statement
29+--
2630desugarDo :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declaration -> m Declaration
2731desugarDo (PositionedDeclaration pos com d) = PositionedDeclaration pos com <$> rethrowWithPosition pos (desugarDo d)
2832desugarDo d =