module Language.PureScript.Sugar (desugar, module S) where
import Control.Category ((>>>))
import Control.Monad ((>=>))
import Control.Monad.Error.Class (MonadError)
import Control.Monad.Supply.Class (MonadSupply)
import Control.Monad.State.Class (MonadState)
import Control.Monad.Writer.Class (MonadWriter)
import Language.PureScript.AST (Module)
import Language.PureScript.Errors (MultipleErrors)
import Language.PureScript.Externs (ExternsFile)
import Language.PureScript.Linter.Imports (UsedImports)
import Language.PureScript.Sugar.BindingGroups as S
import Language.PureScript.Sugar.CaseDeclarations as S
import Language.PureScript.Sugar.DoNotation as S
import Language.PureScript.Sugar.AdoNotation as S
import Language.PureScript.Sugar.LetPattern as S
import Language.PureScript.Sugar.Names as S
import Language.PureScript.Sugar.ObjectWildcards as S
import Language.PureScript.Sugar.Operators as S
import Language.PureScript.Sugar.TypeClasses as S
import Language.PureScript.Sugar.TypeClasses.Deriving as S
import Language.PureScript.Sugar.TypeDeclarations as S
desugar
:: MonadSupply m
=> MonadError MultipleErrors m
=> MonadWriter MultipleErrors m
=> MonadState (Env, UsedImports) m
=> [ExternsFile]
-> Module
-> m Module
desugar :: forall (m :: * -> *).
(MonadSupply m, MonadError MultipleErrors m,
MonadWriter MultipleErrors m, MonadState (Env, UsedImports) m) =>
[ExternsFile] -> Module -> m Module
desugar [ExternsFile]
externs =
Module -> Module
desugarSignedLiterals
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> forall (m :: * -> *).
(MonadSupply m, MonadError MultipleErrors m) =>
Module -> m Module
desugarObjectConstructors
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall (m :: * -> *).
(MonadSupply m, MonadError MultipleErrors m) =>
Module -> m Module
desugarDoModule
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall (m :: * -> *).
(MonadSupply m, MonadError MultipleErrors m) =>
Module -> m Module
desugarAdoModule
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> Module -> Module
desugarLetPatternModule
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> forall (m :: * -> *).
(MonadSupply m, MonadError MultipleErrors m) =>
Module -> m Module
desugarCasesModule
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall (m :: * -> *).
MonadError MultipleErrors m =>
Module -> m Module
desugarTypeDeclarationsModule
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall (m :: * -> *).
(MonadError MultipleErrors m, MonadWriter MultipleErrors m,
MonadState (Env, UsedImports) m) =>
Module -> m Module
desugarImports
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall (m :: * -> *).
(MonadError MultipleErrors m, MonadSupply m) =>
[ExternsFile] -> Module -> m Module
rebracket [ExternsFile]
externs
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall (m :: * -> *).
MonadError MultipleErrors m =>
Module -> m Module
checkFixityExports
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall (m :: * -> *).
(MonadError MultipleErrors m, MonadSupply m) =>
Module -> m Module
deriveInstances
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall (m :: * -> *).
(MonadSupply m, MonadError MultipleErrors m) =>
[ExternsFile] -> Module -> m Module
desugarTypeClasses [ExternsFile]
externs
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> forall (m :: * -> *).
MonadError MultipleErrors m =>
Module -> m Module
createBindingGroupsModule