mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-26 03:08:55 -06:00
added Data instances for backwards compatibility
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE DeriveDataTypeable #-}
|
||||||
module PGF2.Expr(Var, Cat, Fun, Var,
|
module PGF2.Expr(Var, Cat, Fun, Var,
|
||||||
BindType(..), Literal(..), Expr(..),
|
BindType(..), Literal(..), Expr(..),
|
||||||
Type(..), Hypo,
|
Type(..), Hypo,
|
||||||
@@ -19,6 +20,8 @@ module PGF2.Expr(Var, Cat, Fun, Var,
|
|||||||
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Data.Data
|
||||||
|
|
||||||
type Var = String -- ^ Name of syntactic category
|
type Var = String -- ^ Name of syntactic category
|
||||||
type Cat = String -- ^ Name of syntactic category
|
type Cat = String -- ^ Name of syntactic category
|
||||||
type Fun = String -- ^ Name of function
|
type Fun = String -- ^ Name of function
|
||||||
@@ -28,13 +31,13 @@ type MetaId = Int
|
|||||||
data BindType =
|
data BindType =
|
||||||
Explicit
|
Explicit
|
||||||
| Implicit
|
| Implicit
|
||||||
deriving (Eq,Ord,Show)
|
deriving (Eq,Ord,Show,Data)
|
||||||
|
|
||||||
data Literal =
|
data Literal =
|
||||||
LStr String -- ^ string constant
|
LStr String -- ^ string constant
|
||||||
| LInt Integer -- ^ integer constant
|
| LInt Integer -- ^ integer constant
|
||||||
| LFlt Double -- ^ floating point constant
|
| LFlt Double -- ^ floating point constant
|
||||||
deriving (Eq,Ord,Show)
|
deriving (Eq,Ord,Show,Data)
|
||||||
|
|
||||||
-- | An expression in the abstract syntax of the grammar. It could be
|
-- | An expression in the abstract syntax of the grammar. It could be
|
||||||
-- both parameter of a dependent type or an abstract syntax tree for
|
-- both parameter of a dependent type or an abstract syntax tree for
|
||||||
@@ -48,12 +51,12 @@ data Expr =
|
|||||||
| EVar {-# UNPACK #-} !Int -- ^ variable with de Bruijn index
|
| EVar {-# UNPACK #-} !Int -- ^ variable with de Bruijn index
|
||||||
| ETyped Expr Type -- ^ local type signature
|
| ETyped Expr Type -- ^ local type signature
|
||||||
| EImplArg Expr -- ^ implicit argument in expression
|
| EImplArg Expr -- ^ implicit argument in expression
|
||||||
deriving (Eq,Ord,Show)
|
deriving (Eq,Ord,Show,Data)
|
||||||
|
|
||||||
-- | To read a type from a 'String', use 'readType'.
|
-- | To read a type from a 'String', use 'readType'.
|
||||||
data Type =
|
data Type =
|
||||||
DTyp [Hypo] Cat [Expr]
|
DTyp [Hypo] Cat [Expr]
|
||||||
deriving (Eq,Ord,Show)
|
deriving (Eq,Ord,Show,Data)
|
||||||
|
|
||||||
-- | 'Hypo' represents a hypothesis in a type i.e. in the type A -> B, A is the hypothesis
|
-- | 'Hypo' represents a hypothesis in a type i.e. in the type A -> B, A is the hypothesis
|
||||||
type Hypo = (BindType,Var,Type)
|
type Hypo = (BindType,Var,Type)
|
||||||
|
|||||||
Reference in New Issue
Block a user