This commit is contained in:
crumbtoo
2024-02-16 16:13:40 -07:00
parent caeec216b5
commit da81a5a98e
6 changed files with 98 additions and 39 deletions

View File

@@ -10,12 +10,18 @@ module Rlp.Syntax
, Alt(..)
, Ty(..)
, Binding(..)
, Expr(..)
, Expr(..), Expr', ExprF(..)
, Lit(..)
, Pat(..)
, Decl(..)
, Program(..)
, Where
-- * Re-exports
, Cofree(..)
, Trans.Cofree.CofreeF
, pattern (:<$)
, SrcSpan(..)
)
where
----------------------------------------------------------------------------------
@@ -29,10 +35,12 @@ import GHC.Generics
import Language.Haskell.TH.Syntax (Lift)
import Control.Lens
import Control.Comonad.Trans.Cofree qualified as Trans.Cofree
import Control.Comonad.Cofree
import Data.Functor.Foldable
import Data.Functor.Foldable.TH (makeBaseFunctor)
import Compiler.Types (SrcSpan(..))
import Core.Syntax qualified as Core
import Core (Rec(..), HasRHS(..), HasLHS(..))
----------------------------------------------------------------------------------
@@ -105,6 +113,9 @@ type Where p = [Binding p]
data Assoc = InfixL | InfixR | Infix
deriving (Lift, Show)
pattern (:<$) :: a -> f b -> Trans.Cofree.CofreeF f a b
pattern a :<$ b = a Trans.Cofree.:< b
--------------------------------------------------------------------------------
makeBaseFunctor ''Expr