{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE TemplateHaskell   #-}
module Apigen.Types
    ( BitSize (..)
    , BuiltinType (..)
    , Constness (..)
    , Generated (..)
    , Decl
        ( Typename
        , TypeDecl
        , BuiltinType
        , ConstType
        , PointerType
        , ConstPointerType
        , CallbackType

        , ArrayType
        , ConstArrayType
        , UserArrayType
        , SizedArrayType

        , ClassDecl
        , Namespace

        , CallbackTypeDecl
        , IdTypeDecl

        , Constructor
        , Destructor
        , Method
        , Property
        , ValueProp
        , ArrayProp

        , Function
        , Define
        , Var

        , Ref
        , IntVal
        , Paren
        , Abs
        , Max
        , Add
        , Sub
        , Mul
        , Div

        , EnumMember
        , Enumeration
        )
    , Module (Module)
    , Model (Model)
    ) where

import           Data.Aeson.TH (defaultOptions, deriveJSON)
import           Data.Text     (Text)

data BitSize
    = B8
    | B16
    | B32
    | B64
    deriving (Int -> BitSize -> ShowS
[BitSize] -> ShowS
BitSize -> String
(Int -> BitSize -> ShowS)
-> (BitSize -> String) -> ([BitSize] -> ShowS) -> Show BitSize
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BitSize] -> ShowS
$cshowList :: [BitSize] -> ShowS
show :: BitSize -> String
$cshow :: BitSize -> String
showsPrec :: Int -> BitSize -> ShowS
$cshowsPrec :: Int -> BitSize -> ShowS
Show, BitSize -> BitSize -> Bool
(BitSize -> BitSize -> Bool)
-> (BitSize -> BitSize -> Bool) -> Eq BitSize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BitSize -> BitSize -> Bool
$c/= :: BitSize -> BitSize -> Bool
== :: BitSize -> BitSize -> Bool
$c== :: BitSize -> BitSize -> Bool
Eq)
$(deriveJSON defaultOptions ''BitSize)

data BuiltinType
    = Void
    | VoidPtr
    | Bool
    | Char
    | SInt BitSize
    | UInt BitSize
    | SizeT
    | String
    deriving (Int -> BuiltinType -> ShowS
[BuiltinType] -> ShowS
BuiltinType -> String
(Int -> BuiltinType -> ShowS)
-> (BuiltinType -> String)
-> ([BuiltinType] -> ShowS)
-> Show BuiltinType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BuiltinType] -> ShowS
$cshowList :: [BuiltinType] -> ShowS
show :: BuiltinType -> String
$cshow :: BuiltinType -> String
showsPrec :: Int -> BuiltinType -> ShowS
$cshowsPrec :: Int -> BuiltinType -> ShowS
Show, BuiltinType -> BuiltinType -> Bool
(BuiltinType -> BuiltinType -> Bool)
-> (BuiltinType -> BuiltinType -> Bool) -> Eq BuiltinType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BuiltinType -> BuiltinType -> Bool
$c/= :: BuiltinType -> BuiltinType -> Bool
== :: BuiltinType -> BuiltinType -> Bool
$c== :: BuiltinType -> BuiltinType -> Bool
Eq)
$(deriveJSON defaultOptions ''BuiltinType)

data Constness
    = ConstThis
    | MutableThis
    deriving (Int -> Constness -> ShowS
[Constness] -> ShowS
Constness -> String
(Int -> Constness -> ShowS)
-> (Constness -> String)
-> ([Constness] -> ShowS)
-> Show Constness
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Constness] -> ShowS
$cshowList :: [Constness] -> ShowS
show :: Constness -> String
$cshow :: Constness -> String
showsPrec :: Int -> Constness -> ShowS
$cshowsPrec :: Int -> Constness -> ShowS
Show, Constness -> Constness -> Bool
(Constness -> Constness -> Bool)
-> (Constness -> Constness -> Bool) -> Eq Constness
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Constness -> Constness -> Bool
$c/= :: Constness -> Constness -> Bool
== :: Constness -> Constness -> Bool
$c== :: Constness -> Constness -> Bool
Eq)
$(deriveJSON defaultOptions ''Constness)

data Generated
    = GeneratedToString
    | GeneratedFromInt
    deriving (Int -> Generated -> ShowS
[Generated] -> ShowS
Generated -> String
(Int -> Generated -> ShowS)
-> (Generated -> String)
-> ([Generated] -> ShowS)
-> Show Generated
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Generated] -> ShowS
$cshowList :: [Generated] -> ShowS
show :: Generated -> String
$cshow :: Generated -> String
showsPrec :: Int -> Generated -> ShowS
$cshowsPrec :: Int -> Generated -> ShowS
Show, Generated -> Generated -> Bool
(Generated -> Generated -> Bool)
-> (Generated -> Generated -> Bool) -> Eq Generated
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Generated -> Generated -> Bool
$c/= :: Generated -> Generated -> Bool
== :: Generated -> Generated -> Bool
$c== :: Generated -> Generated -> Bool
Eq)
$(deriveJSON defaultOptions ''Generated)

data Decl lexeme
    = Typename { Decl lexeme -> lexeme
name :: lexeme }
    | TypeDecl { name :: lexeme }
    | BuiltinType { Decl lexeme -> BuiltinType
bty :: BuiltinType }
    | ConstType { Decl lexeme -> Decl lexeme
ty :: Decl lexeme }
    | PointerType { name :: lexeme }
    | ConstPointerType { name :: lexeme }
    | CallbackType { name :: lexeme }

    | ArrayType { bty :: BuiltinType }
    | ConstArrayType { bty :: BuiltinType }
    | UserArrayType { name :: lexeme }
    | SizedArrayType { Decl lexeme -> Decl lexeme
memTy :: Decl lexeme, Decl lexeme -> Decl lexeme
sizer :: Decl lexeme }

    | ClassDecl { name :: lexeme, Decl lexeme -> [Decl lexeme]
mems :: [Decl lexeme] }
    | Namespace { Decl lexeme -> [Text]
ns :: [Text], mems :: [Decl lexeme] }

    | CallbackTypeDecl { name :: lexeme, Decl lexeme -> [Decl lexeme]
params :: [Decl lexeme] }
    | IdTypeDecl { name :: lexeme }

    | Constructor { name :: lexeme, params :: [Decl lexeme] }
    | Destructor { name :: lexeme, params :: [Decl lexeme] }
    | Method { Decl lexeme -> Constness
constness :: Constness, ty :: Decl lexeme, name :: lexeme, params :: [Decl lexeme] }
    | Property { name :: lexeme, Decl lexeme -> Decl lexeme
prop :: Decl lexeme }
    | ValueProp
        { Decl lexeme -> Decl lexeme
valType :: Decl lexeme
        , Decl lexeme -> Maybe (Decl lexeme)
valGet  :: Maybe (Decl lexeme)
        , Decl lexeme -> Maybe (Decl lexeme)
valSet  :: Maybe (Decl lexeme)
        }
    | ArrayProp
        { Decl lexeme -> Decl lexeme
arrType :: Decl lexeme
        , Decl lexeme -> Maybe (Decl lexeme)
arrGet  :: Maybe (Decl lexeme)
        , Decl lexeme -> Maybe (Decl lexeme)
arrSet  :: Maybe (Decl lexeme)
        , Decl lexeme -> Maybe (Decl lexeme)
arrSize :: Maybe (Decl lexeme)
        }

    | Function { Decl lexeme -> Decl lexeme
retTy :: Decl lexeme, name :: lexeme, params :: [Decl lexeme] }
    | Define { name :: lexeme }
    | Var { ty :: Decl lexeme, name :: lexeme }

    | Ref { name :: lexeme }
    | IntVal { Decl lexeme -> lexeme
val :: lexeme }
    | Paren { Decl lexeme -> Decl lexeme
expr :: Decl lexeme }
    | Abs { expr :: Decl lexeme }
    | Max { Decl lexeme -> Decl lexeme
left :: Decl lexeme, Decl lexeme -> Decl lexeme
right :: Decl lexeme }
    | Add { left :: Decl lexeme, right :: Decl lexeme }
    | Sub { left :: Decl lexeme, right :: Decl lexeme }
    | Mul { left :: Decl lexeme, right :: Decl lexeme }
    | Div { left :: Decl lexeme, right :: Decl lexeme }

    | EnumMember { name :: lexeme }
    | Enumeration { Decl lexeme -> [Generated]
gen :: [Generated], name :: lexeme, mems :: [Decl lexeme] }
    deriving (Int -> Decl lexeme -> ShowS
[Decl lexeme] -> ShowS
Decl lexeme -> String
(Int -> Decl lexeme -> ShowS)
-> (Decl lexeme -> String)
-> ([Decl lexeme] -> ShowS)
-> Show (Decl lexeme)
forall lexeme. Show lexeme => Int -> Decl lexeme -> ShowS
forall lexeme. Show lexeme => [Decl lexeme] -> ShowS
forall lexeme. Show lexeme => Decl lexeme -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Decl lexeme] -> ShowS
$cshowList :: forall lexeme. Show lexeme => [Decl lexeme] -> ShowS
show :: Decl lexeme -> String
$cshow :: forall lexeme. Show lexeme => Decl lexeme -> String
showsPrec :: Int -> Decl lexeme -> ShowS
$cshowsPrec :: forall lexeme. Show lexeme => Int -> Decl lexeme -> ShowS
Show, a -> Decl b -> Decl a
(a -> b) -> Decl a -> Decl b
(forall a b. (a -> b) -> Decl a -> Decl b)
-> (forall a b. a -> Decl b -> Decl a) -> Functor Decl
forall a b. a -> Decl b -> Decl a
forall a b. (a -> b) -> Decl a -> Decl b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Decl b -> Decl a
$c<$ :: forall a b. a -> Decl b -> Decl a
fmap :: (a -> b) -> Decl a -> Decl b
$cfmap :: forall a b. (a -> b) -> Decl a -> Decl b
Functor, Decl a -> Bool
(a -> m) -> Decl a -> m
(a -> b -> b) -> b -> Decl a -> b
(forall m. Monoid m => Decl m -> m)
-> (forall m a. Monoid m => (a -> m) -> Decl a -> m)
-> (forall m a. Monoid m => (a -> m) -> Decl a -> m)
-> (forall a b. (a -> b -> b) -> b -> Decl a -> b)
-> (forall a b. (a -> b -> b) -> b -> Decl a -> b)
-> (forall b a. (b -> a -> b) -> b -> Decl a -> b)
-> (forall b a. (b -> a -> b) -> b -> Decl a -> b)
-> (forall a. (a -> a -> a) -> Decl a -> a)
-> (forall a. (a -> a -> a) -> Decl a -> a)
-> (forall a. Decl a -> [a])
-> (forall a. Decl a -> Bool)
-> (forall a. Decl a -> Int)
-> (forall a. Eq a => a -> Decl a -> Bool)
-> (forall a. Ord a => Decl a -> a)
-> (forall a. Ord a => Decl a -> a)
-> (forall a. Num a => Decl a -> a)
-> (forall a. Num a => Decl a -> a)
-> Foldable Decl
forall a. Eq a => a -> Decl a -> Bool
forall a. Num a => Decl a -> a
forall a. Ord a => Decl a -> a
forall m. Monoid m => Decl m -> m
forall a. Decl a -> Bool
forall a. Decl a -> Int
forall a. Decl a -> [a]
forall a. (a -> a -> a) -> Decl a -> a
forall m a. Monoid m => (a -> m) -> Decl a -> m
forall b a. (b -> a -> b) -> b -> Decl a -> b
forall a b. (a -> b -> b) -> b -> Decl a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Decl a -> a
$cproduct :: forall a. Num a => Decl a -> a
sum :: Decl a -> a
$csum :: forall a. Num a => Decl a -> a
minimum :: Decl a -> a
$cminimum :: forall a. Ord a => Decl a -> a
maximum :: Decl a -> a
$cmaximum :: forall a. Ord a => Decl a -> a
elem :: a -> Decl a -> Bool
$celem :: forall a. Eq a => a -> Decl a -> Bool
length :: Decl a -> Int
$clength :: forall a. Decl a -> Int
null :: Decl a -> Bool
$cnull :: forall a. Decl a -> Bool
toList :: Decl a -> [a]
$ctoList :: forall a. Decl a -> [a]
foldl1 :: (a -> a -> a) -> Decl a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Decl a -> a
foldr1 :: (a -> a -> a) -> Decl a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Decl a -> a
foldl' :: (b -> a -> b) -> b -> Decl a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Decl a -> b
foldl :: (b -> a -> b) -> b -> Decl a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Decl a -> b
foldr' :: (a -> b -> b) -> b -> Decl a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Decl a -> b
foldr :: (a -> b -> b) -> b -> Decl a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Decl a -> b
foldMap' :: (a -> m) -> Decl a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Decl a -> m
foldMap :: (a -> m) -> Decl a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Decl a -> m
fold :: Decl m -> m
$cfold :: forall m. Monoid m => Decl m -> m
Foldable, Functor Decl
Foldable Decl
Functor Decl
-> Foldable Decl
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Decl a -> f (Decl b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Decl (f a) -> f (Decl a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Decl a -> m (Decl b))
-> (forall (m :: * -> *) a. Monad m => Decl (m a) -> m (Decl a))
-> Traversable Decl
(a -> f b) -> Decl a -> f (Decl b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Decl (m a) -> m (Decl a)
forall (f :: * -> *) a. Applicative f => Decl (f a) -> f (Decl a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Decl a -> m (Decl b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Decl a -> f (Decl b)
sequence :: Decl (m a) -> m (Decl a)
$csequence :: forall (m :: * -> *) a. Monad m => Decl (m a) -> m (Decl a)
mapM :: (a -> m b) -> Decl a -> m (Decl b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Decl a -> m (Decl b)
sequenceA :: Decl (f a) -> f (Decl a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Decl (f a) -> f (Decl a)
traverse :: (a -> f b) -> Decl a -> f (Decl b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Decl a -> f (Decl b)
$cp2Traversable :: Foldable Decl
$cp1Traversable :: Functor Decl
Traversable, Decl lexeme -> Decl lexeme -> Bool
(Decl lexeme -> Decl lexeme -> Bool)
-> (Decl lexeme -> Decl lexeme -> Bool) -> Eq (Decl lexeme)
forall lexeme. Eq lexeme => Decl lexeme -> Decl lexeme -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Decl lexeme -> Decl lexeme -> Bool
$c/= :: forall lexeme. Eq lexeme => Decl lexeme -> Decl lexeme -> Bool
== :: Decl lexeme -> Decl lexeme -> Bool
$c== :: forall lexeme. Eq lexeme => Decl lexeme -> Decl lexeme -> Bool
Eq)
$(deriveJSON defaultOptions ''Decl)

data Module lexeme = Module { Module lexeme -> String
file :: FilePath, Module lexeme -> [Decl lexeme]
decls :: [Decl lexeme] }
    deriving (Int -> Module lexeme -> ShowS
[Module lexeme] -> ShowS
Module lexeme -> String
(Int -> Module lexeme -> ShowS)
-> (Module lexeme -> String)
-> ([Module lexeme] -> ShowS)
-> Show (Module lexeme)
forall lexeme. Show lexeme => Int -> Module lexeme -> ShowS
forall lexeme. Show lexeme => [Module lexeme] -> ShowS
forall lexeme. Show lexeme => Module lexeme -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Module lexeme] -> ShowS
$cshowList :: forall lexeme. Show lexeme => [Module lexeme] -> ShowS
show :: Module lexeme -> String
$cshow :: forall lexeme. Show lexeme => Module lexeme -> String
showsPrec :: Int -> Module lexeme -> ShowS
$cshowsPrec :: forall lexeme. Show lexeme => Int -> Module lexeme -> ShowS
Show, a -> Module b -> Module a
(a -> b) -> Module a -> Module b
(forall a b. (a -> b) -> Module a -> Module b)
-> (forall a b. a -> Module b -> Module a) -> Functor Module
forall a b. a -> Module b -> Module a
forall a b. (a -> b) -> Module a -> Module b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Module b -> Module a
$c<$ :: forall a b. a -> Module b -> Module a
fmap :: (a -> b) -> Module a -> Module b
$cfmap :: forall a b. (a -> b) -> Module a -> Module b
Functor, Module a -> Bool
(a -> m) -> Module a -> m
(a -> b -> b) -> b -> Module a -> b
(forall m. Monoid m => Module m -> m)
-> (forall m a. Monoid m => (a -> m) -> Module a -> m)
-> (forall m a. Monoid m => (a -> m) -> Module a -> m)
-> (forall a b. (a -> b -> b) -> b -> Module a -> b)
-> (forall a b. (a -> b -> b) -> b -> Module a -> b)
-> (forall b a. (b -> a -> b) -> b -> Module a -> b)
-> (forall b a. (b -> a -> b) -> b -> Module a -> b)
-> (forall a. (a -> a -> a) -> Module a -> a)
-> (forall a. (a -> a -> a) -> Module a -> a)
-> (forall a. Module a -> [a])
-> (forall a. Module a -> Bool)
-> (forall a. Module a -> Int)
-> (forall a. Eq a => a -> Module a -> Bool)
-> (forall a. Ord a => Module a -> a)
-> (forall a. Ord a => Module a -> a)
-> (forall a. Num a => Module a -> a)
-> (forall a. Num a => Module a -> a)
-> Foldable Module
forall a. Eq a => a -> Module a -> Bool
forall a. Num a => Module a -> a
forall a. Ord a => Module a -> a
forall m. Monoid m => Module m -> m
forall a. Module a -> Bool
forall a. Module a -> Int
forall a. Module a -> [a]
forall a. (a -> a -> a) -> Module a -> a
forall m a. Monoid m => (a -> m) -> Module a -> m
forall b a. (b -> a -> b) -> b -> Module a -> b
forall a b. (a -> b -> b) -> b -> Module a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Module a -> a
$cproduct :: forall a. Num a => Module a -> a
sum :: Module a -> a
$csum :: forall a. Num a => Module a -> a
minimum :: Module a -> a
$cminimum :: forall a. Ord a => Module a -> a
maximum :: Module a -> a
$cmaximum :: forall a. Ord a => Module a -> a
elem :: a -> Module a -> Bool
$celem :: forall a. Eq a => a -> Module a -> Bool
length :: Module a -> Int
$clength :: forall a. Module a -> Int
null :: Module a -> Bool
$cnull :: forall a. Module a -> Bool
toList :: Module a -> [a]
$ctoList :: forall a. Module a -> [a]
foldl1 :: (a -> a -> a) -> Module a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Module a -> a
foldr1 :: (a -> a -> a) -> Module a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Module a -> a
foldl' :: (b -> a -> b) -> b -> Module a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Module a -> b
foldl :: (b -> a -> b) -> b -> Module a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Module a -> b
foldr' :: (a -> b -> b) -> b -> Module a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Module a -> b
foldr :: (a -> b -> b) -> b -> Module a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Module a -> b
foldMap' :: (a -> m) -> Module a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Module a -> m
foldMap :: (a -> m) -> Module a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Module a -> m
fold :: Module m -> m
$cfold :: forall m. Monoid m => Module m -> m
Foldable, Functor Module
Foldable Module
Functor Module
-> Foldable Module
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Module a -> f (Module b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Module (f a) -> f (Module a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Module a -> m (Module b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Module (m a) -> m (Module a))
-> Traversable Module
(a -> f b) -> Module a -> f (Module b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Module (m a) -> m (Module a)
forall (f :: * -> *) a.
Applicative f =>
Module (f a) -> f (Module a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Module a -> m (Module b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Module a -> f (Module b)
sequence :: Module (m a) -> m (Module a)
$csequence :: forall (m :: * -> *) a. Monad m => Module (m a) -> m (Module a)
mapM :: (a -> m b) -> Module a -> m (Module b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Module a -> m (Module b)
sequenceA :: Module (f a) -> f (Module a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Module (f a) -> f (Module a)
traverse :: (a -> f b) -> Module a -> f (Module b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Module a -> f (Module b)
$cp2Traversable :: Foldable Module
$cp1Traversable :: Functor Module
Traversable)
$(deriveJSON defaultOptions ''Module)

newtype Model lexeme = Model { Model lexeme -> [Module lexeme]
mods :: [Module lexeme] }
    deriving (Int -> Model lexeme -> ShowS
[Model lexeme] -> ShowS
Model lexeme -> String
(Int -> Model lexeme -> ShowS)
-> (Model lexeme -> String)
-> ([Model lexeme] -> ShowS)
-> Show (Model lexeme)
forall lexeme. Show lexeme => Int -> Model lexeme -> ShowS
forall lexeme. Show lexeme => [Model lexeme] -> ShowS
forall lexeme. Show lexeme => Model lexeme -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Model lexeme] -> ShowS
$cshowList :: forall lexeme. Show lexeme => [Model lexeme] -> ShowS
show :: Model lexeme -> String
$cshow :: forall lexeme. Show lexeme => Model lexeme -> String
showsPrec :: Int -> Model lexeme -> ShowS
$cshowsPrec :: forall lexeme. Show lexeme => Int -> Model lexeme -> ShowS
Show, a -> Model b -> Model a
(a -> b) -> Model a -> Model b
(forall a b. (a -> b) -> Model a -> Model b)
-> (forall a b. a -> Model b -> Model a) -> Functor Model
forall a b. a -> Model b -> Model a
forall a b. (a -> b) -> Model a -> Model b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Model b -> Model a
$c<$ :: forall a b. a -> Model b -> Model a
fmap :: (a -> b) -> Model a -> Model b
$cfmap :: forall a b. (a -> b) -> Model a -> Model b
Functor, Model a -> Bool
(a -> m) -> Model a -> m
(a -> b -> b) -> b -> Model a -> b
(forall m. Monoid m => Model m -> m)
-> (forall m a. Monoid m => (a -> m) -> Model a -> m)
-> (forall m a. Monoid m => (a -> m) -> Model a -> m)
-> (forall a b. (a -> b -> b) -> b -> Model a -> b)
-> (forall a b. (a -> b -> b) -> b -> Model a -> b)
-> (forall b a. (b -> a -> b) -> b -> Model a -> b)
-> (forall b a. (b -> a -> b) -> b -> Model a -> b)
-> (forall a. (a -> a -> a) -> Model a -> a)
-> (forall a. (a -> a -> a) -> Model a -> a)
-> (forall a. Model a -> [a])
-> (forall a. Model a -> Bool)
-> (forall a. Model a -> Int)
-> (forall a. Eq a => a -> Model a -> Bool)
-> (forall a. Ord a => Model a -> a)
-> (forall a. Ord a => Model a -> a)
-> (forall a. Num a => Model a -> a)
-> (forall a. Num a => Model a -> a)
-> Foldable Model
forall a. Eq a => a -> Model a -> Bool
forall a. Num a => Model a -> a
forall a. Ord a => Model a -> a
forall m. Monoid m => Model m -> m
forall a. Model a -> Bool
forall a. Model a -> Int
forall a. Model a -> [a]
forall a. (a -> a -> a) -> Model a -> a
forall m a. Monoid m => (a -> m) -> Model a -> m
forall b a. (b -> a -> b) -> b -> Model a -> b
forall a b. (a -> b -> b) -> b -> Model a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Model a -> a
$cproduct :: forall a. Num a => Model a -> a
sum :: Model a -> a
$csum :: forall a. Num a => Model a -> a
minimum :: Model a -> a
$cminimum :: forall a. Ord a => Model a -> a
maximum :: Model a -> a
$cmaximum :: forall a. Ord a => Model a -> a
elem :: a -> Model a -> Bool
$celem :: forall a. Eq a => a -> Model a -> Bool
length :: Model a -> Int
$clength :: forall a. Model a -> Int
null :: Model a -> Bool
$cnull :: forall a. Model a -> Bool
toList :: Model a -> [a]
$ctoList :: forall a. Model a -> [a]
foldl1 :: (a -> a -> a) -> Model a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Model a -> a
foldr1 :: (a -> a -> a) -> Model a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Model a -> a
foldl' :: (b -> a -> b) -> b -> Model a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Model a -> b
foldl :: (b -> a -> b) -> b -> Model a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Model a -> b
foldr' :: (a -> b -> b) -> b -> Model a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Model a -> b
foldr :: (a -> b -> b) -> b -> Model a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Model a -> b
foldMap' :: (a -> m) -> Model a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Model a -> m
foldMap :: (a -> m) -> Model a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Model a -> m
fold :: Model m -> m
$cfold :: forall m. Monoid m => Model m -> m
Foldable, Functor Model
Foldable Model
Functor Model
-> Foldable Model
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Model a -> f (Model b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Model (f a) -> f (Model a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Model a -> m (Model b))
-> (forall (m :: * -> *) a. Monad m => Model (m a) -> m (Model a))
-> Traversable Model
(a -> f b) -> Model a -> f (Model b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Model (m a) -> m (Model a)
forall (f :: * -> *) a. Applicative f => Model (f a) -> f (Model a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Model a -> m (Model b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Model a -> f (Model b)
sequence :: Model (m a) -> m (Model a)
$csequence :: forall (m :: * -> *) a. Monad m => Model (m a) -> m (Model a)
mapM :: (a -> m b) -> Model a -> m (Model b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Model a -> m (Model b)
sequenceA :: Model (f a) -> f (Model a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Model (f a) -> f (Model a)
traverse :: (a -> f b) -> Model a -> f (Model b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Model a -> f (Model b)
$cp2Traversable :: Foldable Model
$cp1Traversable :: Functor Model
Traversable)
$(deriveJSON defaultOptions ''Model)