forked from GitHub/gf-core
Regenerate Transfer abstract syntaxes with updated BNFC.
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
{-# OPTIONS_GHC -fglasgow-exts #-}
|
{-# OPTIONS_GHC -fglasgow-exts #-}
|
||||||
module Transfer.Core.Abs where
|
module Transfer.Core.Abs (Tree(..), Module, Decl, ConsDecl, Pattern, FieldPattern, PatternVariable, Exp, LetDef, Case, FieldType, FieldValue, TMeta, CIdent, composOp, composOpM, composOpM_, composOpMPlus, composOpMonoid, composOpFold, compos, johnMajorEq) where
|
||||||
|
|
||||||
import Control.Monad (ap,MonadPlus,msum,mplus,mzero)
|
import Control.Monad (ap,MonadPlus,msum,mplus,mzero)
|
||||||
|
import Control.Monad.Identity
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
|
|
||||||
-- Haskell module generated by the BNF converter
|
-- Haskell module generated by the BNF converter
|
||||||
@@ -70,7 +71,10 @@ data Tree :: * -> * where
|
|||||||
CIdent :: String -> Tree CIdent_
|
CIdent :: String -> Tree CIdent_
|
||||||
|
|
||||||
composOp :: (forall a. Tree a -> Tree a) -> Tree c -> Tree c
|
composOp :: (forall a. Tree a -> Tree a) -> Tree c -> Tree c
|
||||||
composOp f = head . composOpM (\x -> [f x])
|
composOp f = runIdentity . composOpM (Identity . f)
|
||||||
|
|
||||||
|
composOpM :: Monad m => (forall a. Tree a -> m (Tree a)) -> Tree c -> m (Tree c)
|
||||||
|
composOpM = compos return ap
|
||||||
|
|
||||||
composOpM_ :: Monad m => (forall a. Tree a -> m ()) -> Tree c -> m ()
|
composOpM_ :: Monad m => (forall a. Tree a -> m ()) -> Tree c -> m ()
|
||||||
composOpM_ = composOpFold (return ()) (>>)
|
composOpM_ = composOpFold (return ()) (>>)
|
||||||
@@ -81,61 +85,39 @@ composOpMPlus = composOpFold mzero mplus
|
|||||||
composOpMonoid :: Monoid m => (forall a. Tree a -> m) -> Tree c -> m
|
composOpMonoid :: Monoid m => (forall a. Tree a -> m) -> Tree c -> m
|
||||||
composOpMonoid = composOpFold mempty mappend
|
composOpMonoid = composOpFold mempty mappend
|
||||||
|
|
||||||
composOpM :: Monad m => (forall a. Tree a -> m (Tree a)) -> Tree c -> m (Tree c)
|
newtype C b a = C { unC :: b }
|
||||||
composOpM f t = case t of
|
|
||||||
Module decls -> return Module `ap` mapM f decls
|
|
||||||
DataDecl cident exp consdecls -> return DataDecl `ap` f cident `ap` f exp `ap` mapM f consdecls
|
|
||||||
TypeDecl cident exp -> return TypeDecl `ap` f cident `ap` f exp
|
|
||||||
ValueDecl cident exp -> return ValueDecl `ap` f cident `ap` f exp
|
|
||||||
ConsDecl cident exp -> return ConsDecl `ap` f cident `ap` f exp
|
|
||||||
PCons cident patterns -> return PCons `ap` f cident `ap` mapM f patterns
|
|
||||||
PVar patternvariable -> return PVar `ap` f patternvariable
|
|
||||||
PRec fieldpatterns -> return PRec `ap` mapM f fieldpatterns
|
|
||||||
FieldPattern cident pattern -> return FieldPattern `ap` f cident `ap` f pattern
|
|
||||||
PVVar cident -> return PVVar `ap` f cident
|
|
||||||
ELet letdefs exp -> return ELet `ap` mapM f letdefs `ap` f exp
|
|
||||||
ECase exp cases -> return ECase `ap` f exp `ap` mapM f cases
|
|
||||||
EAbs patternvariable exp -> return EAbs `ap` f patternvariable `ap` f exp
|
|
||||||
EPi patternvariable exp0 exp1 -> return EPi `ap` f patternvariable `ap` f exp0 `ap` f exp1
|
|
||||||
EApp exp0 exp1 -> return EApp `ap` f exp0 `ap` f exp1
|
|
||||||
EProj exp cident -> return EProj `ap` f exp `ap` f cident
|
|
||||||
ERecType fieldtypes -> return ERecType `ap` mapM f fieldtypes
|
|
||||||
ERec fieldvalues -> return ERec `ap` mapM f fieldvalues
|
|
||||||
EVar cident -> return EVar `ap` f cident
|
|
||||||
EMeta tmeta -> return EMeta `ap` f tmeta
|
|
||||||
LetDef cident exp -> return LetDef `ap` f cident `ap` f exp
|
|
||||||
Case pattern exp0 exp1 -> return Case `ap` f pattern `ap` f exp0 `ap` f exp1
|
|
||||||
FieldType cident exp -> return FieldType `ap` f cident `ap` f exp
|
|
||||||
FieldValue cident exp -> return FieldValue `ap` f cident `ap` f exp
|
|
||||||
_ -> return t
|
|
||||||
|
|
||||||
composOpFold :: b -> (b -> b -> b) -> (forall a. Tree a -> b) -> Tree c -> b
|
composOpFold :: b -> (b -> b -> b) -> (forall a. Tree a -> b) -> Tree c -> b
|
||||||
composOpFold zero combine f t = case t of
|
composOpFold z c f = unC . compos (\_ -> C z) (\(C x) (C y) -> C (c x y)) (C . f)
|
||||||
Module decls -> foldr combine zero (map f decls)
|
|
||||||
DataDecl cident exp consdecls -> f cident `combine` f exp `combine` foldr combine zero (map f consdecls)
|
compos :: (forall a. a -> m a)
|
||||||
TypeDecl cident exp -> f cident `combine` f exp
|
-> (forall a b. m (a -> b) -> m a -> m b)
|
||||||
ValueDecl cident exp -> f cident `combine` f exp
|
-> (forall a. Tree a -> m (Tree a)) -> Tree c -> m (Tree c)
|
||||||
ConsDecl cident exp -> f cident `combine` f exp
|
compos r a f t = case t of
|
||||||
PCons cident patterns -> f cident `combine` foldr combine zero (map f patterns)
|
Module decls -> r Module `a` foldr (a . a (r (:)) . f) (r []) decls
|
||||||
PVar patternvariable -> f patternvariable
|
DataDecl cident exp consdecls -> r DataDecl `a` f cident `a` f exp `a` foldr (a . a (r (:)) . f) (r []) consdecls
|
||||||
PRec fieldpatterns -> foldr combine zero (map f fieldpatterns)
|
TypeDecl cident exp -> r TypeDecl `a` f cident `a` f exp
|
||||||
FieldPattern cident pattern -> f cident `combine` f pattern
|
ValueDecl cident exp -> r ValueDecl `a` f cident `a` f exp
|
||||||
PVVar cident -> f cident
|
ConsDecl cident exp -> r ConsDecl `a` f cident `a` f exp
|
||||||
ELet letdefs exp -> foldr combine zero (map f letdefs) `combine` f exp
|
PCons cident patterns -> r PCons `a` f cident `a` foldr (a . a (r (:)) . f) (r []) patterns
|
||||||
ECase exp cases -> f exp `combine` foldr combine zero (map f cases)
|
PVar patternvariable -> r PVar `a` f patternvariable
|
||||||
EAbs patternvariable exp -> f patternvariable `combine` f exp
|
PRec fieldpatterns -> r PRec `a` foldr (a . a (r (:)) . f) (r []) fieldpatterns
|
||||||
EPi patternvariable exp0 exp1 -> f patternvariable `combine` f exp0 `combine` f exp1
|
FieldPattern cident pattern -> r FieldPattern `a` f cident `a` f pattern
|
||||||
EApp exp0 exp1 -> f exp0 `combine` f exp1
|
PVVar cident -> r PVVar `a` f cident
|
||||||
EProj exp cident -> f exp `combine` f cident
|
ELet letdefs exp -> r ELet `a` foldr (a . a (r (:)) . f) (r []) letdefs `a` f exp
|
||||||
ERecType fieldtypes -> foldr combine zero (map f fieldtypes)
|
ECase exp cases -> r ECase `a` f exp `a` foldr (a . a (r (:)) . f) (r []) cases
|
||||||
ERec fieldvalues -> foldr combine zero (map f fieldvalues)
|
EAbs patternvariable exp -> r EAbs `a` f patternvariable `a` f exp
|
||||||
EVar cident -> f cident
|
EPi patternvariable exp0 exp1 -> r EPi `a` f patternvariable `a` f exp0 `a` f exp1
|
||||||
EMeta tmeta -> f tmeta
|
EApp exp0 exp1 -> r EApp `a` f exp0 `a` f exp1
|
||||||
LetDef cident exp -> f cident `combine` f exp
|
EProj exp cident -> r EProj `a` f exp `a` f cident
|
||||||
Case pattern exp0 exp1 -> f pattern `combine` f exp0 `combine` f exp1
|
ERecType fieldtypes -> r ERecType `a` foldr (a . a (r (:)) . f) (r []) fieldtypes
|
||||||
FieldType cident exp -> f cident `combine` f exp
|
ERec fieldvalues -> r ERec `a` foldr (a . a (r (:)) . f) (r []) fieldvalues
|
||||||
FieldValue cident exp -> f cident `combine` f exp
|
EVar cident -> r EVar `a` f cident
|
||||||
_ -> zero
|
EMeta tmeta -> r EMeta `a` f tmeta
|
||||||
|
LetDef cident exp -> r LetDef `a` f cident `a` f exp
|
||||||
|
Case pattern exp0 exp1 -> r Case `a` f pattern `a` f exp0 `a` f exp1
|
||||||
|
FieldType cident exp -> r FieldType `a` f cident `a` f exp
|
||||||
|
FieldValue cident exp -> r FieldValue `a` f cident `a` f exp
|
||||||
|
_ -> r t
|
||||||
|
|
||||||
instance Show (Tree c) where
|
instance Show (Tree c) where
|
||||||
showsPrec n t = case t of
|
showsPrec n t = case t of
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{-# OPTIONS_GHC -fglasgow-exts #-}
|
{-# OPTIONS_GHC -fglasgow-exts #-}
|
||||||
module Transfer.Syntax.Abs where
|
module Transfer.Syntax.Abs (Tree(..), Module, Import, Decl, ConsDecl, Guard, Pattern, CommaPattern, FieldPattern, Exp, VarOrWild, LetDef, Case, Bind, FieldType, FieldValue, Ident, composOp, composOpM, composOpM_, composOpMPlus, composOpMonoid, composOpFold, compos, johnMajorEq) where
|
||||||
|
|
||||||
import Control.Monad (ap,MonadPlus,msum,mplus,mzero)
|
import Control.Monad (ap,MonadPlus,msum,mplus,mzero)
|
||||||
|
import Control.Monad.Identity
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
|
|
||||||
-- Haskell module generated by the BNF converter
|
-- Haskell module generated by the BNF converter
|
||||||
@@ -112,7 +113,10 @@ data Tree :: * -> * where
|
|||||||
Ident :: String -> Tree Ident_
|
Ident :: String -> Tree Ident_
|
||||||
|
|
||||||
composOp :: (forall a. Tree a -> Tree a) -> Tree c -> Tree c
|
composOp :: (forall a. Tree a -> Tree a) -> Tree c -> Tree c
|
||||||
composOp f = head . composOpM (\x -> [f x])
|
composOp f = runIdentity . composOpM (Identity . f)
|
||||||
|
|
||||||
|
composOpM :: Monad m => (forall a. Tree a -> m (Tree a)) -> Tree c -> m (Tree c)
|
||||||
|
composOpM = compos return ap
|
||||||
|
|
||||||
composOpM_ :: Monad m => (forall a. Tree a -> m ()) -> Tree c -> m ()
|
composOpM_ :: Monad m => (forall a. Tree a -> m ()) -> Tree c -> m ()
|
||||||
composOpM_ = composOpFold (return ()) (>>)
|
composOpM_ = composOpFold (return ()) (>>)
|
||||||
@@ -123,125 +127,71 @@ composOpMPlus = composOpFold mzero mplus
|
|||||||
composOpMonoid :: Monoid m => (forall a. Tree a -> m) -> Tree c -> m
|
composOpMonoid :: Monoid m => (forall a. Tree a -> m) -> Tree c -> m
|
||||||
composOpMonoid = composOpFold mempty mappend
|
composOpMonoid = composOpFold mempty mappend
|
||||||
|
|
||||||
composOpM :: Monad m => (forall a. Tree a -> m (Tree a)) -> Tree c -> m (Tree c)
|
newtype C b a = C { unC :: b }
|
||||||
composOpM f t = case t of
|
|
||||||
Module imports decls -> return Module `ap` mapM f imports `ap` mapM f decls
|
|
||||||
Import i -> return Import `ap` f i
|
|
||||||
DataDecl i exp consdecls -> return DataDecl `ap` f i `ap` f exp `ap` mapM f consdecls
|
|
||||||
TypeDecl i exp -> return TypeDecl `ap` f i `ap` f exp
|
|
||||||
ValueDecl i patterns guard exp -> return ValueDecl `ap` f i `ap` mapM f patterns `ap` f guard `ap` f exp
|
|
||||||
DeriveDecl i0 i1 -> return DeriveDecl `ap` f i0 `ap` f i1
|
|
||||||
ConsDecl i exp -> return ConsDecl `ap` f i `ap` f exp
|
|
||||||
GuardExp exp -> return GuardExp `ap` f exp
|
|
||||||
POr pattern0 pattern1 -> return POr `ap` f pattern0 `ap` f pattern1
|
|
||||||
PListCons pattern0 pattern1 -> return PListCons `ap` f pattern0 `ap` f pattern1
|
|
||||||
PConsTop i pattern patterns -> return PConsTop `ap` f i `ap` f pattern `ap` mapM f patterns
|
|
||||||
PCons i patterns -> return PCons `ap` f i `ap` mapM f patterns
|
|
||||||
PRec fieldpatterns -> return PRec `ap` mapM f fieldpatterns
|
|
||||||
PList commapatterns -> return PList `ap` mapM f commapatterns
|
|
||||||
PTuple commapattern commapatterns -> return PTuple `ap` f commapattern `ap` mapM f commapatterns
|
|
||||||
PVar i -> return PVar `ap` f i
|
|
||||||
CommaPattern pattern -> return CommaPattern `ap` f pattern
|
|
||||||
FieldPattern i pattern -> return FieldPattern `ap` f i `ap` f pattern
|
|
||||||
EPi varorwild exp0 exp1 -> return EPi `ap` f varorwild `ap` f exp0 `ap` f exp1
|
|
||||||
EPiNoVar exp0 exp1 -> return EPiNoVar `ap` f exp0 `ap` f exp1
|
|
||||||
EAbs varorwild exp -> return EAbs `ap` f varorwild `ap` f exp
|
|
||||||
ELet letdefs exp -> return ELet `ap` mapM f letdefs `ap` f exp
|
|
||||||
ECase exp cases -> return ECase `ap` f exp `ap` mapM f cases
|
|
||||||
EIf exp0 exp1 exp2 -> return EIf `ap` f exp0 `ap` f exp1 `ap` f exp2
|
|
||||||
EDo binds exp -> return EDo `ap` mapM f binds `ap` f exp
|
|
||||||
EBind exp0 exp1 -> return EBind `ap` f exp0 `ap` f exp1
|
|
||||||
EBindC exp0 exp1 -> return EBindC `ap` f exp0 `ap` f exp1
|
|
||||||
EOr exp0 exp1 -> return EOr `ap` f exp0 `ap` f exp1
|
|
||||||
EAnd exp0 exp1 -> return EAnd `ap` f exp0 `ap` f exp1
|
|
||||||
EEq exp0 exp1 -> return EEq `ap` f exp0 `ap` f exp1
|
|
||||||
ENe exp0 exp1 -> return ENe `ap` f exp0 `ap` f exp1
|
|
||||||
ELt exp0 exp1 -> return ELt `ap` f exp0 `ap` f exp1
|
|
||||||
ELe exp0 exp1 -> return ELe `ap` f exp0 `ap` f exp1
|
|
||||||
EGt exp0 exp1 -> return EGt `ap` f exp0 `ap` f exp1
|
|
||||||
EGe exp0 exp1 -> return EGe `ap` f exp0 `ap` f exp1
|
|
||||||
EListCons exp0 exp1 -> return EListCons `ap` f exp0 `ap` f exp1
|
|
||||||
EAdd exp0 exp1 -> return EAdd `ap` f exp0 `ap` f exp1
|
|
||||||
ESub exp0 exp1 -> return ESub `ap` f exp0 `ap` f exp1
|
|
||||||
EMul exp0 exp1 -> return EMul `ap` f exp0 `ap` f exp1
|
|
||||||
EDiv exp0 exp1 -> return EDiv `ap` f exp0 `ap` f exp1
|
|
||||||
EMod exp0 exp1 -> return EMod `ap` f exp0 `ap` f exp1
|
|
||||||
ENeg exp -> return ENeg `ap` f exp
|
|
||||||
EApp exp0 exp1 -> return EApp `ap` f exp0 `ap` f exp1
|
|
||||||
EProj exp i -> return EProj `ap` f exp `ap` f i
|
|
||||||
ERecType fieldtypes -> return ERecType `ap` mapM f fieldtypes
|
|
||||||
ERec fieldvalues -> return ERec `ap` mapM f fieldvalues
|
|
||||||
EList exps -> return EList `ap` mapM f exps
|
|
||||||
ETuple exp exps -> return ETuple `ap` f exp `ap` mapM f exps
|
|
||||||
EVar i -> return EVar `ap` f i
|
|
||||||
VVar i -> return VVar `ap` f i
|
|
||||||
LetDef i exp -> return LetDef `ap` f i `ap` f exp
|
|
||||||
Case pattern guard exp -> return Case `ap` f pattern `ap` f guard `ap` f exp
|
|
||||||
BindVar varorwild exp -> return BindVar `ap` f varorwild `ap` f exp
|
|
||||||
BindNoVar exp -> return BindNoVar `ap` f exp
|
|
||||||
FieldType i exp -> return FieldType `ap` f i `ap` f exp
|
|
||||||
FieldValue i exp -> return FieldValue `ap` f i `ap` f exp
|
|
||||||
_ -> return t
|
|
||||||
|
|
||||||
composOpFold :: b -> (b -> b -> b) -> (forall a. Tree a -> b) -> Tree c -> b
|
composOpFold :: b -> (b -> b -> b) -> (forall a. Tree a -> b) -> Tree c -> b
|
||||||
composOpFold zero combine f t = case t of
|
composOpFold z c f = unC . compos (\_ -> C z) (\(C x) (C y) -> C (c x y)) (C . f)
|
||||||
Module imports decls -> foldr combine zero (map f imports) `combine` foldr combine zero (map f decls)
|
|
||||||
Import i -> f i
|
compos :: (forall a. a -> m a)
|
||||||
DataDecl i exp consdecls -> f i `combine` f exp `combine` foldr combine zero (map f consdecls)
|
-> (forall a b. m (a -> b) -> m a -> m b)
|
||||||
TypeDecl i exp -> f i `combine` f exp
|
-> (forall a. Tree a -> m (Tree a)) -> Tree c -> m (Tree c)
|
||||||
ValueDecl i patterns guard exp -> f i `combine` foldr combine zero (map f patterns) `combine` f guard `combine` f exp
|
compos r a f t = case t of
|
||||||
DeriveDecl i0 i1 -> f i0 `combine` f i1
|
Module imports decls -> r Module `a` foldr (a . a (r (:)) . f) (r []) imports `a` foldr (a . a (r (:)) . f) (r []) decls
|
||||||
ConsDecl i exp -> f i `combine` f exp
|
Import i -> r Import `a` f i
|
||||||
GuardExp exp -> f exp
|
DataDecl i exp consdecls -> r DataDecl `a` f i `a` f exp `a` foldr (a . a (r (:)) . f) (r []) consdecls
|
||||||
POr pattern0 pattern1 -> f pattern0 `combine` f pattern1
|
TypeDecl i exp -> r TypeDecl `a` f i `a` f exp
|
||||||
PListCons pattern0 pattern1 -> f pattern0 `combine` f pattern1
|
ValueDecl i patterns guard exp -> r ValueDecl `a` f i `a` foldr (a . a (r (:)) . f) (r []) patterns `a` f guard `a` f exp
|
||||||
PConsTop i pattern patterns -> f i `combine` f pattern `combine` foldr combine zero (map f patterns)
|
DeriveDecl i0 i1 -> r DeriveDecl `a` f i0 `a` f i1
|
||||||
PCons i patterns -> f i `combine` foldr combine zero (map f patterns)
|
ConsDecl i exp -> r ConsDecl `a` f i `a` f exp
|
||||||
PRec fieldpatterns -> foldr combine zero (map f fieldpatterns)
|
GuardExp exp -> r GuardExp `a` f exp
|
||||||
PList commapatterns -> foldr combine zero (map f commapatterns)
|
POr pattern0 pattern1 -> r POr `a` f pattern0 `a` f pattern1
|
||||||
PTuple commapattern commapatterns -> f commapattern `combine` foldr combine zero (map f commapatterns)
|
PListCons pattern0 pattern1 -> r PListCons `a` f pattern0 `a` f pattern1
|
||||||
PVar i -> f i
|
PConsTop i pattern patterns -> r PConsTop `a` f i `a` f pattern `a` foldr (a . a (r (:)) . f) (r []) patterns
|
||||||
CommaPattern pattern -> f pattern
|
PCons i patterns -> r PCons `a` f i `a` foldr (a . a (r (:)) . f) (r []) patterns
|
||||||
FieldPattern i pattern -> f i `combine` f pattern
|
PRec fieldpatterns -> r PRec `a` foldr (a . a (r (:)) . f) (r []) fieldpatterns
|
||||||
EPi varorwild exp0 exp1 -> f varorwild `combine` f exp0 `combine` f exp1
|
PList commapatterns -> r PList `a` foldr (a . a (r (:)) . f) (r []) commapatterns
|
||||||
EPiNoVar exp0 exp1 -> f exp0 `combine` f exp1
|
PTuple commapattern commapatterns -> r PTuple `a` f commapattern `a` foldr (a . a (r (:)) . f) (r []) commapatterns
|
||||||
EAbs varorwild exp -> f varorwild `combine` f exp
|
PVar i -> r PVar `a` f i
|
||||||
ELet letdefs exp -> foldr combine zero (map f letdefs) `combine` f exp
|
CommaPattern pattern -> r CommaPattern `a` f pattern
|
||||||
ECase exp cases -> f exp `combine` foldr combine zero (map f cases)
|
FieldPattern i pattern -> r FieldPattern `a` f i `a` f pattern
|
||||||
EIf exp0 exp1 exp2 -> f exp0 `combine` f exp1 `combine` f exp2
|
EPi varorwild exp0 exp1 -> r EPi `a` f varorwild `a` f exp0 `a` f exp1
|
||||||
EDo binds exp -> foldr combine zero (map f binds) `combine` f exp
|
EPiNoVar exp0 exp1 -> r EPiNoVar `a` f exp0 `a` f exp1
|
||||||
EBind exp0 exp1 -> f exp0 `combine` f exp1
|
EAbs varorwild exp -> r EAbs `a` f varorwild `a` f exp
|
||||||
EBindC exp0 exp1 -> f exp0 `combine` f exp1
|
ELet letdefs exp -> r ELet `a` foldr (a . a (r (:)) . f) (r []) letdefs `a` f exp
|
||||||
EOr exp0 exp1 -> f exp0 `combine` f exp1
|
ECase exp cases -> r ECase `a` f exp `a` foldr (a . a (r (:)) . f) (r []) cases
|
||||||
EAnd exp0 exp1 -> f exp0 `combine` f exp1
|
EIf exp0 exp1 exp2 -> r EIf `a` f exp0 `a` f exp1 `a` f exp2
|
||||||
EEq exp0 exp1 -> f exp0 `combine` f exp1
|
EDo binds exp -> r EDo `a` foldr (a . a (r (:)) . f) (r []) binds `a` f exp
|
||||||
ENe exp0 exp1 -> f exp0 `combine` f exp1
|
EBind exp0 exp1 -> r EBind `a` f exp0 `a` f exp1
|
||||||
ELt exp0 exp1 -> f exp0 `combine` f exp1
|
EBindC exp0 exp1 -> r EBindC `a` f exp0 `a` f exp1
|
||||||
ELe exp0 exp1 -> f exp0 `combine` f exp1
|
EOr exp0 exp1 -> r EOr `a` f exp0 `a` f exp1
|
||||||
EGt exp0 exp1 -> f exp0 `combine` f exp1
|
EAnd exp0 exp1 -> r EAnd `a` f exp0 `a` f exp1
|
||||||
EGe exp0 exp1 -> f exp0 `combine` f exp1
|
EEq exp0 exp1 -> r EEq `a` f exp0 `a` f exp1
|
||||||
EListCons exp0 exp1 -> f exp0 `combine` f exp1
|
ENe exp0 exp1 -> r ENe `a` f exp0 `a` f exp1
|
||||||
EAdd exp0 exp1 -> f exp0 `combine` f exp1
|
ELt exp0 exp1 -> r ELt `a` f exp0 `a` f exp1
|
||||||
ESub exp0 exp1 -> f exp0 `combine` f exp1
|
ELe exp0 exp1 -> r ELe `a` f exp0 `a` f exp1
|
||||||
EMul exp0 exp1 -> f exp0 `combine` f exp1
|
EGt exp0 exp1 -> r EGt `a` f exp0 `a` f exp1
|
||||||
EDiv exp0 exp1 -> f exp0 `combine` f exp1
|
EGe exp0 exp1 -> r EGe `a` f exp0 `a` f exp1
|
||||||
EMod exp0 exp1 -> f exp0 `combine` f exp1
|
EListCons exp0 exp1 -> r EListCons `a` f exp0 `a` f exp1
|
||||||
ENeg exp -> f exp
|
EAdd exp0 exp1 -> r EAdd `a` f exp0 `a` f exp1
|
||||||
EApp exp0 exp1 -> f exp0 `combine` f exp1
|
ESub exp0 exp1 -> r ESub `a` f exp0 `a` f exp1
|
||||||
EProj exp i -> f exp `combine` f i
|
EMul exp0 exp1 -> r EMul `a` f exp0 `a` f exp1
|
||||||
ERecType fieldtypes -> foldr combine zero (map f fieldtypes)
|
EDiv exp0 exp1 -> r EDiv `a` f exp0 `a` f exp1
|
||||||
ERec fieldvalues -> foldr combine zero (map f fieldvalues)
|
EMod exp0 exp1 -> r EMod `a` f exp0 `a` f exp1
|
||||||
EList exps -> foldr combine zero (map f exps)
|
ENeg exp -> r ENeg `a` f exp
|
||||||
ETuple exp exps -> f exp `combine` foldr combine zero (map f exps)
|
EApp exp0 exp1 -> r EApp `a` f exp0 `a` f exp1
|
||||||
EVar i -> f i
|
EProj exp i -> r EProj `a` f exp `a` f i
|
||||||
VVar i -> f i
|
ERecType fieldtypes -> r ERecType `a` foldr (a . a (r (:)) . f) (r []) fieldtypes
|
||||||
LetDef i exp -> f i `combine` f exp
|
ERec fieldvalues -> r ERec `a` foldr (a . a (r (:)) . f) (r []) fieldvalues
|
||||||
Case pattern guard exp -> f pattern `combine` f guard `combine` f exp
|
EList exps -> r EList `a` foldr (a . a (r (:)) . f) (r []) exps
|
||||||
BindVar varorwild exp -> f varorwild `combine` f exp
|
ETuple exp exps -> r ETuple `a` f exp `a` foldr (a . a (r (:)) . f) (r []) exps
|
||||||
BindNoVar exp -> f exp
|
EVar i -> r EVar `a` f i
|
||||||
FieldType i exp -> f i `combine` f exp
|
VVar i -> r VVar `a` f i
|
||||||
FieldValue i exp -> f i `combine` f exp
|
LetDef i exp -> r LetDef `a` f i `a` f exp
|
||||||
_ -> zero
|
Case pattern guard exp -> r Case `a` f pattern `a` f guard `a` f exp
|
||||||
|
BindVar varorwild exp -> r BindVar `a` f varorwild `a` f exp
|
||||||
|
BindNoVar exp -> r BindNoVar `a` f exp
|
||||||
|
FieldType i exp -> r FieldType `a` f i `a` f exp
|
||||||
|
FieldValue i exp -> r FieldValue `a` f i `a` f exp
|
||||||
|
_ -> r t
|
||||||
|
|
||||||
instance Show (Tree c) where
|
instance Show (Tree c) where
|
||||||
showsPrec n t = case t of
|
showsPrec n t = case t of
|
||||||
|
|||||||
Reference in New Issue
Block a user