module FFICXX.Generate.Util.HaskellSrcExts where

import Data.List (foldl')
import Data.Maybe (maybeToList)
import Language.Haskell.Exts
  ( Alt (..),
    Asst (TypeA),
    Binds,
    Bracket (TypeBracket),
    CallConv (CCall),
    ClassDecl (ClsDecl),
    ConDecl
      ( ConDecl,
        RecDecl
      ),
    Context
      ( CxEmpty,
        CxTuple
      ),
    DataOrNew
      ( DataType,
        NewType
      ),
    Decl
      ( ClassDecl,
        DataDecl,
        ForImp,
        FunBind,
        InstDecl,
        PatBind,
        TypeSig
      ),
    DeclHead
      ( DHApp,
        DHead
      ),
    Deriving (..),
    EWildcard (..),
    Exp
      ( App,
        BracketExp,
        Con,
        If,
        InfixApp,
        Lit,
        Var
      ),
    ExportSpec
      ( EAbs,
        EModuleContents,
        EThingWith,
        EVar
      ),
    ExportSpecList (..),
    FieldDecl,
    ImportDecl (..),
    ImportSpec (IVar),
    ImportSpecList (..),
    InstDecl
      ( InsDecl,
        InsType
      ),
    InstHead
      ( IHApp,
        IHCon
      ),
    InstRule (IRule),
    Literal,
    Match (..),
    Module (..),
    ModuleHead (..),
    ModuleName (..),
    ModulePragma (LanguagePragma),
    Name
      ( Ident,
        Symbol
      ),
    Namespace (NoNamespace),
    Pat
      ( PVar,
        PatTypeSig
      ),
    QName (UnQual),
    QOp (QVarOp),
    QualConDecl (..),
    Rhs (UnGuardedRhs),
    Safety (PlayInterruptible),
    Splice (ParenSplice),
    Stmt
      ( Generator,
        Qualifier
      ),
    TyVarBind (UnkindedVar),
    Type
      ( TyApp,
        TyCon,
        TyForall,
        TyFun,
        TyList,
        TyParen,
        TySplice,
        TyVar
      ),
    app,
    unit_tycon,
  )
import Language.Haskell.Exts.Syntax (CName)

unqual :: String -> QName ()
unqual :: String -> QName ()
unqual = forall l. l -> Name l -> QName l
UnQual () forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall l. l -> String -> Name l
Ident ()

tycon :: String -> Type ()
tycon :: String -> Type ()
tycon = forall l. l -> QName l -> Type l
TyCon () forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> QName ()
unqual

tyapp :: Type () -> Type () -> Type ()
tyapp :: Type () -> Type () -> Type ()
tyapp = forall l. l -> Type l -> Type l -> Type l
TyApp ()

infixl 2 `tyapp`

tyfun :: Type () -> Type () -> Type ()
tyfun :: Type () -> Type () -> Type ()
tyfun = forall l. l -> Type l -> Type l -> Type l
TyFun ()

infixr 2 `tyfun`

tylist :: Type () -> Type ()
tylist :: Type () -> Type ()
tylist = forall l. l -> Type l -> Type l
TyList ()

unit_tycon :: Type ()
unit_tycon :: Type ()
unit_tycon = forall l. l -> Type l
Language.Haskell.Exts.unit_tycon ()

conDecl :: String -> [Type ()] -> ConDecl ()
conDecl :: String -> [Type ()] -> ConDecl ()
conDecl String
n [Type ()]
ys = forall l. l -> Name l -> [Type l] -> ConDecl l
ConDecl () (forall l. l -> String -> Name l
Ident () String
n) [Type ()]
ys

qualConDecl ::
  Maybe [TyVarBind ()] ->
  Maybe (Context ()) ->
  ConDecl () ->
  QualConDecl ()
qualConDecl :: Maybe [TyVarBind ()]
-> Maybe (Context ()) -> ConDecl () -> QualConDecl ()
qualConDecl = forall l.
l
-> Maybe [TyVarBind l]
-> Maybe (Context l)
-> ConDecl l
-> QualConDecl l
QualConDecl ()

recDecl :: String -> [FieldDecl ()] -> ConDecl ()
recDecl :: String -> [FieldDecl ()] -> ConDecl ()
recDecl String
n [FieldDecl ()]
rs = forall l. l -> Name l -> [FieldDecl l] -> ConDecl l
RecDecl () (forall l. l -> String -> Name l
Ident () String
n) [FieldDecl ()]
rs

app' :: String -> String -> Exp ()
app' :: String -> String -> Exp ()
app' String
x String
y = forall l. l -> Exp l -> Exp l -> Exp l
App () (String -> Exp ()
mkVar String
x) (String -> Exp ()
mkVar String
y)

lit :: Literal () -> Exp ()
lit :: Literal () -> Exp ()
lit = forall l. l -> Literal l -> Exp l
Lit ()

mkVar :: String -> Exp ()
mkVar :: String -> Exp ()
mkVar = forall l. l -> QName l -> Exp l
Var () forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> QName ()
unqual

con :: String -> Exp ()
con :: String -> Exp ()
con = forall l. l -> QName l -> Exp l
Con () forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> QName ()
unqual

mkTVar :: String -> Type ()
mkTVar :: String -> Type ()
mkTVar = forall l. l -> Name l -> Type l
TyVar () forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall l. l -> String -> Name l
Ident ()

mkPVar :: String -> Pat ()
mkPVar :: String -> Pat ()
mkPVar = forall l. l -> Name l -> Pat l
PVar () forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall l. l -> String -> Name l
Ident ()

mkIVar :: String -> ImportSpec ()
mkIVar :: String -> ImportSpec ()
mkIVar = forall l. l -> Name l -> ImportSpec l
IVar () forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall l. l -> String -> Name l
Ident ()

mkPVarSig :: String -> Type () -> Pat ()
mkPVarSig :: String -> Type () -> Pat ()
mkPVarSig String
n Type ()
typ = forall l. l -> Pat l -> Type l -> Pat l
PatTypeSig () (String -> Pat ()
mkPVar String
n) Type ()
typ

pbind :: Pat () -> Exp () -> Maybe (Binds ()) -> Decl ()
pbind :: Pat () -> Exp () -> Maybe (Binds ()) -> Decl ()
pbind Pat ()
pat Exp ()
e = forall l. l -> Pat l -> Rhs l -> Maybe (Binds l) -> Decl l
PatBind () Pat ()
pat (forall l. l -> Exp l -> Rhs l
UnGuardedRhs () Exp ()
e)

pbind_ :: Pat () -> Exp () -> Decl ()
pbind_ :: Pat () -> Exp () -> Decl ()
pbind_ Pat ()
p Exp ()
e = Pat () -> Exp () -> Maybe (Binds ()) -> Decl ()
pbind Pat ()
p Exp ()
e forall a. Maybe a
Nothing

mkTBind :: String -> TyVarBind ()
mkTBind :: String -> TyVarBind ()
mkTBind = forall l. l -> Name l -> TyVarBind l
UnkindedVar () forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall l. l -> String -> Name l
Ident ()

mkBind1 :: String -> [Pat ()] -> Exp () -> Maybe (Binds ()) -> Decl ()
mkBind1 :: String -> [Pat ()] -> Exp () -> Maybe (Binds ()) -> Decl ()
mkBind1 String
n [Pat ()]
pat Exp ()
rhs Maybe (Binds ())
mbinds =
  forall l. l -> [Match l] -> Decl l
FunBind () [forall l.
l -> Name l -> [Pat l] -> Rhs l -> Maybe (Binds l) -> Match l
Match () (forall l. l -> String -> Name l
Ident () String
n) [Pat ()]
pat (forall l. l -> Exp l -> Rhs l
UnGuardedRhs () Exp ()
rhs) Maybe (Binds ())
mbinds]

mkFun :: String -> Type () -> [Pat ()] -> Exp () -> Maybe (Binds ()) -> [Decl ()]
mkFun :: String
-> Type () -> [Pat ()] -> Exp () -> Maybe (Binds ()) -> [Decl ()]
mkFun String
fname Type ()
typ [Pat ()]
pats Exp ()
rhs Maybe (Binds ())
mbinds = [String -> Type () -> Decl ()
mkFunSig String
fname Type ()
typ, String -> [Pat ()] -> Exp () -> Maybe (Binds ()) -> Decl ()
mkBind1 String
fname [Pat ()]
pats Exp ()
rhs Maybe (Binds ())
mbinds]

mkFunSig :: String -> Type () -> Decl ()
mkFunSig :: String -> Type () -> Decl ()
mkFunSig String
fname Type ()
typ = forall l. l -> [Name l] -> Type l -> Decl l
TypeSig () [forall l. l -> String -> Name l
Ident () String
fname] Type ()
typ

mkClass :: Context () -> String -> [TyVarBind ()] -> [ClassDecl ()] -> Decl ()
mkClass :: Context () -> String -> [TyVarBind ()] -> [ClassDecl ()] -> Decl ()
mkClass Context ()
ctxt String
n [TyVarBind ()]
tbinds [ClassDecl ()]
cdecls = forall l.
l
-> Maybe (Context l)
-> DeclHead l
-> [FunDep l]
-> Maybe [ClassDecl l]
-> Decl l
ClassDecl () (forall a. a -> Maybe a
Just Context ()
ctxt) (String -> [TyVarBind ()] -> DeclHead ()
mkDeclHead String
n [TyVarBind ()]
tbinds) [] (forall a. a -> Maybe a
Just [ClassDecl ()]
cdecls)

dhead :: String -> DeclHead ()
dhead :: String -> DeclHead ()
dhead String
n = forall l. l -> Name l -> DeclHead l
DHead () (forall l. l -> String -> Name l
Ident () String
n)

mkDeclHead :: String -> [TyVarBind ()] -> DeclHead ()
mkDeclHead :: String -> [TyVarBind ()] -> DeclHead ()
mkDeclHead String
n [TyVarBind ()]
tbinds = forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' (forall l. l -> DeclHead l -> TyVarBind l -> DeclHead l
DHApp ()) (String -> DeclHead ()
dhead String
n) [TyVarBind ()]
tbinds

mkInstance :: Context () -> String -> [Type ()] -> [InstDecl ()] -> Decl ()
mkInstance :: Context () -> String -> [Type ()] -> [InstDecl ()] -> Decl ()
mkInstance Context ()
ctxt String
n [Type ()]
typs [InstDecl ()]
idecls = forall l.
l
-> Maybe (Overlap l) -> InstRule l -> Maybe [InstDecl l] -> Decl l
InstDecl () forall a. Maybe a
Nothing InstRule ()
instrule (forall a. a -> Maybe a
Just [InstDecl ()]
idecls)
  where
    instrule :: InstRule ()
instrule = forall l.
l
-> Maybe [TyVarBind l]
-> Maybe (Context l)
-> InstHead l
-> InstRule l
IRule () forall a. Maybe a
Nothing (forall a. a -> Maybe a
Just Context ()
ctxt) InstHead ()
insthead
    insthead :: InstHead ()
insthead = forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' InstHead () -> Type () -> InstHead ()
f (forall l. l -> QName l -> InstHead l
IHCon () (String -> QName ()
unqual String
n)) [Type ()]
typs
      where
        f :: InstHead () -> Type () -> InstHead ()
f InstHead ()
acc Type ()
x = forall l. l -> InstHead l -> Type l -> InstHead l
IHApp () InstHead ()
acc (Type () -> Type ()
tyParen Type ()
x)

mkData :: String -> [TyVarBind ()] -> [QualConDecl ()] -> Maybe (Deriving ()) -> Decl ()
mkData :: String
-> [TyVarBind ()]
-> [QualConDecl ()]
-> Maybe (Deriving ())
-> Decl ()
mkData String
n [TyVarBind ()]
tbinds [QualConDecl ()]
qdecls Maybe (Deriving ())
mderiv = forall l.
l
-> DataOrNew l
-> Maybe (Context l)
-> DeclHead l
-> [QualConDecl l]
-> [Deriving l]
-> Decl l
DataDecl () (forall l. l -> DataOrNew l
DataType ()) forall a. Maybe a
Nothing DeclHead ()
declhead [QualConDecl ()]
qdecls (forall a. Maybe a -> [a]
maybeToList Maybe (Deriving ())
mderiv)
  where
    declhead :: DeclHead ()
declhead = String -> [TyVarBind ()] -> DeclHead ()
mkDeclHead String
n [TyVarBind ()]
tbinds

mkNewtype :: String -> [TyVarBind ()] -> [QualConDecl ()] -> Maybe (Deriving ()) -> Decl ()
mkNewtype :: String
-> [TyVarBind ()]
-> [QualConDecl ()]
-> Maybe (Deriving ())
-> Decl ()
mkNewtype String
n [TyVarBind ()]
tbinds [QualConDecl ()]
qdecls Maybe (Deriving ())
mderiv = forall l.
l
-> DataOrNew l
-> Maybe (Context l)
-> DeclHead l
-> [QualConDecl l]
-> [Deriving l]
-> Decl l
DataDecl () (forall l. l -> DataOrNew l
NewType ()) forall a. Maybe a
Nothing DeclHead ()
declhead [QualConDecl ()]
qdecls (forall a. Maybe a -> [a]
maybeToList Maybe (Deriving ())
mderiv)
  where
    declhead :: DeclHead ()
declhead = String -> [TyVarBind ()] -> DeclHead ()
mkDeclHead String
n [TyVarBind ()]
tbinds

mkForImpCcall :: String -> String -> Type () -> Decl ()
mkForImpCcall :: String -> String -> Type () -> Decl ()
mkForImpCcall String
quote String
n Type ()
typ = forall l.
l
-> CallConv l
-> Maybe (Safety l)
-> Maybe String
-> Name l
-> Type l
-> Decl l
ForImp () (forall l. l -> CallConv l
CCall ()) (forall a. a -> Maybe a
Just (forall l. l -> Safety l
PlayInterruptible ())) (forall a. a -> Maybe a
Just String
quote) (forall l. l -> String -> Name l
Ident () String
n) Type ()
typ

mkModule :: String -> [ModulePragma ()] -> [ImportDecl ()] -> [Decl ()] -> Module ()
mkModule :: String
-> [ModulePragma ()] -> [ImportDecl ()] -> [Decl ()] -> Module ()
mkModule String
n [ModulePragma ()]
pragmas [ImportDecl ()]
idecls [Decl ()]
decls = forall l.
l
-> Maybe (ModuleHead l)
-> [ModulePragma l]
-> [ImportDecl l]
-> [Decl l]
-> Module l
Module () (forall a. a -> Maybe a
Just ModuleHead ()
mhead) [ModulePragma ()]
pragmas [ImportDecl ()]
idecls [Decl ()]
decls
  where
    mhead :: ModuleHead ()
mhead = forall l.
l
-> ModuleName l
-> Maybe (WarningText l)
-> Maybe (ExportSpecList l)
-> ModuleHead l
ModuleHead () (forall l. l -> String -> ModuleName l
ModuleName () String
n) forall a. Maybe a
Nothing forall a. Maybe a
Nothing

mkModuleE :: String -> [ModulePragma ()] -> [ExportSpec ()] -> [ImportDecl ()] -> [Decl ()] -> Module ()
mkModuleE :: String
-> [ModulePragma ()]
-> [ExportSpec ()]
-> [ImportDecl ()]
-> [Decl ()]
-> Module ()
mkModuleE String
n [ModulePragma ()]
pragmas [ExportSpec ()]
exps [ImportDecl ()]
idecls [Decl ()]
decls = forall l.
l
-> Maybe (ModuleHead l)
-> [ModulePragma l]
-> [ImportDecl l]
-> [Decl l]
-> Module l
Module () (forall a. a -> Maybe a
Just ModuleHead ()
mhead) [ModulePragma ()]
pragmas [ImportDecl ()]
idecls [Decl ()]
decls
  where
    mhead :: ModuleHead ()
mhead = forall l.
l
-> ModuleName l
-> Maybe (WarningText l)
-> Maybe (ExportSpecList l)
-> ModuleHead l
ModuleHead () (forall l. l -> String -> ModuleName l
ModuleName () String
n) forall a. Maybe a
Nothing (forall a. a -> Maybe a
Just ExportSpecList ()
eslist)
    eslist :: ExportSpecList ()
eslist = forall l. l -> [ExportSpec l] -> ExportSpecList l
ExportSpecList () [ExportSpec ()]
exps

mkImport :: String -> ImportDecl ()
mkImport :: String -> ImportDecl ()
mkImport String
m = forall l.
l
-> ModuleName l
-> Bool
-> Bool
-> Bool
-> Maybe String
-> Maybe (ModuleName l)
-> Maybe (ImportSpecList l)
-> ImportDecl l
ImportDecl () (forall l. l -> String -> ModuleName l
ModuleName () String
m) Bool
False Bool
False Bool
False forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing

mkImportExp :: String -> [String] -> ImportDecl ()
mkImportExp :: String -> [String] -> ImportDecl ()
mkImportExp String
m [String]
lst =
  forall l.
l
-> ModuleName l
-> Bool
-> Bool
-> Bool
-> Maybe String
-> Maybe (ModuleName l)
-> Maybe (ImportSpecList l)
-> ImportDecl l
ImportDecl () (forall l. l -> String -> ModuleName l
ModuleName () String
m) Bool
False Bool
False Bool
False forall a. Maybe a
Nothing forall a. Maybe a
Nothing (forall a. a -> Maybe a
Just ImportSpecList ()
islist)
  where
    islist :: ImportSpecList ()
islist = forall l. l -> Bool -> [ImportSpec l] -> ImportSpecList l
ImportSpecList () Bool
False (forall a b. (a -> b) -> [a] -> [b]
map String -> ImportSpec ()
mkIVar [String]
lst)

mkImportSrc :: String -> ImportDecl ()
mkImportSrc :: String -> ImportDecl ()
mkImportSrc String
m = forall l.
l
-> ModuleName l
-> Bool
-> Bool
-> Bool
-> Maybe String
-> Maybe (ModuleName l)
-> Maybe (ImportSpecList l)
-> ImportDecl l
ImportDecl () (forall l. l -> String -> ModuleName l
ModuleName () String
m) Bool
False Bool
True Bool
False forall a. Maybe a
Nothing forall a. Maybe a
Nothing forall a. Maybe a
Nothing

lang :: [String] -> ModulePragma ()
lang :: [String] -> ModulePragma ()
lang [String]
ns = forall l. l -> [Name l] -> ModulePragma l
LanguagePragma () (forall a b. (a -> b) -> [a] -> [b]
map (forall l. l -> String -> Name l
Ident ()) [String]
ns)

dot :: Exp () -> Exp () -> Exp ()
Exp ()
x dot :: Exp () -> Exp () -> Exp ()
`dot` Exp ()
y = Exp ()
x Exp () -> Exp () -> Exp ()
`app` String -> Exp ()
mkVar String
"." Exp () -> Exp () -> Exp ()
`app` Exp ()
y

tyForall ::
  Maybe [TyVarBind ()] ->
  Maybe (Context ()) ->
  Type () ->
  Type ()
tyForall :: Maybe [TyVarBind ()] -> Maybe (Context ()) -> Type () -> Type ()
tyForall = forall l.
l -> Maybe [TyVarBind l] -> Maybe (Context l) -> Type l -> Type l
TyForall ()

tyParen :: Type () -> Type ()
tyParen :: Type () -> Type ()
tyParen = forall l. l -> Type l -> Type l
TyParen ()

tyPtr :: Type ()
tyPtr :: Type ()
tyPtr = String -> Type ()
tycon String
"Ptr"

tyForeignPtr :: Type ()
tyForeignPtr :: Type ()
tyForeignPtr = String -> Type ()
tycon String
"ForeignPtr"

classA :: QName () -> [Type ()] -> Asst ()
classA :: QName () -> [Type ()] -> Asst ()
classA QName ()
n = forall l. l -> Type l -> Asst l
TypeA () forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' Type () -> Type () -> Type ()
tyapp (forall l. l -> QName l -> Type l
TyCon () QName ()
n)

cxEmpty :: Context ()
cxEmpty :: Context ()
cxEmpty = forall l. l -> Context l
CxEmpty ()

cxTuple :: [Asst ()] -> Context ()
cxTuple :: [Asst ()] -> Context ()
cxTuple = forall l. l -> [Asst l] -> Context l
CxTuple ()

tySplice :: Splice () -> Type ()
tySplice :: Splice () -> Type ()
tySplice = forall l. l -> Splice l -> Type l
TySplice ()

parenSplice :: Exp () -> Splice ()
parenSplice :: Exp () -> Splice ()
parenSplice = forall l. l -> Exp l -> Splice l
ParenSplice ()

bracketExp :: Bracket () -> Exp ()
bracketExp :: Bracket () -> Exp ()
bracketExp = forall l. l -> Bracket l -> Exp l
BracketExp ()

typeBracket :: Type () -> Bracket ()
typeBracket :: Type () -> Bracket ()
typeBracket = forall l. l -> Type l -> Bracket l
TypeBracket ()

mkDeriving :: [InstRule ()] -> Deriving ()
mkDeriving :: [InstRule ()] -> Deriving ()
mkDeriving = forall l.
l -> Maybe (DerivStrategy l) -> [InstRule l] -> Deriving l
Deriving () forall a. Maybe a
Nothing

irule ::
  Maybe [TyVarBind ()] ->
  Maybe (Context ()) ->
  InstHead () ->
  InstRule ()
irule :: Maybe [TyVarBind ()]
-> Maybe (Context ()) -> InstHead () -> InstRule ()
irule = forall l.
l
-> Maybe [TyVarBind l]
-> Maybe (Context l)
-> InstHead l
-> InstRule l
IRule ()

ihcon :: QName () -> InstHead ()
ihcon :: QName () -> InstHead ()
ihcon = forall l. l -> QName l -> InstHead l
IHCon ()

evar :: QName () -> ExportSpec ()
evar :: QName () -> ExportSpec ()
evar = forall l. l -> QName l -> ExportSpec l
EVar ()

eabs :: Namespace () -> QName () -> ExportSpec ()
eabs :: Namespace () -> QName () -> ExportSpec ()
eabs = forall l. l -> Namespace l -> QName l -> ExportSpec l
EAbs ()

ethingwith ::
  EWildcard () ->
  QName () ->
  [Language.Haskell.Exts.Syntax.CName ()] ->
  ExportSpec ()
ethingwith :: EWildcard () -> QName () -> [CName ()] -> ExportSpec ()
ethingwith = forall l. l -> EWildcard l -> QName l -> [CName l] -> ExportSpec l
EThingWith ()

ethingall :: QName () -> ExportSpec ()
ethingall :: QName () -> ExportSpec ()
ethingall QName ()
q = EWildcard () -> QName () -> [CName ()] -> ExportSpec ()
ethingwith (forall l. l -> Int -> EWildcard l
EWildcard () Int
0) QName ()
q []

emodule :: String -> ExportSpec ()
emodule :: String -> ExportSpec ()
emodule String
nm = forall l. l -> ModuleName l -> ExportSpec l
EModuleContents () (forall l. l -> String -> ModuleName l
ModuleName () String
nm)

nonamespace :: Namespace ()
nonamespace :: Namespace ()
nonamespace = forall l. l -> Namespace l
NoNamespace ()

insType :: Type () -> Type () -> InstDecl ()
insType :: Type () -> Type () -> InstDecl ()
insType = forall l. l -> Type l -> Type l -> InstDecl l
InsType ()

insDecl :: Decl () -> InstDecl ()
insDecl :: Decl () -> InstDecl ()
insDecl = forall l. l -> Decl l -> InstDecl l
InsDecl ()

generator :: Pat () -> Exp () -> Stmt ()
generator :: Pat () -> Exp () -> Stmt ()
generator = forall l. l -> Pat l -> Exp l -> Stmt l
Generator ()

qualifier :: Exp () -> Stmt ()
qualifier :: Exp () -> Stmt ()
qualifier = forall l. l -> Exp l -> Stmt l
Qualifier ()

clsDecl :: Decl () -> ClassDecl ()
clsDecl :: Decl () -> ClassDecl ()
clsDecl = forall l. l -> Decl l -> ClassDecl l
ClsDecl ()

unkindedVar :: Name () -> TyVarBind ()
unkindedVar :: Name () -> TyVarBind ()
unkindedVar = forall l. l -> Name l -> TyVarBind l
UnkindedVar ()

op :: String -> QOp ()
op :: String -> QOp ()
op = forall l. l -> QName l -> QOp l
QVarOp () forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall l. l -> Name l -> QName l
UnQual () forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall l. l -> String -> Name l
Symbol ()

inapp :: Exp () -> QOp () -> Exp () -> Exp ()
inapp :: Exp () -> QOp () -> Exp () -> Exp ()
inapp = forall l. l -> Exp l -> QOp l -> Exp l -> Exp l
InfixApp ()

if_ :: Exp () -> Exp () -> Exp () -> Exp ()
if_ :: Exp () -> Exp () -> Exp () -> Exp ()
if_ = forall l. l -> Exp l -> Exp l -> Exp l -> Exp l
If ()

urhs :: Exp () -> Rhs ()
urhs :: Exp () -> Rhs ()
urhs = forall l. l -> Exp l -> Rhs l
UnGuardedRhs ()

-- | case pattern match p -> e
match :: Pat () -> Exp () -> Alt ()
match :: Pat () -> Exp () -> Alt ()
match Pat ()
p Exp ()
e = forall l. l -> Pat l -> Rhs l -> Maybe (Binds l) -> Alt l
Alt () Pat ()
p (Exp () -> Rhs ()
urhs Exp ()
e) forall a. Maybe a
Nothing