SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module AST where
  2.  
  3. import Data.Fix
  4.  
  5. type AST name = Fix (AST_ name)
  6.  
  7. data AST_ name self
  8.   = Var name
  9.   | IfMatch (Match name self)
  10.   | App self self
  11.   | Let [Decl name self] self
  12.   | Constant (Constant name self)
  13.  
  14. data Constant name ast
  15.   = Number Double
  16.   | String String
  17.   | Lambda (Function name ast)
  18.   | Object [Decl name ast]
  19.  
  20. data Decl name ast
  21.   = Ctor name [name]
  22.   | Val (Function name ast)
  23.   | Capture name
  24.  
  25. data Function name ast = Function
  26.   { fName :: name
  27.   , fBody :: ast
  28.   }
  29.  
  30. data Match name ast = Match
  31.   { mCtor   :: name
  32.   , mSubj   :: ast
  33.   , mFields :: [name]
  34.   , yes     :: ast
  35.   , no      :: ast
  36.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top