{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE TemplateHaskell #-}

module Language.Jsonnet.Syntax where

import Control.Applicative (Const (..))
import Data.Data (Data)
import Data.Functor.Sum
import Data.List.NonEmpty
import Data.Scientific (Scientific)
import qualified Data.Text as T
import Data.Typeable (Typeable)
import GHC.Generics
import Language.Jsonnet.Common
import Text.Show.Deriving
import Unbound.Generics.LocallyNameless

type Ident = String

type Param a = (Ident, Maybe a)

data Field a = Field
  { forall a. Field a -> a
key :: a,
    forall a. Field a -> a
value :: a,
    forall a. Field a -> Visibility
visibility :: Visibility,
    forall a. Field a -> Bool
override :: Bool
  }
  deriving
    ( Field a -> Field a -> Bool
(Field a -> Field a -> Bool)
-> (Field a -> Field a -> Bool) -> Eq (Field a)
forall a. Eq a => Field a -> Field a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Field a -> Field a -> Bool
$c/= :: forall a. Eq a => Field a -> Field a -> Bool
== :: Field a -> Field a -> Bool
$c== :: forall a. Eq a => Field a -> Field a -> Bool
Eq,
      ReadPrec [Field a]
ReadPrec (Field a)
Int -> ReadS (Field a)
ReadS [Field a]
(Int -> ReadS (Field a))
-> ReadS [Field a]
-> ReadPrec (Field a)
-> ReadPrec [Field a]
-> Read (Field a)
forall a. Read a => ReadPrec [Field a]
forall a. Read a => ReadPrec (Field a)
forall a. Read a => Int -> ReadS (Field a)
forall a. Read a => ReadS [Field a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Field a]
$creadListPrec :: forall a. Read a => ReadPrec [Field a]
readPrec :: ReadPrec (Field a)
$creadPrec :: forall a. Read a => ReadPrec (Field a)
readList :: ReadS [Field a]
$creadList :: forall a. Read a => ReadS [Field a]
readsPrec :: Int -> ReadS (Field a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Field a)
Read,
      Int -> Field a -> ShowS
[Field a] -> ShowS
Field a -> String
(Int -> Field a -> ShowS)
-> (Field a -> String) -> ([Field a] -> ShowS) -> Show (Field a)
forall a. Show a => Int -> Field a -> ShowS
forall a. Show a => [Field a] -> ShowS
forall a. Show a => Field a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Field a] -> ShowS
$cshowList :: forall a. Show a => [Field a] -> ShowS
show :: Field a -> String
$cshow :: forall a. Show a => Field a -> String
showsPrec :: Int -> Field a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Field a -> ShowS
Show,
      Typeable,
      Typeable (Field a)
Typeable (Field a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Field a -> c (Field a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Field a))
-> (Field a -> Constr)
-> (Field a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Field a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Field a)))
-> ((forall b. Data b => b -> b) -> Field a -> Field a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Field a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Field a -> r)
-> (forall u. (forall d. Data d => d -> u) -> Field a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Field a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Field a -> m (Field a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Field a -> m (Field a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Field a -> m (Field a))
-> Data (Field a)
Field a -> DataType
Field a -> Constr
(forall b. Data b => b -> b) -> Field a -> Field a
forall {a}. Data a => Typeable (Field a)
forall a. Data a => Field a -> DataType
forall a. Data a => Field a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> Field a -> Field a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Field a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> Field a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Field a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Field a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Field a -> m (Field a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Field a -> m (Field a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Field a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Field a -> c (Field a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Field a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Field a))
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Field a -> u
forall u. (forall d. Data d => d -> u) -> Field a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Field a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Field a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Field a -> m (Field a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Field a -> m (Field a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Field a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Field a -> c (Field a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Field a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Field a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Field a -> m (Field a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Field a -> m (Field a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Field a -> m (Field a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Field a -> m (Field a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Field a -> m (Field a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Field a -> m (Field a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Field a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Field a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Field a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> Field a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Field a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Field a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Field a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Field a -> r
gmapT :: (forall b. Data b => b -> b) -> Field a -> Field a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Field a -> Field a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Field a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Field a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Field a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Field a))
dataTypeOf :: Field a -> DataType
$cdataTypeOf :: forall a. Data a => Field a -> DataType
toConstr :: Field a -> Constr
$ctoConstr :: forall a. Data a => Field a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Field a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Field a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Field a -> c (Field a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Field a -> c (Field a)
Data,
      (forall x. Field a -> Rep (Field a) x)
-> (forall x. Rep (Field a) x -> Field a) -> Generic (Field a)
forall x. Rep (Field a) x -> Field a
forall x. Field a -> Rep (Field a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Field a) x -> Field a
forall a x. Field a -> Rep (Field a) x
$cto :: forall a x. Rep (Field a) x -> Field a
$cfrom :: forall a x. Field a -> Rep (Field a) x
Generic,
      (forall a b. (a -> b) -> Field a -> Field b)
-> (forall a b. a -> Field b -> Field a) -> Functor Field
forall a b. a -> Field b -> Field a
forall a b. (a -> b) -> Field a -> Field b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Field b -> Field a
$c<$ :: forall a b. a -> Field b -> Field a
fmap :: forall a b. (a -> b) -> Field a -> Field b
$cfmap :: forall a b. (a -> b) -> Field a -> Field b
Functor,
      (forall m. Monoid m => Field m -> m)
-> (forall m a. Monoid m => (a -> m) -> Field a -> m)
-> (forall m a. Monoid m => (a -> m) -> Field a -> m)
-> (forall a b. (a -> b -> b) -> b -> Field a -> b)
-> (forall a b. (a -> b -> b) -> b -> Field a -> b)
-> (forall b a. (b -> a -> b) -> b -> Field a -> b)
-> (forall b a. (b -> a -> b) -> b -> Field a -> b)
-> (forall a. (a -> a -> a) -> Field a -> a)
-> (forall a. (a -> a -> a) -> Field a -> a)
-> (forall a. Field a -> [a])
-> (forall a. Field a -> Bool)
-> (forall a. Field a -> Int)
-> (forall a. Eq a => a -> Field a -> Bool)
-> (forall a. Ord a => Field a -> a)
-> (forall a. Ord a => Field a -> a)
-> (forall a. Num a => Field a -> a)
-> (forall a. Num a => Field a -> a)
-> Foldable Field
forall a. Eq a => a -> Field a -> Bool
forall a. Num a => Field a -> a
forall a. Ord a => Field a -> a
forall m. Monoid m => Field m -> m
forall a. Field a -> Bool
forall a. Field a -> Int
forall a. Field a -> [a]
forall a. (a -> a -> a) -> Field a -> a
forall m a. Monoid m => (a -> m) -> Field a -> m
forall b a. (b -> a -> b) -> b -> Field a -> b
forall a b. (a -> b -> b) -> b -> Field 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 :: forall a. Num a => Field a -> a
$cproduct :: forall a. Num a => Field a -> a
sum :: forall a. Num a => Field a -> a
$csum :: forall a. Num a => Field a -> a
minimum :: forall a. Ord a => Field a -> a
$cminimum :: forall a. Ord a => Field a -> a
maximum :: forall a. Ord a => Field a -> a
$cmaximum :: forall a. Ord a => Field a -> a
elem :: forall a. Eq a => a -> Field a -> Bool
$celem :: forall a. Eq a => a -> Field a -> Bool
length :: forall a. Field a -> Int
$clength :: forall a. Field a -> Int
null :: forall a. Field a -> Bool
$cnull :: forall a. Field a -> Bool
toList :: forall a. Field a -> [a]
$ctoList :: forall a. Field a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Field a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Field a -> a
foldr1 :: forall a. (a -> a -> a) -> Field a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Field a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Field a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Field a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Field a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Field a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Field a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Field a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Field a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Field a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Field a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Field a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Field a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Field a -> m
fold :: forall m. Monoid m => Field m -> m
$cfold :: forall m. Monoid m => Field m -> m
Foldable,
      Functor Field
Foldable Field
Functor Field
-> Foldable Field
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Field a -> f (Field b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Field (f a) -> f (Field a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Field a -> m (Field b))
-> (forall (m :: * -> *) a. Monad m => Field (m a) -> m (Field a))
-> Traversable Field
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 => Field (m a) -> m (Field a)
forall (f :: * -> *) a. Applicative f => Field (f a) -> f (Field a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Field a -> m (Field b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Field a -> f (Field b)
sequence :: forall (m :: * -> *) a. Monad m => Field (m a) -> m (Field a)
$csequence :: forall (m :: * -> *) a. Monad m => Field (m a) -> m (Field a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Field a -> m (Field b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Field a -> m (Field b)
sequenceA :: forall (f :: * -> *) a. Applicative f => Field (f a) -> f (Field a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Field (f a) -> f (Field a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Field a -> f (Field b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Field a -> f (Field b)
Traversable
    )

instance Alpha a => Alpha (Field a)

deriveShow1 ''Field

data ExprF a
  = ELit Literal
  | EIdent Ident
  | EFun [Param a] a
  | EApply a (Args a)
  | ELocal
      { forall a. ExprF a -> NonEmpty (String, a)
bnds :: NonEmpty (Ident, a),
        forall a. ExprF a -> a
expr :: a
      }
  | EObj
      { forall a. ExprF a -> [(String, a)]
locals :: [(Ident, a)],
        forall a. ExprF a -> [Field a]
fields :: [Field a]
        --asserts :: [Assert a]
      }
  | EArr [a]
  | EErr a
  | ELookup a a
  | EIndex a a
  | EAssert (Assert a)
  | EIf a a
  | EIfElse a a a
  | ESlice
      { expr :: a,
        forall a. ExprF a -> Maybe a
start :: Maybe a,
        forall a. ExprF a -> Maybe a
end :: Maybe a,
        forall a. ExprF a -> Maybe a
step :: Maybe a
      }
  | EBinOp BinOp a a
  | EUnyOp UnyOp a
  | EArrComp
      { expr :: a,
        forall a. ExprF a -> NonEmpty (CompSpec a)
comp :: NonEmpty (CompSpec a)
      }
  | EObjComp
      { forall a. ExprF a -> Field a
field :: Field a,
        locals :: [(Ident, a)],
        comp :: NonEmpty (CompSpec a)
      }
  deriving
    ( Int -> ExprF a -> ShowS
[ExprF a] -> ShowS
ExprF a -> String
(Int -> ExprF a -> ShowS)
-> (ExprF a -> String) -> ([ExprF a] -> ShowS) -> Show (ExprF a)
forall a. Show a => Int -> ExprF a -> ShowS
forall a. Show a => [ExprF a] -> ShowS
forall a. Show a => ExprF a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExprF a] -> ShowS
$cshowList :: forall a. Show a => [ExprF a] -> ShowS
show :: ExprF a -> String
$cshow :: forall a. Show a => ExprF a -> String
showsPrec :: Int -> ExprF a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> ExprF a -> ShowS
Show,
      (forall a b. (a -> b) -> ExprF a -> ExprF b)
-> (forall a b. a -> ExprF b -> ExprF a) -> Functor ExprF
forall a b. a -> ExprF b -> ExprF a
forall a b. (a -> b) -> ExprF a -> ExprF b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> ExprF b -> ExprF a
$c<$ :: forall a b. a -> ExprF b -> ExprF a
fmap :: forall a b. (a -> b) -> ExprF a -> ExprF b
$cfmap :: forall a b. (a -> b) -> ExprF a -> ExprF b
Functor,
      (forall m. Monoid m => ExprF m -> m)
-> (forall m a. Monoid m => (a -> m) -> ExprF a -> m)
-> (forall m a. Monoid m => (a -> m) -> ExprF a -> m)
-> (forall a b. (a -> b -> b) -> b -> ExprF a -> b)
-> (forall a b. (a -> b -> b) -> b -> ExprF a -> b)
-> (forall b a. (b -> a -> b) -> b -> ExprF a -> b)
-> (forall b a. (b -> a -> b) -> b -> ExprF a -> b)
-> (forall a. (a -> a -> a) -> ExprF a -> a)
-> (forall a. (a -> a -> a) -> ExprF a -> a)
-> (forall a. ExprF a -> [a])
-> (forall a. ExprF a -> Bool)
-> (forall a. ExprF a -> Int)
-> (forall a. Eq a => a -> ExprF a -> Bool)
-> (forall a. Ord a => ExprF a -> a)
-> (forall a. Ord a => ExprF a -> a)
-> (forall a. Num a => ExprF a -> a)
-> (forall a. Num a => ExprF a -> a)
-> Foldable ExprF
forall a. Eq a => a -> ExprF a -> Bool
forall a. Num a => ExprF a -> a
forall a. Ord a => ExprF a -> a
forall m. Monoid m => ExprF m -> m
forall a. ExprF a -> Bool
forall a. ExprF a -> Int
forall a. ExprF a -> [a]
forall a. (a -> a -> a) -> ExprF a -> a
forall m a. Monoid m => (a -> m) -> ExprF a -> m
forall b a. (b -> a -> b) -> b -> ExprF a -> b
forall a b. (a -> b -> b) -> b -> ExprF 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 :: forall a. Num a => ExprF a -> a
$cproduct :: forall a. Num a => ExprF a -> a
sum :: forall a. Num a => ExprF a -> a
$csum :: forall a. Num a => ExprF a -> a
minimum :: forall a. Ord a => ExprF a -> a
$cminimum :: forall a. Ord a => ExprF a -> a
maximum :: forall a. Ord a => ExprF a -> a
$cmaximum :: forall a. Ord a => ExprF a -> a
elem :: forall a. Eq a => a -> ExprF a -> Bool
$celem :: forall a. Eq a => a -> ExprF a -> Bool
length :: forall a. ExprF a -> Int
$clength :: forall a. ExprF a -> Int
null :: forall a. ExprF a -> Bool
$cnull :: forall a. ExprF a -> Bool
toList :: forall a. ExprF a -> [a]
$ctoList :: forall a. ExprF a -> [a]
foldl1 :: forall a. (a -> a -> a) -> ExprF a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> ExprF a -> a
foldr1 :: forall a. (a -> a -> a) -> ExprF a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> ExprF a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> ExprF a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> ExprF a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ExprF a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> ExprF a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ExprF a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> ExprF a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ExprF a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> ExprF a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> ExprF a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> ExprF a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ExprF a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> ExprF a -> m
fold :: forall m. Monoid m => ExprF m -> m
$cfold :: forall m. Monoid m => ExprF m -> m
Foldable,
      Functor ExprF
Foldable ExprF
Functor ExprF
-> Foldable ExprF
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> ExprF a -> f (ExprF b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    ExprF (f a) -> f (ExprF a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> ExprF a -> m (ExprF b))
-> (forall (m :: * -> *) a. Monad m => ExprF (m a) -> m (ExprF a))
-> Traversable ExprF
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 => ExprF (m a) -> m (ExprF a)
forall (f :: * -> *) a. Applicative f => ExprF (f a) -> f (ExprF a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ExprF a -> m (ExprF b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ExprF a -> f (ExprF b)
sequence :: forall (m :: * -> *) a. Monad m => ExprF (m a) -> m (ExprF a)
$csequence :: forall (m :: * -> *) a. Monad m => ExprF (m a) -> m (ExprF a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ExprF a -> m (ExprF b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ExprF a -> m (ExprF b)
sequenceA :: forall (f :: * -> *) a. Applicative f => ExprF (f a) -> f (ExprF a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => ExprF (f a) -> f (ExprF a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ExprF a -> f (ExprF b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ExprF a -> f (ExprF b)
Traversable,
      (forall x. ExprF a -> Rep (ExprF a) x)
-> (forall x. Rep (ExprF a) x -> ExprF a) -> Generic (ExprF a)
forall x. Rep (ExprF a) x -> ExprF a
forall x. ExprF a -> Rep (ExprF a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (ExprF a) x -> ExprF a
forall a x. ExprF a -> Rep (ExprF a) x
$cto :: forall a x. Rep (ExprF a) x -> ExprF a
$cfrom :: forall a x. ExprF a -> Rep (ExprF a) x
Generic,
      Typeable,
      Typeable (ExprF a)
Typeable (ExprF a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ExprF a -> c (ExprF a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (ExprF a))
-> (ExprF a -> Constr)
-> (ExprF a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (ExprF a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ExprF a)))
-> ((forall b. Data b => b -> b) -> ExprF a -> ExprF a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ExprF a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ExprF a -> r)
-> (forall u. (forall d. Data d => d -> u) -> ExprF a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> ExprF a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a))
-> Data (ExprF a)
ExprF a -> DataType
ExprF a -> Constr
(forall b. Data b => b -> b) -> ExprF a -> ExprF a
forall {a}. Data a => Typeable (ExprF a)
forall a. Data a => ExprF a -> DataType
forall a. Data a => ExprF a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> ExprF a -> ExprF a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> ExprF a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> ExprF a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ExprF a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ExprF a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ExprF a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ExprF a -> c (ExprF a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ExprF a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ExprF a))
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ExprF a -> u
forall u. (forall d. Data d => d -> u) -> ExprF a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ExprF a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ExprF a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ExprF a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ExprF a -> c (ExprF a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ExprF a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ExprF a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> ExprF a -> m (ExprF a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ExprF a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> ExprF a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> ExprF a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> ExprF a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ExprF a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ExprF a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ExprF a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ExprF a -> r
gmapT :: (forall b. Data b => b -> b) -> ExprF a -> ExprF a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> ExprF a -> ExprF a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ExprF a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ExprF a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ExprF a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ExprF a))
dataTypeOf :: ExprF a -> DataType
$cdataTypeOf :: forall a. Data a => ExprF a -> DataType
toConstr :: ExprF a -> Constr
$ctoConstr :: forall a. Data a => ExprF a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ExprF a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ExprF a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ExprF a -> c (ExprF a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ExprF a -> c (ExprF a)
Data
    )

deriveShow1 ''ExprF

newtype Import = Import FilePath
  deriving (Int -> Import -> ShowS
[Import] -> ShowS
Import -> String
(Int -> Import -> ShowS)
-> (Import -> String) -> ([Import] -> ShowS) -> Show Import
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Import] -> ShowS
$cshowList :: [Import] -> ShowS
show :: Import -> String
$cshow :: Import -> String
showsPrec :: Int -> Import -> ShowS
$cshowsPrec :: Int -> Import -> ShowS
Show, Import -> Import -> Bool
(Import -> Import -> Bool)
-> (Import -> Import -> Bool) -> Eq Import
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Import -> Import -> Bool
$c/= :: Import -> Import -> Bool
== :: Import -> Import -> Bool
$c== :: Import -> Import -> Bool
Eq)

type ExprF' = Sum ExprF (Const Import)

mkImportF :: String -> ExprF' a
mkImportF :: forall a. String -> ExprF' a
mkImportF = Const Import a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR (Const Import a -> Sum ExprF (Const Import) a)
-> (String -> Const Import a)
-> String
-> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Import -> Const Import a
forall {k} a (b :: k). a -> Const a b
Const (Import -> Const Import a)
-> (String -> Import) -> String -> Const Import a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Import
Import

mkNullF :: ExprF' a
mkNullF :: forall a. ExprF' a
mkNullF = (ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (Literal -> ExprF a) -> Literal -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Literal -> ExprF a
forall a. Literal -> ExprF a
ELit) Literal
Null

mkIntF :: Integral b => b -> ExprF' a
mkIntF :: forall b a. Integral b => b -> ExprF' a
mkIntF = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (b -> ExprF a) -> b -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Literal -> ExprF a
forall a. Literal -> ExprF a
ELit (Literal -> ExprF a) -> (b -> Literal) -> b -> ExprF a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Scientific -> Literal
Number (Scientific -> Literal) -> (b -> Scientific) -> b -> Literal
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Scientific
forall a b. (Integral a, Num b) => a -> b
fromIntegral

mkFloatF :: Scientific -> ExprF' a
mkFloatF :: forall a. Scientific -> ExprF' a
mkFloatF = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (Scientific -> ExprF a)
-> Scientific
-> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Literal -> ExprF a
forall a. Literal -> ExprF a
ELit (Literal -> ExprF a)
-> (Scientific -> Literal) -> Scientific -> ExprF a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Scientific -> Literal
Number

mkStrF :: String -> ExprF' a
mkStrF :: forall a. String -> ExprF' a
mkStrF = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (String -> ExprF a) -> String -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Literal -> ExprF a
forall a. Literal -> ExprF a
ELit (Literal -> ExprF a) -> (String -> Literal) -> String -> ExprF a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Literal
String (Text -> Literal) -> (String -> Text) -> String -> Literal
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack

mkBoolF :: Bool -> ExprF' a
mkBoolF :: forall a. Bool -> ExprF' a
mkBoolF = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (Bool -> ExprF a) -> Bool -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Literal -> ExprF a
forall a. Literal -> ExprF a
ELit (Literal -> ExprF a) -> (Bool -> Literal) -> Bool -> ExprF a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Literal
Bool

mkIdentF :: Ident -> ExprF' a
mkIdentF :: forall a. String -> ExprF' a
mkIdentF = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (String -> ExprF a) -> String -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ExprF a
forall a. String -> ExprF a
EIdent

mkFunF :: [Param a] -> a -> ExprF' a
mkFunF :: forall a. [Param a] -> a -> ExprF' a
mkFunF [Param a]
a = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (a -> ExprF a) -> a -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Param a] -> a -> ExprF a
forall a. [Param a] -> a -> ExprF a
EFun [Param a]
a

mkApplyF :: a -> Args a -> ExprF' a
mkApplyF :: forall a. a -> Args a -> ExprF' a
mkApplyF a
a = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (Args a -> ExprF a) -> Args a -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Args a -> ExprF a
forall a. a -> Args a -> ExprF a
EApply a
a

mkIfF :: a -> a -> ExprF' a
mkIfF :: forall a. a -> a -> ExprF' a
mkIfF a
c = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (a -> ExprF a) -> a -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a -> ExprF a
forall a. a -> a -> ExprF a
EIf a
c

mkIfElseF :: a -> a -> a -> ExprF' a
mkIfElseF :: forall a. a -> a -> a -> ExprF' a
mkIfElseF a
c a
a = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (a -> ExprF a) -> a -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a -> a -> ExprF a
forall a. a -> a -> a -> ExprF a
EIfElse a
c a
a

mkLocalF :: NonEmpty (Ident, a) -> a -> ExprF' a
mkLocalF :: forall a. NonEmpty (String, a) -> a -> ExprF' a
mkLocalF NonEmpty (String, a)
n = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (a -> ExprF a) -> a -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (String, a) -> a -> ExprF a
forall a. NonEmpty (String, a) -> a -> ExprF a
ELocal NonEmpty (String, a)
n

mkLookupF :: a -> a -> ExprF' a
mkLookupF :: forall a. a -> a -> ExprF' a
mkLookupF a
e = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (a -> ExprF a) -> a -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a -> ExprF a
forall a. a -> a -> ExprF a
ELookup a
e

mkIndexF :: a -> a -> ExprF' a
mkIndexF :: forall a. a -> a -> ExprF' a
mkIndexF a
e = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (a -> ExprF a) -> a -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a -> ExprF a
forall a. a -> a -> ExprF a
EIndex a
e

mkSliceF :: a -> Maybe a -> Maybe a -> Maybe a -> ExprF' a
mkSliceF :: forall a. a -> Maybe a -> Maybe a -> Maybe a -> ExprF' a
mkSliceF a
e Maybe a
f Maybe a
g = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (Maybe a -> ExprF a) -> Maybe a -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Maybe a -> Maybe a -> Maybe a -> ExprF a
forall a. a -> Maybe a -> Maybe a -> Maybe a -> ExprF a
ESlice a
e Maybe a
f Maybe a
g

mkObjectF :: [Field a] -> [(Ident, a)] -> ExprF' a
mkObjectF :: forall a. [Field a] -> [(String, a)] -> ExprF' a
mkObjectF [Field a]
fs [(String, a)]
ls = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> ExprF a -> Sum ExprF (Const Import) a
forall a b. (a -> b) -> a -> b
$ [(String, a)] -> [Field a] -> ExprF a
forall a. [(String, a)] -> [Field a] -> ExprF a
EObj [(String, a)]
ls [Field a]
fs

mkArrayF :: [a] -> ExprF' a
mkArrayF :: forall a. [a] -> ExprF' a
mkArrayF = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> ([a] -> ExprF a) -> [a] -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> ExprF a
forall a. [a] -> ExprF a
EArr

mkErrorF :: a -> ExprF' a
mkErrorF :: forall a. a -> ExprF' a
mkErrorF = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (a -> ExprF a) -> a -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ExprF a
forall a. a -> ExprF a
EErr

mkAssertF :: a -> Maybe a -> a -> ExprF' a
mkAssertF :: forall a. a -> Maybe a -> a -> ExprF' a
mkAssertF a
e Maybe a
m = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (a -> ExprF a) -> a -> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Assert a -> ExprF a
forall a. Assert a -> ExprF a
EAssert (Assert a -> ExprF a) -> (a -> Assert a) -> a -> ExprF a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Maybe a -> a -> Assert a
forall a. a -> Maybe a -> a -> Assert a
Assert a
e Maybe a
m

mkArrCompF :: a -> NonEmpty (CompSpec a) -> ExprF' a
mkArrCompF :: forall a. a -> NonEmpty (CompSpec a) -> ExprF' a
mkArrCompF a
e = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (NonEmpty (CompSpec a) -> ExprF a)
-> NonEmpty (CompSpec a)
-> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> NonEmpty (CompSpec a) -> ExprF a
forall a. a -> NonEmpty (CompSpec a) -> ExprF a
EArrComp a
e

mkObjCompF :: Field a -> [(Ident, a)] -> NonEmpty (CompSpec a) -> ExprF' a
mkObjCompF :: forall a.
Field a -> [(String, a)] -> NonEmpty (CompSpec a) -> ExprF' a
mkObjCompF Field a
f [(String, a)]
ls = ExprF a -> Sum ExprF (Const Import) a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (ExprF a -> Sum ExprF (Const Import) a)
-> (NonEmpty (CompSpec a) -> ExprF a)
-> NonEmpty (CompSpec a)
-> Sum ExprF (Const Import) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Field a -> [(String, a)] -> NonEmpty (CompSpec a) -> ExprF a
forall a.
Field a -> [(String, a)] -> NonEmpty (CompSpec a) -> ExprF a
EObjComp Field a
f [(String, a)]
ls