@@ -0,0 +1,58 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
module Gyehoek.Sexp.Syntax
|
||||
( DatumF(..)
|
||||
, Simple(..)
|
||||
, CompoundF(..)
|
||||
, Prefix(..)
|
||||
, Delimiter(..)
|
||||
, Label(..)
|
||||
) where
|
||||
|
||||
import Language.Haskell.TH.Syntax (Lift)
|
||||
import Data.Scientific (Scientific)
|
||||
import Data.ByteString (ByteString)
|
||||
import Gyehoek.Prelude hiding (Simple)
|
||||
|
||||
|
||||
data DatumF a
|
||||
= SimpleF Simple
|
||||
| CompoundF (CompoundF a)
|
||||
| LabeledF Label a
|
||||
| LabelRefF Label
|
||||
deriving stock (Show, Eq, Data, Generic, Lift)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
data Simple
|
||||
= SimpleBool Bool
|
||||
| SimpleNumber Scientific
|
||||
| SimpleChar Char
|
||||
| SimpleString Text
|
||||
| SimpleSymbol Text
|
||||
| SimpleBytevector ByteString
|
||||
deriving stock (Show, Eq, Data, Generic, Lift)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
data CompoundF a
|
||||
= ListF (List a)
|
||||
| DotListF (NonEmpty a) a
|
||||
| VectorF (List a)
|
||||
| AbbrevF Prefix a
|
||||
deriving stock (Show, Eq, Data, Generic, Lift)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
data Prefix
|
||||
= Quote | Backtick | Comma | CommaAt
|
||||
deriving stock (Show, Eq, Data, Generic, Lift)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
data Delimiter
|
||||
= Paren
|
||||
| Square
|
||||
| Curly
|
||||
deriving stock (Show, Eq, Data, Generic, Lift)
|
||||
deriving anyclass (NFData)
|
||||
|
||||
newtype Label = MkLabel Natural
|
||||
deriving stock (Data, Generic, Lift)
|
||||
deriving newtype (Eq, Ord, Show)
|
||||
deriving anyclass (NFData)
|
||||
Reference in New Issue
Block a user