{-# LANGUAGE CPP, DeriveDataTypeable, DeriveFoldable, DeriveFunctor,
DeriveGeneric, DeriveTraversable, FlexibleContexts,
FlexibleInstances, FunctionalDependencies, MultiParamTypeClasses,
PatternGuards, TypeSynonymInstances #-}
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
module Idris.Core.TT(
AppStatus(..), ArithTy(..), Binder(..), Const(..), Ctxt(..)
, ConstraintFC(..), DataOpt(..), DataOpts(..), Datatype(..)
, Env(..), EnvTT(..), Err(..), Err'(..), ErrorReportPart(..)
, FC(..), FC'(..), ImplicitInfo(..), IntTy(..), Name(..)
, NameOutput(..), NameType(..), NativeTy(..), OutputAnnotation(..)
, Provenance(..), Raw(..), RigCount(..), SpecialName(..), TC(..), Term(..)
, TermSize(..), TextFormatting(..), TT(..),Type(..), TypeInfo(..)
, UConstraint(..), UCs(..), UExp(..), Universe(..)
, addAlist, addBinder, addDef, allTTNames, arity, bindAll
, bindingOf, bindTyArgs, caseName, constDocs, constIsType, deleteDefExact
, discard, emptyContext, emptyFC, explicitNames, fc_end, fc_fname
, fc_start, fcIn, fileFC, finalise, fmapMB, forget, forgetEnv
, freeNames, getArgTys, getRetTy, substRetTy, implicitable, instantiate, internalNS
, intTyName, isInjective, isTypeConst, lookupCtxt
, lookupCtxtExact, lookupCtxtName, mapCtxt, mkApp, nativeTyWidth
, nextName, noOccurrence, nsroot, occurrences
, pEraseType, pmap, pprintRaw, pprintTT, pprintTTClause, prettyEnv, psubst
, pToV, pToVs, pureTerm, raw_apply, raw_unapply, refsIn, safeForget
, safeForgetEnv, showCG, showEnv, showEnvDbg, showSep
, sImplementationN, sMN, sNS, str, subst, substNames, substTerm
, substV, sUN, tcname, termSmallerThan, tfail, thead, tnull
, toAlist, traceWhen, txt, unApply, uniqueBinders, uniqueName
, uniqueNameFrom, uniqueNameSet, unList, updateDef, vToP, weakenTm
, rigPlus, rigMult, fstEnv, rigEnv, sndEnv, lookupBinder, envBinders
, envZero
) where
import Util.Pretty hiding (Str)
import Prelude (Bool(..), Double, Enum(..), Eq(..), FilePath, Functor(..), Int,
Integer, Maybe(..), Monad(..), Monoid(..), Num(..), Ord(..),
Ordering(..), Show(..), String, div, error, fst, max, min, mod,
not, otherwise, read, snd, ($), (&&), (.), (||))
#if (MIN_VERSION_base(4,11,0))
import qualified Prelude as S (Semigroup(..))
#endif
import Control.Applicative (Alternative, Applicative(..))
import qualified Control.Applicative as A (Alternative(..))
import Control.DeepSeq (($!!))
import qualified Control.Monad.Fail as Fail
import Control.Monad.State.Strict
import Data.Binary hiding (get, put)
import Data.Char
import Data.Data (Data)
import Data.Foldable (Foldable)
import Data.List hiding (group, insert)
import qualified Data.Map.Strict as Map
import Data.Maybe (listToMaybe)
import Data.Set (Set, fromList, insert, member)
import qualified Data.Text as T
import Data.Traversable (Traversable)
import Data.Typeable (Typeable)
import Debug.Trace
import GHC.Generics (Generic)
import Numeric (showIntAtBase)
import Numeric.IEEE (IEEE(identicalIEEE))
data Option = TTypeInTType
| CheckConv
deriving Option -> Option -> Bool
(Option -> Option -> Bool)
-> (Option -> Option -> Bool) -> Eq Option
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Option -> Option -> Bool
$c/= :: Option -> Option -> Bool
== :: Option -> Option -> Bool
$c== :: Option -> Option -> Bool
Eq
data FC = FC { FC -> String
_fc_fname :: String,
FC -> (Int, Int)
_fc_start :: (Int, Int),
FC -> (Int, Int)
_fc_end :: (Int, Int)
}
| NoFC
| FileFC { _fc_fname :: String }
deriving (Typeable FC
Constr
DataType
Typeable FC =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FC -> c FC)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FC)
-> (FC -> Constr)
-> (FC -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FC))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FC))
-> ((forall b. Data b => b -> b) -> FC -> FC)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FC -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FC -> r)
-> (forall u. (forall d. Data d => d -> u) -> FC -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FC -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FC -> m FC)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FC -> m FC)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FC -> m FC)
-> Data FC
FC -> Constr
FC -> DataType
(forall b. Data b => b -> b) -> FC -> FC
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FC -> c FC
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FC
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) -> FC -> u
forall u. (forall d. Data d => d -> u) -> FC -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FC -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FC -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FC -> m FC
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FC -> m FC
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FC
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FC -> c FC
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FC)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FC)
$cFileFC :: Constr
$cNoFC :: Constr
$cFC :: Constr
$tFC :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FC -> m FC
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FC -> m FC
gmapMp :: (forall d. Data d => d -> m d) -> FC -> m FC
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FC -> m FC
gmapM :: (forall d. Data d => d -> m d) -> FC -> m FC
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FC -> m FC
gmapQi :: Int -> (forall d. Data d => d -> u) -> FC -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FC -> u
gmapQ :: (forall d. Data d => d -> u) -> FC -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FC -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FC -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FC -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FC -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FC -> r
gmapT :: (forall b. Data b => b -> b) -> FC -> FC
$cgmapT :: (forall b. Data b => b -> b) -> FC -> FC
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FC)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FC)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FC)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FC)
dataTypeOf :: FC -> DataType
$cdataTypeOf :: FC -> DataType
toConstr :: FC -> Constr
$ctoConstr :: FC -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FC
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FC
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FC -> c FC
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FC -> c FC
$cp1Data :: Typeable FC
Data, (forall x. FC -> Rep FC x)
-> (forall x. Rep FC x -> FC) -> Generic FC
forall x. Rep FC x -> FC
forall x. FC -> Rep FC x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FC x -> FC
$cfrom :: forall x. FC -> Rep FC x
Generic, Typeable, Eq FC
Eq FC =>
(FC -> FC -> Ordering)
-> (FC -> FC -> Bool)
-> (FC -> FC -> Bool)
-> (FC -> FC -> Bool)
-> (FC -> FC -> Bool)
-> (FC -> FC -> FC)
-> (FC -> FC -> FC)
-> Ord FC
FC -> FC -> Bool
FC -> FC -> Ordering
FC -> FC -> FC
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FC -> FC -> FC
$cmin :: FC -> FC -> FC
max :: FC -> FC -> FC
$cmax :: FC -> FC -> FC
>= :: FC -> FC -> Bool
$c>= :: FC -> FC -> Bool
> :: FC -> FC -> Bool
$c> :: FC -> FC -> Bool
<= :: FC -> FC -> Bool
$c<= :: FC -> FC -> Bool
< :: FC -> FC -> Bool
$c< :: FC -> FC -> Bool
compare :: FC -> FC -> Ordering
$ccompare :: FC -> FC -> Ordering
$cp1Ord :: Eq FC
Ord)
fc_fname :: FC -> String
fc_fname :: FC -> String
fc_fname (FC f :: String
f _ _) = String
f
fc_fname NoFC = "(no file)"
fc_fname (FileFC f :: String
f) = String
f
fc_start :: FC -> (Int, Int)
fc_start :: FC -> (Int, Int)
fc_start (FC _ start :: (Int, Int)
start _) = (Int, Int)
start
fc_start NoFC = (0, 0)
fc_start (FileFC f :: String
f) = (0, 0)
fc_end :: FC -> (Int, Int)
fc_end :: FC -> (Int, Int)
fc_end (FC _ _ end :: (Int, Int)
end) = (Int, Int)
end
fc_end NoFC = (0, 0)
fc_end (FileFC f :: String
f) = (0, 0)
#if (MIN_VERSION_base(4,11,0))
instance S.Semigroup FC where
<> :: FC -> FC -> FC
(<>) = FC -> FC -> FC
forall a. Monoid a => a -> a -> a
mappend
#endif
instance Monoid FC where
mempty :: FC
mempty = FC
NoFC
mappend :: FC -> FC -> FC
mappend (FC f :: String
f start :: (Int, Int)
start end :: (Int, Int)
end) (FC f' :: String
f' start' :: (Int, Int)
start' end' :: (Int, Int)
end')
| String
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
f' = String -> (Int, Int) -> (Int, Int) -> FC
FC String
f ((Int, Int) -> (Int, Int) -> (Int, Int)
forall a. Ord a => a -> a -> a
min (Int, Int)
start (Int, Int)
start') ((Int, Int) -> (Int, Int) -> (Int, Int)
forall a. Ord a => a -> a -> a
max (Int, Int)
end (Int, Int)
end')
| Bool
otherwise = FC
NoFC
mappend fc :: FC
fc@(FC f :: String
f _ _) (FileFC f' :: String
f') | String
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
f' = FC
fc
| Bool
otherwise = FC
NoFC
mappend (FileFC f' :: String
f') fc :: FC
fc@(FC f :: String
f _ _) | String
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
f' = FC
fc
| Bool
otherwise = FC
NoFC
mappend (FileFC f :: String
f) (FileFC f' :: String
f') | String
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
f' = String -> FC
FileFC String
f
| Bool
otherwise = FC
NoFC
mappend NoFC fc :: FC
fc = FC
fc
mappend fc :: FC
fc NoFC = FC
fc
fcIn :: FC -> FC -> Bool
fcIn :: FC -> FC -> Bool
fcIn NoFC _ = Bool
False
fcIn (FileFC _) _ = Bool
False
fcIn (FC {}) NoFC = Bool
False
fcIn (FC {}) (FileFC _) = Bool
False
fcIn (FC fn1 :: String
fn1 (sl1 :: Int
sl1, sc1 :: Int
sc1) (el1 :: Int
el1, ec1 :: Int
ec1)) (FC fn2 :: String
fn2 (sl2 :: Int
sl2, sc2 :: Int
sc2) (el2 :: Int
el2, ec2 :: Int
ec2)) =
String
fn1 String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
fn2 Bool -> Bool -> Bool
&&
(Int
sl1 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
sl2 Bool -> Bool -> Bool
&& Int
sc1 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
sc2 Bool -> Bool -> Bool
|| Int
sl1 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
sl2) Bool -> Bool -> Bool
&&
(Int
el1 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
el2 Bool -> Bool -> Bool
&& Int
ec1 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
ec2 Bool -> Bool -> Bool
|| Int
el1 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
el2)
instance Eq FC where
_ == :: FC -> FC -> Bool
== _ = Bool
True
newtype FC' = FC' { FC' -> FC
unwrapFC :: FC } deriving (Typeable FC'
Constr
DataType
Typeable FC' =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FC' -> c FC')
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FC')
-> (FC' -> Constr)
-> (FC' -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FC'))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FC'))
-> ((forall b. Data b => b -> b) -> FC' -> FC')
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FC' -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FC' -> r)
-> (forall u. (forall d. Data d => d -> u) -> FC' -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FC' -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FC' -> m FC')
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FC' -> m FC')
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FC' -> m FC')
-> Data FC'
FC' -> Constr
FC' -> DataType
(forall b. Data b => b -> b) -> FC' -> FC'
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FC' -> c FC'
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FC'
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) -> FC' -> u
forall u. (forall d. Data d => d -> u) -> FC' -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FC' -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FC' -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FC' -> m FC'
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FC' -> m FC'
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FC'
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FC' -> c FC'
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FC')
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FC')
$cFC' :: Constr
$tFC' :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FC' -> m FC'
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FC' -> m FC'
gmapMp :: (forall d. Data d => d -> m d) -> FC' -> m FC'
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FC' -> m FC'
gmapM :: (forall d. Data d => d -> m d) -> FC' -> m FC'
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FC' -> m FC'
gmapQi :: Int -> (forall d. Data d => d -> u) -> FC' -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FC' -> u
gmapQ :: (forall d. Data d => d -> u) -> FC' -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FC' -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FC' -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FC' -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FC' -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FC' -> r
gmapT :: (forall b. Data b => b -> b) -> FC' -> FC'
$cgmapT :: (forall b. Data b => b -> b) -> FC' -> FC'
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FC')
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FC')
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FC')
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FC')
dataTypeOf :: FC' -> DataType
$cdataTypeOf :: FC' -> DataType
toConstr :: FC' -> Constr
$ctoConstr :: FC' -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FC'
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FC'
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FC' -> c FC'
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FC' -> c FC'
$cp1Data :: Typeable FC'
Data, (forall x. FC' -> Rep FC' x)
-> (forall x. Rep FC' x -> FC') -> Generic FC'
forall x. Rep FC' x -> FC'
forall x. FC' -> Rep FC' x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FC' x -> FC'
$cfrom :: forall x. FC' -> Rep FC' x
Generic, Typeable, Eq FC'
Eq FC' =>
(FC' -> FC' -> Ordering)
-> (FC' -> FC' -> Bool)
-> (FC' -> FC' -> Bool)
-> (FC' -> FC' -> Bool)
-> (FC' -> FC' -> Bool)
-> (FC' -> FC' -> FC')
-> (FC' -> FC' -> FC')
-> Ord FC'
FC' -> FC' -> Bool
FC' -> FC' -> Ordering
FC' -> FC' -> FC'
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FC' -> FC' -> FC'
$cmin :: FC' -> FC' -> FC'
max :: FC' -> FC' -> FC'
$cmax :: FC' -> FC' -> FC'
>= :: FC' -> FC' -> Bool
$c>= :: FC' -> FC' -> Bool
> :: FC' -> FC' -> Bool
$c> :: FC' -> FC' -> Bool
<= :: FC' -> FC' -> Bool
$c<= :: FC' -> FC' -> Bool
< :: FC' -> FC' -> Bool
$c< :: FC' -> FC' -> Bool
compare :: FC' -> FC' -> Ordering
$ccompare :: FC' -> FC' -> Ordering
$cp1Ord :: Eq FC'
Ord)
instance Eq FC' where
FC' fc :: FC
fc == :: FC' -> FC' -> Bool
== FC' fc' :: FC
fc' = FC -> FC -> Bool
fcEq FC
fc FC
fc'
where fcEq :: FC -> FC -> Bool
fcEq (FC n :: String
n s :: (Int, Int)
s e :: (Int, Int)
e) (FC n' :: String
n' s' :: (Int, Int)
s' e' :: (Int, Int)
e') = String
n String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
n' Bool -> Bool -> Bool
&& (Int, Int)
s (Int, Int) -> (Int, Int) -> Bool
forall a. Eq a => a -> a -> Bool
== (Int, Int)
s' Bool -> Bool -> Bool
&& (Int, Int)
e (Int, Int) -> (Int, Int) -> Bool
forall a. Eq a => a -> a -> Bool
== (Int, Int)
e'
fcEq NoFC NoFC = Bool
True
fcEq (FileFC f :: String
f) (FileFC f' :: String
f') = String
f String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
f'
fcEq _ _ = Bool
False
instance Show FC' where
showsPrec :: Int -> FC' -> ShowS
showsPrec d :: Int
d (FC' fc :: FC
fc) = Int -> FC -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
d FC
fc
emptyFC :: FC
emptyFC :: FC
emptyFC = FC
NoFC
fileFC :: String -> FC
fileFC :: String -> FC
fileFC s :: String
s = String -> FC
FileFC String
s
instance Sized FC where
size :: FC -> Int
size (FC f :: String
f s :: (Int, Int)
s e :: (Int, Int)
e) = 4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
f
size NoFC = 1
size (FileFC f :: String
f) = String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
f
instance Show FC where
show :: FC -> String
show (FC f :: String
f s :: (Int, Int)
s e :: (Int, Int)
e) = String
f String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ (Int, Int) -> (Int, Int) -> String
forall a a.
(Eq a, Eq a, Show a, Show a) =>
(a, a) -> (a, a) -> String
showLC (Int, Int)
s (Int, Int)
e
where showLC :: (a, a) -> (a, a) -> String
showLC (sl :: a
sl, sc :: a
sc) (el :: a
el, ec :: a
ec) | a
sl a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
el Bool -> Bool -> Bool
&& a
sc a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
ec = a -> String
forall a. Show a => a -> String
show a
sl String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
sc
| a
sl a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
el = a -> String
forall a. Show a => a -> String
show a
sl String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
sc String -> ShowS
forall a. [a] -> [a] -> [a]
++ "-" String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
ec
| Bool
otherwise = a -> String
forall a. Show a => a -> String
show a
sl String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
sc String -> ShowS
forall a. [a] -> [a] -> [a]
++ "-" String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
el String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
ec
show NoFC = "No location"
show (FileFC f :: String
f) = String
f
data NameOutput = TypeOutput | FunOutput | DataOutput | MetavarOutput | PostulateOutput deriving (Int -> NameOutput -> ShowS
[NameOutput] -> ShowS
NameOutput -> String
(Int -> NameOutput -> ShowS)
-> (NameOutput -> String)
-> ([NameOutput] -> ShowS)
-> Show NameOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NameOutput] -> ShowS
$cshowList :: [NameOutput] -> ShowS
show :: NameOutput -> String
$cshow :: NameOutput -> String
showsPrec :: Int -> NameOutput -> ShowS
$cshowsPrec :: Int -> NameOutput -> ShowS
Show, NameOutput -> NameOutput -> Bool
(NameOutput -> NameOutput -> Bool)
-> (NameOutput -> NameOutput -> Bool) -> Eq NameOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NameOutput -> NameOutput -> Bool
$c/= :: NameOutput -> NameOutput -> Bool
== :: NameOutput -> NameOutput -> Bool
$c== :: NameOutput -> NameOutput -> Bool
Eq, Eq NameOutput
Eq NameOutput =>
(NameOutput -> NameOutput -> Ordering)
-> (NameOutput -> NameOutput -> Bool)
-> (NameOutput -> NameOutput -> Bool)
-> (NameOutput -> NameOutput -> Bool)
-> (NameOutput -> NameOutput -> Bool)
-> (NameOutput -> NameOutput -> NameOutput)
-> (NameOutput -> NameOutput -> NameOutput)
-> Ord NameOutput
NameOutput -> NameOutput -> Bool
NameOutput -> NameOutput -> Ordering
NameOutput -> NameOutput -> NameOutput
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: NameOutput -> NameOutput -> NameOutput
$cmin :: NameOutput -> NameOutput -> NameOutput
max :: NameOutput -> NameOutput -> NameOutput
$cmax :: NameOutput -> NameOutput -> NameOutput
>= :: NameOutput -> NameOutput -> Bool
$c>= :: NameOutput -> NameOutput -> Bool
> :: NameOutput -> NameOutput -> Bool
$c> :: NameOutput -> NameOutput -> Bool
<= :: NameOutput -> NameOutput -> Bool
$c<= :: NameOutput -> NameOutput -> Bool
< :: NameOutput -> NameOutput -> Bool
$c< :: NameOutput -> NameOutput -> Bool
compare :: NameOutput -> NameOutput -> Ordering
$ccompare :: NameOutput -> NameOutput -> Ordering
$cp1Ord :: Eq NameOutput
Ord, (forall x. NameOutput -> Rep NameOutput x)
-> (forall x. Rep NameOutput x -> NameOutput) -> Generic NameOutput
forall x. Rep NameOutput x -> NameOutput
forall x. NameOutput -> Rep NameOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NameOutput x -> NameOutput
$cfrom :: forall x. NameOutput -> Rep NameOutput x
Generic)
data TextFormatting = BoldText | ItalicText | UnderlineText deriving (Int -> TextFormatting -> ShowS
[TextFormatting] -> ShowS
TextFormatting -> String
(Int -> TextFormatting -> ShowS)
-> (TextFormatting -> String)
-> ([TextFormatting] -> ShowS)
-> Show TextFormatting
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextFormatting] -> ShowS
$cshowList :: [TextFormatting] -> ShowS
show :: TextFormatting -> String
$cshow :: TextFormatting -> String
showsPrec :: Int -> TextFormatting -> ShowS
$cshowsPrec :: Int -> TextFormatting -> ShowS
Show, TextFormatting -> TextFormatting -> Bool
(TextFormatting -> TextFormatting -> Bool)
-> (TextFormatting -> TextFormatting -> Bool) -> Eq TextFormatting
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextFormatting -> TextFormatting -> Bool
$c/= :: TextFormatting -> TextFormatting -> Bool
== :: TextFormatting -> TextFormatting -> Bool
$c== :: TextFormatting -> TextFormatting -> Bool
Eq, Eq TextFormatting
Eq TextFormatting =>
(TextFormatting -> TextFormatting -> Ordering)
-> (TextFormatting -> TextFormatting -> Bool)
-> (TextFormatting -> TextFormatting -> Bool)
-> (TextFormatting -> TextFormatting -> Bool)
-> (TextFormatting -> TextFormatting -> Bool)
-> (TextFormatting -> TextFormatting -> TextFormatting)
-> (TextFormatting -> TextFormatting -> TextFormatting)
-> Ord TextFormatting
TextFormatting -> TextFormatting -> Bool
TextFormatting -> TextFormatting -> Ordering
TextFormatting -> TextFormatting -> TextFormatting
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TextFormatting -> TextFormatting -> TextFormatting
$cmin :: TextFormatting -> TextFormatting -> TextFormatting
max :: TextFormatting -> TextFormatting -> TextFormatting
$cmax :: TextFormatting -> TextFormatting -> TextFormatting
>= :: TextFormatting -> TextFormatting -> Bool
$c>= :: TextFormatting -> TextFormatting -> Bool
> :: TextFormatting -> TextFormatting -> Bool
$c> :: TextFormatting -> TextFormatting -> Bool
<= :: TextFormatting -> TextFormatting -> Bool
$c<= :: TextFormatting -> TextFormatting -> Bool
< :: TextFormatting -> TextFormatting -> Bool
$c< :: TextFormatting -> TextFormatting -> Bool
compare :: TextFormatting -> TextFormatting -> Ordering
$ccompare :: TextFormatting -> TextFormatting -> Ordering
$cp1Ord :: Eq TextFormatting
Ord, (forall x. TextFormatting -> Rep TextFormatting x)
-> (forall x. Rep TextFormatting x -> TextFormatting)
-> Generic TextFormatting
forall x. Rep TextFormatting x -> TextFormatting
forall x. TextFormatting -> Rep TextFormatting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TextFormatting x -> TextFormatting
$cfrom :: forall x. TextFormatting -> Rep TextFormatting x
Generic)
data OutputAnnotation = AnnName Name (Maybe NameOutput) (Maybe String) (Maybe String)
| AnnBoundName Name Bool
| AnnConst Const
| AnnData String String
| AnnType String String
| AnnKeyword
| AnnFC FC
| AnnTextFmt TextFormatting
| AnnLink String
| AnnTerm [(Name, Bool)] (TT Name)
| AnnSearchResult Ordering
| AnnErr Err
| AnnNamespace [T.Text] (Maybe FilePath)
| AnnQuasiquote
| AnnAntiquote
| AnnSyntax String
deriving (Int -> OutputAnnotation -> ShowS
[OutputAnnotation] -> ShowS
OutputAnnotation -> String
(Int -> OutputAnnotation -> ShowS)
-> (OutputAnnotation -> String)
-> ([OutputAnnotation] -> ShowS)
-> Show OutputAnnotation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputAnnotation] -> ShowS
$cshowList :: [OutputAnnotation] -> ShowS
show :: OutputAnnotation -> String
$cshow :: OutputAnnotation -> String
showsPrec :: Int -> OutputAnnotation -> ShowS
$cshowsPrec :: Int -> OutputAnnotation -> ShowS
Show, OutputAnnotation -> OutputAnnotation -> Bool
(OutputAnnotation -> OutputAnnotation -> Bool)
-> (OutputAnnotation -> OutputAnnotation -> Bool)
-> Eq OutputAnnotation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputAnnotation -> OutputAnnotation -> Bool
$c/= :: OutputAnnotation -> OutputAnnotation -> Bool
== :: OutputAnnotation -> OutputAnnotation -> Bool
$c== :: OutputAnnotation -> OutputAnnotation -> Bool
Eq, (forall x. OutputAnnotation -> Rep OutputAnnotation x)
-> (forall x. Rep OutputAnnotation x -> OutputAnnotation)
-> Generic OutputAnnotation
forall x. Rep OutputAnnotation x -> OutputAnnotation
forall x. OutputAnnotation -> Rep OutputAnnotation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputAnnotation x -> OutputAnnotation
$cfrom :: forall x. OutputAnnotation -> Rep OutputAnnotation x
Generic, Eq OutputAnnotation
Eq OutputAnnotation =>
(OutputAnnotation -> OutputAnnotation -> Ordering)
-> (OutputAnnotation -> OutputAnnotation -> Bool)
-> (OutputAnnotation -> OutputAnnotation -> Bool)
-> (OutputAnnotation -> OutputAnnotation -> Bool)
-> (OutputAnnotation -> OutputAnnotation -> Bool)
-> (OutputAnnotation -> OutputAnnotation -> OutputAnnotation)
-> (OutputAnnotation -> OutputAnnotation -> OutputAnnotation)
-> Ord OutputAnnotation
OutputAnnotation -> OutputAnnotation -> Bool
OutputAnnotation -> OutputAnnotation -> Ordering
OutputAnnotation -> OutputAnnotation -> OutputAnnotation
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: OutputAnnotation -> OutputAnnotation -> OutputAnnotation
$cmin :: OutputAnnotation -> OutputAnnotation -> OutputAnnotation
max :: OutputAnnotation -> OutputAnnotation -> OutputAnnotation
$cmax :: OutputAnnotation -> OutputAnnotation -> OutputAnnotation
>= :: OutputAnnotation -> OutputAnnotation -> Bool
$c>= :: OutputAnnotation -> OutputAnnotation -> Bool
> :: OutputAnnotation -> OutputAnnotation -> Bool
$c> :: OutputAnnotation -> OutputAnnotation -> Bool
<= :: OutputAnnotation -> OutputAnnotation -> Bool
$c<= :: OutputAnnotation -> OutputAnnotation -> Bool
< :: OutputAnnotation -> OutputAnnotation -> Bool
$c< :: OutputAnnotation -> OutputAnnotation -> Bool
compare :: OutputAnnotation -> OutputAnnotation -> Ordering
$ccompare :: OutputAnnotation -> OutputAnnotation -> Ordering
$cp1Ord :: Eq OutputAnnotation
Ord)
data ErrorReportPart = TextPart String
| NamePart Name
| TermPart Term
| RawPart Raw
| SubReport [ErrorReportPart]
deriving (Int -> ErrorReportPart -> ShowS
[ErrorReportPart] -> ShowS
ErrorReportPart -> String
(Int -> ErrorReportPart -> ShowS)
-> (ErrorReportPart -> String)
-> ([ErrorReportPart] -> ShowS)
-> Show ErrorReportPart
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ErrorReportPart] -> ShowS
$cshowList :: [ErrorReportPart] -> ShowS
show :: ErrorReportPart -> String
$cshow :: ErrorReportPart -> String
showsPrec :: Int -> ErrorReportPart -> ShowS
$cshowsPrec :: Int -> ErrorReportPart -> ShowS
Show, ErrorReportPart -> ErrorReportPart -> Bool
(ErrorReportPart -> ErrorReportPart -> Bool)
-> (ErrorReportPart -> ErrorReportPart -> Bool)
-> Eq ErrorReportPart
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ErrorReportPart -> ErrorReportPart -> Bool
$c/= :: ErrorReportPart -> ErrorReportPart -> Bool
== :: ErrorReportPart -> ErrorReportPart -> Bool
$c== :: ErrorReportPart -> ErrorReportPart -> Bool
Eq, Eq ErrorReportPart
Eq ErrorReportPart =>
(ErrorReportPart -> ErrorReportPart -> Ordering)
-> (ErrorReportPart -> ErrorReportPart -> Bool)
-> (ErrorReportPart -> ErrorReportPart -> Bool)
-> (ErrorReportPart -> ErrorReportPart -> Bool)
-> (ErrorReportPart -> ErrorReportPart -> Bool)
-> (ErrorReportPart -> ErrorReportPart -> ErrorReportPart)
-> (ErrorReportPart -> ErrorReportPart -> ErrorReportPart)
-> Ord ErrorReportPart
ErrorReportPart -> ErrorReportPart -> Bool
ErrorReportPart -> ErrorReportPart -> Ordering
ErrorReportPart -> ErrorReportPart -> ErrorReportPart
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ErrorReportPart -> ErrorReportPart -> ErrorReportPart
$cmin :: ErrorReportPart -> ErrorReportPart -> ErrorReportPart
max :: ErrorReportPart -> ErrorReportPart -> ErrorReportPart
$cmax :: ErrorReportPart -> ErrorReportPart -> ErrorReportPart
>= :: ErrorReportPart -> ErrorReportPart -> Bool
$c>= :: ErrorReportPart -> ErrorReportPart -> Bool
> :: ErrorReportPart -> ErrorReportPart -> Bool
$c> :: ErrorReportPart -> ErrorReportPart -> Bool
<= :: ErrorReportPart -> ErrorReportPart -> Bool
$c<= :: ErrorReportPart -> ErrorReportPart -> Bool
< :: ErrorReportPart -> ErrorReportPart -> Bool
$c< :: ErrorReportPart -> ErrorReportPart -> Bool
compare :: ErrorReportPart -> ErrorReportPart -> Ordering
$ccompare :: ErrorReportPart -> ErrorReportPart -> Ordering
$cp1Ord :: Eq ErrorReportPart
Ord, Typeable ErrorReportPart
Constr
DataType
Typeable ErrorReportPart =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ErrorReportPart -> c ErrorReportPart)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ErrorReportPart)
-> (ErrorReportPart -> Constr)
-> (ErrorReportPart -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ErrorReportPart))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ErrorReportPart))
-> ((forall b. Data b => b -> b)
-> ErrorReportPart -> ErrorReportPart)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ErrorReportPart -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ErrorReportPart -> r)
-> (forall u.
(forall d. Data d => d -> u) -> ErrorReportPart -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ErrorReportPart -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart)
-> Data ErrorReportPart
ErrorReportPart -> Constr
ErrorReportPart -> DataType
(forall b. Data b => b -> b) -> ErrorReportPart -> ErrorReportPart
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ErrorReportPart -> c ErrorReportPart
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ErrorReportPart
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) -> ErrorReportPart -> u
forall u. (forall d. Data d => d -> u) -> ErrorReportPart -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ErrorReportPart -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ErrorReportPart -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ErrorReportPart
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ErrorReportPart -> c ErrorReportPart
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ErrorReportPart)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ErrorReportPart)
$cSubReport :: Constr
$cRawPart :: Constr
$cTermPart :: Constr
$cNamePart :: Constr
$cTextPart :: Constr
$tErrorReportPart :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart
gmapMp :: (forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart
gmapM :: (forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ErrorReportPart -> m ErrorReportPart
gmapQi :: Int -> (forall d. Data d => d -> u) -> ErrorReportPart -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ErrorReportPart -> u
gmapQ :: (forall d. Data d => d -> u) -> ErrorReportPart -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ErrorReportPart -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ErrorReportPart -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ErrorReportPart -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ErrorReportPart -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ErrorReportPart -> r
gmapT :: (forall b. Data b => b -> b) -> ErrorReportPart -> ErrorReportPart
$cgmapT :: (forall b. Data b => b -> b) -> ErrorReportPart -> ErrorReportPart
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ErrorReportPart)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ErrorReportPart)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ErrorReportPart)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ErrorReportPart)
dataTypeOf :: ErrorReportPart -> DataType
$cdataTypeOf :: ErrorReportPart -> DataType
toConstr :: ErrorReportPart -> Constr
$ctoConstr :: ErrorReportPart -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ErrorReportPart
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ErrorReportPart
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ErrorReportPart -> c ErrorReportPart
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ErrorReportPart -> c ErrorReportPart
$cp1Data :: Typeable ErrorReportPart
Data, (forall x. ErrorReportPart -> Rep ErrorReportPart x)
-> (forall x. Rep ErrorReportPart x -> ErrorReportPart)
-> Generic ErrorReportPart
forall x. Rep ErrorReportPart x -> ErrorReportPart
forall x. ErrorReportPart -> Rep ErrorReportPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ErrorReportPart x -> ErrorReportPart
$cfrom :: forall x. ErrorReportPart -> Rep ErrorReportPart x
Generic, Typeable)
data Provenance = ExpectedType
| TooManyArgs Term
| InferredVal
| GivenVal
| SourceTerm Term
deriving (Int -> Provenance -> ShowS
[Provenance] -> ShowS
Provenance -> String
(Int -> Provenance -> ShowS)
-> (Provenance -> String)
-> ([Provenance] -> ShowS)
-> Show Provenance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Provenance] -> ShowS
$cshowList :: [Provenance] -> ShowS
show :: Provenance -> String
$cshow :: Provenance -> String
showsPrec :: Int -> Provenance -> ShowS
$cshowsPrec :: Int -> Provenance -> ShowS
Show, Provenance -> Provenance -> Bool
(Provenance -> Provenance -> Bool)
-> (Provenance -> Provenance -> Bool) -> Eq Provenance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Provenance -> Provenance -> Bool
$c/= :: Provenance -> Provenance -> Bool
== :: Provenance -> Provenance -> Bool
$c== :: Provenance -> Provenance -> Bool
Eq, Eq Provenance
Eq Provenance =>
(Provenance -> Provenance -> Ordering)
-> (Provenance -> Provenance -> Bool)
-> (Provenance -> Provenance -> Bool)
-> (Provenance -> Provenance -> Bool)
-> (Provenance -> Provenance -> Bool)
-> (Provenance -> Provenance -> Provenance)
-> (Provenance -> Provenance -> Provenance)
-> Ord Provenance
Provenance -> Provenance -> Bool
Provenance -> Provenance -> Ordering
Provenance -> Provenance -> Provenance
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Provenance -> Provenance -> Provenance
$cmin :: Provenance -> Provenance -> Provenance
max :: Provenance -> Provenance -> Provenance
$cmax :: Provenance -> Provenance -> Provenance
>= :: Provenance -> Provenance -> Bool
$c>= :: Provenance -> Provenance -> Bool
> :: Provenance -> Provenance -> Bool
$c> :: Provenance -> Provenance -> Bool
<= :: Provenance -> Provenance -> Bool
$c<= :: Provenance -> Provenance -> Bool
< :: Provenance -> Provenance -> Bool
$c< :: Provenance -> Provenance -> Bool
compare :: Provenance -> Provenance -> Ordering
$ccompare :: Provenance -> Provenance -> Ordering
$cp1Ord :: Eq Provenance
Ord, Typeable Provenance
Constr
DataType
Typeable Provenance =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Provenance -> c Provenance)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Provenance)
-> (Provenance -> Constr)
-> (Provenance -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Provenance))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c Provenance))
-> ((forall b. Data b => b -> b) -> Provenance -> Provenance)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Provenance -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Provenance -> r)
-> (forall u. (forall d. Data d => d -> u) -> Provenance -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> Provenance -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Provenance -> m Provenance)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Provenance -> m Provenance)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Provenance -> m Provenance)
-> Data Provenance
Provenance -> Constr
Provenance -> DataType
(forall b. Data b => b -> b) -> Provenance -> Provenance
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Provenance -> c Provenance
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Provenance
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) -> Provenance -> u
forall u. (forall d. Data d => d -> u) -> Provenance -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Provenance -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Provenance -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Provenance -> m Provenance
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Provenance -> m Provenance
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Provenance
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Provenance -> c Provenance
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Provenance)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Provenance)
$cSourceTerm :: Constr
$cGivenVal :: Constr
$cInferredVal :: Constr
$cTooManyArgs :: Constr
$cExpectedType :: Constr
$tProvenance :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Provenance -> m Provenance
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Provenance -> m Provenance
gmapMp :: (forall d. Data d => d -> m d) -> Provenance -> m Provenance
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Provenance -> m Provenance
gmapM :: (forall d. Data d => d -> m d) -> Provenance -> m Provenance
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Provenance -> m Provenance
gmapQi :: Int -> (forall d. Data d => d -> u) -> Provenance -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Provenance -> u
gmapQ :: (forall d. Data d => d -> u) -> Provenance -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Provenance -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Provenance -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Provenance -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Provenance -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Provenance -> r
gmapT :: (forall b. Data b => b -> b) -> Provenance -> Provenance
$cgmapT :: (forall b. Data b => b -> b) -> Provenance -> Provenance
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Provenance)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Provenance)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Provenance)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Provenance)
dataTypeOf :: Provenance -> DataType
$cdataTypeOf :: Provenance -> DataType
toConstr :: Provenance -> Constr
$ctoConstr :: Provenance -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Provenance
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Provenance
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Provenance -> c Provenance
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Provenance -> c Provenance
$cp1Data :: Typeable Provenance
Data, (forall x. Provenance -> Rep Provenance x)
-> (forall x. Rep Provenance x -> Provenance) -> Generic Provenance
forall x. Rep Provenance x -> Provenance
forall x. Provenance -> Rep Provenance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Provenance x -> Provenance
$cfrom :: forall x. Provenance -> Rep Provenance x
Generic, Typeable)
data Err' t
= Msg String
| InternalMsg String
| CantUnify Bool (t, Maybe Provenance)
(t, Maybe Provenance)
(Err' t) [(Name, t)] Int
| InfiniteUnify Name t [(Name, t)]
| CantConvert t t [(Name, t)]
| CantSolveGoal t [(Name, t)]
| UnifyScope Name Name t [(Name, t)]
| CantInferType String
| NonFunctionType t t
| NotEquality t t
| TooManyArguments Name
| CantIntroduce t
| NoSuchVariable Name
| WithFnType t
| NoTypeDecl Name
| NotInjective t t t
| CantResolve Bool
t (Err' t)
| InvalidTCArg Name t
| CantResolveAlts [Name]
| NoValidAlts [Name]
| IncompleteTerm t
| UniverseError FC UExp (Int, Int) (Int, Int) [ConstraintFC]
| UniqueError Universe Name
| UniqueKindError Universe Name
|
| Inaccessible Name
| UnknownImplicit Name Name
| CantMatch t
| NonCollapsiblePostulate Name
| AlreadyDefined Name
| ProofSearchFail (Err' t)
| NoRewriting t t t
| At FC (Err' t)
| Elaborating String Name (Maybe t) (Err' t)
| ElaboratingArg Name Name [(Name, Name)] (Err' t)
| ProviderError String
| LoadingFailed String (Err' t)
| ReflectionError [[ErrorReportPart]] (Err' t)
| ReflectionFailed String (Err' t)
| ElabScriptDebug [ErrorReportPart] t [(Name, t, [(Name, Binder t)])]
| ElabScriptStuck t
| RunningElabScript (Err' t)
| ElabScriptStaging Name
| FancyMsg [ErrorReportPart]
deriving (Err' t -> Err' t -> Bool
(Err' t -> Err' t -> Bool)
-> (Err' t -> Err' t -> Bool) -> Eq (Err' t)
forall t. Eq t => Err' t -> Err' t -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Err' t -> Err' t -> Bool
$c/= :: forall t. Eq t => Err' t -> Err' t -> Bool
== :: Err' t -> Err' t -> Bool
$c== :: forall t. Eq t => Err' t -> Err' t -> Bool
Eq, Eq (Err' t)
Eq (Err' t) =>
(Err' t -> Err' t -> Ordering)
-> (Err' t -> Err' t -> Bool)
-> (Err' t -> Err' t -> Bool)
-> (Err' t -> Err' t -> Bool)
-> (Err' t -> Err' t -> Bool)
-> (Err' t -> Err' t -> Err' t)
-> (Err' t -> Err' t -> Err' t)
-> Ord (Err' t)
Err' t -> Err' t -> Bool
Err' t -> Err' t -> Ordering
Err' t -> Err' t -> Err' t
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall t. Ord t => Eq (Err' t)
forall t. Ord t => Err' t -> Err' t -> Bool
forall t. Ord t => Err' t -> Err' t -> Ordering
forall t. Ord t => Err' t -> Err' t -> Err' t
min :: Err' t -> Err' t -> Err' t
$cmin :: forall t. Ord t => Err' t -> Err' t -> Err' t
max :: Err' t -> Err' t -> Err' t
$cmax :: forall t. Ord t => Err' t -> Err' t -> Err' t
>= :: Err' t -> Err' t -> Bool
$c>= :: forall t. Ord t => Err' t -> Err' t -> Bool
> :: Err' t -> Err' t -> Bool
$c> :: forall t. Ord t => Err' t -> Err' t -> Bool
<= :: Err' t -> Err' t -> Bool
$c<= :: forall t. Ord t => Err' t -> Err' t -> Bool
< :: Err' t -> Err' t -> Bool
$c< :: forall t. Ord t => Err' t -> Err' t -> Bool
compare :: Err' t -> Err' t -> Ordering
$ccompare :: forall t. Ord t => Err' t -> Err' t -> Ordering
$cp1Ord :: forall t. Ord t => Eq (Err' t)
Ord, a -> Err' b -> Err' a
(a -> b) -> Err' a -> Err' b
(forall a b. (a -> b) -> Err' a -> Err' b)
-> (forall a b. a -> Err' b -> Err' a) -> Functor Err'
forall a b. a -> Err' b -> Err' a
forall a b. (a -> b) -> Err' a -> Err' b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Err' b -> Err' a
$c<$ :: forall a b. a -> Err' b -> Err' a
fmap :: (a -> b) -> Err' a -> Err' b
$cfmap :: forall a b. (a -> b) -> Err' a -> Err' b
Functor, , (forall x. Err' t -> Rep (Err' t) x)
-> (forall x. Rep (Err' t) x -> Err' t) -> Generic (Err' t)
forall x. Rep (Err' t) x -> Err' t
forall x. Err' t -> Rep (Err' t) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall t x. Rep (Err' t) x -> Err' t
forall t x. Err' t -> Rep (Err' t) x
$cto :: forall t x. Rep (Err' t) x -> Err' t
$cfrom :: forall t x. Err' t -> Rep (Err' t) x
Generic, Typeable)
type Err = Err' Term
data TC a = OK !a
| Error Err
deriving (TC a -> TC a -> Bool
(TC a -> TC a -> Bool) -> (TC a -> TC a -> Bool) -> Eq (TC a)
forall a. Eq a => TC a -> TC a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TC a -> TC a -> Bool
$c/= :: forall a. Eq a => TC a -> TC a -> Bool
== :: TC a -> TC a -> Bool
$c== :: forall a. Eq a => TC a -> TC a -> Bool
Eq, a -> TC b -> TC a
(a -> b) -> TC a -> TC b
(forall a b. (a -> b) -> TC a -> TC b)
-> (forall a b. a -> TC b -> TC a) -> Functor TC
forall a b. a -> TC b -> TC a
forall a b. (a -> b) -> TC a -> TC b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> TC b -> TC a
$c<$ :: forall a b. a -> TC b -> TC a
fmap :: (a -> b) -> TC a -> TC b
$cfmap :: forall a b. (a -> b) -> TC a -> TC b
Functor)
bindTC :: TC a -> (a -> TC b) -> TC b
bindTC :: TC a -> (a -> TC b) -> TC b
bindTC x :: TC a
x k :: a -> TC b
k = case TC a
x of
OK v :: a
v -> a -> TC b
k a
v
Error e :: Err
e -> Err -> TC b
forall a. Err -> TC a
Error Err
e
{-# INLINE bindTC #-}
instance Monad TC where
return :: a -> TC a
return x :: a
x = a -> TC a
forall a. a -> TC a
OK a
x
x :: TC a
x >>= :: TC a -> (a -> TC b) -> TC b
>>= k :: a -> TC b
k = TC a -> (a -> TC b) -> TC b
forall a b. TC a -> (a -> TC b) -> TC b
bindTC TC a
x a -> TC b
k
#if !(MIN_VERSION_base(4,13,0))
fail = Fail.fail
#endif
instance Fail.MonadFail TC where
fail :: String -> TC a
fail e :: String
e = Err -> TC a
forall a. Err -> TC a
Error (String -> Err
forall t. String -> Err' t
InternalMsg String
e)
instance MonadPlus TC where
mzero :: TC a
mzero = String -> TC a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail "Unknown error"
(OK x :: a
x) mplus :: TC a -> TC a -> TC a
`mplus` _ = a -> TC a
forall a. a -> TC a
OK a
x
_ `mplus` (OK y :: a
y) = a -> TC a
forall a. a -> TC a
OK a
y
err :: TC a
err `mplus` _ = TC a
err
instance Applicative TC where
pure :: a -> TC a
pure = a -> TC a
forall (m :: * -> *) a. Monad m => a -> m a
return
<*> :: TC (a -> b) -> TC a -> TC b
(<*>) = TC (a -> b) -> TC a -> TC b
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
ap
instance Alternative TC where
empty :: TC a
empty = TC a
forall (m :: * -> *) a. MonadPlus m => m a
mzero
<|> :: TC a -> TC a -> TC a
(<|>) = TC a -> TC a -> TC a
forall (m :: * -> *) a. MonadPlus m => m a -> m a -> m a
mplus
instance Sized ErrorReportPart where
size :: ErrorReportPart -> Int
size (TextPart msg :: String
msg) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
msg
size (TermPart t :: Term
t) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Term -> Int
forall a. Sized a => a -> Int
size Term
t
size (RawPart r :: Raw
r) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Raw -> Int
forall a. Sized a => a -> Int
size Raw
r
size (NamePart n :: Name
n) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Name -> Int
forall a. Sized a => a -> Int
size Name
n
size (SubReport rs :: [ErrorReportPart]
rs) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ [ErrorReportPart] -> Int
forall a. Sized a => a -> Int
size [ErrorReportPart]
rs
instance Sized Err where
size :: Err -> Int
size (Msg msg :: String
msg) = String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
msg
size (InternalMsg msg :: String
msg) = String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
msg
size (CantUnify _ left :: (Term, Maybe Provenance)
left right :: (Term, Maybe Provenance)
right err :: Err
err _ score :: Int
score) = Term -> Int
forall a. Sized a => a -> Int
size ((Term, Maybe Provenance) -> Term
forall a b. (a, b) -> a
fst (Term, Maybe Provenance)
left) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Term -> Int
forall a. Sized a => a -> Int
size ((Term, Maybe Provenance) -> Term
forall a b. (a, b) -> a
fst (Term, Maybe Provenance)
right) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Err -> Int
forall a. Sized a => a -> Int
size Err
err
size (InfiniteUnify _ right :: Term
right _) = Term -> Int
forall a. Sized a => a -> Int
size Term
right
size (CantConvert left :: Term
left right :: Term
right _) = Term -> Int
forall a. Sized a => a -> Int
size Term
left Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Term -> Int
forall a. Sized a => a -> Int
size Term
right
size (UnifyScope _ _ right :: Term
right _) = Term -> Int
forall a. Sized a => a -> Int
size Term
right
size (NoSuchVariable name :: Name
name) = Name -> Int
forall a. Sized a => a -> Int
size Name
name
size (NoTypeDecl name :: Name
name) = Name -> Int
forall a. Sized a => a -> Int
size Name
name
size (NotInjective l :: Term
l c :: Term
c r :: Term
r) = Term -> Int
forall a. Sized a => a -> Int
size Term
l Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Term -> Int
forall a. Sized a => a -> Int
size Term
c Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Term -> Int
forall a. Sized a => a -> Int
size Term
r
size (CantResolve _ trm :: Term
trm _) = Term -> Int
forall a. Sized a => a -> Int
size Term
trm
size (NoRewriting l :: Term
l r :: Term
r t :: Term
t) = Term -> Int
forall a. Sized a => a -> Int
size Term
l Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Term -> Int
forall a. Sized a => a -> Int
size Term
r Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Term -> Int
forall a. Sized a => a -> Int
size Term
t
size (CantResolveAlts _) = 1
size (IncompleteTerm trm :: Term
trm) = Term -> Int
forall a. Sized a => a -> Int
size Term
trm
size ProgramLineComment = 1
size (At fc :: FC
fc err :: Err
err) = FC -> Int
forall a. Sized a => a -> Int
size FC
fc Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Err -> Int
forall a. Sized a => a -> Int
size Err
err
size (Elaborating _ _ _ err :: Err
err) = Err -> Int
forall a. Sized a => a -> Int
size Err
err
size (ElaboratingArg _ _ _ err :: Err
err) = Err -> Int
forall a. Sized a => a -> Int
size Err
err
size (ProviderError msg :: String
msg) = String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
msg
size (LoadingFailed fn :: String
fn e :: Err
e) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
fn Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Err -> Int
forall a. Sized a => a -> Int
size Err
e
size _ = 1
instance Show Err where
show :: Err -> String
show (Msg s :: String
s) = String
s
show (InternalMsg s :: String
s) = "Internal error: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ ShowS
forall a. Show a => a -> String
show String
s
show (CantUnify rcv :: Bool
rcv l :: (Term, Maybe Provenance)
l r :: (Term, Maybe Provenance)
r e :: Err
e sc :: [(Name, Term)]
sc i :: Int
i) = "CantUnify " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Bool -> String
forall a. Show a => a -> String
show Bool
rcv String -> ShowS
forall a. [a] -> [a] -> [a]
++ " " String -> ShowS
forall a. [a] -> [a] -> [a]
++
(Term, Maybe Provenance) -> String
forall a. Show a => a -> String
show (Term, Maybe Provenance)
l String -> ShowS
forall a. [a] -> [a] -> [a]
++ " and " String -> ShowS
forall a. [a] -> [a] -> [a]
++ (Term, Maybe Provenance) -> String
forall a. Show a => a -> String
show (Term, Maybe Provenance)
r String -> ShowS
forall a. [a] -> [a] -> [a]
++ " " String -> ShowS
forall a. [a] -> [a] -> [a]
++
Err -> String
forall a. Show a => a -> String
show Err
e String -> ShowS
forall a. [a] -> [a] -> [a]
++ " in " String -> ShowS
forall a. [a] -> [a] -> [a]
++ [(Name, Term)] -> String
forall a. Show a => a -> String
show [(Name, Term)]
sc String -> ShowS
forall a. [a] -> [a] -> [a]
++ " " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i
show (CantConvert l :: Term
l r :: Term
r sc :: [(Name, Term)]
sc) = "CantConvert " String -> ShowS
forall a. [a] -> [a] -> [a]
++
Term -> String
forall a. Show a => a -> String
show Term
l String -> ShowS
forall a. [a] -> [a] -> [a]
++ " and " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Term -> String
forall a. Show a => a -> String
show Term
r String -> ShowS
forall a. [a] -> [a] -> [a]
++ " " String -> ShowS
forall a. [a] -> [a] -> [a]
++
" in " String -> ShowS
forall a. [a] -> [a] -> [a]
++ [(Name, Term)] -> String
forall a. Show a => a -> String
show [(Name, Term)]
sc
show (CantSolveGoal g :: Term
g _) = "CantSolve " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Term -> String
forall a. Show a => a -> String
show Term
g
show (Inaccessible n :: Name
n) = Name -> String
forall a. Show a => a -> String
show Name
n String -> ShowS
forall a. [a] -> [a] -> [a]
++ " is not an accessible pattern variable"
show (UnknownImplicit n :: Name
n f :: Name
f) = Name -> String
forall a. Show a => a -> String
show Name
n String -> ShowS
forall a. [a] -> [a] -> [a]
++ " is not an implicit argument of " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
f
show (ProviderError msg :: String
msg) = "Type provider error: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
msg
show (LoadingFailed fn :: String
fn e :: Err
e) = "Loading " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
fn String -> ShowS
forall a. [a] -> [a] -> [a]
++ " failed: (TT) " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Err -> String
forall a. Show a => a -> String
show Err
e
show ProgramLineComment = "Program line next to comment"
show (At f :: FC
f e :: Err
e) = FC -> String
forall a. Show a => a -> String
show FC
f String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Err -> String
forall a. Show a => a -> String
show Err
e
show (ElaboratingArg f :: Name
f x :: Name
x prev :: [(Name, Name)]
prev e :: Err
e) = "Elaborating " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
f String -> ShowS
forall a. [a] -> [a] -> [a]
++ " arg " String -> ShowS
forall a. [a] -> [a] -> [a]
++
Name -> String
forall a. Show a => a -> String
show Name
x String -> ShowS
forall a. [a] -> [a] -> [a]
++ ": " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Err -> String
forall a. Show a => a -> String
show Err
e
show (Elaborating what :: String
what n :: Name
n ty :: Maybe Term
ty e :: Err
e) = "Elaborating " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
what String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
n String -> ShowS
forall a. [a] -> [a] -> [a]
++
Maybe Term -> String
forall a. Show a => Maybe a -> String
showType Maybe Term
ty String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Err -> String
forall a. Show a => a -> String
show Err
e
where
showType :: Maybe a -> String
showType Nothing = ""
showType (Just ty :: a
ty) = " with expected type " String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
ty
show (ProofSearchFail e :: Err
e) = "Proof search fail: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Err -> String
forall a. Show a => a -> String
show Err
e
show (InfiniteUnify _ _ _) = "InfiniteUnify"
show (UnifyScope _ _ _ _) = "UnifyScope"
show (NonFunctionType _ _) = "NonFunctionType"
show (NotEquality _ _) = "NotEquality"
show (TooManyArguments _) = "TooManyArguments"
show (CantIntroduce _) = "CantIntroduce"
show (NoSuchVariable n :: Name
n) = "NoSuchVariable " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
n
show (WithFnType _) = "WithFnType"
show (NoTypeDecl _) = "NoTypeDecl"
show (NotInjective _ _ _) = "NotInjective"
show (CantResolve _ _ _) = "CantResolve"
show (InvalidTCArg _ _) = "InvalidTCArg"
show (CantResolveAlts _) = "CantResolveAlts"
show (NoValidAlts _) = "NoValidAlts"
show (IncompleteTerm _) = "IncompleteTerm"
show _ = "Error"
instance Pretty Err OutputAnnotation where
pretty :: Err -> Doc OutputAnnotation
pretty (Msg m :: String
m) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text String
m
pretty (CantUnify _ (l :: Term
l, _) (r :: Term
r, _) e :: Err
e _ i :: Int
i) =
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Cannot unify" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
forall a. Doc a
colon Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Term -> Doc OutputAnnotation
forall a ty. Pretty a ty => a -> Doc ty
pretty Term
l Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc OutputAnnotation
forall a. String -> Doc a
text "and" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Term -> Doc OutputAnnotation
forall a ty. Pretty a ty => a -> Doc ty
pretty Term
r Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
nest Int
nestingSize (String -> Doc OutputAnnotation
forall a. String -> Doc a
text "where" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Err -> Doc OutputAnnotation
forall a ty. Pretty a ty => a -> Doc ty
pretty Err
e Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc OutputAnnotation
forall a. String -> Doc a
text "with" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> (String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Int -> String) -> Int -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String
forall a. Show a => a -> String
show (Int -> Doc OutputAnnotation) -> Int -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Int
i))
pretty (ProviderError msg :: String
msg) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text String
msg
pretty err :: Err
err@(LoadingFailed _ _) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (Err -> String
forall a. Show a => a -> String
show Err
err)
pretty _ = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Error"
instance (Pretty a OutputAnnotation) => Pretty (TC a) OutputAnnotation where
pretty :: TC a -> Doc OutputAnnotation
pretty (OK ok :: a
ok) = a -> Doc OutputAnnotation
forall a ty. Pretty a ty => a -> Doc ty
pretty a
ok
pretty (Error err :: Err
err) =
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Error" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
forall a. Doc a
colon Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Err -> Doc OutputAnnotation
forall a ty. Pretty a ty => a -> Doc ty
pretty Err
err
instance Show a => Show (TC a) where
show :: TC a -> String
show (OK x :: a
x) = a -> String
forall a. Show a => a -> String
show a
x
show (Error str :: Err
str) = "Error: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Err -> String
forall a. Show a => a -> String
show Err
str
tfail :: Err -> TC a
tfail :: Err -> TC a
tfail e :: Err
e = Err -> TC a
forall a. Err -> TC a
Error Err
e
discard :: Monad m => m a -> m ()
discard :: m a -> m ()
discard f :: m a
f = m a
f m a -> m () -> m ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> () -> m ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
showSep :: String -> [String] -> String
showSep :: String -> [String] -> String
showSep sep :: String
sep [] = ""
showSep sep :: String
sep [x :: String
x] = String
x
showSep sep :: String
sep (x :: String
x:xs :: [String]
xs) = String
x String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
sep String -> ShowS
forall a. [a] -> [a] -> [a]
++ String -> [String] -> String
showSep String
sep [String]
xs
pmap :: (t -> b) -> (t, t) -> (b, b)
pmap f :: t -> b
f (x :: t
x, y :: t
y) = (t -> b
f t
x, t -> b
f t
y)
traceWhen :: Bool -> String -> p -> p
traceWhen True msg :: String
msg a :: p
a = String -> p -> p
forall a. String -> a -> a
trace String
msg p
a
traceWhen False _ a :: p
a = p
a
data Name = UN !T.Text
| NS !Name [T.Text]
| MN !Int !T.Text
| SN !SpecialName
| SymRef Int
deriving (Name -> Name -> Bool
(Name -> Name -> Bool) -> (Name -> Name -> Bool) -> Eq Name
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Name -> Name -> Bool
$c/= :: Name -> Name -> Bool
== :: Name -> Name -> Bool
$c== :: Name -> Name -> Bool
Eq, Eq Name
Eq Name =>
(Name -> Name -> Ordering)
-> (Name -> Name -> Bool)
-> (Name -> Name -> Bool)
-> (Name -> Name -> Bool)
-> (Name -> Name -> Bool)
-> (Name -> Name -> Name)
-> (Name -> Name -> Name)
-> Ord Name
Name -> Name -> Bool
Name -> Name -> Ordering
Name -> Name -> Name
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Name -> Name -> Name
$cmin :: Name -> Name -> Name
max :: Name -> Name -> Name
$cmax :: Name -> Name -> Name
>= :: Name -> Name -> Bool
$c>= :: Name -> Name -> Bool
> :: Name -> Name -> Bool
$c> :: Name -> Name -> Bool
<= :: Name -> Name -> Bool
$c<= :: Name -> Name -> Bool
< :: Name -> Name -> Bool
$c< :: Name -> Name -> Bool
compare :: Name -> Name -> Ordering
$ccompare :: Name -> Name -> Ordering
$cp1Ord :: Eq Name
Ord, Typeable Name
Constr
DataType
Typeable Name =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name -> c Name)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Name)
-> (Name -> Constr)
-> (Name -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Name))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name))
-> ((forall b. Data b => b -> b) -> Name -> Name)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r)
-> (forall u. (forall d. Data d => d -> u) -> Name -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Name -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Name -> m Name)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Name -> m Name)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Name -> m Name)
-> Data Name
Name -> Constr
Name -> DataType
(forall b. Data b => b -> b) -> Name -> Name
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name -> c Name
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Name
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) -> Name -> u
forall u. (forall d. Data d => d -> u) -> Name -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Name -> m Name
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Name -> m Name
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Name
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name -> c Name
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Name)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name)
$cSymRef :: Constr
$cSN :: Constr
$cMN :: Constr
$cNS :: Constr
$cUN :: Constr
$tName :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Name -> m Name
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Name -> m Name
gmapMp :: (forall d. Data d => d -> m d) -> Name -> m Name
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Name -> m Name
gmapM :: (forall d. Data d => d -> m d) -> Name -> m Name
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Name -> m Name
gmapQi :: Int -> (forall d. Data d => d -> u) -> Name -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Name -> u
gmapQ :: (forall d. Data d => d -> u) -> Name -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Name -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r
gmapT :: (forall b. Data b => b -> b) -> Name -> Name
$cgmapT :: (forall b. Data b => b -> b) -> Name -> Name
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Name)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Name)
dataTypeOf :: Name -> DataType
$cdataTypeOf :: Name -> DataType
toConstr :: Name -> Constr
$ctoConstr :: Name -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Name
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Name
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name -> c Name
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Name -> c Name
$cp1Data :: Typeable Name
Data, (forall x. Name -> Rep Name x)
-> (forall x. Rep Name x -> Name) -> Generic Name
forall x. Rep Name x -> Name
forall x. Name -> Rep Name x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Name x -> Name
$cfrom :: forall x. Name -> Rep Name x
Generic, Typeable)
txt :: String -> T.Text
txt :: String -> Text
txt = String -> Text
T.pack
str :: T.Text -> String
str :: Text -> String
str = Text -> String
T.unpack
tnull :: T.Text -> Bool
tnull :: Text -> Bool
tnull = Text -> Bool
T.null
thead :: T.Text -> Char
thead :: Text -> Char
thead = Text -> Char
T.head
sUN :: String -> Name
sUN :: String -> Name
sUN s :: String
s = Text -> Name
UN (String -> Text
txt String
s)
sNS :: Name -> [String] -> Name
sNS :: Name -> [String] -> Name
sNS n :: Name
n ss :: [String]
ss = Name -> [Text] -> Name
NS Name
n ([Text] -> Name) -> [Text] -> Name
forall a b. NFData a => (a -> b) -> a -> b
$!! ((String -> Text) -> [String] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map String -> Text
txt [String]
ss)
sMN :: Int -> String -> Name
sMN :: Int -> String -> Name
sMN i :: Int
i s :: String
s = Int -> Text -> Name
MN Int
i (String -> Text
txt String
s)
caseName :: Name -> Bool
caseName (SN (CaseN _ _)) = Bool
True
caseName (NS n :: Name
n _) = Name -> Bool
caseName Name
n
caseName _ = Bool
False
data SpecialName = WhereN !Int !Name !Name
| WithN !Int !Name
| ImplementationN !Name [T.Text]
| ParentN !Name !T.Text
| MethodN !Name
| CaseN !FC' !Name
| ImplementationCtorN !Name
| MetaN !Name !Name
deriving (SpecialName -> SpecialName -> Bool
(SpecialName -> SpecialName -> Bool)
-> (SpecialName -> SpecialName -> Bool) -> Eq SpecialName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SpecialName -> SpecialName -> Bool
$c/= :: SpecialName -> SpecialName -> Bool
== :: SpecialName -> SpecialName -> Bool
$c== :: SpecialName -> SpecialName -> Bool
Eq, Eq SpecialName
Eq SpecialName =>
(SpecialName -> SpecialName -> Ordering)
-> (SpecialName -> SpecialName -> Bool)
-> (SpecialName -> SpecialName -> Bool)
-> (SpecialName -> SpecialName -> Bool)
-> (SpecialName -> SpecialName -> Bool)
-> (SpecialName -> SpecialName -> SpecialName)
-> (SpecialName -> SpecialName -> SpecialName)
-> Ord SpecialName
SpecialName -> SpecialName -> Bool
SpecialName -> SpecialName -> Ordering
SpecialName -> SpecialName -> SpecialName
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: SpecialName -> SpecialName -> SpecialName
$cmin :: SpecialName -> SpecialName -> SpecialName
max :: SpecialName -> SpecialName -> SpecialName
$cmax :: SpecialName -> SpecialName -> SpecialName
>= :: SpecialName -> SpecialName -> Bool
$c>= :: SpecialName -> SpecialName -> Bool
> :: SpecialName -> SpecialName -> Bool
$c> :: SpecialName -> SpecialName -> Bool
<= :: SpecialName -> SpecialName -> Bool
$c<= :: SpecialName -> SpecialName -> Bool
< :: SpecialName -> SpecialName -> Bool
$c< :: SpecialName -> SpecialName -> Bool
compare :: SpecialName -> SpecialName -> Ordering
$ccompare :: SpecialName -> SpecialName -> Ordering
$cp1Ord :: Eq SpecialName
Ord, Typeable SpecialName
Constr
DataType
Typeable SpecialName =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SpecialName -> c SpecialName)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SpecialName)
-> (SpecialName -> Constr)
-> (SpecialName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SpecialName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SpecialName))
-> ((forall b. Data b => b -> b) -> SpecialName -> SpecialName)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SpecialName -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SpecialName -> r)
-> (forall u. (forall d. Data d => d -> u) -> SpecialName -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> SpecialName -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SpecialName -> m SpecialName)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SpecialName -> m SpecialName)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SpecialName -> m SpecialName)
-> Data SpecialName
SpecialName -> Constr
SpecialName -> DataType
(forall b. Data b => b -> b) -> SpecialName -> SpecialName
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SpecialName -> c SpecialName
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SpecialName
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) -> SpecialName -> u
forall u. (forall d. Data d => d -> u) -> SpecialName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SpecialName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SpecialName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SpecialName -> m SpecialName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SpecialName -> m SpecialName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SpecialName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SpecialName -> c SpecialName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SpecialName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SpecialName)
$cMetaN :: Constr
$cImplementationCtorN :: Constr
$cCaseN :: Constr
$cMethodN :: Constr
$cParentN :: Constr
$cImplementationN :: Constr
$cWithN :: Constr
$cWhereN :: Constr
$tSpecialName :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> SpecialName -> m SpecialName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SpecialName -> m SpecialName
gmapMp :: (forall d. Data d => d -> m d) -> SpecialName -> m SpecialName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SpecialName -> m SpecialName
gmapM :: (forall d. Data d => d -> m d) -> SpecialName -> m SpecialName
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SpecialName -> m SpecialName
gmapQi :: Int -> (forall d. Data d => d -> u) -> SpecialName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SpecialName -> u
gmapQ :: (forall d. Data d => d -> u) -> SpecialName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SpecialName -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SpecialName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SpecialName -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SpecialName -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SpecialName -> r
gmapT :: (forall b. Data b => b -> b) -> SpecialName -> SpecialName
$cgmapT :: (forall b. Data b => b -> b) -> SpecialName -> SpecialName
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SpecialName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SpecialName)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c SpecialName)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SpecialName)
dataTypeOf :: SpecialName -> DataType
$cdataTypeOf :: SpecialName -> DataType
toConstr :: SpecialName -> Constr
$ctoConstr :: SpecialName -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SpecialName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SpecialName
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SpecialName -> c SpecialName
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SpecialName -> c SpecialName
$cp1Data :: Typeable SpecialName
Data, (forall x. SpecialName -> Rep SpecialName x)
-> (forall x. Rep SpecialName x -> SpecialName)
-> Generic SpecialName
forall x. Rep SpecialName x -> SpecialName
forall x. SpecialName -> Rep SpecialName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SpecialName x -> SpecialName
$cfrom :: forall x. SpecialName -> Rep SpecialName x
Generic, Typeable)
sImplementationN :: Name -> [String] -> SpecialName
sImplementationN :: Name -> [String] -> SpecialName
sImplementationN n :: Name
n ss :: [String]
ss = Name -> [Text] -> SpecialName
ImplementationN Name
n ((String -> Text) -> [String] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map String -> Text
T.pack [String]
ss)
instance Sized Name where
size :: Name -> Int
size (UN n :: Text
n) = 1
size (NS n :: Name
n els :: [Text]
els) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ [Text] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Text]
els
size (MN i :: Int
i n :: Text
n) = 1
size _ = 1
instance Pretty Name OutputAnnotation where
pretty :: Name -> Doc OutputAnnotation
pretty n :: Name
n@(UN n' :: Text
n') = OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Name
-> Maybe NameOutput
-> Maybe String
-> Maybe String
-> OutputAnnotation
AnnName Name
n Maybe NameOutput
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing) (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ String -> Doc OutputAnnotation
forall a. String -> Doc a
text (Text -> String
T.unpack Text
n')
pretty n :: Name
n@(NS un :: Name
un s :: [Text]
s) = OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Name
-> Maybe NameOutput
-> Maybe String
-> Maybe String
-> OutputAnnotation
AnnName Name
n Maybe NameOutput
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing) (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
noAnnotate (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Name -> Doc OutputAnnotation
forall a ty. Pretty a ty => a -> Doc ty
pretty Name
un
pretty n :: Name
n@(MN i :: Int
i s :: Text
s) = OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Name
-> Maybe NameOutput
-> Maybe String
-> Maybe String
-> OutputAnnotation
AnnName Name
n Maybe NameOutput
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing) (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
Doc OutputAnnotation
forall a. Doc a
lbrace Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc OutputAnnotation
forall a. String -> Doc a
text (Text -> String
T.unpack Text
s) Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> (String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Int -> String) -> Int -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String
forall a. Show a => a -> String
show (Int -> Doc OutputAnnotation) -> Int -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Int
i) Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
forall a. Doc a
rbrace
pretty n :: Name
n@(SN s :: SpecialName
s) = OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Name
-> Maybe NameOutput
-> Maybe String
-> Maybe String
-> OutputAnnotation
AnnName Name
n Maybe NameOutput
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing) (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ String -> Doc OutputAnnotation
forall a. String -> Doc a
text (SpecialName -> String
forall a. Show a => a -> String
show SpecialName
s)
pretty n :: Name
n@(SymRef i :: Int
i) = OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Name
-> Maybe NameOutput
-> Maybe String
-> Maybe String
-> OutputAnnotation
AnnName Name
n Maybe NameOutput
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing) (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation) -> String -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ "##symbol" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i String -> ShowS
forall a. [a] -> [a] -> [a]
++ "##"
instance Pretty [Name] OutputAnnotation where
pretty :: [Name] -> Doc OutputAnnotation
pretty = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> [Doc OutputAnnotation]
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> [Doc a] -> Doc a
encloseSep Doc OutputAnnotation
forall a. Doc a
empty Doc OutputAnnotation
forall a. Doc a
empty Doc OutputAnnotation
forall a. Doc a
comma ([Doc OutputAnnotation] -> Doc OutputAnnotation)
-> ([Name] -> [Doc OutputAnnotation])
-> [Name]
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Name -> Doc OutputAnnotation) -> [Name] -> [Doc OutputAnnotation]
forall a b. (a -> b) -> [a] -> [b]
map Name -> Doc OutputAnnotation
forall a ty. Pretty a ty => a -> Doc ty
pretty
instance Show Name where
show :: Name -> String
show (UN n :: Text
n) = Text -> String
str Text
n
show (NS n :: Name
n s :: [Text]
s) = String -> [String] -> String
showSep "." ((Text -> String) -> [Text] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Text -> String
T.unpack ([Text] -> [Text]
forall a. [a] -> [a]
reverse [Text]
s)) String -> ShowS
forall a. [a] -> [a] -> [a]
++ "." String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
n
show (MN _ u :: Text
u) | Text
u Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== String -> Text
txt "underscore" = "_"
show (MN i :: Int
i s :: Text
s) = "{" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
str Text
s String -> ShowS
forall a. [a] -> [a] -> [a]
++ "_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i String -> ShowS
forall a. [a] -> [a] -> [a]
++ "}"
show (SN s :: SpecialName
s) = SpecialName -> String
forall a. Show a => a -> String
show SpecialName
s
show (SymRef i :: Int
i) = "##symbol" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i String -> ShowS
forall a. [a] -> [a] -> [a]
++ "##"
instance Show SpecialName where
show :: SpecialName -> String
show (WhereN i :: Int
i p :: Name
p c :: Name
c) = Name -> String
forall a. Show a => a -> String
show Name
p String -> ShowS
forall a. [a] -> [a] -> [a]
++ ", " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
c
show (WithN i :: Int
i n :: Name
n) = "with block in " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
n
show (ImplementationN cl :: Name
cl impl :: [Text]
impl) = String -> [String] -> String
showSep ", " ((Text -> String) -> [Text] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Text -> String
T.unpack [Text]
impl) String -> ShowS
forall a. [a] -> [a] -> [a]
++ " implementation of " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
cl
show (MethodN m :: Name
m) = "method " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
m
show (ParentN p :: Name
p c :: Text
c) = Name -> String
forall a. Show a => a -> String
show Name
p String -> ShowS
forall a. [a] -> [a] -> [a]
++ "#" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
T.unpack Text
c
show (CaseN fc :: FC'
fc n :: Name
n) = "case block in " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
n String -> ShowS
forall a. [a] -> [a] -> [a]
++
if FC'
fc FC' -> FC' -> Bool
forall a. Eq a => a -> a -> Bool
== FC -> FC'
FC' FC
emptyFC then "" else " at " String -> ShowS
forall a. [a] -> [a] -> [a]
++ FC' -> String
forall a. Show a => a -> String
show FC'
fc
show (ImplementationCtorN n :: Name
n) = "constructor of " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
n
show (MetaN parent :: Name
parent meta :: Name
meta) = "<<" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
parent String -> ShowS
forall a. [a] -> [a] -> [a]
++ " " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
meta String -> ShowS
forall a. [a] -> [a] -> [a]
++ ">>"
showCG :: Name -> String
showCG :: Name -> String
showCG (UN n :: Text
n) = Text -> String
T.unpack Text
n
showCG (NS n :: Name
n s :: [Text]
s) = String -> [String] -> String
showSep "." ((Text -> String) -> [Text] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Text -> String
T.unpack ([Text] -> [Text]
forall a. [a] -> [a]
reverse [Text]
s)) String -> ShowS
forall a. [a] -> [a] -> [a]
++ "." String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
showCG Name
n
showCG (MN _ u :: Text
u) | Text
u Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== String -> Text
txt "underscore" = "_"
showCG (MN i :: Int
i s :: Text
s) = "{" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
T.unpack Text
s String -> ShowS
forall a. [a] -> [a] -> [a]
++ "_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i String -> ShowS
forall a. [a] -> [a] -> [a]
++ "}"
showCG (SN s :: SpecialName
s) = SpecialName -> String
showCG' SpecialName
s
where showCG' :: SpecialName -> String
showCG' (WhereN i :: Int
i p :: Name
p c :: Name
c) = Name -> String
showCG Name
p String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
showCG Name
c String -> ShowS
forall a. [a] -> [a] -> [a]
++ ":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i
showCG' (WithN i :: Int
i n :: Name
n) = "_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
showCG Name
n String -> ShowS
forall a. [a] -> [a] -> [a]
++ "_with_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i
showCG' (ImplementationN cl :: Name
cl impl :: [Text]
impl) = '@'Char -> ShowS
forall a. a -> [a] -> [a]
:Name -> String
showCG Name
cl String -> ShowS
forall a. [a] -> [a] -> [a]
++ '$'Char -> ShowS
forall a. a -> [a] -> [a]
:String -> [String] -> String
showSep ":" ((Text -> String) -> [Text] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Text -> String
T.unpack [Text]
impl)
showCG' (MethodN m :: Name
m) = '!'Char -> ShowS
forall a. a -> [a] -> [a]
:Name -> String
showCG Name
m
showCG' (ParentN p :: Name
p c :: Text
c) = Name -> String
showCG Name
p String -> ShowS
forall a. [a] -> [a] -> [a]
++ "#" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
forall a. Show a => a -> String
show Text
c
showCG' (CaseN fc :: FC'
fc c :: Name
c) = Name -> String
showCG Name
c String -> ShowS
forall a. [a] -> [a] -> [a]
++ FC' -> String
showFC' FC'
fc String -> ShowS
forall a. [a] -> [a] -> [a]
++ "_case"
showCG' (ImplementationCtorN n :: Name
n) = Name -> String
showCG Name
n String -> ShowS
forall a. [a] -> [a] -> [a]
++ "_ictor"
showCG' (MetaN parent :: Name
parent meta :: Name
meta) = Name -> String
showCG Name
parent String -> ShowS
forall a. [a] -> [a] -> [a]
++ "_meta_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Name -> String
showCG Name
meta
showFC' :: FC' -> String
showFC' (FC' NoFC) = ""
showFC' (FC' (FileFC f :: String
f)) = "_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ ShowS
cgFN String
f
showFC' (FC' (FC f :: String
f s :: (Int, Int)
s e :: (Int, Int)
e))
| (Int, Int)
s (Int, Int) -> (Int, Int) -> Bool
forall a. Eq a => a -> a -> Bool
== (Int, Int)
e = "_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ ShowS
cgFN String
f String -> ShowS
forall a. [a] -> [a] -> [a]
++
"_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show ((Int, Int) -> Int
forall a b. (a, b) -> a
fst (Int, Int)
s) String -> ShowS
forall a. [a] -> [a] -> [a]
++ "_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show ((Int, Int) -> Int
forall a b. (a, b) -> b
snd (Int, Int)
s)
| Bool
otherwise = "_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ ShowS
cgFN String
f String -> ShowS
forall a. [a] -> [a] -> [a]
++
"_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show ((Int, Int) -> Int
forall a b. (a, b) -> a
fst (Int, Int)
s) String -> ShowS
forall a. [a] -> [a] -> [a]
++ "_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show ((Int, Int) -> Int
forall a b. (a, b) -> b
snd (Int, Int)
s) String -> ShowS
forall a. [a] -> [a] -> [a]
++
"_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show ((Int, Int) -> Int
forall a b. (a, b) -> a
fst (Int, Int)
e) String -> ShowS
forall a. [a] -> [a] -> [a]
++ "_" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show ((Int, Int) -> Int
forall a b. (a, b) -> b
snd (Int, Int)
e)
cgFN :: ShowS
cgFN = (Char -> String) -> ShowS
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\c :: Char
c -> if Bool -> Bool
not (Char -> Bool
isDigit Char
c Bool -> Bool -> Bool
|| Char -> Bool
isLetter Char
c) then "__" else [Char
c])
showCG (SymRef i :: Int
i) = ShowS
forall a. HasCallStack => String -> a
error "can't do codegen for a symbol reference"
type Ctxt a = Map.Map Name (Map.Map Name a)
emptyContext :: Map k a
emptyContext = Map k a
forall k a. Map k a
Map.empty
mapCtxt :: (a -> b) -> Ctxt a -> Ctxt b
mapCtxt :: (a -> b) -> Ctxt a -> Ctxt b
mapCtxt = (Map Name a -> Map Name b) -> Ctxt a -> Ctxt b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Map Name a -> Map Name b) -> Ctxt a -> Ctxt b)
-> ((a -> b) -> Map Name a -> Map Name b)
-> (a -> b)
-> Ctxt a
-> Ctxt b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> Map Name a -> Map Name b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
tcname :: Name -> Bool
tcname (UN xs :: Text
xs) = Bool
False
tcname (NS n :: Name
n _) = Name -> Bool
tcname Name
n
tcname (SN (ImplementationN _ _)) = Bool
True
tcname (SN (MethodN _)) = Bool
True
tcname (SN (ParentN _ _)) = Bool
True
tcname _ = Bool
False
implicitable :: Name -> Bool
implicitable (NS n :: Name
n _) = Bool
False
implicitable (UN xs :: Text
xs) | Text -> Bool
T.null Text
xs = Bool
False
| Bool
otherwise = Char -> Bool
isLower (Text -> Char
T.head Text
xs) Bool -> Bool -> Bool
||
Text -> Char
T.head Text
xs Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== '_'
implicitable (MN _ x :: Text
x) = Bool -> Bool
not (Text -> Bool
tnull Text
x) Bool -> Bool -> Bool
&& Text -> Char
thead Text
x Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
/= '_'
implicitable _ = Bool
False
nsroot :: Name -> Name
nsroot (NS n :: Name
n _) = Name
n
nsroot n :: Name
n = Name
n
addDef :: Name -> a -> Ctxt a -> Ctxt a
addDef :: Name -> a -> Ctxt a -> Ctxt a
addDef n :: Name
n v :: a
v ctxt :: Ctxt a
ctxt = case Name -> Ctxt a -> Maybe (Map Name a)
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup (Name -> Name
nsroot Name
n) Ctxt a
ctxt of
Nothing -> Name -> Map Name a -> Ctxt a -> Ctxt a
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert (Name -> Name
nsroot Name
n)
(Name -> a -> Map Name a -> Map Name a
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert Name
n a
v Map Name a
forall k a. Map k a
Map.empty) Ctxt a
ctxt
Just xs :: Map Name a
xs -> Name -> Map Name a -> Ctxt a -> Ctxt a
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert (Name -> Name
nsroot Name
n)
(Name -> a -> Map Name a -> Map Name a
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert Name
n a
v Map Name a
xs) Ctxt a
ctxt
lookupCtxtName :: Name -> Ctxt a -> [(Name, a)]
lookupCtxtName :: Name -> Ctxt a -> [(Name, a)]
lookupCtxtName n :: Name
n ctxt :: Ctxt a
ctxt = case Name -> Ctxt a -> Maybe (Map Name a)
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup (Name -> Name
nsroot Name
n) Ctxt a
ctxt of
Just xs :: Map Name a
xs -> [(Name, a)] -> [(Name, a)]
forall b. [(Name, b)] -> [(Name, b)]
filterNS (Map Name a -> [(Name, a)]
forall k a. Map k a -> [(k, a)]
Map.toList Map Name a
xs)
Nothing -> []
where
filterNS :: [(Name, b)] -> [(Name, b)]
filterNS [] = []
filterNS ((found :: Name
found, v :: b
v) : xs :: [(Name, b)]
xs)
| Name -> Name -> Bool
nsmatch Name
n Name
found = (Name
found, b
v) (Name, b) -> [(Name, b)] -> [(Name, b)]
forall a. a -> [a] -> [a]
: [(Name, b)] -> [(Name, b)]
filterNS [(Name, b)]
xs
| Bool
otherwise = [(Name, b)] -> [(Name, b)]
filterNS [(Name, b)]
xs
nsmatch :: Name -> Name -> Bool
nsmatch (NS n :: Name
n ns :: [Text]
ns) (NS p :: Name
p ps :: [Text]
ps) = [Text]
ns [Text] -> [Text] -> Bool
forall a. Eq a => [a] -> [a] -> Bool
`isPrefixOf` [Text]
ps
nsmatch (NS _ _) _ = Bool
False
nsmatch looking :: Name
looking found :: Name
found = Bool
True
lookupCtxt :: Name -> Ctxt a -> [a]
lookupCtxt :: Name -> Ctxt a -> [a]
lookupCtxt n :: Name
n ctxt :: Ctxt a
ctxt = ((Name, a) -> a) -> [(Name, a)] -> [a]
forall a b. (a -> b) -> [a] -> [b]
map (Name, a) -> a
forall a b. (a, b) -> b
snd (Name -> Ctxt a -> [(Name, a)]
forall a. Name -> Ctxt a -> [(Name, a)]
lookupCtxtName Name
n Ctxt a
ctxt)
lookupCtxtExact :: Name -> Ctxt a -> Maybe a
lookupCtxtExact :: Name -> Ctxt a -> Maybe a
lookupCtxtExact n :: Name
n ctxt :: Ctxt a
ctxt = [a] -> Maybe a
forall a. [a] -> Maybe a
listToMaybe [ a
v | (nm :: Name
nm, v :: a
v) <- Name -> Ctxt a -> [(Name, a)]
forall a. Name -> Ctxt a -> [(Name, a)]
lookupCtxtName Name
n Ctxt a
ctxt, Name
nm Name -> Name -> Bool
forall a. Eq a => a -> a -> Bool
== Name
n]
deleteDefExact :: Name -> Ctxt a -> Ctxt a
deleteDefExact :: Name -> Ctxt a -> Ctxt a
deleteDefExact n :: Name
n = (Map Name a -> Map Name a) -> Name -> Ctxt a -> Ctxt a
forall k a. Ord k => (a -> a) -> k -> Map k a -> Map k a
Map.adjust (Name -> Map Name a -> Map Name a
forall k a. Ord k => k -> Map k a -> Map k a
Map.delete Name
n) (Name -> Name
nsroot Name
n)
updateDef :: Name -> (a -> a) -> Ctxt a -> Ctxt a
updateDef :: Name -> (a -> a) -> Ctxt a -> Ctxt a
updateDef n :: Name
n f :: a -> a
f ctxt :: Ctxt a
ctxt
= case Name -> Ctxt a -> Maybe a
forall a. Name -> Ctxt a -> Maybe a
lookupCtxtExact Name
n Ctxt a
ctxt of
Just t :: a
t -> Name -> a -> Ctxt a -> Ctxt a
forall a. Name -> a -> Ctxt a -> Ctxt a
addDef Name
n (a -> a
f a
t) Ctxt a
ctxt
Nothing -> Ctxt a
ctxt
toAlist :: Ctxt a -> [(Name, a)]
toAlist :: Ctxt a -> [(Name, a)]
toAlist ctxt :: Ctxt a
ctxt = let allns :: [Map Name a]
allns = ((Name, Map Name a) -> Map Name a)
-> [(Name, Map Name a)] -> [Map Name a]
forall a b. (a -> b) -> [a] -> [b]
map (Name, Map Name a) -> Map Name a
forall a b. (a, b) -> b
snd (Ctxt a -> [(Name, Map Name a)]
forall k a. Map k a -> [(k, a)]
Map.toList Ctxt a
ctxt) in
(Map Name a -> [(Name, a)]) -> [Map Name a] -> [(Name, a)]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Map Name a -> [(Name, a)]
forall k a. Map k a -> [(k, a)]
Map.toList) [Map Name a]
allns
addAlist :: [(Name, a)] -> Ctxt a -> Ctxt a
addAlist :: [(Name, a)] -> Ctxt a -> Ctxt a
addAlist [] ctxt :: Ctxt a
ctxt = Ctxt a
ctxt
addAlist ((n :: Name
n, tm :: a
tm) : ds :: [(Name, a)]
ds) ctxt :: Ctxt a
ctxt = Name -> a -> Ctxt a -> Ctxt a
forall a. Name -> a -> Ctxt a -> Ctxt a
addDef Name
n a
tm ([(Name, a)] -> Ctxt a -> Ctxt a
forall a. [(Name, a)] -> Ctxt a -> Ctxt a
addAlist [(Name, a)]
ds Ctxt a
ctxt)
data NativeTy = IT8 | IT16 | IT32 | IT64
deriving (Int -> NativeTy -> ShowS
[NativeTy] -> ShowS
NativeTy -> String
(Int -> NativeTy -> ShowS)
-> (NativeTy -> String) -> ([NativeTy] -> ShowS) -> Show NativeTy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NativeTy] -> ShowS
$cshowList :: [NativeTy] -> ShowS
show :: NativeTy -> String
$cshow :: NativeTy -> String
showsPrec :: Int -> NativeTy -> ShowS
$cshowsPrec :: Int -> NativeTy -> ShowS
Show, NativeTy -> NativeTy -> Bool
(NativeTy -> NativeTy -> Bool)
-> (NativeTy -> NativeTy -> Bool) -> Eq NativeTy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NativeTy -> NativeTy -> Bool
$c/= :: NativeTy -> NativeTy -> Bool
== :: NativeTy -> NativeTy -> Bool
$c== :: NativeTy -> NativeTy -> Bool
Eq, Eq NativeTy
Eq NativeTy =>
(NativeTy -> NativeTy -> Ordering)
-> (NativeTy -> NativeTy -> Bool)
-> (NativeTy -> NativeTy -> Bool)
-> (NativeTy -> NativeTy -> Bool)
-> (NativeTy -> NativeTy -> Bool)
-> (NativeTy -> NativeTy -> NativeTy)
-> (NativeTy -> NativeTy -> NativeTy)
-> Ord NativeTy
NativeTy -> NativeTy -> Bool
NativeTy -> NativeTy -> Ordering
NativeTy -> NativeTy -> NativeTy
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: NativeTy -> NativeTy -> NativeTy
$cmin :: NativeTy -> NativeTy -> NativeTy
max :: NativeTy -> NativeTy -> NativeTy
$cmax :: NativeTy -> NativeTy -> NativeTy
>= :: NativeTy -> NativeTy -> Bool
$c>= :: NativeTy -> NativeTy -> Bool
> :: NativeTy -> NativeTy -> Bool
$c> :: NativeTy -> NativeTy -> Bool
<= :: NativeTy -> NativeTy -> Bool
$c<= :: NativeTy -> NativeTy -> Bool
< :: NativeTy -> NativeTy -> Bool
$c< :: NativeTy -> NativeTy -> Bool
compare :: NativeTy -> NativeTy -> Ordering
$ccompare :: NativeTy -> NativeTy -> Ordering
$cp1Ord :: Eq NativeTy
Ord, Int -> NativeTy
NativeTy -> Int
NativeTy -> [NativeTy]
NativeTy -> NativeTy
NativeTy -> NativeTy -> [NativeTy]
NativeTy -> NativeTy -> NativeTy -> [NativeTy]
(NativeTy -> NativeTy)
-> (NativeTy -> NativeTy)
-> (Int -> NativeTy)
-> (NativeTy -> Int)
-> (NativeTy -> [NativeTy])
-> (NativeTy -> NativeTy -> [NativeTy])
-> (NativeTy -> NativeTy -> [NativeTy])
-> (NativeTy -> NativeTy -> NativeTy -> [NativeTy])
-> Enum NativeTy
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: NativeTy -> NativeTy -> NativeTy -> [NativeTy]
$cenumFromThenTo :: NativeTy -> NativeTy -> NativeTy -> [NativeTy]
enumFromTo :: NativeTy -> NativeTy -> [NativeTy]
$cenumFromTo :: NativeTy -> NativeTy -> [NativeTy]
enumFromThen :: NativeTy -> NativeTy -> [NativeTy]
$cenumFromThen :: NativeTy -> NativeTy -> [NativeTy]
enumFrom :: NativeTy -> [NativeTy]
$cenumFrom :: NativeTy -> [NativeTy]
fromEnum :: NativeTy -> Int
$cfromEnum :: NativeTy -> Int
toEnum :: Int -> NativeTy
$ctoEnum :: Int -> NativeTy
pred :: NativeTy -> NativeTy
$cpred :: NativeTy -> NativeTy
succ :: NativeTy -> NativeTy
$csucc :: NativeTy -> NativeTy
Enum, Typeable NativeTy
Constr
DataType
Typeable NativeTy =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NativeTy -> c NativeTy)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NativeTy)
-> (NativeTy -> Constr)
-> (NativeTy -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NativeTy))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NativeTy))
-> ((forall b. Data b => b -> b) -> NativeTy -> NativeTy)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NativeTy -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NativeTy -> r)
-> (forall u. (forall d. Data d => d -> u) -> NativeTy -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> NativeTy -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NativeTy -> m NativeTy)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NativeTy -> m NativeTy)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NativeTy -> m NativeTy)
-> Data NativeTy
NativeTy -> Constr
NativeTy -> DataType
(forall b. Data b => b -> b) -> NativeTy -> NativeTy
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NativeTy -> c NativeTy
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NativeTy
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) -> NativeTy -> u
forall u. (forall d. Data d => d -> u) -> NativeTy -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NativeTy -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NativeTy -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NativeTy -> m NativeTy
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NativeTy -> m NativeTy
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NativeTy
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NativeTy -> c NativeTy
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NativeTy)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NativeTy)
$cIT64 :: Constr
$cIT32 :: Constr
$cIT16 :: Constr
$cIT8 :: Constr
$tNativeTy :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NativeTy -> m NativeTy
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NativeTy -> m NativeTy
gmapMp :: (forall d. Data d => d -> m d) -> NativeTy -> m NativeTy
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NativeTy -> m NativeTy
gmapM :: (forall d. Data d => d -> m d) -> NativeTy -> m NativeTy
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NativeTy -> m NativeTy
gmapQi :: Int -> (forall d. Data d => d -> u) -> NativeTy -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NativeTy -> u
gmapQ :: (forall d. Data d => d -> u) -> NativeTy -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NativeTy -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NativeTy -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NativeTy -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NativeTy -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NativeTy -> r
gmapT :: (forall b. Data b => b -> b) -> NativeTy -> NativeTy
$cgmapT :: (forall b. Data b => b -> b) -> NativeTy -> NativeTy
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NativeTy)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NativeTy)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c NativeTy)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NativeTy)
dataTypeOf :: NativeTy -> DataType
$cdataTypeOf :: NativeTy -> DataType
toConstr :: NativeTy -> Constr
$ctoConstr :: NativeTy -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NativeTy
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NativeTy
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NativeTy -> c NativeTy
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NativeTy -> c NativeTy
$cp1Data :: Typeable NativeTy
Data, (forall x. NativeTy -> Rep NativeTy x)
-> (forall x. Rep NativeTy x -> NativeTy) -> Generic NativeTy
forall x. Rep NativeTy x -> NativeTy
forall x. NativeTy -> Rep NativeTy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NativeTy x -> NativeTy
$cfrom :: forall x. NativeTy -> Rep NativeTy x
Generic, Typeable)
instance Pretty NativeTy OutputAnnotation where
pretty :: NativeTy -> Doc OutputAnnotation
pretty IT8 = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Bits8"
pretty IT16 = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Bits16"
pretty IT32 = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Bits32"
pretty IT64 = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Bits64"
data IntTy = ITFixed NativeTy | ITNative | ITBig | ITChar
deriving (Int -> IntTy -> ShowS
[IntTy] -> ShowS
IntTy -> String
(Int -> IntTy -> ShowS)
-> (IntTy -> String) -> ([IntTy] -> ShowS) -> Show IntTy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntTy] -> ShowS
$cshowList :: [IntTy] -> ShowS
show :: IntTy -> String
$cshow :: IntTy -> String
showsPrec :: Int -> IntTy -> ShowS
$cshowsPrec :: Int -> IntTy -> ShowS
Show, IntTy -> IntTy -> Bool
(IntTy -> IntTy -> Bool) -> (IntTy -> IntTy -> Bool) -> Eq IntTy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntTy -> IntTy -> Bool
$c/= :: IntTy -> IntTy -> Bool
== :: IntTy -> IntTy -> Bool
$c== :: IntTy -> IntTy -> Bool
Eq, Eq IntTy
Eq IntTy =>
(IntTy -> IntTy -> Ordering)
-> (IntTy -> IntTy -> Bool)
-> (IntTy -> IntTy -> Bool)
-> (IntTy -> IntTy -> Bool)
-> (IntTy -> IntTy -> Bool)
-> (IntTy -> IntTy -> IntTy)
-> (IntTy -> IntTy -> IntTy)
-> Ord IntTy
IntTy -> IntTy -> Bool
IntTy -> IntTy -> Ordering
IntTy -> IntTy -> IntTy
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: IntTy -> IntTy -> IntTy
$cmin :: IntTy -> IntTy -> IntTy
max :: IntTy -> IntTy -> IntTy
$cmax :: IntTy -> IntTy -> IntTy
>= :: IntTy -> IntTy -> Bool
$c>= :: IntTy -> IntTy -> Bool
> :: IntTy -> IntTy -> Bool
$c> :: IntTy -> IntTy -> Bool
<= :: IntTy -> IntTy -> Bool
$c<= :: IntTy -> IntTy -> Bool
< :: IntTy -> IntTy -> Bool
$c< :: IntTy -> IntTy -> Bool
compare :: IntTy -> IntTy -> Ordering
$ccompare :: IntTy -> IntTy -> Ordering
$cp1Ord :: Eq IntTy
Ord, Typeable IntTy
Constr
DataType
Typeable IntTy =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntTy -> c IntTy)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntTy)
-> (IntTy -> Constr)
-> (IntTy -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntTy))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntTy))
-> ((forall b. Data b => b -> b) -> IntTy -> IntTy)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntTy -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntTy -> r)
-> (forall u. (forall d. Data d => d -> u) -> IntTy -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> IntTy -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntTy -> m IntTy)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntTy -> m IntTy)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntTy -> m IntTy)
-> Data IntTy
IntTy -> Constr
IntTy -> DataType
(forall b. Data b => b -> b) -> IntTy -> IntTy
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntTy -> c IntTy
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntTy
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) -> IntTy -> u
forall u. (forall d. Data d => d -> u) -> IntTy -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntTy -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntTy -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntTy -> m IntTy
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntTy -> m IntTy
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntTy
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntTy -> c IntTy
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntTy)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntTy)
$cITChar :: Constr
$cITBig :: Constr
$cITNative :: Constr
$cITFixed :: Constr
$tIntTy :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> IntTy -> m IntTy
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntTy -> m IntTy
gmapMp :: (forall d. Data d => d -> m d) -> IntTy -> m IntTy
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntTy -> m IntTy
gmapM :: (forall d. Data d => d -> m d) -> IntTy -> m IntTy
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntTy -> m IntTy
gmapQi :: Int -> (forall d. Data d => d -> u) -> IntTy -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IntTy -> u
gmapQ :: (forall d. Data d => d -> u) -> IntTy -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IntTy -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntTy -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntTy -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntTy -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntTy -> r
gmapT :: (forall b. Data b => b -> b) -> IntTy -> IntTy
$cgmapT :: (forall b. Data b => b -> b) -> IntTy -> IntTy
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntTy)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntTy)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c IntTy)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntTy)
dataTypeOf :: IntTy -> DataType
$cdataTypeOf :: IntTy -> DataType
toConstr :: IntTy -> Constr
$ctoConstr :: IntTy -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntTy
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntTy
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntTy -> c IntTy
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntTy -> c IntTy
$cp1Data :: Typeable IntTy
Data, (forall x. IntTy -> Rep IntTy x)
-> (forall x. Rep IntTy x -> IntTy) -> Generic IntTy
forall x. Rep IntTy x -> IntTy
forall x. IntTy -> Rep IntTy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IntTy x -> IntTy
$cfrom :: forall x. IntTy -> Rep IntTy x
Generic, Typeable)
intTyName :: IntTy -> String
intTyName :: IntTy -> String
intTyName ITNative = "Int"
intTyName ITBig = "BigInt"
intTyName (ITFixed sized :: NativeTy
sized) = "B" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (NativeTy -> Int
nativeTyWidth NativeTy
sized)
intTyName (IntTy
ITChar) = "Char"
data ArithTy = ATInt IntTy | ATFloat
deriving (Int -> ArithTy -> ShowS
[ArithTy] -> ShowS
ArithTy -> String
(Int -> ArithTy -> ShowS)
-> (ArithTy -> String) -> ([ArithTy] -> ShowS) -> Show ArithTy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArithTy] -> ShowS
$cshowList :: [ArithTy] -> ShowS
show :: ArithTy -> String
$cshow :: ArithTy -> String
showsPrec :: Int -> ArithTy -> ShowS
$cshowsPrec :: Int -> ArithTy -> ShowS
Show, ArithTy -> ArithTy -> Bool
(ArithTy -> ArithTy -> Bool)
-> (ArithTy -> ArithTy -> Bool) -> Eq ArithTy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArithTy -> ArithTy -> Bool
$c/= :: ArithTy -> ArithTy -> Bool
== :: ArithTy -> ArithTy -> Bool
$c== :: ArithTy -> ArithTy -> Bool
Eq, Eq ArithTy
Eq ArithTy =>
(ArithTy -> ArithTy -> Ordering)
-> (ArithTy -> ArithTy -> Bool)
-> (ArithTy -> ArithTy -> Bool)
-> (ArithTy -> ArithTy -> Bool)
-> (ArithTy -> ArithTy -> Bool)
-> (ArithTy -> ArithTy -> ArithTy)
-> (ArithTy -> ArithTy -> ArithTy)
-> Ord ArithTy
ArithTy -> ArithTy -> Bool
ArithTy -> ArithTy -> Ordering
ArithTy -> ArithTy -> ArithTy
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ArithTy -> ArithTy -> ArithTy
$cmin :: ArithTy -> ArithTy -> ArithTy
max :: ArithTy -> ArithTy -> ArithTy
$cmax :: ArithTy -> ArithTy -> ArithTy
>= :: ArithTy -> ArithTy -> Bool
$c>= :: ArithTy -> ArithTy -> Bool
> :: ArithTy -> ArithTy -> Bool
$c> :: ArithTy -> ArithTy -> Bool
<= :: ArithTy -> ArithTy -> Bool
$c<= :: ArithTy -> ArithTy -> Bool
< :: ArithTy -> ArithTy -> Bool
$c< :: ArithTy -> ArithTy -> Bool
compare :: ArithTy -> ArithTy -> Ordering
$ccompare :: ArithTy -> ArithTy -> Ordering
$cp1Ord :: Eq ArithTy
Ord, Typeable ArithTy
Constr
DataType
Typeable ArithTy =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArithTy -> c ArithTy)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArithTy)
-> (ArithTy -> Constr)
-> (ArithTy -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ArithTy))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArithTy))
-> ((forall b. Data b => b -> b) -> ArithTy -> ArithTy)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ArithTy -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ArithTy -> r)
-> (forall u. (forall d. Data d => d -> u) -> ArithTy -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> ArithTy -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ArithTy -> m ArithTy)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArithTy -> m ArithTy)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArithTy -> m ArithTy)
-> Data ArithTy
ArithTy -> Constr
ArithTy -> DataType
(forall b. Data b => b -> b) -> ArithTy -> ArithTy
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArithTy -> c ArithTy
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArithTy
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) -> ArithTy -> u
forall u. (forall d. Data d => d -> u) -> ArithTy -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ArithTy -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ArithTy -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ArithTy -> m ArithTy
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArithTy -> m ArithTy
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArithTy
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArithTy -> c ArithTy
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ArithTy)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArithTy)
$cATFloat :: Constr
$cATInt :: Constr
$tArithTy :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ArithTy -> m ArithTy
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArithTy -> m ArithTy
gmapMp :: (forall d. Data d => d -> m d) -> ArithTy -> m ArithTy
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ArithTy -> m ArithTy
gmapM :: (forall d. Data d => d -> m d) -> ArithTy -> m ArithTy
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ArithTy -> m ArithTy
gmapQi :: Int -> (forall d. Data d => d -> u) -> ArithTy -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ArithTy -> u
gmapQ :: (forall d. Data d => d -> u) -> ArithTy -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ArithTy -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ArithTy -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ArithTy -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ArithTy -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ArithTy -> r
gmapT :: (forall b. Data b => b -> b) -> ArithTy -> ArithTy
$cgmapT :: (forall b. Data b => b -> b) -> ArithTy -> ArithTy
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArithTy)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArithTy)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ArithTy)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ArithTy)
dataTypeOf :: ArithTy -> DataType
$cdataTypeOf :: ArithTy -> DataType
toConstr :: ArithTy -> Constr
$ctoConstr :: ArithTy -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArithTy
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ArithTy
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArithTy -> c ArithTy
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ArithTy -> c ArithTy
$cp1Data :: Typeable ArithTy
Data, (forall x. ArithTy -> Rep ArithTy x)
-> (forall x. Rep ArithTy x -> ArithTy) -> Generic ArithTy
forall x. Rep ArithTy x -> ArithTy
forall x. ArithTy -> Rep ArithTy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArithTy x -> ArithTy
$cfrom :: forall x. ArithTy -> Rep ArithTy x
Generic, Typeable)
instance Pretty ArithTy OutputAnnotation where
pretty :: ArithTy -> Doc OutputAnnotation
pretty (ATInt ITNative) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Int"
pretty (ATInt ITBig) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "BigInt"
pretty (ATInt ITChar) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Char"
pretty (ATInt (ITFixed n :: NativeTy
n)) = NativeTy -> Doc OutputAnnotation
forall a ty. Pretty a ty => a -> Doc ty
pretty NativeTy
n
pretty ATFloat = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Float"
nativeTyWidth :: NativeTy -> Int
nativeTyWidth :: NativeTy -> Int
nativeTyWidth IT8 = 8
nativeTyWidth IT16 = 16
nativeTyWidth IT32 = 32
nativeTyWidth IT64 = 64
data Const = I Int | BI Integer | Fl Double | Ch Char | Str String
| B8 Word8 | B16 Word16 | B32 Word32 | B64 Word64
| AType ArithTy | StrType
| WorldType | TheWorld
| VoidType | Forgot
deriving (Eq Const
Eq Const =>
(Const -> Const -> Ordering)
-> (Const -> Const -> Bool)
-> (Const -> Const -> Bool)
-> (Const -> Const -> Bool)
-> (Const -> Const -> Bool)
-> (Const -> Const -> Const)
-> (Const -> Const -> Const)
-> Ord Const
Const -> Const -> Bool
Const -> Const -> Ordering
Const -> Const -> Const
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Const -> Const -> Const
$cmin :: Const -> Const -> Const
max :: Const -> Const -> Const
$cmax :: Const -> Const -> Const
>= :: Const -> Const -> Bool
$c>= :: Const -> Const -> Bool
> :: Const -> Const -> Bool
$c> :: Const -> Const -> Bool
<= :: Const -> Const -> Bool
$c<= :: Const -> Const -> Bool
< :: Const -> Const -> Bool
$c< :: Const -> Const -> Bool
compare :: Const -> Const -> Ordering
$ccompare :: Const -> Const -> Ordering
$cp1Ord :: Eq Const
Ord, Typeable Const
Constr
DataType
Typeable Const =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Const -> c Const)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Const)
-> (Const -> Constr)
-> (Const -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Const))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Const))
-> ((forall b. Data b => b -> b) -> Const -> Const)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Const -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Const -> r)
-> (forall u. (forall d. Data d => d -> u) -> Const -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Const -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Const -> m Const)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Const -> m Const)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Const -> m Const)
-> Data Const
Const -> Constr
Const -> DataType
(forall b. Data b => b -> b) -> Const -> Const
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Const -> c Const
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Const
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) -> Const -> u
forall u. (forall d. Data d => d -> u) -> Const -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Const -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Const -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Const -> m Const
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Const -> m Const
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Const
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Const -> c Const
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Const)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Const)
$cForgot :: Constr
$cVoidType :: Constr
$cTheWorld :: Constr
$cWorldType :: Constr
$cStrType :: Constr
$cAType :: Constr
$cB64 :: Constr
$cB32 :: Constr
$cB16 :: Constr
$cB8 :: Constr
$cStr :: Constr
$cCh :: Constr
$cFl :: Constr
$cBI :: Constr
$cI :: Constr
$tConst :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Const -> m Const
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Const -> m Const
gmapMp :: (forall d. Data d => d -> m d) -> Const -> m Const
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Const -> m Const
gmapM :: (forall d. Data d => d -> m d) -> Const -> m Const
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Const -> m Const
gmapQi :: Int -> (forall d. Data d => d -> u) -> Const -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Const -> u
gmapQ :: (forall d. Data d => d -> u) -> Const -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Const -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Const -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Const -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Const -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Const -> r
gmapT :: (forall b. Data b => b -> b) -> Const -> Const
$cgmapT :: (forall b. Data b => b -> b) -> Const -> Const
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Const)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Const)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Const)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Const)
dataTypeOf :: Const -> DataType
$cdataTypeOf :: Const -> DataType
toConstr :: Const -> Constr
$ctoConstr :: Const -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Const
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Const
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Const -> c Const
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Const -> c Const
$cp1Data :: Typeable Const
Data, (forall x. Const -> Rep Const x)
-> (forall x. Rep Const x -> Const) -> Generic Const
forall x. Rep Const x -> Const
forall x. Const -> Rep Const x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Const x -> Const
$cfrom :: forall x. Const -> Rep Const x
Generic, Typeable)
instance Eq Const where
I i :: Int
i == :: Const -> Const -> Bool
== I j :: Int
j = Int
i Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
j
BI i :: Integer
i == BI j :: Integer
j = Integer
i Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
== Integer
j
Fl i :: Double
i == Fl j :: Double
j = Double -> Double -> Bool
forall a. IEEE a => a -> a -> Bool
identicalIEEE Double
i Double
j
Ch i :: Char
i == Ch j :: Char
j = Char
i Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
j
Str i :: String
i == Str j :: String
j = String
i String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
j
B8 i :: Word8
i == B8 j :: Word8
j = Word8
i Word8 -> Word8 -> Bool
forall a. Eq a => a -> a -> Bool
== Word8
j
B16 i :: Word16
i == B16 j :: Word16
j = Word16
i Word16 -> Word16 -> Bool
forall a. Eq a => a -> a -> Bool
== Word16
j
B32 i :: Word32
i == B32 j :: Word32
j = Word32
i Word32 -> Word32 -> Bool
forall a. Eq a => a -> a -> Bool
== Word32
j
B64 i :: Word64
i == B64 j :: Word64
j = Word64
i Word64 -> Word64 -> Bool
forall a. Eq a => a -> a -> Bool
== Word64
j
AType i :: ArithTy
i == AType j :: ArithTy
j = ArithTy
i ArithTy -> ArithTy -> Bool
forall a. Eq a => a -> a -> Bool
== ArithTy
j
StrType == StrType = Bool
True
WorldType == WorldType = Bool
True
TheWorld == TheWorld = Bool
True
VoidType == VoidType = Bool
True
Forgot == Forgot = Bool
True
_ == _ = Bool
False
isTypeConst :: Const -> Bool
isTypeConst :: Const -> Bool
isTypeConst (AType _) = Bool
True
isTypeConst StrType = Bool
True
isTypeConst WorldType = Bool
True
isTypeConst VoidType = Bool
True
isTypeConst _ = Bool
False
instance Sized Const where
size :: Const -> Int
size _ = 1
instance Pretty Const OutputAnnotation where
pretty :: Const -> Doc OutputAnnotation
pretty (I i :: Int
i) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Int -> String) -> Int -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String
forall a. Show a => a -> String
show (Int -> Doc OutputAnnotation) -> Int -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Int
i
pretty (BI i :: Integer
i) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Integer -> String) -> Integer -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> String
forall a. Show a => a -> String
show (Integer -> Doc OutputAnnotation)
-> Integer -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Integer
i
pretty (Fl f :: Double
f) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Double -> String) -> Double -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> String
forall a. Show a => a -> String
show (Double -> Doc OutputAnnotation) -> Double -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Double
f
pretty (Ch c :: Char
c) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Char -> String) -> Char -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> String
forall a. Show a => a -> String
show (Char -> Doc OutputAnnotation) -> Char -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Char
c
pretty (Str s :: String
s) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text String
s
pretty (AType a :: ArithTy
a) = ArithTy -> Doc OutputAnnotation
forall a ty. Pretty a ty => a -> Doc ty
pretty ArithTy
a
pretty StrType = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "String"
pretty TheWorld = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "%theWorld"
pretty WorldType = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "prim__World"
pretty VoidType = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Void"
pretty Forgot = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Forgot"
pretty (B8 w :: Word8
w) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Word8 -> String) -> Word8 -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> String
forall a. Show a => a -> String
show (Word8 -> Doc OutputAnnotation) -> Word8 -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Word8
w
pretty (B16 w :: Word16
w) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Word16 -> String) -> Word16 -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> String
forall a. Show a => a -> String
show (Word16 -> Doc OutputAnnotation) -> Word16 -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Word16
w
pretty (B32 w :: Word32
w) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Word32 -> String) -> Word32 -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> String
forall a. Show a => a -> String
show (Word32 -> Doc OutputAnnotation) -> Word32 -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Word32
w
pretty (B64 w :: Word64
w) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Word64 -> String) -> Word64 -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> String
forall a. Show a => a -> String
show (Word64 -> Doc OutputAnnotation) -> Word64 -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Word64
w
constIsType :: Const -> Bool
constIsType :: Const -> Bool
constIsType (I _) = Bool
False
constIsType (BI _) = Bool
False
constIsType (Fl _) = Bool
False
constIsType (Ch _) = Bool
False
constIsType (Str _) = Bool
False
constIsType (B8 _) = Bool
False
constIsType (B16 _) = Bool
False
constIsType (B32 _) = Bool
False
constIsType (B64 _) = Bool
False
constIsType _ = Bool
True
constDocs :: Const -> String
constDocs :: Const -> String
constDocs c :: Const
c@(AType (ATInt ITBig)) = "Arbitrary-precision integers"
constDocs c :: Const
c@(AType (ATInt ITNative)) = "Fixed-precision integers of undefined size"
constDocs c :: Const
c@(AType (ATInt ITChar)) = "Characters in some unspecified encoding"
constDocs c :: Const
c@(AType ATFloat) = "Double-precision floating-point numbers"
constDocs StrType = "Strings in some unspecified encoding"
constDocs c :: Const
c@(AType (ATInt (ITFixed IT8))) = "Eight bits (unsigned)"
constDocs c :: Const
c@(AType (ATInt (ITFixed IT16))) = "Sixteen bits (unsigned)"
constDocs c :: Const
c@(AType (ATInt (ITFixed IT32))) = "Thirty-two bits (unsigned)"
constDocs c :: Const
c@(AType (ATInt (ITFixed IT64))) = "Sixty-four bits (unsigned)"
constDocs (Fl f :: Double
f) = "A float"
constDocs (I i :: Int
i) = "A fixed-precision integer"
constDocs (BI i :: Integer
i) = "An arbitrary-precision integer"
constDocs (Str s :: String
s) = "A string of length " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (String -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
s)
constDocs (Ch c :: Char
c) = "A character"
constDocs (B8 w :: Word8
w) = "The eight-bit value 0x" String -> ShowS
forall a. [a] -> [a] -> [a]
++
Word8 -> (Int -> Char) -> Word8 -> ShowS
forall a. (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS
showIntAtBase 16 Int -> Char
intToDigit Word8
w ""
constDocs (B16 w :: Word16
w) = "The sixteen-bit value 0x" String -> ShowS
forall a. [a] -> [a] -> [a]
++
Word16 -> (Int -> Char) -> Word16 -> ShowS
forall a. (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS
showIntAtBase 16 Int -> Char
intToDigit Word16
w ""
constDocs (B32 w :: Word32
w) = "The thirty-two-bit value 0x" String -> ShowS
forall a. [a] -> [a] -> [a]
++
Word32 -> (Int -> Char) -> Word32 -> ShowS
forall a. (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS
showIntAtBase 16 Int -> Char
intToDigit Word32
w ""
constDocs (B64 w :: Word64
w) = "The sixty-four-bit value 0x" String -> ShowS
forall a. [a] -> [a] -> [a]
++
Word64 -> (Int -> Char) -> Word64 -> ShowS
forall a. (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS
showIntAtBase 16 Int -> Char
intToDigit Word64
w ""
constDocs prim :: Const
prim = "Undocumented"
data Universe = NullType | UniqueType | AllTypes
deriving (Universe -> Universe -> Bool
(Universe -> Universe -> Bool)
-> (Universe -> Universe -> Bool) -> Eq Universe
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Universe -> Universe -> Bool
$c/= :: Universe -> Universe -> Bool
== :: Universe -> Universe -> Bool
$c== :: Universe -> Universe -> Bool
Eq, Eq Universe
Eq Universe =>
(Universe -> Universe -> Ordering)
-> (Universe -> Universe -> Bool)
-> (Universe -> Universe -> Bool)
-> (Universe -> Universe -> Bool)
-> (Universe -> Universe -> Bool)
-> (Universe -> Universe -> Universe)
-> (Universe -> Universe -> Universe)
-> Ord Universe
Universe -> Universe -> Bool
Universe -> Universe -> Ordering
Universe -> Universe -> Universe
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Universe -> Universe -> Universe
$cmin :: Universe -> Universe -> Universe
max :: Universe -> Universe -> Universe
$cmax :: Universe -> Universe -> Universe
>= :: Universe -> Universe -> Bool
$c>= :: Universe -> Universe -> Bool
> :: Universe -> Universe -> Bool
$c> :: Universe -> Universe -> Bool
<= :: Universe -> Universe -> Bool
$c<= :: Universe -> Universe -> Bool
< :: Universe -> Universe -> Bool
$c< :: Universe -> Universe -> Bool
compare :: Universe -> Universe -> Ordering
$ccompare :: Universe -> Universe -> Ordering
$cp1Ord :: Eq Universe
Ord, Typeable Universe
Constr
DataType
Typeable Universe =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Universe -> c Universe)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Universe)
-> (Universe -> Constr)
-> (Universe -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Universe))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Universe))
-> ((forall b. Data b => b -> b) -> Universe -> Universe)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Universe -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Universe -> r)
-> (forall u. (forall d. Data d => d -> u) -> Universe -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Universe -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Universe -> m Universe)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Universe -> m Universe)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Universe -> m Universe)
-> Data Universe
Universe -> Constr
Universe -> DataType
(forall b. Data b => b -> b) -> Universe -> Universe
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Universe -> c Universe
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Universe
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) -> Universe -> u
forall u. (forall d. Data d => d -> u) -> Universe -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Universe -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Universe -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Universe -> m Universe
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Universe -> m Universe
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Universe
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Universe -> c Universe
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Universe)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Universe)
$cAllTypes :: Constr
$cUniqueType :: Constr
$cNullType :: Constr
$tUniverse :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Universe -> m Universe
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Universe -> m Universe
gmapMp :: (forall d. Data d => d -> m d) -> Universe -> m Universe
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Universe -> m Universe
gmapM :: (forall d. Data d => d -> m d) -> Universe -> m Universe
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Universe -> m Universe
gmapQi :: Int -> (forall d. Data d => d -> u) -> Universe -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Universe -> u
gmapQ :: (forall d. Data d => d -> u) -> Universe -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Universe -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Universe -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Universe -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Universe -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Universe -> r
gmapT :: (forall b. Data b => b -> b) -> Universe -> Universe
$cgmapT :: (forall b. Data b => b -> b) -> Universe -> Universe
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Universe)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Universe)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Universe)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Universe)
dataTypeOf :: Universe -> DataType
$cdataTypeOf :: Universe -> DataType
toConstr :: Universe -> Constr
$ctoConstr :: Universe -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Universe
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Universe
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Universe -> c Universe
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Universe -> c Universe
$cp1Data :: Typeable Universe
Data, (forall x. Universe -> Rep Universe x)
-> (forall x. Rep Universe x -> Universe) -> Generic Universe
forall x. Rep Universe x -> Universe
forall x. Universe -> Rep Universe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Universe x -> Universe
$cfrom :: forall x. Universe -> Rep Universe x
Generic, Typeable)
instance Show Universe where
show :: Universe -> String
show UniqueType = "UniqueType"
show NullType = "NullType"
show AllTypes = "AnyType"
data Raw = Var Name
| RBind Name (Binder Raw) Raw
| RApp Raw Raw
| RType
| RUType Universe
| RConstant Const
deriving (Int -> Raw -> ShowS
[Raw] -> ShowS
Raw -> String
(Int -> Raw -> ShowS)
-> (Raw -> String) -> ([Raw] -> ShowS) -> Show Raw
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Raw] -> ShowS
$cshowList :: [Raw] -> ShowS
show :: Raw -> String
$cshow :: Raw -> String
showsPrec :: Int -> Raw -> ShowS
$cshowsPrec :: Int -> Raw -> ShowS
Show, Raw -> Raw -> Bool
(Raw -> Raw -> Bool) -> (Raw -> Raw -> Bool) -> Eq Raw
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Raw -> Raw -> Bool
$c/= :: Raw -> Raw -> Bool
== :: Raw -> Raw -> Bool
$c== :: Raw -> Raw -> Bool
Eq, Eq Raw
Eq Raw =>
(Raw -> Raw -> Ordering)
-> (Raw -> Raw -> Bool)
-> (Raw -> Raw -> Bool)
-> (Raw -> Raw -> Bool)
-> (Raw -> Raw -> Bool)
-> (Raw -> Raw -> Raw)
-> (Raw -> Raw -> Raw)
-> Ord Raw
Raw -> Raw -> Bool
Raw -> Raw -> Ordering
Raw -> Raw -> Raw
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Raw -> Raw -> Raw
$cmin :: Raw -> Raw -> Raw
max :: Raw -> Raw -> Raw
$cmax :: Raw -> Raw -> Raw
>= :: Raw -> Raw -> Bool
$c>= :: Raw -> Raw -> Bool
> :: Raw -> Raw -> Bool
$c> :: Raw -> Raw -> Bool
<= :: Raw -> Raw -> Bool
$c<= :: Raw -> Raw -> Bool
< :: Raw -> Raw -> Bool
$c< :: Raw -> Raw -> Bool
compare :: Raw -> Raw -> Ordering
$ccompare :: Raw -> Raw -> Ordering
$cp1Ord :: Eq Raw
Ord, Typeable Raw
Constr
DataType
Typeable Raw =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Raw -> c Raw)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Raw)
-> (Raw -> Constr)
-> (Raw -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Raw))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Raw))
-> ((forall b. Data b => b -> b) -> Raw -> Raw)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Raw -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Raw -> r)
-> (forall u. (forall d. Data d => d -> u) -> Raw -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Raw -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Raw -> m Raw)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Raw -> m Raw)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Raw -> m Raw)
-> Data Raw
Raw -> Constr
Raw -> DataType
(forall b. Data b => b -> b) -> Raw -> Raw
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Raw -> c Raw
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Raw
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) -> Raw -> u
forall u. (forall d. Data d => d -> u) -> Raw -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Raw -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Raw -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Raw -> m Raw
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Raw -> m Raw
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Raw
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Raw -> c Raw
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Raw)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Raw)
$cRConstant :: Constr
$cRUType :: Constr
$cRType :: Constr
$cRApp :: Constr
$cRBind :: Constr
$cVar :: Constr
$tRaw :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Raw -> m Raw
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Raw -> m Raw
gmapMp :: (forall d. Data d => d -> m d) -> Raw -> m Raw
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Raw -> m Raw
gmapM :: (forall d. Data d => d -> m d) -> Raw -> m Raw
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Raw -> m Raw
gmapQi :: Int -> (forall d. Data d => d -> u) -> Raw -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Raw -> u
gmapQ :: (forall d. Data d => d -> u) -> Raw -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Raw -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Raw -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Raw -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Raw -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Raw -> r
gmapT :: (forall b. Data b => b -> b) -> Raw -> Raw
$cgmapT :: (forall b. Data b => b -> b) -> Raw -> Raw
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Raw)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Raw)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Raw)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Raw)
dataTypeOf :: Raw -> DataType
$cdataTypeOf :: Raw -> DataType
toConstr :: Raw -> Constr
$ctoConstr :: Raw -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Raw
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Raw
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Raw -> c Raw
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Raw -> c Raw
$cp1Data :: Typeable Raw
Data, (forall x. Raw -> Rep Raw x)
-> (forall x. Rep Raw x -> Raw) -> Generic Raw
forall x. Rep Raw x -> Raw
forall x. Raw -> Rep Raw x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Raw x -> Raw
$cfrom :: forall x. Raw -> Rep Raw x
Generic, Typeable)
instance Sized Raw where
size :: Raw -> Int
size (Var name :: Name
name) = 1
size (RBind name :: Name
name bind :: Binder Raw
bind right :: Raw
right) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Binder Raw -> Int
forall a. Sized a => a -> Int
size Binder Raw
bind Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Raw -> Int
forall a. Sized a => a -> Int
size Raw
right
size (RApp left :: Raw
left right :: Raw
right) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Raw -> Int
forall a. Sized a => a -> Int
size Raw
left Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Raw -> Int
forall a. Sized a => a -> Int
size Raw
right
size RType = 1
size (RUType _) = 1
size (RConstant const :: Const
const) = Const -> Int
forall a. Sized a => a -> Int
size Const
const
instance Pretty Raw OutputAnnotation where
pretty :: Raw -> Doc OutputAnnotation
pretty = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (Raw -> String) -> Raw -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Raw -> String
forall a. Show a => a -> String
show
data ImplicitInfo = Impl { ImplicitInfo -> Bool
tcimplementation :: Bool, ImplicitInfo -> Bool
toplevel_imp :: Bool,
ImplicitInfo -> Bool
machine_gen :: Bool }
deriving (Int -> ImplicitInfo -> ShowS
[ImplicitInfo] -> ShowS
ImplicitInfo -> String
(Int -> ImplicitInfo -> ShowS)
-> (ImplicitInfo -> String)
-> ([ImplicitInfo] -> ShowS)
-> Show ImplicitInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImplicitInfo] -> ShowS
$cshowList :: [ImplicitInfo] -> ShowS
show :: ImplicitInfo -> String
$cshow :: ImplicitInfo -> String
showsPrec :: Int -> ImplicitInfo -> ShowS
$cshowsPrec :: Int -> ImplicitInfo -> ShowS
Show, ImplicitInfo -> ImplicitInfo -> Bool
(ImplicitInfo -> ImplicitInfo -> Bool)
-> (ImplicitInfo -> ImplicitInfo -> Bool) -> Eq ImplicitInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImplicitInfo -> ImplicitInfo -> Bool
$c/= :: ImplicitInfo -> ImplicitInfo -> Bool
== :: ImplicitInfo -> ImplicitInfo -> Bool
$c== :: ImplicitInfo -> ImplicitInfo -> Bool
Eq, Eq ImplicitInfo
Eq ImplicitInfo =>
(ImplicitInfo -> ImplicitInfo -> Ordering)
-> (ImplicitInfo -> ImplicitInfo -> Bool)
-> (ImplicitInfo -> ImplicitInfo -> Bool)
-> (ImplicitInfo -> ImplicitInfo -> Bool)
-> (ImplicitInfo -> ImplicitInfo -> Bool)
-> (ImplicitInfo -> ImplicitInfo -> ImplicitInfo)
-> (ImplicitInfo -> ImplicitInfo -> ImplicitInfo)
-> Ord ImplicitInfo
ImplicitInfo -> ImplicitInfo -> Bool
ImplicitInfo -> ImplicitInfo -> Ordering
ImplicitInfo -> ImplicitInfo -> ImplicitInfo
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ImplicitInfo -> ImplicitInfo -> ImplicitInfo
$cmin :: ImplicitInfo -> ImplicitInfo -> ImplicitInfo
max :: ImplicitInfo -> ImplicitInfo -> ImplicitInfo
$cmax :: ImplicitInfo -> ImplicitInfo -> ImplicitInfo
>= :: ImplicitInfo -> ImplicitInfo -> Bool
$c>= :: ImplicitInfo -> ImplicitInfo -> Bool
> :: ImplicitInfo -> ImplicitInfo -> Bool
$c> :: ImplicitInfo -> ImplicitInfo -> Bool
<= :: ImplicitInfo -> ImplicitInfo -> Bool
$c<= :: ImplicitInfo -> ImplicitInfo -> Bool
< :: ImplicitInfo -> ImplicitInfo -> Bool
$c< :: ImplicitInfo -> ImplicitInfo -> Bool
compare :: ImplicitInfo -> ImplicitInfo -> Ordering
$ccompare :: ImplicitInfo -> ImplicitInfo -> Ordering
$cp1Ord :: Eq ImplicitInfo
Ord, Typeable ImplicitInfo
Constr
DataType
Typeable ImplicitInfo =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ImplicitInfo -> c ImplicitInfo)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ImplicitInfo)
-> (ImplicitInfo -> Constr)
-> (ImplicitInfo -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ImplicitInfo))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ImplicitInfo))
-> ((forall b. Data b => b -> b) -> ImplicitInfo -> ImplicitInfo)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImplicitInfo -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImplicitInfo -> r)
-> (forall u. (forall d. Data d => d -> u) -> ImplicitInfo -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ImplicitInfo -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo)
-> Data ImplicitInfo
ImplicitInfo -> Constr
ImplicitInfo -> DataType
(forall b. Data b => b -> b) -> ImplicitInfo -> ImplicitInfo
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ImplicitInfo -> c ImplicitInfo
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ImplicitInfo
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) -> ImplicitInfo -> u
forall u. (forall d. Data d => d -> u) -> ImplicitInfo -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImplicitInfo -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImplicitInfo -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ImplicitInfo
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ImplicitInfo -> c ImplicitInfo
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ImplicitInfo)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ImplicitInfo)
$cImpl :: Constr
$tImplicitInfo :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo
gmapMp :: (forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo
gmapM :: (forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ImplicitInfo -> m ImplicitInfo
gmapQi :: Int -> (forall d. Data d => d -> u) -> ImplicitInfo -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ImplicitInfo -> u
gmapQ :: (forall d. Data d => d -> u) -> ImplicitInfo -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ImplicitInfo -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImplicitInfo -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ImplicitInfo -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImplicitInfo -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ImplicitInfo -> r
gmapT :: (forall b. Data b => b -> b) -> ImplicitInfo -> ImplicitInfo
$cgmapT :: (forall b. Data b => b -> b) -> ImplicitInfo -> ImplicitInfo
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ImplicitInfo)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ImplicitInfo)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ImplicitInfo)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ImplicitInfo)
dataTypeOf :: ImplicitInfo -> DataType
$cdataTypeOf :: ImplicitInfo -> DataType
toConstr :: ImplicitInfo -> Constr
$ctoConstr :: ImplicitInfo -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ImplicitInfo
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ImplicitInfo
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ImplicitInfo -> c ImplicitInfo
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ImplicitInfo -> c ImplicitInfo
$cp1Data :: Typeable ImplicitInfo
Data, (forall x. ImplicitInfo -> Rep ImplicitInfo x)
-> (forall x. Rep ImplicitInfo x -> ImplicitInfo)
-> Generic ImplicitInfo
forall x. Rep ImplicitInfo x -> ImplicitInfo
forall x. ImplicitInfo -> Rep ImplicitInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImplicitInfo x -> ImplicitInfo
$cfrom :: forall x. ImplicitInfo -> Rep ImplicitInfo x
Generic, Typeable)
data Binder b = Lam { Binder b -> RigCount
binderCount :: RigCount,
Binder b -> b
binderTy :: !b }
| Pi { binderCount :: RigCount,
Binder b -> Maybe ImplicitInfo
binderImpl :: Maybe ImplicitInfo,
binderTy :: !b,
Binder b -> b
binderKind :: !b }
| Let { binderCount :: RigCount,
binderTy :: !b,
Binder b -> b
binderVal :: b }
| NLet { binderTy :: !b,
binderVal :: b }
| Hole { binderTy :: !b}
| GHole { Binder b -> Int
envlen :: Int,
Binder b -> [Name]
localnames :: [Name],
binderTy :: !b}
| Guess { binderTy :: !b,
binderVal :: b }
| PVar { binderCount :: RigCount,
binderTy :: !b }
| PVTy { binderTy :: !b }
deriving (Int -> Binder b -> ShowS
[Binder b] -> ShowS
Binder b -> String
(Int -> Binder b -> ShowS)
-> (Binder b -> String) -> ([Binder b] -> ShowS) -> Show (Binder b)
forall b. Show b => Int -> Binder b -> ShowS
forall b. Show b => [Binder b] -> ShowS
forall b. Show b => Binder b -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Binder b] -> ShowS
$cshowList :: forall b. Show b => [Binder b] -> ShowS
show :: Binder b -> String
$cshow :: forall b. Show b => Binder b -> String
showsPrec :: Int -> Binder b -> ShowS
$cshowsPrec :: forall b. Show b => Int -> Binder b -> ShowS
Show, Binder b -> Binder b -> Bool
(Binder b -> Binder b -> Bool)
-> (Binder b -> Binder b -> Bool) -> Eq (Binder b)
forall b. Eq b => Binder b -> Binder b -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Binder b -> Binder b -> Bool
$c/= :: forall b. Eq b => Binder b -> Binder b -> Bool
== :: Binder b -> Binder b -> Bool
$c== :: forall b. Eq b => Binder b -> Binder b -> Bool
Eq, Eq (Binder b)
Eq (Binder b) =>
(Binder b -> Binder b -> Ordering)
-> (Binder b -> Binder b -> Bool)
-> (Binder b -> Binder b -> Bool)
-> (Binder b -> Binder b -> Bool)
-> (Binder b -> Binder b -> Bool)
-> (Binder b -> Binder b -> Binder b)
-> (Binder b -> Binder b -> Binder b)
-> Ord (Binder b)
Binder b -> Binder b -> Bool
Binder b -> Binder b -> Ordering
Binder b -> Binder b -> Binder b
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall b. Ord b => Eq (Binder b)
forall b. Ord b => Binder b -> Binder b -> Bool
forall b. Ord b => Binder b -> Binder b -> Ordering
forall b. Ord b => Binder b -> Binder b -> Binder b
min :: Binder b -> Binder b -> Binder b
$cmin :: forall b. Ord b => Binder b -> Binder b -> Binder b
max :: Binder b -> Binder b -> Binder b
$cmax :: forall b. Ord b => Binder b -> Binder b -> Binder b
>= :: Binder b -> Binder b -> Bool
$c>= :: forall b. Ord b => Binder b -> Binder b -> Bool
> :: Binder b -> Binder b -> Bool
$c> :: forall b. Ord b => Binder b -> Binder b -> Bool
<= :: Binder b -> Binder b -> Bool
$c<= :: forall b. Ord b => Binder b -> Binder b -> Bool
< :: Binder b -> Binder b -> Bool
$c< :: forall b. Ord b => Binder b -> Binder b -> Bool
compare :: Binder b -> Binder b -> Ordering
$ccompare :: forall b. Ord b => Binder b -> Binder b -> Ordering
$cp1Ord :: forall b. Ord b => Eq (Binder b)
Ord, a -> Binder b -> Binder a
(a -> b) -> Binder a -> Binder b
(forall a b. (a -> b) -> Binder a -> Binder b)
-> (forall a b. a -> Binder b -> Binder a) -> Functor Binder
forall a b. a -> Binder b -> Binder a
forall a b. (a -> b) -> Binder a -> Binder b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Binder b -> Binder a
$c<$ :: forall a b. a -> Binder b -> Binder a
fmap :: (a -> b) -> Binder a -> Binder b
$cfmap :: forall a b. (a -> b) -> Binder a -> Binder b
Functor, Binder a -> Bool
(a -> m) -> Binder a -> m
(a -> b -> b) -> b -> Binder a -> b
(forall m. Monoid m => Binder m -> m)
-> (forall m a. Monoid m => (a -> m) -> Binder a -> m)
-> (forall m a. Monoid m => (a -> m) -> Binder a -> m)
-> (forall a b. (a -> b -> b) -> b -> Binder a -> b)
-> (forall a b. (a -> b -> b) -> b -> Binder a -> b)
-> (forall b a. (b -> a -> b) -> b -> Binder a -> b)
-> (forall b a. (b -> a -> b) -> b -> Binder a -> b)
-> (forall a. (a -> a -> a) -> Binder a -> a)
-> (forall a. (a -> a -> a) -> Binder a -> a)
-> (forall a. Binder a -> [a])
-> (forall a. Binder a -> Bool)
-> (forall a. Binder a -> Int)
-> (forall a. Eq a => a -> Binder a -> Bool)
-> (forall a. Ord a => Binder a -> a)
-> (forall a. Ord a => Binder a -> a)
-> (forall a. Num a => Binder a -> a)
-> (forall a. Num a => Binder a -> a)
-> Foldable Binder
forall a. Eq a => a -> Binder a -> Bool
forall a. Num a => Binder a -> a
forall a. Ord a => Binder a -> a
forall m. Monoid m => Binder m -> m
forall a. Binder a -> Bool
forall a. Binder a -> Int
forall a. Binder a -> [a]
forall a. (a -> a -> a) -> Binder a -> a
forall m a. Monoid m => (a -> m) -> Binder a -> m
forall b a. (b -> a -> b) -> b -> Binder a -> b
forall a b. (a -> b -> b) -> b -> Binder 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 :: Binder a -> a
$cproduct :: forall a. Num a => Binder a -> a
sum :: Binder a -> a
$csum :: forall a. Num a => Binder a -> a
minimum :: Binder a -> a
$cminimum :: forall a. Ord a => Binder a -> a
maximum :: Binder a -> a
$cmaximum :: forall a. Ord a => Binder a -> a
elem :: a -> Binder a -> Bool
$celem :: forall a. Eq a => a -> Binder a -> Bool
length :: Binder a -> Int
$clength :: forall a. Binder a -> Int
null :: Binder a -> Bool
$cnull :: forall a. Binder a -> Bool
toList :: Binder a -> [a]
$ctoList :: forall a. Binder a -> [a]
foldl1 :: (a -> a -> a) -> Binder a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Binder a -> a
foldr1 :: (a -> a -> a) -> Binder a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Binder a -> a
foldl' :: (b -> a -> b) -> b -> Binder a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Binder a -> b
foldl :: (b -> a -> b) -> b -> Binder a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Binder a -> b
foldr' :: (a -> b -> b) -> b -> Binder a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Binder a -> b
foldr :: (a -> b -> b) -> b -> Binder a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Binder a -> b
foldMap' :: (a -> m) -> Binder a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Binder a -> m
foldMap :: (a -> m) -> Binder a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Binder a -> m
fold :: Binder m -> m
$cfold :: forall m. Monoid m => Binder m -> m
Foldable, Functor Binder
Foldable Binder
(Functor Binder, Foldable Binder) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Binder a -> f (Binder b))
-> (forall (f :: * -> *) a.
Applicative f =>
Binder (f a) -> f (Binder a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Binder a -> m (Binder b))
-> (forall (m :: * -> *) a.
Monad m =>
Binder (m a) -> m (Binder a))
-> Traversable Binder
(a -> f b) -> Binder a -> f (Binder 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 => Binder (m a) -> m (Binder a)
forall (f :: * -> *) a.
Applicative f =>
Binder (f a) -> f (Binder a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Binder a -> m (Binder b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Binder a -> f (Binder b)
sequence :: Binder (m a) -> m (Binder a)
$csequence :: forall (m :: * -> *) a. Monad m => Binder (m a) -> m (Binder a)
mapM :: (a -> m b) -> Binder a -> m (Binder b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Binder a -> m (Binder b)
sequenceA :: Binder (f a) -> f (Binder a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Binder (f a) -> f (Binder a)
traverse :: (a -> f b) -> Binder a -> f (Binder b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Binder a -> f (Binder b)
$cp2Traversable :: Foldable Binder
$cp1Traversable :: Functor Binder
Traversable, Typeable (Binder b)
Constr
DataType
Typeable (Binder b) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binder b -> c (Binder b))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binder b))
-> (Binder b -> Constr)
-> (Binder b -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Binder b)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Binder b)))
-> ((forall b. Data b => b -> b) -> Binder b -> Binder b)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Binder b -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Binder b -> r)
-> (forall u. (forall d. Data d => d -> u) -> Binder b -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Binder b -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Binder b -> m (Binder b))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Binder b -> m (Binder b))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Binder b -> m (Binder b))
-> Data (Binder b)
Binder b -> Constr
Binder b -> DataType
(forall d. Data d => c (t d)) -> Maybe (c (Binder b))
(forall b. Data b => b -> b) -> Binder b -> Binder b
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binder b -> c (Binder b)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binder b)
forall b. Data b => Typeable (Binder b)
forall b. Data b => Binder b -> Constr
forall b. Data b => Binder b -> DataType
forall b.
Data b =>
(forall b. Data b => b -> b) -> Binder b -> Binder b
forall b u.
Data b =>
Int -> (forall d. Data d => d -> u) -> Binder b -> u
forall b u.
Data b =>
(forall d. Data d => d -> u) -> Binder b -> [u]
forall b r r'.
Data b =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Binder b -> r
forall b r r'.
Data b =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Binder b -> r
forall b (m :: * -> *).
(Data b, Monad m) =>
(forall d. Data d => d -> m d) -> Binder b -> m (Binder b)
forall b (m :: * -> *).
(Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Binder b -> m (Binder b)
forall b (c :: * -> *).
Data b =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binder b)
forall b (c :: * -> *).
Data b =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binder b -> c (Binder b)
forall b (t :: * -> *) (c :: * -> *).
(Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Binder b))
forall b (t :: * -> * -> *) (c :: * -> *).
(Data b, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Binder b))
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) -> Binder b -> u
forall u. (forall d. Data d => d -> u) -> Binder b -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Binder b -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Binder b -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Binder b -> m (Binder b)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Binder b -> m (Binder b)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binder b)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binder b -> c (Binder b)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Binder b))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Binder b))
$cPVTy :: Constr
$cPVar :: Constr
$cGuess :: Constr
$cGHole :: Constr
$cHole :: Constr
$cNLet :: Constr
$cLet :: Constr
$cPi :: Constr
$cLam :: Constr
$tBinder :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Binder b -> m (Binder b)
$cgmapMo :: forall b (m :: * -> *).
(Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Binder b -> m (Binder b)
gmapMp :: (forall d. Data d => d -> m d) -> Binder b -> m (Binder b)
$cgmapMp :: forall b (m :: * -> *).
(Data b, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Binder b -> m (Binder b)
gmapM :: (forall d. Data d => d -> m d) -> Binder b -> m (Binder b)
$cgmapM :: forall b (m :: * -> *).
(Data b, Monad m) =>
(forall d. Data d => d -> m d) -> Binder b -> m (Binder b)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Binder b -> u
$cgmapQi :: forall b u.
Data b =>
Int -> (forall d. Data d => d -> u) -> Binder b -> u
gmapQ :: (forall d. Data d => d -> u) -> Binder b -> [u]
$cgmapQ :: forall b u.
Data b =>
(forall d. Data d => d -> u) -> Binder b -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Binder b -> r
$cgmapQr :: forall b r r'.
Data b =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Binder b -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Binder b -> r
$cgmapQl :: forall b r r'.
Data b =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Binder b -> r
gmapT :: (forall b. Data b => b -> b) -> Binder b -> Binder b
$cgmapT :: forall b.
Data b =>
(forall b. Data b => b -> b) -> Binder b -> Binder b
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Binder b))
$cdataCast2 :: forall b (t :: * -> * -> *) (c :: * -> *).
(Data b, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Binder b))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Binder b))
$cdataCast1 :: forall b (t :: * -> *) (c :: * -> *).
(Data b, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Binder b))
dataTypeOf :: Binder b -> DataType
$cdataTypeOf :: forall b. Data b => Binder b -> DataType
toConstr :: Binder b -> Constr
$ctoConstr :: forall b. Data b => Binder b -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binder b)
$cgunfold :: forall b (c :: * -> *).
Data b =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binder b)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binder b -> c (Binder b)
$cgfoldl :: forall b (c :: * -> *).
Data b =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binder b -> c (Binder b)
$cp1Data :: forall b. Data b => Typeable (Binder b)
Data, (forall x. Binder b -> Rep (Binder b) x)
-> (forall x. Rep (Binder b) x -> Binder b) -> Generic (Binder b)
forall x. Rep (Binder b) x -> Binder b
forall x. Binder b -> Rep (Binder b) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall b x. Rep (Binder b) x -> Binder b
forall b x. Binder b -> Rep (Binder b) x
$cto :: forall b x. Rep (Binder b) x -> Binder b
$cfrom :: forall b x. Binder b -> Rep (Binder b) x
Generic, Typeable)
instance Sized a => Sized (Binder a) where
size :: Binder a -> Int
size (Lam _ ty :: a
ty) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
ty
size (Pi _ _ ty :: a
ty _) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
ty
size (Let _ ty :: a
ty val :: a
val) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
ty Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
val
size (NLet ty :: a
ty val :: a
val) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
ty Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
val
size (Hole ty :: a
ty) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
ty
size (GHole _ _ ty :: a
ty) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
ty
size (Guess ty :: a
ty val :: a
val) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
ty Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
val
size (PVar _ ty :: a
ty) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
ty
size (PVTy ty :: a
ty) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
ty
fmapMB :: Monad m => (a -> m b) -> Binder a -> m (Binder b)
fmapMB :: (a -> m b) -> Binder a -> m (Binder b)
fmapMB f :: a -> m b
f (Let c :: RigCount
c t :: a
t v :: a
v) = (b -> b -> Binder b) -> m b -> m b -> m (Binder b)
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 (RigCount -> b -> b -> Binder b
forall b. RigCount -> b -> b -> Binder b
Let RigCount
c) (a -> m b
f a
t) (a -> m b
f a
v)
fmapMB f :: a -> m b
f (NLet t :: a
t v :: a
v) = (b -> b -> Binder b) -> m b -> m b -> m (Binder b)
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 b -> b -> Binder b
forall b. b -> b -> Binder b
NLet (a -> m b
f a
t) (a -> m b
f a
v)
fmapMB f :: a -> m b
f (Guess t :: a
t v :: a
v) = (b -> b -> Binder b) -> m b -> m b -> m (Binder b)
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 b -> b -> Binder b
forall b. b -> b -> Binder b
Guess (a -> m b
f a
t) (a -> m b
f a
v)
fmapMB f :: a -> m b
f (Lam c :: RigCount
c t :: a
t) = (b -> Binder b) -> m b -> m (Binder b)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (RigCount -> b -> Binder b
forall b. RigCount -> b -> Binder b
Lam RigCount
c) (a -> m b
f a
t)
fmapMB f :: a -> m b
f (Pi c :: RigCount
c i :: Maybe ImplicitInfo
i t :: a
t k :: a
k) = (b -> b -> Binder b) -> m b -> m b -> m (Binder b)
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 (RigCount -> Maybe ImplicitInfo -> b -> b -> Binder b
forall b. RigCount -> Maybe ImplicitInfo -> b -> b -> Binder b
Pi RigCount
c Maybe ImplicitInfo
i) (a -> m b
f a
t) (a -> m b
f a
k)
fmapMB f :: a -> m b
f (Hole t :: a
t) = (b -> Binder b) -> m b -> m (Binder b)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM b -> Binder b
forall b. b -> Binder b
Hole (a -> m b
f a
t)
fmapMB f :: a -> m b
f (GHole i :: Int
i ns :: [Name]
ns t :: a
t) = (b -> Binder b) -> m b -> m (Binder b)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Int -> [Name] -> b -> Binder b
forall b. Int -> [Name] -> b -> Binder b
GHole Int
i [Name]
ns) (a -> m b
f a
t)
fmapMB f :: a -> m b
f (PVar c :: RigCount
c t :: a
t) = (b -> Binder b) -> m b -> m (Binder b)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (RigCount -> b -> Binder b
forall b. RigCount -> b -> Binder b
PVar RigCount
c) (a -> m b
f a
t)
fmapMB f :: a -> m b
f (PVTy t :: a
t) = (b -> Binder b) -> m b -> m (Binder b)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM b -> Binder b
forall b. b -> Binder b
PVTy (a -> m b
f a
t)
raw_apply :: Raw -> [Raw] -> Raw
raw_apply :: Raw -> [Raw] -> Raw
raw_apply f :: Raw
f [] = Raw
f
raw_apply f :: Raw
f (a :: Raw
a : as :: [Raw]
as) = Raw -> [Raw] -> Raw
raw_apply (Raw -> Raw -> Raw
RApp Raw
f Raw
a) [Raw]
as
raw_unapply :: Raw -> (Raw, [Raw])
raw_unapply :: Raw -> (Raw, [Raw])
raw_unapply t :: Raw
t = [Raw] -> Raw -> (Raw, [Raw])
ua [] Raw
t where
ua :: [Raw] -> Raw -> (Raw, [Raw])
ua args :: [Raw]
args (RApp f :: Raw
f a :: Raw
a) = [Raw] -> Raw -> (Raw, [Raw])
ua (Raw
aRaw -> [Raw] -> [Raw]
forall a. a -> [a] -> [a]
:[Raw]
args) Raw
f
ua args :: [Raw]
args t :: Raw
t = (Raw
t, [Raw]
args)
internalNS :: String
internalNS :: String
internalNS = "(internal)"
data UExp = UVar String Int
| UVal Int
deriving (UExp -> UExp -> Bool
(UExp -> UExp -> Bool) -> (UExp -> UExp -> Bool) -> Eq UExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UExp -> UExp -> Bool
$c/= :: UExp -> UExp -> Bool
== :: UExp -> UExp -> Bool
$c== :: UExp -> UExp -> Bool
Eq, Eq UExp
Eq UExp =>
(UExp -> UExp -> Ordering)
-> (UExp -> UExp -> Bool)
-> (UExp -> UExp -> Bool)
-> (UExp -> UExp -> Bool)
-> (UExp -> UExp -> Bool)
-> (UExp -> UExp -> UExp)
-> (UExp -> UExp -> UExp)
-> Ord UExp
UExp -> UExp -> Bool
UExp -> UExp -> Ordering
UExp -> UExp -> UExp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: UExp -> UExp -> UExp
$cmin :: UExp -> UExp -> UExp
max :: UExp -> UExp -> UExp
$cmax :: UExp -> UExp -> UExp
>= :: UExp -> UExp -> Bool
$c>= :: UExp -> UExp -> Bool
> :: UExp -> UExp -> Bool
$c> :: UExp -> UExp -> Bool
<= :: UExp -> UExp -> Bool
$c<= :: UExp -> UExp -> Bool
< :: UExp -> UExp -> Bool
$c< :: UExp -> UExp -> Bool
compare :: UExp -> UExp -> Ordering
$ccompare :: UExp -> UExp -> Ordering
$cp1Ord :: Eq UExp
Ord, Typeable UExp
Constr
DataType
Typeable UExp =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UExp -> c UExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UExp)
-> (UExp -> Constr)
-> (UExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UExp))
-> ((forall b. Data b => b -> b) -> UExp -> UExp)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UExp -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> UExp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> UExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UExp -> m UExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UExp -> m UExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UExp -> m UExp)
-> Data UExp
UExp -> Constr
UExp -> DataType
(forall b. Data b => b -> b) -> UExp -> UExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UExp -> c UExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UExp
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) -> UExp -> u
forall u. (forall d. Data d => d -> u) -> UExp -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UExp -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UExp -> m UExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UExp -> m UExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UExp -> c UExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UExp)
$cUVal :: Constr
$cUVar :: Constr
$tUExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UExp -> m UExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UExp -> m UExp
gmapMp :: (forall d. Data d => d -> m d) -> UExp -> m UExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UExp -> m UExp
gmapM :: (forall d. Data d => d -> m d) -> UExp -> m UExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UExp -> m UExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> UExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UExp -> u
gmapQ :: (forall d. Data d => d -> u) -> UExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UExp -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UExp -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UExp -> r
gmapT :: (forall b. Data b => b -> b) -> UExp -> UExp
$cgmapT :: (forall b. Data b => b -> b) -> UExp -> UExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UExp)
dataTypeOf :: UExp -> DataType
$cdataTypeOf :: UExp -> DataType
toConstr :: UExp -> Constr
$ctoConstr :: UExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UExp -> c UExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UExp -> c UExp
$cp1Data :: Typeable UExp
Data, (forall x. UExp -> Rep UExp x)
-> (forall x. Rep UExp x -> UExp) -> Generic UExp
forall x. Rep UExp x -> UExp
forall x. UExp -> Rep UExp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UExp x -> UExp
$cfrom :: forall x. UExp -> Rep UExp x
Generic, Typeable)
instance Sized UExp where
size :: UExp -> Int
size _ = 1
instance Show UExp where
show :: UExp -> String
show (UVar ns :: String
ns x :: Int
x)
| Int
x Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< 26 = String
ns String -> ShowS
forall a. [a] -> [a] -> [a]
++ "." String -> ShowS
forall a. [a] -> [a] -> [a]
++ [Int -> Char
forall a. Enum a => Int -> a
toEnum (Int
x Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Char -> Int
forall a. Enum a => a -> Int
fromEnum 'a')]
| Bool
otherwise = String
ns String -> ShowS
forall a. [a] -> [a] -> [a]
++ "." String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> Char
forall a. Enum a => Int -> a
toEnum ((Int
x Int -> Int -> Int
forall a. Integral a => a -> a -> a
`mod` 26) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Char -> Int
forall a. Enum a => a -> Int
fromEnum 'a') Char -> ShowS
forall a. a -> [a] -> [a]
: Int -> String
forall a. Show a => a -> String
show (Int
x Int -> Int -> Int
forall a. Integral a => a -> a -> a
`div` 26)
show (UVal x :: Int
x) = Int -> String
forall a. Show a => a -> String
show Int
x
data UConstraint = ULT UExp UExp
| ULE UExp UExp
deriving (UConstraint -> UConstraint -> Bool
(UConstraint -> UConstraint -> Bool)
-> (UConstraint -> UConstraint -> Bool) -> Eq UConstraint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UConstraint -> UConstraint -> Bool
$c/= :: UConstraint -> UConstraint -> Bool
== :: UConstraint -> UConstraint -> Bool
$c== :: UConstraint -> UConstraint -> Bool
Eq, Eq UConstraint
Eq UConstraint =>
(UConstraint -> UConstraint -> Ordering)
-> (UConstraint -> UConstraint -> Bool)
-> (UConstraint -> UConstraint -> Bool)
-> (UConstraint -> UConstraint -> Bool)
-> (UConstraint -> UConstraint -> Bool)
-> (UConstraint -> UConstraint -> UConstraint)
-> (UConstraint -> UConstraint -> UConstraint)
-> Ord UConstraint
UConstraint -> UConstraint -> Bool
UConstraint -> UConstraint -> Ordering
UConstraint -> UConstraint -> UConstraint
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: UConstraint -> UConstraint -> UConstraint
$cmin :: UConstraint -> UConstraint -> UConstraint
max :: UConstraint -> UConstraint -> UConstraint
$cmax :: UConstraint -> UConstraint -> UConstraint
>= :: UConstraint -> UConstraint -> Bool
$c>= :: UConstraint -> UConstraint -> Bool
> :: UConstraint -> UConstraint -> Bool
$c> :: UConstraint -> UConstraint -> Bool
<= :: UConstraint -> UConstraint -> Bool
$c<= :: UConstraint -> UConstraint -> Bool
< :: UConstraint -> UConstraint -> Bool
$c< :: UConstraint -> UConstraint -> Bool
compare :: UConstraint -> UConstraint -> Ordering
$ccompare :: UConstraint -> UConstraint -> Ordering
$cp1Ord :: Eq UConstraint
Ord, Typeable UConstraint
Constr
DataType
Typeable UConstraint =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UConstraint -> c UConstraint)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UConstraint)
-> (UConstraint -> Constr)
-> (UConstraint -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UConstraint))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UConstraint))
-> ((forall b. Data b => b -> b) -> UConstraint -> UConstraint)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UConstraint -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UConstraint -> r)
-> (forall u. (forall d. Data d => d -> u) -> UConstraint -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> UConstraint -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UConstraint -> m UConstraint)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UConstraint -> m UConstraint)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UConstraint -> m UConstraint)
-> Data UConstraint
UConstraint -> Constr
UConstraint -> DataType
(forall b. Data b => b -> b) -> UConstraint -> UConstraint
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UConstraint -> c UConstraint
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UConstraint
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) -> UConstraint -> u
forall u. (forall d. Data d => d -> u) -> UConstraint -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UConstraint -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UConstraint -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UConstraint -> m UConstraint
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UConstraint -> m UConstraint
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UConstraint
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UConstraint -> c UConstraint
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UConstraint)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UConstraint)
$cULE :: Constr
$cULT :: Constr
$tUConstraint :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> UConstraint -> m UConstraint
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UConstraint -> m UConstraint
gmapMp :: (forall d. Data d => d -> m d) -> UConstraint -> m UConstraint
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> UConstraint -> m UConstraint
gmapM :: (forall d. Data d => d -> m d) -> UConstraint -> m UConstraint
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> UConstraint -> m UConstraint
gmapQi :: Int -> (forall d. Data d => d -> u) -> UConstraint -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> UConstraint -> u
gmapQ :: (forall d. Data d => d -> u) -> UConstraint -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UConstraint -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UConstraint -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UConstraint -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UConstraint -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UConstraint -> r
gmapT :: (forall b. Data b => b -> b) -> UConstraint -> UConstraint
$cgmapT :: (forall b. Data b => b -> b) -> UConstraint -> UConstraint
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UConstraint)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UConstraint)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c UConstraint)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UConstraint)
dataTypeOf :: UConstraint -> DataType
$cdataTypeOf :: UConstraint -> DataType
toConstr :: UConstraint -> Constr
$ctoConstr :: UConstraint -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UConstraint
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UConstraint
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UConstraint -> c UConstraint
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UConstraint -> c UConstraint
$cp1Data :: Typeable UConstraint
Data, (forall x. UConstraint -> Rep UConstraint x)
-> (forall x. Rep UConstraint x -> UConstraint)
-> Generic UConstraint
forall x. Rep UConstraint x -> UConstraint
forall x. UConstraint -> Rep UConstraint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UConstraint x -> UConstraint
$cfrom :: forall x. UConstraint -> Rep UConstraint x
Generic, Typeable)
data ConstraintFC = ConstraintFC { ConstraintFC -> UConstraint
uconstraint :: UConstraint,
ConstraintFC -> FC
ufc :: FC }
deriving (Int -> ConstraintFC -> ShowS
[ConstraintFC] -> ShowS
ConstraintFC -> String
(Int -> ConstraintFC -> ShowS)
-> (ConstraintFC -> String)
-> ([ConstraintFC] -> ShowS)
-> Show ConstraintFC
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConstraintFC] -> ShowS
$cshowList :: [ConstraintFC] -> ShowS
show :: ConstraintFC -> String
$cshow :: ConstraintFC -> String
showsPrec :: Int -> ConstraintFC -> ShowS
$cshowsPrec :: Int -> ConstraintFC -> ShowS
Show, Typeable ConstraintFC
Constr
DataType
Typeable ConstraintFC =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstraintFC -> c ConstraintFC)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConstraintFC)
-> (ConstraintFC -> Constr)
-> (ConstraintFC -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ConstraintFC))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ConstraintFC))
-> ((forall b. Data b => b -> b) -> ConstraintFC -> ConstraintFC)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstraintFC -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstraintFC -> r)
-> (forall u. (forall d. Data d => d -> u) -> ConstraintFC -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ConstraintFC -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC)
-> Data ConstraintFC
ConstraintFC -> Constr
ConstraintFC -> DataType
(forall b. Data b => b -> b) -> ConstraintFC -> ConstraintFC
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstraintFC -> c ConstraintFC
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConstraintFC
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) -> ConstraintFC -> u
forall u. (forall d. Data d => d -> u) -> ConstraintFC -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstraintFC -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstraintFC -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConstraintFC
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstraintFC -> c ConstraintFC
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ConstraintFC)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ConstraintFC)
$cConstraintFC :: Constr
$tConstraintFC :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC
gmapMp :: (forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC
gmapM :: (forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConstraintFC -> m ConstraintFC
gmapQi :: Int -> (forall d. Data d => d -> u) -> ConstraintFC -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ConstraintFC -> u
gmapQ :: (forall d. Data d => d -> u) -> ConstraintFC -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ConstraintFC -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstraintFC -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstraintFC -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstraintFC -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstraintFC -> r
gmapT :: (forall b. Data b => b -> b) -> ConstraintFC -> ConstraintFC
$cgmapT :: (forall b. Data b => b -> b) -> ConstraintFC -> ConstraintFC
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ConstraintFC)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ConstraintFC)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ConstraintFC)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ConstraintFC)
dataTypeOf :: ConstraintFC -> DataType
$cdataTypeOf :: ConstraintFC -> DataType
toConstr :: ConstraintFC -> Constr
$ctoConstr :: ConstraintFC -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConstraintFC
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConstraintFC
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstraintFC -> c ConstraintFC
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstraintFC -> c ConstraintFC
$cp1Data :: Typeable ConstraintFC
Data, (forall x. ConstraintFC -> Rep ConstraintFC x)
-> (forall x. Rep ConstraintFC x -> ConstraintFC)
-> Generic ConstraintFC
forall x. Rep ConstraintFC x -> ConstraintFC
forall x. ConstraintFC -> Rep ConstraintFC x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConstraintFC x -> ConstraintFC
$cfrom :: forall x. ConstraintFC -> Rep ConstraintFC x
Generic, Typeable)
instance Eq ConstraintFC where
x :: ConstraintFC
x == :: ConstraintFC -> ConstraintFC -> Bool
== y :: ConstraintFC
y = ConstraintFC -> UConstraint
uconstraint ConstraintFC
x UConstraint -> UConstraint -> Bool
forall a. Eq a => a -> a -> Bool
== ConstraintFC -> UConstraint
uconstraint ConstraintFC
y
instance Ord ConstraintFC where
compare :: ConstraintFC -> ConstraintFC -> Ordering
compare x :: ConstraintFC
x y :: ConstraintFC
y = UConstraint -> UConstraint -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (ConstraintFC -> UConstraint
uconstraint ConstraintFC
x) (ConstraintFC -> UConstraint
uconstraint ConstraintFC
y)
instance Show UConstraint where
show :: UConstraint -> String
show (ULT x :: UExp
x y :: UExp
y) = UExp -> String
forall a. Show a => a -> String
show UExp
x String -> ShowS
forall a. [a] -> [a] -> [a]
++ " < " String -> ShowS
forall a. [a] -> [a] -> [a]
++ UExp -> String
forall a. Show a => a -> String
show UExp
y
show (ULE x :: UExp
x y :: UExp
y) = UExp -> String
forall a. Show a => a -> String
show UExp
x String -> ShowS
forall a. [a] -> [a] -> [a]
++ " <= " String -> ShowS
forall a. [a] -> [a] -> [a]
++ UExp -> String
forall a. Show a => a -> String
show UExp
y
type UCs = (Int, [UConstraint])
data NameType = Bound
| Ref
| DCon {NameType -> Int
nt_tag :: Int, NameType -> Int
nt_arity :: Int, NameType -> Bool
nt_unique :: Bool}
| TCon {nt_tag :: Int, nt_arity :: Int}
deriving (Int -> NameType -> ShowS
[NameType] -> ShowS
NameType -> String
(Int -> NameType -> ShowS)
-> (NameType -> String) -> ([NameType] -> ShowS) -> Show NameType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NameType] -> ShowS
$cshowList :: [NameType] -> ShowS
show :: NameType -> String
$cshow :: NameType -> String
showsPrec :: Int -> NameType -> ShowS
$cshowsPrec :: Int -> NameType -> ShowS
Show, Eq NameType
Eq NameType =>
(NameType -> NameType -> Ordering)
-> (NameType -> NameType -> Bool)
-> (NameType -> NameType -> Bool)
-> (NameType -> NameType -> Bool)
-> (NameType -> NameType -> Bool)
-> (NameType -> NameType -> NameType)
-> (NameType -> NameType -> NameType)
-> Ord NameType
NameType -> NameType -> Bool
NameType -> NameType -> Ordering
NameType -> NameType -> NameType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: NameType -> NameType -> NameType
$cmin :: NameType -> NameType -> NameType
max :: NameType -> NameType -> NameType
$cmax :: NameType -> NameType -> NameType
>= :: NameType -> NameType -> Bool
$c>= :: NameType -> NameType -> Bool
> :: NameType -> NameType -> Bool
$c> :: NameType -> NameType -> Bool
<= :: NameType -> NameType -> Bool
$c<= :: NameType -> NameType -> Bool
< :: NameType -> NameType -> Bool
$c< :: NameType -> NameType -> Bool
compare :: NameType -> NameType -> Ordering
$ccompare :: NameType -> NameType -> Ordering
$cp1Ord :: Eq NameType
Ord, Typeable NameType
Constr
DataType
Typeable NameType =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameType -> c NameType)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameType)
-> (NameType -> Constr)
-> (NameType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NameType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameType))
-> ((forall b. Data b => b -> b) -> NameType -> NameType)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r)
-> (forall u. (forall d. Data d => d -> u) -> NameType -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> NameType -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType)
-> Data NameType
NameType -> Constr
NameType -> DataType
(forall b. Data b => b -> b) -> NameType -> NameType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameType -> c NameType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameType
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) -> NameType -> u
forall u. (forall d. Data d => d -> u) -> NameType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameType -> c NameType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NameType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameType)
$cTCon :: Constr
$cDCon :: Constr
$cRef :: Constr
$cBound :: Constr
$tNameType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NameType -> m NameType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType
gmapMp :: (forall d. Data d => d -> m d) -> NameType -> m NameType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType
gmapM :: (forall d. Data d => d -> m d) -> NameType -> m NameType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType
gmapQi :: Int -> (forall d. Data d => d -> u) -> NameType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NameType -> u
gmapQ :: (forall d. Data d => d -> u) -> NameType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NameType -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
gmapT :: (forall b. Data b => b -> b) -> NameType -> NameType
$cgmapT :: (forall b. Data b => b -> b) -> NameType -> NameType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c NameType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NameType)
dataTypeOf :: NameType -> DataType
$cdataTypeOf :: NameType -> DataType
toConstr :: NameType -> Constr
$ctoConstr :: NameType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameType -> c NameType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameType -> c NameType
$cp1Data :: Typeable NameType
Data, (forall x. NameType -> Rep NameType x)
-> (forall x. Rep NameType x -> NameType) -> Generic NameType
forall x. Rep NameType x -> NameType
forall x. NameType -> Rep NameType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NameType x -> NameType
$cfrom :: forall x. NameType -> Rep NameType x
Generic, Typeable)
instance Sized NameType where
size :: NameType -> Int
size _ = 1
instance Pretty NameType OutputAnnotation where
pretty :: NameType -> Doc OutputAnnotation
pretty = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation)
-> (NameType -> String) -> NameType -> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NameType -> String
forall a. Show a => a -> String
show
instance Eq NameType where
Bound == :: NameType -> NameType -> Bool
== Bound = Bool
True
Ref == Ref = Bool
True
DCon _ a :: Int
a _ == DCon _ b :: Int
b _ = (Int
a Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
b)
TCon _ a :: Int
a == TCon _ b :: Int
b = (Int
a Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
b)
_ == _ = Bool
False
data AppStatus n = Complete
| MaybeHoles
| Holes [n]
deriving (AppStatus n -> AppStatus n -> Bool
(AppStatus n -> AppStatus n -> Bool)
-> (AppStatus n -> AppStatus n -> Bool) -> Eq (AppStatus n)
forall n. Eq n => AppStatus n -> AppStatus n -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppStatus n -> AppStatus n -> Bool
$c/= :: forall n. Eq n => AppStatus n -> AppStatus n -> Bool
== :: AppStatus n -> AppStatus n -> Bool
$c== :: forall n. Eq n => AppStatus n -> AppStatus n -> Bool
Eq, Eq (AppStatus n)
Eq (AppStatus n) =>
(AppStatus n -> AppStatus n -> Ordering)
-> (AppStatus n -> AppStatus n -> Bool)
-> (AppStatus n -> AppStatus n -> Bool)
-> (AppStatus n -> AppStatus n -> Bool)
-> (AppStatus n -> AppStatus n -> Bool)
-> (AppStatus n -> AppStatus n -> AppStatus n)
-> (AppStatus n -> AppStatus n -> AppStatus n)
-> Ord (AppStatus n)
AppStatus n -> AppStatus n -> Bool
AppStatus n -> AppStatus n -> Ordering
AppStatus n -> AppStatus n -> AppStatus n
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall n. Ord n => Eq (AppStatus n)
forall n. Ord n => AppStatus n -> AppStatus n -> Bool
forall n. Ord n => AppStatus n -> AppStatus n -> Ordering
forall n. Ord n => AppStatus n -> AppStatus n -> AppStatus n
min :: AppStatus n -> AppStatus n -> AppStatus n
$cmin :: forall n. Ord n => AppStatus n -> AppStatus n -> AppStatus n
max :: AppStatus n -> AppStatus n -> AppStatus n
$cmax :: forall n. Ord n => AppStatus n -> AppStatus n -> AppStatus n
>= :: AppStatus n -> AppStatus n -> Bool
$c>= :: forall n. Ord n => AppStatus n -> AppStatus n -> Bool
> :: AppStatus n -> AppStatus n -> Bool
$c> :: forall n. Ord n => AppStatus n -> AppStatus n -> Bool
<= :: AppStatus n -> AppStatus n -> Bool
$c<= :: forall n. Ord n => AppStatus n -> AppStatus n -> Bool
< :: AppStatus n -> AppStatus n -> Bool
$c< :: forall n. Ord n => AppStatus n -> AppStatus n -> Bool
compare :: AppStatus n -> AppStatus n -> Ordering
$ccompare :: forall n. Ord n => AppStatus n -> AppStatus n -> Ordering
$cp1Ord :: forall n. Ord n => Eq (AppStatus n)
Ord, a -> AppStatus b -> AppStatus a
(a -> b) -> AppStatus a -> AppStatus b
(forall a b. (a -> b) -> AppStatus a -> AppStatus b)
-> (forall a b. a -> AppStatus b -> AppStatus a)
-> Functor AppStatus
forall a b. a -> AppStatus b -> AppStatus a
forall a b. (a -> b) -> AppStatus a -> AppStatus b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> AppStatus b -> AppStatus a
$c<$ :: forall a b. a -> AppStatus b -> AppStatus a
fmap :: (a -> b) -> AppStatus a -> AppStatus b
$cfmap :: forall a b. (a -> b) -> AppStatus a -> AppStatus b
Functor, Typeable (AppStatus n)
Constr
DataType
Typeable (AppStatus n) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AppStatus n -> c (AppStatus n))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AppStatus n))
-> (AppStatus n -> Constr)
-> (AppStatus n -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (AppStatus n)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AppStatus n)))
-> ((forall b. Data b => b -> b) -> AppStatus n -> AppStatus n)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AppStatus n -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AppStatus n -> r)
-> (forall u. (forall d. Data d => d -> u) -> AppStatus n -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> AppStatus n -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n))
-> Data (AppStatus n)
AppStatus n -> Constr
AppStatus n -> DataType
(forall d. Data d => c (t d)) -> Maybe (c (AppStatus n))
(forall b. Data b => b -> b) -> AppStatus n -> AppStatus n
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AppStatus n -> c (AppStatus n)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AppStatus n)
forall n. Data n => Typeable (AppStatus n)
forall n. Data n => AppStatus n -> Constr
forall n. Data n => AppStatus n -> DataType
forall n.
Data n =>
(forall b. Data b => b -> b) -> AppStatus n -> AppStatus n
forall n u.
Data n =>
Int -> (forall d. Data d => d -> u) -> AppStatus n -> u
forall n u.
Data n =>
(forall d. Data d => d -> u) -> AppStatus n -> [u]
forall n r r'.
Data n =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AppStatus n -> r
forall n r r'.
Data n =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AppStatus n -> r
forall n (m :: * -> *).
(Data n, Monad m) =>
(forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n)
forall n (m :: * -> *).
(Data n, MonadPlus m) =>
(forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n)
forall n (c :: * -> *).
Data n =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AppStatus n)
forall n (c :: * -> *).
Data n =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AppStatus n -> c (AppStatus n)
forall n (t :: * -> *) (c :: * -> *).
(Data n, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (AppStatus n))
forall n (t :: * -> * -> *) (c :: * -> *).
(Data n, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AppStatus n))
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) -> AppStatus n -> u
forall u. (forall d. Data d => d -> u) -> AppStatus n -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AppStatus n -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AppStatus n -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AppStatus n)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AppStatus n -> c (AppStatus n)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (AppStatus n))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AppStatus n))
$cHoles :: Constr
$cMaybeHoles :: Constr
$cComplete :: Constr
$tAppStatus :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n)
$cgmapMo :: forall n (m :: * -> *).
(Data n, MonadPlus m) =>
(forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n)
gmapMp :: (forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n)
$cgmapMp :: forall n (m :: * -> *).
(Data n, MonadPlus m) =>
(forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n)
gmapM :: (forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n)
$cgmapM :: forall n (m :: * -> *).
(Data n, Monad m) =>
(forall d. Data d => d -> m d) -> AppStatus n -> m (AppStatus n)
gmapQi :: Int -> (forall d. Data d => d -> u) -> AppStatus n -> u
$cgmapQi :: forall n u.
Data n =>
Int -> (forall d. Data d => d -> u) -> AppStatus n -> u
gmapQ :: (forall d. Data d => d -> u) -> AppStatus n -> [u]
$cgmapQ :: forall n u.
Data n =>
(forall d. Data d => d -> u) -> AppStatus n -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AppStatus n -> r
$cgmapQr :: forall n r r'.
Data n =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> AppStatus n -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AppStatus n -> r
$cgmapQl :: forall n r r'.
Data n =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> AppStatus n -> r
gmapT :: (forall b. Data b => b -> b) -> AppStatus n -> AppStatus n
$cgmapT :: forall n.
Data n =>
(forall b. Data b => b -> b) -> AppStatus n -> AppStatus n
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AppStatus n))
$cdataCast2 :: forall n (t :: * -> * -> *) (c :: * -> *).
(Data n, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (AppStatus n))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (AppStatus n))
$cdataCast1 :: forall n (t :: * -> *) (c :: * -> *).
(Data n, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (AppStatus n))
dataTypeOf :: AppStatus n -> DataType
$cdataTypeOf :: forall n. Data n => AppStatus n -> DataType
toConstr :: AppStatus n -> Constr
$ctoConstr :: forall n. Data n => AppStatus n -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AppStatus n)
$cgunfold :: forall n (c :: * -> *).
Data n =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (AppStatus n)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AppStatus n -> c (AppStatus n)
$cgfoldl :: forall n (c :: * -> *).
Data n =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> AppStatus n -> c (AppStatus n)
$cp1Data :: forall n. Data n => Typeable (AppStatus n)
Data, (forall x. AppStatus n -> Rep (AppStatus n) x)
-> (forall x. Rep (AppStatus n) x -> AppStatus n)
-> Generic (AppStatus n)
forall x. Rep (AppStatus n) x -> AppStatus n
forall x. AppStatus n -> Rep (AppStatus n) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall n x. Rep (AppStatus n) x -> AppStatus n
forall n x. AppStatus n -> Rep (AppStatus n) x
$cto :: forall n x. Rep (AppStatus n) x -> AppStatus n
$cfrom :: forall n x. AppStatus n -> Rep (AppStatus n) x
Generic, Typeable, Int -> AppStatus n -> ShowS
[AppStatus n] -> ShowS
AppStatus n -> String
(Int -> AppStatus n -> ShowS)
-> (AppStatus n -> String)
-> ([AppStatus n] -> ShowS)
-> Show (AppStatus n)
forall n. Show n => Int -> AppStatus n -> ShowS
forall n. Show n => [AppStatus n] -> ShowS
forall n. Show n => AppStatus n -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppStatus n] -> ShowS
$cshowList :: forall n. Show n => [AppStatus n] -> ShowS
show :: AppStatus n -> String
$cshow :: forall n. Show n => AppStatus n -> String
showsPrec :: Int -> AppStatus n -> ShowS
$cshowsPrec :: forall n. Show n => Int -> AppStatus n -> ShowS
Show)
data TT n = P NameType n (TT n)
| V !Int
| Bind n !(Binder (TT n)) (TT n)
| App (AppStatus n) !(TT n) (TT n)
| Constant Const
| Proj (TT n) !Int
| Erased
| Impossible
| Inferred (TT n)
| TType UExp
| UType Universe
deriving (Eq (TT n)
Eq (TT n) =>
(TT n -> TT n -> Ordering)
-> (TT n -> TT n -> Bool)
-> (TT n -> TT n -> Bool)
-> (TT n -> TT n -> Bool)
-> (TT n -> TT n -> Bool)
-> (TT n -> TT n -> TT n)
-> (TT n -> TT n -> TT n)
-> Ord (TT n)
TT n -> TT n -> Bool
TT n -> TT n -> Ordering
TT n -> TT n -> TT n
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall n. Ord n => Eq (TT n)
forall n. Ord n => TT n -> TT n -> Bool
forall n. Ord n => TT n -> TT n -> Ordering
forall n. Ord n => TT n -> TT n -> TT n
min :: TT n -> TT n -> TT n
$cmin :: forall n. Ord n => TT n -> TT n -> TT n
max :: TT n -> TT n -> TT n
$cmax :: forall n. Ord n => TT n -> TT n -> TT n
>= :: TT n -> TT n -> Bool
$c>= :: forall n. Ord n => TT n -> TT n -> Bool
> :: TT n -> TT n -> Bool
$c> :: forall n. Ord n => TT n -> TT n -> Bool
<= :: TT n -> TT n -> Bool
$c<= :: forall n. Ord n => TT n -> TT n -> Bool
< :: TT n -> TT n -> Bool
$c< :: forall n. Ord n => TT n -> TT n -> Bool
compare :: TT n -> TT n -> Ordering
$ccompare :: forall n. Ord n => TT n -> TT n -> Ordering
$cp1Ord :: forall n. Ord n => Eq (TT n)
Ord, a -> TT b -> TT a
(a -> b) -> TT a -> TT b
(forall a b. (a -> b) -> TT a -> TT b)
-> (forall a b. a -> TT b -> TT a) -> Functor TT
forall a b. a -> TT b -> TT a
forall a b. (a -> b) -> TT a -> TT b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> TT b -> TT a
$c<$ :: forall a b. a -> TT b -> TT a
fmap :: (a -> b) -> TT a -> TT b
$cfmap :: forall a b. (a -> b) -> TT a -> TT b
Functor, Typeable (TT n)
Constr
DataType
Typeable (TT n) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TT n -> c (TT n))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TT n))
-> (TT n -> Constr)
-> (TT n -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (TT n)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (TT n)))
-> ((forall b. Data b => b -> b) -> TT n -> TT n)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TT n -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TT n -> r)
-> (forall u. (forall d. Data d => d -> u) -> TT n -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> TT n -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TT n -> m (TT n))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TT n -> m (TT n))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TT n -> m (TT n))
-> Data (TT n)
TT n -> Constr
TT n -> DataType
(forall d. Data d => c (t d)) -> Maybe (c (TT n))
(forall b. Data b => b -> b) -> TT n -> TT n
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TT n -> c (TT n)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TT n)
forall n. Data n => Typeable (TT n)
forall n. Data n => TT n -> Constr
forall n. Data n => TT n -> DataType
forall n. Data n => (forall b. Data b => b -> b) -> TT n -> TT n
forall n u.
Data n =>
Int -> (forall d. Data d => d -> u) -> TT n -> u
forall n u. Data n => (forall d. Data d => d -> u) -> TT n -> [u]
forall n r r'.
Data n =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TT n -> r
forall n r r'.
Data n =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TT n -> r
forall n (m :: * -> *).
(Data n, Monad m) =>
(forall d. Data d => d -> m d) -> TT n -> m (TT n)
forall n (m :: * -> *).
(Data n, MonadPlus m) =>
(forall d. Data d => d -> m d) -> TT n -> m (TT n)
forall n (c :: * -> *).
Data n =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TT n)
forall n (c :: * -> *).
Data n =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TT n -> c (TT n)
forall n (t :: * -> *) (c :: * -> *).
(Data n, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (TT n))
forall n (t :: * -> * -> *) (c :: * -> *).
(Data n, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (TT n))
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) -> TT n -> u
forall u. (forall d. Data d => d -> u) -> TT n -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TT n -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TT n -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TT n -> m (TT n)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TT n -> m (TT n)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TT n)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TT n -> c (TT n)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (TT n))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (TT n))
$cUType :: Constr
$cTType :: Constr
$cInferred :: Constr
$cImpossible :: Constr
$cErased :: Constr
$cProj :: Constr
$cConstant :: Constr
$cApp :: Constr
$cBind :: Constr
$cV :: Constr
$cP :: Constr
$tTT :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> TT n -> m (TT n)
$cgmapMo :: forall n (m :: * -> *).
(Data n, MonadPlus m) =>
(forall d. Data d => d -> m d) -> TT n -> m (TT n)
gmapMp :: (forall d. Data d => d -> m d) -> TT n -> m (TT n)
$cgmapMp :: forall n (m :: * -> *).
(Data n, MonadPlus m) =>
(forall d. Data d => d -> m d) -> TT n -> m (TT n)
gmapM :: (forall d. Data d => d -> m d) -> TT n -> m (TT n)
$cgmapM :: forall n (m :: * -> *).
(Data n, Monad m) =>
(forall d. Data d => d -> m d) -> TT n -> m (TT n)
gmapQi :: Int -> (forall d. Data d => d -> u) -> TT n -> u
$cgmapQi :: forall n u.
Data n =>
Int -> (forall d. Data d => d -> u) -> TT n -> u
gmapQ :: (forall d. Data d => d -> u) -> TT n -> [u]
$cgmapQ :: forall n u. Data n => (forall d. Data d => d -> u) -> TT n -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TT n -> r
$cgmapQr :: forall n r r'.
Data n =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TT n -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TT n -> r
$cgmapQl :: forall n r r'.
Data n =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TT n -> r
gmapT :: (forall b. Data b => b -> b) -> TT n -> TT n
$cgmapT :: forall n. Data n => (forall b. Data b => b -> b) -> TT n -> TT n
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (TT n))
$cdataCast2 :: forall n (t :: * -> * -> *) (c :: * -> *).
(Data n, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (TT n))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (TT n))
$cdataCast1 :: forall n (t :: * -> *) (c :: * -> *).
(Data n, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (TT n))
dataTypeOf :: TT n -> DataType
$cdataTypeOf :: forall n. Data n => TT n -> DataType
toConstr :: TT n -> Constr
$ctoConstr :: forall n. Data n => TT n -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TT n)
$cgunfold :: forall n (c :: * -> *).
Data n =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (TT n)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TT n -> c (TT n)
$cgfoldl :: forall n (c :: * -> *).
Data n =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TT n -> c (TT n)
$cp1Data :: forall n. Data n => Typeable (TT n)
Data, (forall x. TT n -> Rep (TT n) x)
-> (forall x. Rep (TT n) x -> TT n) -> Generic (TT n)
forall x. Rep (TT n) x -> TT n
forall x. TT n -> Rep (TT n) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall n x. Rep (TT n) x -> TT n
forall n x. TT n -> Rep (TT n) x
$cto :: forall n x. Rep (TT n) x -> TT n
$cfrom :: forall n x. TT n -> Rep (TT n) x
Generic, Typeable)
class TermSize a where
termsize :: Name -> a -> Int
instance TermSize a => TermSize [a] where
termsize :: Name -> [a] -> Int
termsize n :: Name
n [] = 0
termsize n :: Name
n (x :: a
x : xs :: [a]
xs) = Name -> a -> Int
forall a. TermSize a => Name -> a -> Int
termsize Name
n a
x Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Name -> [a] -> Int
forall a. TermSize a => Name -> a -> Int
termsize Name
n [a]
xs
instance TermSize (TT Name) where
termsize :: Name -> Term -> Int
termsize n :: Name
n (P _ n' :: Name
n' _)
| Name
n' Name -> Name -> Bool
forall a. Eq a => a -> a -> Bool
== Name
n = 1000000
| Name -> Bool
caseName Name
n' = 1000000
| Bool
otherwise = 1
termsize n :: Name
n (V _) = 1
termsize n :: Name
n (Bind n' :: Name
n' (Let c :: RigCount
c t :: Term
t v :: Term
v) sc :: Term
sc)
= let rn :: Name
rn = if Name
n Name -> Name -> Bool
forall a. Eq a => a -> a -> Bool
== Name
n' then Int -> String -> Name
sMN 0 "noname" else Name
n in
Name -> Term -> Int
forall a. TermSize a => Name -> a -> Int
termsize Name
rn Term
v Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Name -> Term -> Int
forall a. TermSize a => Name -> a -> Int
termsize Name
rn Term
sc
termsize n :: Name
n (Bind n' :: Name
n' b :: Binder Term
b sc :: Term
sc)
= let rn :: Name
rn = if Name
n Name -> Name -> Bool
forall a. Eq a => a -> a -> Bool
== Name
n' then Int -> String -> Name
sMN 0 "noname" else Name
n in
Name -> Term -> Int
forall a. TermSize a => Name -> a -> Int
termsize Name
rn Term
sc
termsize n :: Name
n (App _ f :: Term
f a :: Term
a) = Name -> Term -> Int
forall a. TermSize a => Name -> a -> Int
termsize Name
n Term
f Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Name -> Term -> Int
forall a. TermSize a => Name -> a -> Int
termsize Name
n Term
a
termsize n :: Name
n (Proj t :: Term
t i :: Int
i) = Name -> Term -> Int
forall a. TermSize a => Name -> a -> Int
termsize Name
n Term
t
termsize n :: Name
n _ = 1
instance Sized Universe where
size :: Universe -> Int
size u :: Universe
u = 1
instance Sized a => Sized (TT a) where
size :: TT a -> Int
size (P name :: NameType
name n :: a
n trm :: TT a
trm) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ NameType -> Int
forall a. Sized a => a -> Int
size NameType
name Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ TT a -> Int
forall a. Sized a => a -> Int
size TT a
trm
size (V v :: Int
v) = 1
size (Bind nm :: a
nm binder :: Binder (TT a)
binder bdy :: TT a
bdy) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ a -> Int
forall a. Sized a => a -> Int
size a
nm Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Binder (TT a) -> Int
forall a. Sized a => a -> Int
size Binder (TT a)
binder Int -> Int -> Int
forall a. Num a => a -> a -> a
+ TT a -> Int
forall a. Sized a => a -> Int
size TT a
bdy
size (App _ l :: TT a
l r :: TT a
r) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ TT a -> Int
forall a. Sized a => a -> Int
size TT a
l Int -> Int -> Int
forall a. Num a => a -> a -> a
+ TT a -> Int
forall a. Sized a => a -> Int
size TT a
r
size (Constant c :: Const
c) = Const -> Int
forall a. Sized a => a -> Int
size Const
c
size Erased = 1
size (TType u :: UExp
u) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ UExp -> Int
forall a. Sized a => a -> Int
size UExp
u
size (Proj a :: TT a
a _) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ TT a -> Int
forall a. Sized a => a -> Int
size TT a
a
size Impossible = 1
size (Inferred t :: TT a
t) = TT a -> Int
forall a. Sized a => a -> Int
size TT a
t
size (UType u :: Universe
u) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Universe -> Int
forall a. Sized a => a -> Int
size Universe
u
instance Pretty a o => Pretty (TT a) o where
pretty :: TT a -> Doc o
pretty _ = String -> Doc o
forall a. String -> Doc a
text "test"
data RigCount = Rig0 | Rig1 | RigW
deriving (Int -> RigCount -> ShowS
[RigCount] -> ShowS
RigCount -> String
(Int -> RigCount -> ShowS)
-> (RigCount -> String) -> ([RigCount] -> ShowS) -> Show RigCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RigCount] -> ShowS
$cshowList :: [RigCount] -> ShowS
show :: RigCount -> String
$cshow :: RigCount -> String
showsPrec :: Int -> RigCount -> ShowS
$cshowsPrec :: Int -> RigCount -> ShowS
Show, RigCount -> RigCount -> Bool
(RigCount -> RigCount -> Bool)
-> (RigCount -> RigCount -> Bool) -> Eq RigCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RigCount -> RigCount -> Bool
$c/= :: RigCount -> RigCount -> Bool
== :: RigCount -> RigCount -> Bool
$c== :: RigCount -> RigCount -> Bool
Eq, Eq RigCount
Eq RigCount =>
(RigCount -> RigCount -> Ordering)
-> (RigCount -> RigCount -> Bool)
-> (RigCount -> RigCount -> Bool)
-> (RigCount -> RigCount -> Bool)
-> (RigCount -> RigCount -> Bool)
-> (RigCount -> RigCount -> RigCount)
-> (RigCount -> RigCount -> RigCount)
-> Ord RigCount
RigCount -> RigCount -> Bool
RigCount -> RigCount -> Ordering
RigCount -> RigCount -> RigCount
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: RigCount -> RigCount -> RigCount
$cmin :: RigCount -> RigCount -> RigCount
max :: RigCount -> RigCount -> RigCount
$cmax :: RigCount -> RigCount -> RigCount
>= :: RigCount -> RigCount -> Bool
$c>= :: RigCount -> RigCount -> Bool
> :: RigCount -> RigCount -> Bool
$c> :: RigCount -> RigCount -> Bool
<= :: RigCount -> RigCount -> Bool
$c<= :: RigCount -> RigCount -> Bool
< :: RigCount -> RigCount -> Bool
$c< :: RigCount -> RigCount -> Bool
compare :: RigCount -> RigCount -> Ordering
$ccompare :: RigCount -> RigCount -> Ordering
$cp1Ord :: Eq RigCount
Ord, Typeable RigCount
Constr
DataType
Typeable RigCount =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RigCount -> c RigCount)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RigCount)
-> (RigCount -> Constr)
-> (RigCount -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RigCount))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RigCount))
-> ((forall b. Data b => b -> b) -> RigCount -> RigCount)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RigCount -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RigCount -> r)
-> (forall u. (forall d. Data d => d -> u) -> RigCount -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> RigCount -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RigCount -> m RigCount)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RigCount -> m RigCount)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RigCount -> m RigCount)
-> Data RigCount
RigCount -> Constr
RigCount -> DataType
(forall b. Data b => b -> b) -> RigCount -> RigCount
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RigCount -> c RigCount
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RigCount
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) -> RigCount -> u
forall u. (forall d. Data d => d -> u) -> RigCount -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RigCount -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RigCount -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RigCount -> m RigCount
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RigCount -> m RigCount
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RigCount
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RigCount -> c RigCount
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RigCount)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RigCount)
$cRigW :: Constr
$cRig1 :: Constr
$cRig0 :: Constr
$tRigCount :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> RigCount -> m RigCount
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RigCount -> m RigCount
gmapMp :: (forall d. Data d => d -> m d) -> RigCount -> m RigCount
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RigCount -> m RigCount
gmapM :: (forall d. Data d => d -> m d) -> RigCount -> m RigCount
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RigCount -> m RigCount
gmapQi :: Int -> (forall d. Data d => d -> u) -> RigCount -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> RigCount -> u
gmapQ :: (forall d. Data d => d -> u) -> RigCount -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> RigCount -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RigCount -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RigCount -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RigCount -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RigCount -> r
gmapT :: (forall b. Data b => b -> b) -> RigCount -> RigCount
$cgmapT :: (forall b. Data b => b -> b) -> RigCount -> RigCount
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RigCount)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RigCount)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c RigCount)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RigCount)
dataTypeOf :: RigCount -> DataType
$cdataTypeOf :: RigCount -> DataType
toConstr :: RigCount -> Constr
$ctoConstr :: RigCount -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RigCount
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RigCount
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RigCount -> c RigCount
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RigCount -> c RigCount
$cp1Data :: Typeable RigCount
Data, (forall x. RigCount -> Rep RigCount x)
-> (forall x. Rep RigCount x -> RigCount) -> Generic RigCount
forall x. Rep RigCount x -> RigCount
forall x. RigCount -> Rep RigCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RigCount x -> RigCount
$cfrom :: forall x. RigCount -> Rep RigCount x
Generic, Typeable)
rigPlus :: RigCount -> RigCount -> RigCount
rigPlus :: RigCount -> RigCount -> RigCount
rigPlus Rig0 Rig0 = RigCount
Rig0
rigPlus Rig0 Rig1 = RigCount
Rig1
rigPlus Rig0 RigW = RigCount
RigW
rigPlus Rig1 Rig0 = RigCount
Rig1
rigPlus Rig1 Rig1 = RigCount
RigW
rigPlus Rig1 RigW = RigCount
RigW
rigPlus RigW Rig0 = RigCount
RigW
rigPlus RigW Rig1 = RigCount
RigW
rigPlus RigW RigW = RigCount
RigW
rigMult :: RigCount -> RigCount -> RigCount
rigMult :: RigCount -> RigCount -> RigCount
rigMult Rig0 Rig0 = RigCount
Rig0
rigMult Rig0 Rig1 = RigCount
Rig0
rigMult Rig0 RigW = RigCount
Rig0
rigMult Rig1 Rig0 = RigCount
Rig0
rigMult Rig1 Rig1 = RigCount
Rig1
rigMult Rig1 RigW = RigCount
RigW
rigMult RigW Rig0 = RigCount
Rig0
rigMult RigW Rig1 = RigCount
RigW
rigMult RigW RigW = RigCount
RigW
type EnvTT n = [(n, RigCount, Binder (TT n))]
fstEnv :: (a, b, c) -> a
fstEnv (n :: a
n, c :: b
c, b :: c
b) = a
n
rigEnv :: (a, b, c) -> b
rigEnv (n :: a
n, c :: b
c, b :: c
b) = b
c
sndEnv :: (a, b, c) -> c
sndEnv (n :: a
n, c :: b
c, b :: c
b) = c
b
envBinders :: [(a, b, b)] -> [(a, b)]
envBinders = ((a, b, b) -> (a, b)) -> [(a, b, b)] -> [(a, b)]
forall a b. (a -> b) -> [a] -> [b]
map (\(n :: a
n, _, b :: b
b) -> (a
n, b
b))
envZero :: [(a, b, c)] -> [(a, RigCount, c)]
envZero = ((a, b, c) -> (a, RigCount, c))
-> [(a, b, c)] -> [(a, RigCount, c)]
forall a b. (a -> b) -> [a] -> [b]
map (\(n :: a
n, _, b :: c
b) -> (a
n, RigCount
Rig0, c
b))
lookupBinder :: Eq n => n -> EnvTT n -> Maybe (Binder (TT n))
lookupBinder :: n -> EnvTT n -> Maybe (Binder (TT n))
lookupBinder n :: n
n = n -> [(n, Binder (TT n))] -> Maybe (Binder (TT n))
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup n
n ([(n, Binder (TT n))] -> Maybe (Binder (TT n)))
-> (EnvTT n -> [(n, Binder (TT n))])
-> EnvTT n
-> Maybe (Binder (TT n))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EnvTT n -> [(n, Binder (TT n))]
forall a b b. [(a, b, b)] -> [(a, b)]
envBinders
data Datatype n = Data { Datatype n -> n
d_typename :: n,
Datatype n -> Int
d_typetag :: Int,
Datatype n -> TT n
d_type :: (TT n),
Datatype n -> Bool
d_unique :: Bool,
Datatype n -> [(n, TT n)]
d_cons :: [(n, TT n)] }
deriving (Int -> Datatype n -> ShowS
[Datatype n] -> ShowS
Datatype n -> String
(Int -> Datatype n -> ShowS)
-> (Datatype n -> String)
-> ([Datatype n] -> ShowS)
-> Show (Datatype n)
forall n. (Show n, Eq n) => Int -> Datatype n -> ShowS
forall n. (Show n, Eq n) => [Datatype n] -> ShowS
forall n. (Show n, Eq n) => Datatype n -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Datatype n] -> ShowS
$cshowList :: forall n. (Show n, Eq n) => [Datatype n] -> ShowS
show :: Datatype n -> String
$cshow :: forall n. (Show n, Eq n) => Datatype n -> String
showsPrec :: Int -> Datatype n -> ShowS
$cshowsPrec :: forall n. (Show n, Eq n) => Int -> Datatype n -> ShowS
Show, a -> Datatype b -> Datatype a
(a -> b) -> Datatype a -> Datatype b
(forall a b. (a -> b) -> Datatype a -> Datatype b)
-> (forall a b. a -> Datatype b -> Datatype a) -> Functor Datatype
forall a b. a -> Datatype b -> Datatype a
forall a b. (a -> b) -> Datatype a -> Datatype b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Datatype b -> Datatype a
$c<$ :: forall a b. a -> Datatype b -> Datatype a
fmap :: (a -> b) -> Datatype a -> Datatype b
$cfmap :: forall a b. (a -> b) -> Datatype a -> Datatype b
Functor, Datatype n -> Datatype n -> Bool
(Datatype n -> Datatype n -> Bool)
-> (Datatype n -> Datatype n -> Bool) -> Eq (Datatype n)
forall n. Eq n => Datatype n -> Datatype n -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Datatype n -> Datatype n -> Bool
$c/= :: forall n. Eq n => Datatype n -> Datatype n -> Bool
== :: Datatype n -> Datatype n -> Bool
$c== :: forall n. Eq n => Datatype n -> Datatype n -> Bool
Eq)
data DataOpt = Codata
| DataErrRev
deriving (Int -> DataOpt -> ShowS
[DataOpt] -> ShowS
DataOpt -> String
(Int -> DataOpt -> ShowS)
-> (DataOpt -> String) -> ([DataOpt] -> ShowS) -> Show DataOpt
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataOpt] -> ShowS
$cshowList :: [DataOpt] -> ShowS
show :: DataOpt -> String
$cshow :: DataOpt -> String
showsPrec :: Int -> DataOpt -> ShowS
$cshowsPrec :: Int -> DataOpt -> ShowS
Show, DataOpt -> DataOpt -> Bool
(DataOpt -> DataOpt -> Bool)
-> (DataOpt -> DataOpt -> Bool) -> Eq DataOpt
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataOpt -> DataOpt -> Bool
$c/= :: DataOpt -> DataOpt -> Bool
== :: DataOpt -> DataOpt -> Bool
$c== :: DataOpt -> DataOpt -> Bool
Eq, (forall x. DataOpt -> Rep DataOpt x)
-> (forall x. Rep DataOpt x -> DataOpt) -> Generic DataOpt
forall x. Rep DataOpt x -> DataOpt
forall x. DataOpt -> Rep DataOpt x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataOpt x -> DataOpt
$cfrom :: forall x. DataOpt -> Rep DataOpt x
Generic)
type DataOpts = [DataOpt]
data TypeInfo = TI { TypeInfo -> [Name]
con_names :: [Name],
TypeInfo -> Bool
codata :: Bool,
TypeInfo -> [DataOpt]
data_opts :: DataOpts,
TypeInfo -> [Int]
param_pos :: [Int],
TypeInfo -> [Name]
mutual_types :: [Name],
TypeInfo -> Bool
linear_con :: Bool
}
deriving (Int -> TypeInfo -> ShowS
[TypeInfo] -> ShowS
TypeInfo -> String
(Int -> TypeInfo -> ShowS)
-> (TypeInfo -> String) -> ([TypeInfo] -> ShowS) -> Show TypeInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypeInfo] -> ShowS
$cshowList :: [TypeInfo] -> ShowS
show :: TypeInfo -> String
$cshow :: TypeInfo -> String
showsPrec :: Int -> TypeInfo -> ShowS
$cshowsPrec :: Int -> TypeInfo -> ShowS
Show, (forall x. TypeInfo -> Rep TypeInfo x)
-> (forall x. Rep TypeInfo x -> TypeInfo) -> Generic TypeInfo
forall x. Rep TypeInfo x -> TypeInfo
forall x. TypeInfo -> Rep TypeInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TypeInfo x -> TypeInfo
$cfrom :: forall x. TypeInfo -> Rep TypeInfo x
Generic)
instance Eq n => Eq (TT n) where
== :: TT n -> TT n -> Bool
(==) (P xt :: NameType
xt x :: n
x _) (P yt :: NameType
yt y :: n
y _) = n
x n -> n -> Bool
forall a. Eq a => a -> a -> Bool
== n
y
(==) (V x :: Int
x) (V y :: Int
y) = Int
x Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
y
(==) (Bind _ xb :: Binder (TT n)
xb xs :: TT n
xs) (Bind _ yb :: Binder (TT n)
yb ys :: TT n
ys) = TT n
xs TT n -> TT n -> Bool
forall a. Eq a => a -> a -> Bool
== TT n
ys Bool -> Bool -> Bool
&& Binder (TT n)
xb Binder (TT n) -> Binder (TT n) -> Bool
forall a. Eq a => a -> a -> Bool
== Binder (TT n)
yb
(==) (App _ fx :: TT n
fx ax :: TT n
ax) (App _ fy :: TT n
fy ay :: TT n
ay) = TT n
ax TT n -> TT n -> Bool
forall a. Eq a => a -> a -> Bool
== TT n
ay Bool -> Bool -> Bool
&& TT n
fx TT n -> TT n -> Bool
forall a. Eq a => a -> a -> Bool
== TT n
fy
(==) (TType _) (TType _) = Bool
True
(==) (Constant x :: Const
x) (Constant y :: Const
y) = Const
x Const -> Const -> Bool
forall a. Eq a => a -> a -> Bool
== Const
y
(==) (Proj x :: TT n
x i :: Int
i) (Proj y :: TT n
y j :: Int
j) = TT n
x TT n -> TT n -> Bool
forall a. Eq a => a -> a -> Bool
== TT n
y Bool -> Bool -> Bool
&& Int
i Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
j
(==) Erased _ = Bool
True
(==) _ Erased = Bool
True
(==) _ _ = Bool
False
isInjective :: TT n -> Bool
isInjective :: TT n -> Bool
isInjective (P (DCon _ _ _) _ _) = Bool
True
isInjective (P (TCon _ _) _ _) = Bool
True
isInjective (Constant _) = Bool
True
isInjective (TType x :: UExp
x) = Bool
True
isInjective (Bind _ (Pi _ _ _ _) sc :: TT n
sc) = Bool
True
isInjective (App _ f :: TT n
f a :: TT n
a) = TT n -> Bool
forall n. TT n -> Bool
isInjective TT n
f
isInjective _ = Bool
False
instantiate :: TT n -> TT n -> TT n
instantiate :: TT n -> TT n -> TT n
instantiate e :: TT n
e = Int -> TT n -> TT n
subst 0 where
subst :: Int -> TT n -> TT n
subst i :: Int
i (P nt :: NameType
nt x :: n
x ty :: TT n
ty) = NameType -> n -> TT n -> TT n
forall n. NameType -> n -> TT n -> TT n
P NameType
nt n
x (Int -> TT n -> TT n
subst Int
i TT n
ty)
subst i :: Int
i (V x :: Int
x) | Int
i Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
x = TT n
e
subst i :: Int
i (Bind x :: n
x b :: Binder (TT n)
b sc :: TT n
sc) = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x ((TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Int -> TT n -> TT n
subst Int
i) Binder (TT n)
b) (Int -> TT n -> TT n
subst (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
+1) TT n
sc)
subst i :: Int
i (App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s (Int -> TT n -> TT n
subst Int
i TT n
f) (Int -> TT n -> TT n
subst Int
i TT n
a)
subst i :: Int
i (Proj x :: TT n
x idx :: Int
idx) = TT n -> Int -> TT n
forall n. TT n -> Int -> TT n
Proj (Int -> TT n -> TT n
subst Int
i TT n
x) Int
idx
subst i :: Int
i t :: TT n
t = TT n
t
substV :: TT n -> TT n -> TT n
substV :: TT n -> TT n -> TT n
substV x :: TT n
x tm :: TT n
tm = Int -> TT n -> TT n
forall n. Int -> TT n -> TT n
dropV 0 (TT n -> TT n -> TT n
forall n. TT n -> TT n -> TT n
instantiate TT n
x TT n
tm) where
dropV :: Int -> TT n -> TT n
dropV i :: Int
i (P nt :: NameType
nt x :: n
x ty :: TT n
ty) = NameType -> n -> TT n -> TT n
forall n. NameType -> n -> TT n -> TT n
P NameType
nt n
x (Int -> TT n -> TT n
dropV Int
i TT n
ty)
dropV i :: Int
i (V x :: Int
x) | Int
x Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
i = Int -> TT n
forall n. Int -> TT n
V (Int
x Int -> Int -> Int
forall a. Num a => a -> a -> a
- 1)
| Bool
otherwise = Int -> TT n
forall n. Int -> TT n
V Int
x
dropV i :: Int
i (Bind x :: n
x b :: Binder (TT n)
b sc :: TT n
sc) = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x ((TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Int -> TT n -> TT n
dropV Int
i) Binder (TT n)
b) (Int -> TT n -> TT n
dropV (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
+1) TT n
sc)
dropV i :: Int
i (App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s (Int -> TT n -> TT n
dropV Int
i TT n
f) (Int -> TT n -> TT n
dropV Int
i TT n
a)
dropV i :: Int
i (Proj x :: TT n
x idx :: Int
idx) = TT n -> Int -> TT n
forall n. TT n -> Int -> TT n
Proj (Int -> TT n -> TT n
dropV Int
i TT n
x) Int
idx
dropV i :: Int
i t :: TT n
t = TT n
t
explicitNames :: TT n -> TT n
explicitNames :: TT n -> TT n
explicitNames (Bind x :: n
x b :: Binder (TT n)
b sc :: TT n
sc) = let b' :: Binder (TT n)
b' = (TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TT n -> TT n
forall n. TT n -> TT n
explicitNames Binder (TT n)
b in
n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x Binder (TT n)
b'
(TT n -> TT n
forall n. TT n -> TT n
explicitNames (TT n -> TT n -> TT n
forall n. TT n -> TT n -> TT n
instantiate
(NameType -> n -> TT n -> TT n
forall n. NameType -> n -> TT n -> TT n
P NameType
Bound n
x (Binder (TT n) -> TT n
forall b. Binder b -> b
binderTy Binder (TT n)
b')) TT n
sc))
explicitNames (App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s (TT n -> TT n
forall n. TT n -> TT n
explicitNames TT n
f) (TT n -> TT n
forall n. TT n -> TT n
explicitNames TT n
a)
explicitNames (Proj x :: TT n
x idx :: Int
idx) = TT n -> Int -> TT n
forall n. TT n -> Int -> TT n
Proj (TT n -> TT n
forall n. TT n -> TT n
explicitNames TT n
x) Int
idx
explicitNames t :: TT n
t = TT n
t
pToV :: Eq n => n -> TT n -> TT n
pToV :: n -> TT n -> TT n
pToV n :: n
n = n -> Int -> TT n -> TT n
forall n. Eq n => n -> Int -> TT n -> TT n
pToV' n
n 0
pToV' :: n -> Int -> TT n -> TT n
pToV' n :: n
n i :: Int
i (P _ x :: n
x _) | n
n n -> n -> Bool
forall a. Eq a => a -> a -> Bool
== n
x = Int -> TT n
forall n. Int -> TT n
V Int
i
pToV' n :: n
n i :: Int
i (Bind x :: n
x b :: Binder (TT n)
b sc :: TT n
sc)
| n
n n -> n -> Bool
forall a. Eq a => a -> a -> Bool
== n
x = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x ((TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (n -> Int -> TT n -> TT n
pToV' n
n Int
i) Binder (TT n)
b) TT n
sc
| Bool
otherwise = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x ((TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (n -> Int -> TT n -> TT n
pToV' n
n Int
i) Binder (TT n)
b) (n -> Int -> TT n -> TT n
pToV' n
n (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
+1) TT n
sc)
pToV' n :: n
n i :: Int
i (App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s (n -> Int -> TT n -> TT n
pToV' n
n Int
i TT n
f) (n -> Int -> TT n -> TT n
pToV' n
n Int
i TT n
a)
pToV' n :: n
n i :: Int
i (Proj t :: TT n
t idx :: Int
idx) = TT n -> Int -> TT n
forall n. TT n -> Int -> TT n
Proj (n -> Int -> TT n -> TT n
pToV' n
n Int
i TT n
t) Int
idx
pToV' n :: n
n i :: Int
i t :: TT n
t = TT n
t
addBinder :: TT n -> TT n
addBinder :: TT n -> TT n
addBinder t :: TT n
t = Int -> TT n -> TT n
forall n. Int -> TT n -> TT n
ab 0 TT n
t
where
ab :: Int -> TT n -> TT n
ab top :: Int
top (V i :: Int
i) | Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
top = Int -> TT n
forall n. Int -> TT n
V (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)
| Bool
otherwise = Int -> TT n
forall n. Int -> TT n
V Int
i
ab top :: Int
top (Bind x :: n
x b :: Binder (TT n)
b sc :: TT n
sc) = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x ((TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Int -> TT n -> TT n
ab Int
top) Binder (TT n)
b) (Int -> TT n -> TT n
ab (Int
top Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) TT n
sc)
ab top :: Int
top (App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s (Int -> TT n -> TT n
ab Int
top TT n
f) (Int -> TT n -> TT n
ab Int
top TT n
a)
ab top :: Int
top (Proj t :: TT n
t idx :: Int
idx) = TT n -> Int -> TT n
forall n. TT n -> Int -> TT n
Proj (Int -> TT n -> TT n
ab Int
top TT n
t) Int
idx
ab top :: Int
top t :: TT n
t = TT n
t
pToVs :: Eq n => [n] -> TT n -> TT n
pToVs :: [n] -> TT n -> TT n
pToVs ns :: [n]
ns tm :: TT n
tm = [n] -> TT n -> Int -> TT n
forall n. Eq n => [n] -> TT n -> Int -> TT n
pToVs' [n]
ns TT n
tm 0 where
pToVs' :: [n] -> TT n -> Int -> TT n
pToVs' [] tm :: TT n
tm i :: Int
i = TT n
tm
pToVs' (n :: n
n:ns :: [n]
ns) tm :: TT n
tm i :: Int
i = n -> Int -> TT n -> TT n
forall n. Eq n => n -> Int -> TT n -> TT n
pToV' n
n Int
i ([n] -> TT n -> Int -> TT n
pToVs' [n]
ns TT n
tm (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
+1))
vToP :: TT n -> TT n
vToP :: TT n -> TT n
vToP = [(n, Binder (TT n))] -> TT n -> TT n
forall n. [(n, Binder (TT n))] -> TT n -> TT n
vToP' [] where
vToP' :: [(n, Binder (TT n))] -> TT n -> TT n
vToP' env :: [(n, Binder (TT n))]
env (V i :: Int
i) = let (n :: n
n, b :: Binder (TT n)
b) = ([(n, Binder (TT n))]
env [(n, Binder (TT n))] -> Int -> (n, Binder (TT n))
forall a. [a] -> Int -> a
!! Int
i) in
NameType -> n -> TT n -> TT n
forall n. NameType -> n -> TT n -> TT n
P NameType
Bound n
n (Binder (TT n) -> TT n
forall b. Binder b -> b
binderTy Binder (TT n)
b)
vToP' env :: [(n, Binder (TT n))]
env (Bind n :: n
n b :: Binder (TT n)
b sc :: TT n
sc) = let b' :: Binder (TT n)
b' = (TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ([(n, Binder (TT n))] -> TT n -> TT n
vToP' [(n, Binder (TT n))]
env) Binder (TT n)
b in
n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
n Binder (TT n)
b' ([(n, Binder (TT n))] -> TT n -> TT n
vToP' ((n
n, Binder (TT n)
b')(n, Binder (TT n)) -> [(n, Binder (TT n))] -> [(n, Binder (TT n))]
forall a. a -> [a] -> [a]
:[(n, Binder (TT n))]
env) TT n
sc)
vToP' env :: [(n, Binder (TT n))]
env (App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s ([(n, Binder (TT n))] -> TT n -> TT n
vToP' [(n, Binder (TT n))]
env TT n
f) ([(n, Binder (TT n))] -> TT n -> TT n
vToP' [(n, Binder (TT n))]
env TT n
a)
vToP' env :: [(n, Binder (TT n))]
env t :: TT n
t = TT n
t
finalise :: Eq n => TT n -> TT n
finalise :: TT n -> TT n
finalise (Bind x :: n
x b :: Binder (TT n)
b sc :: TT n
sc) = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x ((TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TT n -> TT n
forall n. Eq n => TT n -> TT n
finalise Binder (TT n)
b) (n -> TT n -> TT n
forall n. Eq n => n -> TT n -> TT n
pToV n
x (TT n -> TT n
forall n. Eq n => TT n -> TT n
finalise TT n
sc))
finalise (App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s (TT n -> TT n
forall n. Eq n => TT n -> TT n
finalise TT n
f) (TT n -> TT n
forall n. Eq n => TT n -> TT n
finalise TT n
a)
finalise t :: TT n
t = TT n
t
pEraseType :: TT n -> TT n
pEraseType :: TT n -> TT n
pEraseType (P nt :: NameType
nt t :: n
t _) = NameType -> n -> TT n -> TT n
forall n. NameType -> n -> TT n -> TT n
P NameType
nt n
t TT n
forall n. TT n
Erased
pEraseType (App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s (TT n -> TT n
forall n. TT n -> TT n
pEraseType TT n
f) (TT n -> TT n
forall n. TT n -> TT n
pEraseType TT n
a)
pEraseType (Bind n :: n
n b :: Binder (TT n)
b sc :: TT n
sc) = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
n ((TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TT n -> TT n
forall n. TT n -> TT n
pEraseType Binder (TT n)
b) (TT n -> TT n
forall n. TT n -> TT n
pEraseType TT n
sc)
pEraseType t :: TT n
t = TT n
t
subst :: Eq n => n ->
TT n ->
TT n ->
TT n
subst :: n -> TT n -> TT n -> TT n
subst n :: n
n v :: TT n
v tm :: TT n
tm = (TT n, Bool) -> TT n
forall a b. (a, b) -> a
fst ((TT n, Bool) -> TT n) -> (TT n, Bool) -> TT n
forall a b. (a -> b) -> a -> b
$ Int -> TT n -> (TT n, Bool)
subst' 0 TT n
tm
where
subst' :: Int -> TT n -> (TT n, Bool)
subst' i :: Int
i (V x :: Int
x) | Int
i Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
x = (TT n
v, Bool
True)
subst' i :: Int
i (P _ x :: n
x _) | n
n n -> n -> Bool
forall a. Eq a => a -> a -> Bool
== n
x = (TT n
v, Bool
True)
subst' i :: Int
i t :: TT n
t@(P nt :: NameType
nt x :: n
x ty :: TT n
ty)
= let (ty' :: TT n
ty', ut :: Bool
ut) = Int -> TT n -> (TT n, Bool)
subst' Int
i TT n
ty in
if Bool
ut then (NameType -> n -> TT n -> TT n
forall n. NameType -> n -> TT n -> TT n
P NameType
nt n
x TT n
ty', Bool
True) else (TT n
t, Bool
False)
subst' i :: Int
i t :: TT n
t@(Bind x :: n
x b :: Binder (TT n)
b sc :: TT n
sc) | n
x n -> n -> Bool
forall a. Eq a => a -> a -> Bool
/= n
n
= let (b' :: Binder (TT n)
b', ub :: Bool
ub) = Int -> Binder (TT n) -> (Binder (TT n), Bool)
substB' Int
i Binder (TT n)
b
(sc' :: TT n
sc', usc :: Bool
usc) = Int -> TT n -> (TT n, Bool)
subst' (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
+1) TT n
sc in
if Bool
ub Bool -> Bool -> Bool
|| Bool
usc then (n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x Binder (TT n)
b' TT n
sc', Bool
True) else (TT n
t, Bool
False)
subst' i :: Int
i t :: TT n
t@(App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = let (f' :: TT n
f', uf :: Bool
uf) = Int -> TT n -> (TT n, Bool)
subst' Int
i TT n
f
(a' :: TT n
a', ua :: Bool
ua) = Int -> TT n -> (TT n, Bool)
subst' Int
i TT n
a in
if Bool
uf Bool -> Bool -> Bool
|| Bool
ua then (AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s TT n
f' TT n
a', Bool
True) else (TT n
t, Bool
False)
subst' i :: Int
i t :: TT n
t@(Proj x :: TT n
x idx :: Int
idx) = let (x' :: TT n
x', u :: Bool
u) = Int -> TT n -> (TT n, Bool)
subst' Int
i TT n
x in
if Bool
u then (TT n -> Int -> TT n
forall n. TT n -> Int -> TT n
Proj TT n
x' Int
idx, Bool
u) else (TT n
t, Bool
False)
subst' i :: Int
i t :: TT n
t = (TT n
t, Bool
False)
substB' :: Int -> Binder (TT n) -> (Binder (TT n), Bool)
substB' i :: Int
i b :: Binder (TT n)
b@(Let c :: RigCount
c t :: TT n
t v :: TT n
v) = let (t' :: TT n
t', ut :: Bool
ut) = Int -> TT n -> (TT n, Bool)
subst' Int
i TT n
t
(v' :: TT n
v', uv :: Bool
uv) = Int -> TT n -> (TT n, Bool)
subst' Int
i TT n
v in
if Bool
ut Bool -> Bool -> Bool
|| Bool
uv then (RigCount -> TT n -> TT n -> Binder (TT n)
forall b. RigCount -> b -> b -> Binder b
Let RigCount
c TT n
t' TT n
v', Bool
True)
else (Binder (TT n)
b, Bool
False)
substB' i :: Int
i b :: Binder (TT n)
b@(Guess t :: TT n
t v :: TT n
v) = let (t' :: TT n
t', ut :: Bool
ut) = Int -> TT n -> (TT n, Bool)
subst' Int
i TT n
t
(v' :: TT n
v', uv :: Bool
uv) = Int -> TT n -> (TT n, Bool)
subst' Int
i TT n
v in
if Bool
ut Bool -> Bool -> Bool
|| Bool
uv then (TT n -> TT n -> Binder (TT n)
forall b. b -> b -> Binder b
Guess TT n
t' TT n
v', Bool
True)
else (Binder (TT n)
b, Bool
False)
substB' i :: Int
i b :: Binder (TT n)
b = let (ty' :: TT n
ty', u :: Bool
u) = Int -> TT n -> (TT n, Bool)
subst' Int
i (Binder (TT n) -> TT n
forall b. Binder b -> b
binderTy Binder (TT n)
b) in
if Bool
u then (Binder (TT n)
b { binderTy :: TT n
binderTy = TT n
ty' }, Bool
u) else (Binder (TT n)
b, Bool
False)
psubst :: Eq n => n -> TT n -> TT n -> TT n
psubst :: n -> TT n -> TT n -> TT n
psubst n :: n
n v :: TT n
v tm :: TT n
tm = Int -> TT n -> TT n
s' 0 TT n
tm where
s' :: Int -> TT n -> TT n
s' i :: Int
i (V x :: Int
x) | Int
x Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
i = Int -> TT n
forall n. Int -> TT n
V (Int
x Int -> Int -> Int
forall a. Num a => a -> a -> a
- 1)
| Int
x Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
i = TT n
v
| Bool
otherwise = Int -> TT n
forall n. Int -> TT n
V Int
x
s' i :: Int
i (P _ x :: n
x _) | n
n n -> n -> Bool
forall a. Eq a => a -> a -> Bool
== n
x = TT n
v
s' i :: Int
i (Bind x :: n
x b :: Binder (TT n)
b sc :: TT n
sc) | n
n n -> n -> Bool
forall a. Eq a => a -> a -> Bool
== n
x = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x ((TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Int -> TT n -> TT n
s' Int
i) Binder (TT n)
b) TT n
sc
| Bool
otherwise = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x ((TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Int -> TT n -> TT n
s' Int
i) Binder (TT n)
b) (Int -> TT n -> TT n
s' (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
+1) TT n
sc)
s' i :: Int
i (App st :: AppStatus n
st f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
st (Int -> TT n -> TT n
s' Int
i TT n
f) (Int -> TT n -> TT n
s' Int
i TT n
a)
s' i :: Int
i (Proj t :: TT n
t idx :: Int
idx) = TT n -> Int -> TT n
forall n. TT n -> Int -> TT n
Proj (Int -> TT n -> TT n
s' Int
i TT n
t) Int
idx
s' i :: Int
i t :: TT n
t = TT n
t
substNames :: Eq n => [(n, TT n)] -> TT n -> TT n
substNames :: [(n, TT n)] -> TT n -> TT n
substNames [] t :: TT n
t = TT n
t
substNames ((n :: n
n, tm :: TT n
tm) : xs :: [(n, TT n)]
xs) t :: TT n
t = n -> TT n -> TT n -> TT n
forall n. Eq n => n -> TT n -> TT n -> TT n
subst n
n TT n
tm ([(n, TT n)] -> TT n -> TT n
forall n. Eq n => [(n, TT n)] -> TT n -> TT n
substNames [(n, TT n)]
xs TT n
t)
substTerm :: Eq n => TT n ->
TT n ->
TT n
-> TT n
substTerm :: TT n -> TT n -> TT n -> TT n
substTerm old :: TT n
old new :: TT n
new = TT n -> TT n
st where
st :: TT n -> TT n
st t :: TT n
t | [(n, n)] -> TT n -> TT n -> Bool
forall b. Eq b => [(b, b)] -> TT b -> TT b -> Bool
eqAlpha [] TT n
t TT n
old = TT n
new
st (App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s (TT n -> TT n
st TT n
f) (TT n -> TT n
st TT n
a)
st (Bind x :: n
x b :: Binder (TT n)
b sc :: TT n
sc) = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x ((TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TT n -> TT n
st Binder (TT n)
b) (TT n -> TT n
st TT n
sc)
st t :: TT n
t = TT n
t
eqAlpha :: [(b, b)] -> TT b -> TT b -> Bool
eqAlpha as :: [(b, b)]
as (P _ x :: b
x _) (P _ y :: b
y _)
= b
x b -> b -> Bool
forall a. Eq a => a -> a -> Bool
== b
y Bool -> Bool -> Bool
|| (b
x, b
y) (b, b) -> [(b, b)] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [(b, b)]
as Bool -> Bool -> Bool
|| (b
y, b
x) (b, b) -> [(b, b)] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [(b, b)]
as
eqAlpha as :: [(b, b)]
as (V x :: Int
x) (V y :: Int
y) = Int
x Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
y
eqAlpha as :: [(b, b)]
as (Bind x :: b
x xb :: Binder (TT b)
xb xs :: TT b
xs) (Bind y :: b
y yb :: Binder (TT b)
yb ys :: TT b
ys)
= [(b, b)] -> Binder (TT b) -> Binder (TT b) -> Bool
eqAlphaB [(b, b)]
as Binder (TT b)
xb Binder (TT b)
yb Bool -> Bool -> Bool
&& [(b, b)] -> TT b -> TT b -> Bool
eqAlpha ((b
x, b
y) (b, b) -> [(b, b)] -> [(b, b)]
forall a. a -> [a] -> [a]
: [(b, b)]
as) TT b
xs TT b
ys
eqAlpha as :: [(b, b)]
as (App _ fx :: TT b
fx ax :: TT b
ax) (App _ fy :: TT b
fy ay :: TT b
ay) = [(b, b)] -> TT b -> TT b -> Bool
eqAlpha [(b, b)]
as TT b
fx TT b
fy Bool -> Bool -> Bool
&& [(b, b)] -> TT b -> TT b -> Bool
eqAlpha [(b, b)]
as TT b
ax TT b
ay
eqAlpha as :: [(b, b)]
as x :: TT b
x y :: TT b
y = TT b
x TT b -> TT b -> Bool
forall a. Eq a => a -> a -> Bool
== TT b
y
eqAlphaB :: [(b, b)] -> Binder (TT b) -> Binder (TT b) -> Bool
eqAlphaB as :: [(b, b)]
as (Let xc :: RigCount
xc xt :: TT b
xt xv :: TT b
xv) (Let yc :: RigCount
yc yt :: TT b
yt yv :: TT b
yv)
= [(b, b)] -> TT b -> TT b -> Bool
eqAlpha [(b, b)]
as TT b
xt TT b
yt Bool -> Bool -> Bool
&& [(b, b)] -> TT b -> TT b -> Bool
eqAlpha [(b, b)]
as TT b
xv TT b
yv
eqAlphaB as :: [(b, b)]
as (Guess xt :: TT b
xt xv :: TT b
xv) (Guess yt :: TT b
yt yv :: TT b
yv)
= [(b, b)] -> TT b -> TT b -> Bool
eqAlpha [(b, b)]
as TT b
xt TT b
yt Bool -> Bool -> Bool
&& [(b, b)] -> TT b -> TT b -> Bool
eqAlpha [(b, b)]
as TT b
xv TT b
yv
eqAlphaB as :: [(b, b)]
as bx :: Binder (TT b)
bx by :: Binder (TT b)
by = [(b, b)] -> TT b -> TT b -> Bool
eqAlpha [(b, b)]
as (Binder (TT b) -> TT b
forall b. Binder b -> b
binderTy Binder (TT b)
bx) (Binder (TT b) -> TT b
forall b. Binder b -> b
binderTy Binder (TT b)
by)
occurrences :: Eq n => n -> TT n -> Int
occurrences :: n -> TT n -> Int
occurrences n :: n
n t :: TT n
t = State Int () -> Int -> Int
forall s a. State s a -> s -> s
execState (Int -> TT n -> State Int ()
forall s (m :: * -> *).
(MonadState s m, Num s) =>
Int -> TT n -> m ()
no' 0 TT n
t) 0
where
no' :: Int -> TT n -> m ()
no' i :: Int
i (V x :: Int
x) | Int
i Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
x = do s
num <- m s
forall s (m :: * -> *). MonadState s m => m s
get; s -> m ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put (s
num s -> s -> s
forall a. Num a => a -> a -> a
+ 1)
no' i :: Int
i (P Bound x :: n
x _) | n
n n -> n -> Bool
forall a. Eq a => a -> a -> Bool
== n
x = do s
num <- m s
forall s (m :: * -> *). MonadState s m => m s
get; s -> m ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put (s
num s -> s -> s
forall a. Num a => a -> a -> a
+ 1)
no' i :: Int
i (Bind n :: n
n b :: Binder (TT n)
b sc :: TT n
sc) = do Int -> Binder (TT n) -> m ()
noB' Int
i Binder (TT n)
b; Int -> TT n -> m ()
no' (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
+1) TT n
sc
where noB' :: Int -> Binder (TT n) -> m ()
noB' i :: Int
i (Let c :: RigCount
c t :: TT n
t v :: TT n
v) = do Int -> TT n -> m ()
no' Int
i TT n
t; Int -> TT n -> m ()
no' Int
i TT n
v
noB' i :: Int
i (Guess t :: TT n
t v :: TT n
v) = do Int -> TT n -> m ()
no' Int
i TT n
t; Int -> TT n -> m ()
no' Int
i TT n
v
noB' i :: Int
i b :: Binder (TT n)
b = Int -> TT n -> m ()
no' Int
i (Binder (TT n) -> TT n
forall b. Binder b -> b
binderTy Binder (TT n)
b)
no' i :: Int
i (App _ f :: TT n
f a :: TT n
a) = do Int -> TT n -> m ()
no' Int
i TT n
f; Int -> TT n -> m ()
no' Int
i TT n
a
no' i :: Int
i (Proj x :: TT n
x _) = Int -> TT n -> m ()
no' Int
i TT n
x
no' i :: Int
i _ = () -> m ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
noOccurrence :: Eq n => n -> TT n -> Bool
noOccurrence :: n -> TT n -> Bool
noOccurrence n :: n
n t :: TT n
t = Int -> TT n -> Bool
no' 0 TT n
t
where
no' :: Int -> TT n -> Bool
no' i :: Int
i (V x :: Int
x) = Bool -> Bool
not (Int
i Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
x)
no' i :: Int
i (P Bound x :: n
x _) = Bool -> Bool
not (n
n n -> n -> Bool
forall a. Eq a => a -> a -> Bool
== n
x)
no' i :: Int
i (Bind n :: n
n b :: Binder (TT n)
b sc :: TT n
sc) = Int -> Binder (TT n) -> Bool
noB' Int
i Binder (TT n)
b Bool -> Bool -> Bool
&& Int -> TT n -> Bool
no' (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
+1) TT n
sc
where noB' :: Int -> Binder (TT n) -> Bool
noB' i :: Int
i (Let c :: RigCount
c t :: TT n
t v :: TT n
v) = Int -> TT n -> Bool
no' Int
i TT n
t Bool -> Bool -> Bool
&& Int -> TT n -> Bool
no' Int
i TT n
v
noB' i :: Int
i (Guess t :: TT n
t v :: TT n
v) = Int -> TT n -> Bool
no' Int
i TT n
t Bool -> Bool -> Bool
&& Int -> TT n -> Bool
no' Int
i TT n
v
noB' i :: Int
i b :: Binder (TT n)
b = Int -> TT n -> Bool
no' Int
i (Binder (TT n) -> TT n
forall b. Binder b -> b
binderTy Binder (TT n)
b)
no' i :: Int
i (App _ f :: TT n
f a :: TT n
a) = Int -> TT n -> Bool
no' Int
i TT n
f Bool -> Bool -> Bool
&& Int -> TT n -> Bool
no' Int
i TT n
a
no' i :: Int
i (Proj x :: TT n
x _) = Int -> TT n -> Bool
no' Int
i TT n
x
no' i :: Int
i _ = Bool
True
freeNames :: Eq n => TT n -> [n]
freeNames :: TT n -> [n]
freeNames t :: TT n
t = [n] -> [n]
forall a. Eq a => [a] -> [a]
nub ([n] -> [n]) -> [n] -> [n]
forall a b. (a -> b) -> a -> b
$ TT n -> [n]
forall a. Eq a => TT a -> [a]
freeNames' TT n
t
where
freeNames' :: TT a -> [a]
freeNames' (P _ n :: a
n _) = [a
n]
freeNames' (Bind n :: a
n (Let c :: RigCount
c t :: TT a
t v :: TT a
v) sc :: TT a
sc) = TT a -> [a]
freeNames' TT a
v [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ (TT a -> [a]
freeNames' TT a
sc [a] -> [a] -> [a]
forall a. Eq a => [a] -> [a] -> [a]
\\ [a
n])
[a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ TT a -> [a]
freeNames' TT a
t
freeNames' (Bind n :: a
n b :: Binder (TT a)
b sc :: TT a
sc) = TT a -> [a]
freeNames' (Binder (TT a) -> TT a
forall b. Binder b -> b
binderTy Binder (TT a)
b) [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ (TT a -> [a]
freeNames' TT a
sc [a] -> [a] -> [a]
forall a. Eq a => [a] -> [a] -> [a]
\\ [a
n])
freeNames' (App _ f :: TT a
f a :: TT a
a) = TT a -> [a]
freeNames' TT a
f [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ TT a -> [a]
freeNames' TT a
a
freeNames' (Proj x :: TT a
x i :: Int
i) = TT a -> [a]
freeNames' TT a
x
freeNames' _ = []
arity :: TT n -> Int
arity :: TT n -> Int
arity (Bind n :: n
n (Pi _ _ t :: TT n
t _) sc :: TT n
sc) = 1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ TT n -> Int
forall n. TT n -> Int
arity TT n
sc
arity _ = 0
unApply :: TT n -> (TT n, [TT n])
unApply :: TT n -> (TT n, [TT n])
unApply t :: TT n
t = [TT n] -> TT n -> (TT n, [TT n])
forall n. [TT n] -> TT n -> (TT n, [TT n])
ua [] TT n
t where
ua :: [TT n] -> TT n -> (TT n, [TT n])
ua args :: [TT n]
args (App _ f :: TT n
f a :: TT n
a) = [TT n] -> TT n -> (TT n, [TT n])
ua (TT n
aTT n -> [TT n] -> [TT n]
forall a. a -> [a] -> [a]
:[TT n]
args) TT n
f
ua args :: [TT n]
args t :: TT n
t = (TT n
t, [TT n]
args)
mkApp :: TT n -> [TT n] -> TT n
mkApp :: TT n -> [TT n] -> TT n
mkApp f :: TT n
f [] = TT n
f
mkApp f :: TT n
f (a :: TT n
a:as :: [TT n]
as) = TT n -> [TT n] -> TT n
forall n. TT n -> [TT n] -> TT n
mkApp (AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
forall n. AppStatus n
MaybeHoles TT n
f TT n
a) [TT n]
as
unList :: Term -> Maybe [Term]
unList :: Term -> Maybe [Term]
unList tm :: Term
tm = case Term -> (Term, [Term])
forall n. TT n -> (TT n, [TT n])
unApply Term
tm of
(nil :: Term
nil, [_]) -> [Term] -> Maybe [Term]
forall a. a -> Maybe a
Just []
(cons :: Term
cons, ([_, x :: Term
x, xs :: Term
xs])) ->
do [Term]
rest <- Term -> Maybe [Term]
unList Term
xs
[Term] -> Maybe [Term]
forall (m :: * -> *) a. Monad m => a -> m a
return ([Term] -> Maybe [Term]) -> [Term] -> Maybe [Term]
forall a b. (a -> b) -> a -> b
$ Term
xTerm -> [Term] -> [Term]
forall a. a -> [a] -> [a]
:[Term]
rest
(f :: Term
f, args :: [Term]
args) -> Maybe [Term]
forall a. Maybe a
Nothing
termSmallerThan :: Int -> Term -> Bool
termSmallerThan :: Int -> Term -> Bool
termSmallerThan x :: Int
x tm :: Term
tm | Int
x Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= 0 = Bool
False
termSmallerThan x :: Int
x (P _ _ ty :: Term
ty) = Int -> Term -> Bool
termSmallerThan (Int
xInt -> Int -> Int
forall a. Num a => a -> a -> a
-1) Term
ty
termSmallerThan x :: Int
x (Bind _ _ tm :: Term
tm) = Int -> Term -> Bool
termSmallerThan (Int
xInt -> Int -> Int
forall a. Num a => a -> a -> a
-1) Term
tm
termSmallerThan x :: Int
x (App _ f :: Term
f a :: Term
a) = Int -> Term -> Bool
termSmallerThan (Int
xInt -> Int -> Int
forall a. Num a => a -> a -> a
-1) Term
f Bool -> Bool -> Bool
&& Int -> Term -> Bool
termSmallerThan (Int
xInt -> Int -> Int
forall a. Num a => a -> a -> a
-1) Term
a
termSmallerThan x :: Int
x (Proj tm :: Term
tm _) = Int -> Term -> Bool
termSmallerThan (Int
xInt -> Int -> Int
forall a. Num a => a -> a -> a
-1) Term
tm
termSmallerThan x :: Int
x (V i :: Int
i) = Bool
True
termSmallerThan x :: Int
x (Constant c :: Const
c) = Bool
True
termSmallerThan x :: Int
x Erased = Bool
True
termSmallerThan x :: Int
x Impossible = Bool
True
termSmallerThan x :: Int
x (Inferred t :: Term
t) = Int -> Term -> Bool
termSmallerThan Int
x Term
t
termSmallerThan x :: Int
x (TType u :: UExp
u) = Bool
True
termSmallerThan x :: Int
x (UType u :: Universe
u) = Bool
True
forget :: TT Name -> Raw
forget :: Term -> Raw
forget tm :: Term
tm = [Name] -> Term -> Raw
forgetEnv [] Term
tm
safeForget :: TT Name -> Maybe Raw
safeForget :: Term -> Maybe Raw
safeForget tm :: Term
tm = [Name] -> Term -> Maybe Raw
safeForgetEnv [] Term
tm
forgetEnv :: [Name] -> TT Name -> Raw
forgetEnv :: [Name] -> Term -> Raw
forgetEnv env :: [Name]
env tm :: Term
tm = case [Name] -> Term -> Maybe Raw
safeForgetEnv [Name]
env Term
tm of
Just t' :: Raw
t' -> Raw
t'
Nothing -> String -> Raw
forall a. HasCallStack => String -> a
error (String -> Raw) -> String -> Raw
forall a b. (a -> b) -> a -> b
$ "Scope error in " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Term -> String
forall a. Show a => a -> String
show Term
tm String -> ShowS
forall a. [a] -> [a] -> [a]
++ [Name] -> String
forall a. Show a => a -> String
show [Name]
env
safeForgetEnv :: [Name] -> TT Name -> Maybe Raw
safeForgetEnv :: [Name] -> Term -> Maybe Raw
safeForgetEnv env :: [Name]
env (P _ n :: Name
n _) = Raw -> Maybe Raw
forall a. a -> Maybe a
Just (Raw -> Maybe Raw) -> Raw -> Maybe Raw
forall a b. (a -> b) -> a -> b
$ Name -> Raw
Var Name
n
safeForgetEnv env :: [Name]
env (V i :: Int
i) | Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Name]
env = Raw -> Maybe Raw
forall a. a -> Maybe a
Just (Raw -> Maybe Raw) -> Raw -> Maybe Raw
forall a b. (a -> b) -> a -> b
$ Name -> Raw
Var ([Name]
env [Name] -> Int -> Name
forall a. [a] -> Int -> a
!! Int
i)
| Bool
otherwise = Maybe Raw
forall a. Maybe a
Nothing
safeForgetEnv env :: [Name]
env (Bind n :: Name
n b :: Binder Term
b sc :: Term
sc)
= do let n' :: Name
n' = Name -> [Name] -> Name
uniqueName Name
n [Name]
env
Binder Raw
b' <- [Name] -> Binder Term -> Maybe (Binder Raw)
safeForgetEnvB [Name]
env Binder Term
b
Raw
sc' <- [Name] -> Term -> Maybe Raw
safeForgetEnv (Name
n'Name -> [Name] -> [Name]
forall a. a -> [a] -> [a]
:[Name]
env) Term
sc
Raw -> Maybe Raw
forall a. a -> Maybe a
Just (Raw -> Maybe Raw) -> Raw -> Maybe Raw
forall a b. (a -> b) -> a -> b
$ Name -> Binder Raw -> Raw -> Raw
RBind Name
n' Binder Raw
b' Raw
sc'
where safeForgetEnvB :: [Name] -> Binder Term -> Maybe (Binder Raw)
safeForgetEnvB env :: [Name]
env (Let c :: RigCount
c t :: Term
t v :: Term
v) = (Raw -> Raw -> Binder Raw)
-> Maybe Raw -> Maybe Raw -> Maybe (Binder Raw)
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 (RigCount -> Raw -> Raw -> Binder Raw
forall b. RigCount -> b -> b -> Binder b
Let RigCount
c) ([Name] -> Term -> Maybe Raw
safeForgetEnv [Name]
env Term
t)
([Name] -> Term -> Maybe Raw
safeForgetEnv [Name]
env Term
v)
safeForgetEnvB env :: [Name]
env (Guess t :: Term
t v :: Term
v) = (Raw -> Raw -> Binder Raw)
-> Maybe Raw -> Maybe Raw -> Maybe (Binder Raw)
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 Raw -> Raw -> Binder Raw
forall b. b -> b -> Binder b
Guess ([Name] -> Term -> Maybe Raw
safeForgetEnv [Name]
env Term
t)
([Name] -> Term -> Maybe Raw
safeForgetEnv [Name]
env Term
v)
safeForgetEnvB env :: [Name]
env b :: Binder Term
b = do Raw
ty' <- [Name] -> Term -> Maybe Raw
safeForgetEnv [Name]
env (Binder Term -> Term
forall b. Binder b -> b
binderTy Binder Term
b)
Binder Raw -> Maybe (Binder Raw)
forall a. a -> Maybe a
Just (Binder Raw -> Maybe (Binder Raw))
-> Binder Raw -> Maybe (Binder Raw)
forall a b. (a -> b) -> a -> b
$ (Term -> Raw) -> Binder Term -> Binder Raw
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\_ -> Raw
ty') Binder Term
b
safeForgetEnv env :: [Name]
env (App _ f :: Term
f a :: Term
a) = (Raw -> Raw -> Raw) -> Maybe Raw -> Maybe Raw -> Maybe Raw
forall (m :: * -> *) a1 a2 r.
Monad m =>
(a1 -> a2 -> r) -> m a1 -> m a2 -> m r
liftM2 Raw -> Raw -> Raw
RApp ([Name] -> Term -> Maybe Raw
safeForgetEnv [Name]
env Term
f) ([Name] -> Term -> Maybe Raw
safeForgetEnv [Name]
env Term
a)
safeForgetEnv env :: [Name]
env (Constant c :: Const
c) = Raw -> Maybe Raw
forall a. a -> Maybe a
Just (Raw -> Maybe Raw) -> Raw -> Maybe Raw
forall a b. (a -> b) -> a -> b
$ Const -> Raw
RConstant Const
c
safeForgetEnv env :: [Name]
env (TType i :: UExp
i) = Raw -> Maybe Raw
forall a. a -> Maybe a
Just Raw
RType
safeForgetEnv env :: [Name]
env (UType u :: Universe
u) = Raw -> Maybe Raw
forall a. a -> Maybe a
Just (Raw -> Maybe Raw) -> Raw -> Maybe Raw
forall a b. (a -> b) -> a -> b
$ Universe -> Raw
RUType Universe
u
safeForgetEnv env :: [Name]
env Erased = Raw -> Maybe Raw
forall a. a -> Maybe a
Just (Raw -> Maybe Raw) -> Raw -> Maybe Raw
forall a b. (a -> b) -> a -> b
$ Const -> Raw
RConstant Const
Forgot
safeForgetEnv env :: [Name]
env (Proj tm :: Term
tm i :: Int
i) = String -> Maybe Raw
forall a. HasCallStack => String -> a
error "Don't know how to forget a projection"
safeForgetEnv env :: [Name]
env Impossible = String -> Maybe Raw
forall a. HasCallStack => String -> a
error "Don't know how to forget Impossible"
safeForgetEnv env :: [Name]
env (Inferred t :: Term
t) = [Name] -> Term -> Maybe Raw
safeForgetEnv [Name]
env Term
t
bindAll :: [(n, Binder (TT n))] -> TT n -> TT n
bindAll :: [(n, Binder (TT n))] -> TT n -> TT n
bindAll [] t :: TT n
t = TT n
t
bindAll ((n :: n
n, b :: Binder (TT n)
b) : bs :: [(n, Binder (TT n))]
bs) t :: TT n
t = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
n Binder (TT n)
b ([(n, Binder (TT n))] -> TT n -> TT n
forall n. [(n, Binder (TT n))] -> TT n -> TT n
bindAll [(n, Binder (TT n))]
bs TT n
t)
bindTyArgs :: (TT n -> Binder (TT n)) -> [(n, TT n)] -> TT n -> TT n
bindTyArgs :: (TT n -> Binder (TT n)) -> [(n, TT n)] -> TT n -> TT n
bindTyArgs b :: TT n -> Binder (TT n)
b xs :: [(n, TT n)]
xs = [(n, Binder (TT n))] -> TT n -> TT n
forall n. [(n, Binder (TT n))] -> TT n -> TT n
bindAll (((n, TT n) -> (n, Binder (TT n)))
-> [(n, TT n)] -> [(n, Binder (TT n))]
forall a b. (a -> b) -> [a] -> [b]
map (\ (n :: n
n, ty :: TT n
ty) -> (n
n, TT n -> Binder (TT n)
b TT n
ty)) [(n, TT n)]
xs)
getArgTys :: TT n -> [(n, TT n)]
getArgTys :: TT n -> [(n, TT n)]
getArgTys (Bind n :: n
n (PVar _ _) sc :: TT n
sc) = TT n -> [(n, TT n)]
forall n. TT n -> [(n, TT n)]
getArgTys TT n
sc
getArgTys (Bind n :: n
n (PVTy _) sc :: TT n
sc) = TT n -> [(n, TT n)]
forall n. TT n -> [(n, TT n)]
getArgTys TT n
sc
getArgTys (Bind n :: n
n (Pi _ _ t :: TT n
t _) sc :: TT n
sc) = (n
n, TT n
t) (n, TT n) -> [(n, TT n)] -> [(n, TT n)]
forall a. a -> [a] -> [a]
: TT n -> [(n, TT n)]
forall n. TT n -> [(n, TT n)]
getArgTys TT n
sc
getArgTys _ = []
getRetTy :: TT n -> TT n
getRetTy :: TT n -> TT n
getRetTy (Bind n :: n
n (PVar _ _) sc :: TT n
sc) = TT n -> TT n
forall n. TT n -> TT n
getRetTy TT n
sc
getRetTy (Bind n :: n
n (PVTy _) sc :: TT n
sc) = TT n -> TT n
forall n. TT n -> TT n
getRetTy TT n
sc
getRetTy (Bind n :: n
n (Pi _ _ _ _) sc :: TT n
sc) = TT n -> TT n
forall n. TT n -> TT n
getRetTy TT n
sc
getRetTy sc :: TT n
sc = TT n
sc
substRetTy :: TT n -> TT n
substRetTy :: TT n -> TT n
substRetTy (Bind n :: n
n (PVar _ ty :: TT n
ty) sc :: TT n
sc) = TT n -> TT n
forall n. TT n -> TT n
substRetTy (TT n -> TT n -> TT n
forall n. TT n -> TT n -> TT n
substV (NameType -> n -> TT n -> TT n
forall n. NameType -> n -> TT n -> TT n
P NameType
Ref n
n TT n
ty) TT n
sc)
substRetTy (Bind n :: n
n (PVTy ty :: TT n
ty) sc :: TT n
sc) = TT n -> TT n
forall n. TT n -> TT n
substRetTy (TT n -> TT n -> TT n
forall n. TT n -> TT n -> TT n
substV (NameType -> n -> TT n -> TT n
forall n. NameType -> n -> TT n -> TT n
P NameType
Ref n
n TT n
ty) TT n
sc)
substRetTy (Bind n :: n
n (Pi _ _ ty :: TT n
ty _) sc :: TT n
sc) = TT n -> TT n
forall n. TT n -> TT n
substRetTy (TT n -> TT n -> TT n
forall n. TT n -> TT n -> TT n
substV (NameType -> n -> TT n -> TT n
forall n. NameType -> n -> TT n -> TT n
P NameType
Ref n
n TT n
ty) TT n
sc)
substRetTy sc :: TT n
sc = TT n
sc
uniqueNameFrom :: [Name] -> [Name] -> Name
uniqueNameFrom :: [Name] -> [Name] -> Name
uniqueNameFrom [] hs :: [Name]
hs = Name -> [Name] -> Name
uniqueName (Name -> Name
nextName (String -> Name
sUN "x")) [Name]
hs
uniqueNameFrom (s :: Name
s : supply :: [Name]
supply) hs :: [Name]
hs
| Name
s Name -> [Name] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Name]
hs = [Name] -> [Name] -> Name
uniqueNameFrom [Name]
supply [Name]
hs
| Bool
otherwise = Name
s
uniqueName :: Name -> [Name] -> Name
uniqueName :: Name -> [Name] -> Name
uniqueName n :: Name
n hs :: [Name]
hs | Name
n Name -> [Name] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Name]
hs = Name -> [Name] -> Name
uniqueName (Name -> Name
nextName Name
n) [Name]
hs
| Bool
otherwise = Name
n
uniqueNameSet :: Name -> Set Name -> Name
uniqueNameSet :: Name -> Set Name -> Name
uniqueNameSet n :: Name
n hs :: Set Name
hs | Name
n Name -> Set Name -> Bool
forall a. Ord a => a -> Set a -> Bool
`member` Set Name
hs = Name -> Set Name -> Name
uniqueNameSet (Name -> Name
nextName Name
n) Set Name
hs
| Bool
otherwise = Name
n
uniqueBinders :: [Name] -> TT Name -> TT Name
uniqueBinders :: [Name] -> Term -> Term
uniqueBinders ns :: [Name]
ns = Set Name -> Term -> Term
ubSet ([Name] -> Set Name
forall a. Ord a => [a] -> Set a
fromList [Name]
ns) where
ubSet :: Set Name -> Term -> Term
ubSet ns :: Set Name
ns (Bind n :: Name
n b :: Binder Term
b sc :: Term
sc)
= let n' :: Name
n' = Name -> Set Name -> Name
uniqueNameSet Name
n Set Name
ns
ns' :: Set Name
ns' = Name -> Set Name -> Set Name
forall a. Ord a => a -> Set a -> Set a
insert Name
n' Set Name
ns in
Name -> Binder Term -> Term -> Term
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind Name
n' ((Term -> Term) -> Binder Term -> Binder Term
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Set Name -> Term -> Term
ubSet Set Name
ns') Binder Term
b) (Set Name -> Term -> Term
ubSet Set Name
ns' Term
sc)
ubSet ns :: Set Name
ns (App s :: AppStatus Name
s f :: Term
f a :: Term
a) = AppStatus Name -> Term -> Term -> Term
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus Name
s (Set Name -> Term -> Term
ubSet Set Name
ns Term
f) (Set Name -> Term -> Term
ubSet Set Name
ns Term
a)
ubSet ns :: Set Name
ns t :: Term
t = Term
t
nextName :: Name -> Name
nextName :: Name -> Name
nextName (NS x :: Name
x s :: [Text]
s) = Name -> [Text] -> Name
NS (Name -> Name
nextName Name
x) [Text]
s
nextName (MN i :: Int
i n :: Text
n) = Int -> Text -> Name
MN (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
+1) Text
n
nextName (UN x :: Text
x) = let (num' :: Text
num', nm' :: Text
nm') = (Char -> Bool) -> Text -> (Text, Text)
T.span Char -> Bool
isDigit (Text -> Text
T.reverse Text
x)
nm :: Text
nm = Text -> Text
T.reverse Text
nm'
num :: Integer
num = Text -> Integer
forall p. (Read p, Num p) => Text -> p
readN (Text -> Text
T.reverse Text
num') in
Text -> Name
UN (Text
nm Text -> Text -> Text
`T.append` String -> Text
txt (Integer -> String
forall a. Show a => a -> String
show (Integer
numInteger -> Integer -> Integer
forall a. Num a => a -> a -> a
+1)))
where
readN :: Text -> p
readN x :: Text
x | Bool -> Bool
not (Text -> Bool
T.null Text
x) = String -> p
forall a. Read a => String -> a
read (Text -> String
T.unpack Text
x)
readN x :: Text
x = 0
nextName (SN x :: SpecialName
x) = SpecialName -> Name
SN (SpecialName -> SpecialName
nextName' SpecialName
x)
where
nextName' :: SpecialName -> SpecialName
nextName' (WhereN i :: Int
i f :: Name
f x :: Name
x) = Int -> Name -> Name -> SpecialName
WhereN Int
i Name
f (Name -> Name
nextName Name
x)
nextName' (WithN i :: Int
i n :: Name
n) = Int -> Name -> SpecialName
WithN Int
i (Name -> Name
nextName Name
n)
nextName' (ImplementationN n :: Name
n ns :: [Text]
ns) = Name -> [Text] -> SpecialName
ImplementationN (Name -> Name
nextName Name
n) [Text]
ns
nextName' (ParentN n :: Name
n ns :: Text
ns) = Name -> Text -> SpecialName
ParentN (Name -> Name
nextName Name
n) Text
ns
nextName' (CaseN fc :: FC'
fc n :: Name
n) = FC' -> Name -> SpecialName
CaseN FC'
fc (Name -> Name
nextName Name
n)
nextName' (MethodN n :: Name
n) = Name -> SpecialName
MethodN (Name -> Name
nextName Name
n)
nextName' (ImplementationCtorN n :: Name
n) = Name -> SpecialName
ImplementationCtorN (Name -> Name
nextName Name
n)
nextName' (MetaN parent :: Name
parent meta :: Name
meta) = Name -> Name -> SpecialName
MetaN Name
parent (Name -> Name
nextName Name
meta)
nextName (SymRef i :: Int
i) = String -> Name
forall a. HasCallStack => String -> a
error "Can't generate a name from a symbol reference"
type Term = TT Name
type Type = Term
type Env = EnvTT Name
newtype WkEnvTT n = Wk (EnvTT n)
type WkEnv = WkEnvTT Name
instance (Eq n, Show n) => Show (TT n) where
show :: TT n -> String
show t :: TT n
t = EnvTT n -> TT n -> String
forall n. (Eq n, Show n) => EnvTT n -> TT n -> String
showEnv [] TT n
t
itBitsName :: NativeTy -> String
itBitsName IT8 = "Bits8"
itBitsName IT16 = "Bits16"
itBitsName IT32 = "Bits32"
itBitsName IT64 = "Bits64"
instance Show Const where
show :: Const -> String
show (I i :: Int
i) = Int -> String
forall a. Show a => a -> String
show Int
i
show (BI i :: Integer
i) = Integer -> String
forall a. Show a => a -> String
show Integer
i
show (Fl f :: Double
f) = Double -> String
forall a. Show a => a -> String
show Double
f
show (Ch c :: Char
c) = Char -> String
forall a. Show a => a -> String
show Char
c
show (Str s :: String
s) = ShowS
forall a. Show a => a -> String
show String
s
show (B8 x :: Word8
x) = Word8 -> String
forall a. Show a => a -> String
show Word8
x
show (B16 x :: Word16
x) = Word16 -> String
forall a. Show a => a -> String
show Word16
x
show (B32 x :: Word32
x) = Word32 -> String
forall a. Show a => a -> String
show Word32
x
show (B64 x :: Word64
x) = Word64 -> String
forall a. Show a => a -> String
show Word64
x
show (AType ATFloat) = "Double"
show (AType (ATInt ITBig)) = "Integer"
show (AType (ATInt ITNative)) = "Int"
show (AType (ATInt ITChar)) = "Char"
show (AType (ATInt (ITFixed it :: NativeTy
it))) = NativeTy -> String
itBitsName NativeTy
it
show TheWorld = "prim__TheWorld"
show WorldType = "prim__WorldType"
show StrType = "String"
show VoidType = "Void"
show Forgot = "Forgot"
showEnv :: (Eq n, Show n) => EnvTT n -> TT n -> String
showEnv :: EnvTT n -> TT n -> String
showEnv env :: EnvTT n
env t :: TT n
t = EnvTT n -> TT n -> Bool -> String
forall a.
(Show a, Eq a) =>
[(a, RigCount, Binder (TT a))] -> TT a -> Bool -> String
showEnv' EnvTT n
env TT n
t Bool
False
showEnvDbg :: [(a, RigCount, Binder (TT a))] -> TT a -> String
showEnvDbg env :: [(a, RigCount, Binder (TT a))]
env t :: TT a
t = [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> String
forall a.
(Show a, Eq a) =>
[(a, RigCount, Binder (TT a))] -> TT a -> Bool -> String
showEnv' [(a, RigCount, Binder (TT a))]
env TT a
t Bool
True
prettyEnv :: Env -> Term -> Doc OutputAnnotation
prettyEnv :: Env -> Term -> Doc OutputAnnotation
prettyEnv env :: Env
env t :: Term
t = Env -> Term -> Bool -> Doc OutputAnnotation
forall a a.
(Show a, Pretty a a, Pretty NameType a, Pretty Const a, Eq a) =>
[(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettyEnv' Env
env Term
t Bool
False
where
prettyEnv' :: [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettyEnv' env :: [(a, RigCount, Binder (TT a))]
env t :: TT a
t dbg :: Bool
dbg = Integer -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
forall t a a.
(Num t, Show a, Ord t, Pretty a a, Pretty NameType a,
Pretty Const a, Eq a) =>
t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe 10 [(a, RigCount, Binder (TT a))]
env TT a
t Bool
dbg
bracket :: a -> a -> Doc a -> Doc a
bracket outer :: a
outer inner :: a
inner p :: Doc a
p
| a
inner a -> a -> Bool
forall a. Ord a => a -> a -> Bool
> a
outer = Doc a
forall a. Doc a
lparen Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<> Doc a
p Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<> Doc a
forall a. Doc a
rparen
| Bool
otherwise = Doc a
p
prettySe :: t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (P nt :: NameType
nt n :: a
n t :: TT a
t) debug :: Bool
debug =
a -> Doc a
forall a ty. Pretty a ty => a -> Doc ty
pretty a
n Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+>
if Bool
debug then
Doc a
forall a. Doc a
lbracket Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> NameType -> Doc a
forall a ty. Pretty a ty => a -> Doc ty
pretty NameType
nt Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> Doc a
forall a. Doc a
colon Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe 10 [(a, RigCount, Binder (TT a))]
env TT a
t Bool
debug Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> Doc a
forall a. Doc a
rbracket
else
Doc a
forall a. Doc a
empty
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (V i :: Int
i) debug :: Bool
debug
| Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< [(a, RigCount, Binder (TT a))] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [(a, RigCount, Binder (TT a))]
env =
if Bool
debug then
String -> Doc a
forall a. String -> Doc a
text (String -> Doc a)
-> ((a, RigCount, Binder (TT a)) -> String)
-> (a, RigCount, Binder (TT a))
-> Doc a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> String
forall a. Show a => a -> String
show (a -> String)
-> ((a, RigCount, Binder (TT a)) -> a)
-> (a, RigCount, Binder (TT a))
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a, RigCount, Binder (TT a)) -> a
forall a b c. (a, b, c) -> a
fstEnv ((a, RigCount, Binder (TT a)) -> Doc a)
-> (a, RigCount, Binder (TT a)) -> Doc a
forall a b. (a -> b) -> a -> b
$ [(a, RigCount, Binder (TT a))]
env[(a, RigCount, Binder (TT a))]
-> Int -> (a, RigCount, Binder (TT a))
forall a. [a] -> Int -> a
!!Int
i
else
Doc a
forall a. Doc a
lbracket Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc a
forall a. String -> Doc a
text (Int -> String
forall a. Show a => a -> String
show Int
i) Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> Doc a
forall a. Doc a
rbracket
| Bool
otherwise = String -> Doc a
forall a. String -> Doc a
text "unbound" Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc a
forall a. String -> Doc a
text (Int -> String
forall a. Show a => a -> String
show Int
i) Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc a
forall a. String -> Doc a
text "!"
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Bind n :: a
n b :: Binder (TT a)
b@(Pi _ _ t :: TT a
t _) sc :: TT a
sc) debug :: Bool
debug
| a -> TT a -> Bool
forall n. Eq n => n -> TT n -> Bool
noOccurrence a
n TT a
sc Bool -> Bool -> Bool
&& Bool -> Bool
not Bool
debug =
t -> t -> Doc a -> Doc a
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket t
p 2 (Doc a -> Doc a) -> Doc a -> Doc a
forall a b. (a -> b) -> a -> b
$ [(a, RigCount, Binder (TT a))]
-> a -> Binder (TT a) -> Bool -> Doc a
prettySb [(a, RigCount, Binder (TT a))]
env a
n Binder (TT a)
b Bool
debug Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<> t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe 10 ((a
n, RigCount
Rig0, Binder (TT a)
b)(a, RigCount, Binder (TT a))
-> [(a, RigCount, Binder (TT a))] -> [(a, RigCount, Binder (TT a))]
forall a. a -> [a] -> [a]
:[(a, RigCount, Binder (TT a))]
env) TT a
sc Bool
debug
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Bind n :: a
n b :: Binder (TT a)
b sc :: TT a
sc) debug :: Bool
debug =
t -> t -> Doc a -> Doc a
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket t
p 2 (Doc a -> Doc a) -> Doc a -> Doc a
forall a b. (a -> b) -> a -> b
$ [(a, RigCount, Binder (TT a))]
-> a -> Binder (TT a) -> Bool -> Doc a
prettySb [(a, RigCount, Binder (TT a))]
env a
n Binder (TT a)
b Bool
debug Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<> t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe 10 ((a
n, RigCount
Rig0, Binder (TT a)
b)(a, RigCount, Binder (TT a))
-> [(a, RigCount, Binder (TT a))] -> [(a, RigCount, Binder (TT a))]
forall a. a -> [a] -> [a]
:[(a, RigCount, Binder (TT a))]
env) TT a
sc Bool
debug
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (App _ f :: TT a
f a :: TT a
a) debug :: Bool
debug =
t -> t -> Doc a -> Doc a
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket t
p 1 (Doc a -> Doc a) -> Doc a -> Doc a
forall a b. (a -> b) -> a -> b
$ t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe 1 [(a, RigCount, Binder (TT a))]
env TT a
f Bool
debug Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe 0 [(a, RigCount, Binder (TT a))]
env TT a
a Bool
debug
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Proj x :: TT a
x i :: Int
i) debug :: Bool
debug =
t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe 1 [(a, RigCount, Binder (TT a))]
env TT a
x Bool
debug Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc a
forall a. String -> Doc a
text ("!" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i)
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Constant c :: Const
c) debug :: Bool
debug = Const -> Doc a
forall a ty. Pretty a ty => a -> Doc ty
pretty Const
c
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env Erased debug :: Bool
debug = String -> Doc a
forall a. String -> Doc a
text "[_]"
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (TType i :: UExp
i) debug :: Bool
debug = String -> Doc a
forall a. String -> Doc a
text "Type" Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> (String -> Doc a
forall a. String -> Doc a
text (String -> Doc a) -> (UExp -> String) -> UExp -> Doc a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UExp -> String
forall a. Show a => a -> String
show (UExp -> Doc a) -> UExp -> Doc a
forall a b. (a -> b) -> a -> b
$ UExp
i)
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env Impossible debug :: Bool
debug = String -> Doc a
forall a. String -> Doc a
text "Impossible"
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Inferred tm :: TT a
tm) debug :: Bool
debug = String -> Doc a
forall a. String -> Doc a
text "<" Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe t
p [(a, RigCount, Binder (TT a))]
env TT a
tm Bool
debug Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc a
forall a. String -> Doc a
text ">"
prettySe p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (UType u :: Universe
u) debug :: Bool
debug = String -> Doc a
forall a. String -> Doc a
text (Universe -> String
forall a. Show a => a -> String
show Universe
u)
prettySb :: [(a, RigCount, Binder (TT a))]
-> a -> Binder (TT a) -> Bool -> Doc a
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Lam _ t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> Bool -> Doc a
prettyB [(a, RigCount, Binder (TT a))]
env "λ" "=>" a
n TT a
t
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Hole t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> Bool -> Doc a
prettyB [(a, RigCount, Binder (TT a))]
env "?defer" "." a
n TT a
t
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (GHole _ _ t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> Bool -> Doc a
prettyB [(a, RigCount, Binder (TT a))]
env "?gdefer" "." a
n TT a
t
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Pi Rig0 _ t :: TT a
t _) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> Bool -> Doc a
prettyB [(a, RigCount, Binder (TT a))]
env "(" ") ->" a
n TT a
t
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Pi Rig1 _ t :: TT a
t _) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> Bool -> Doc a
prettyB [(a, RigCount, Binder (TT a))]
env "(" ") -o" a
n TT a
t
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Pi RigW _ t :: TT a
t _) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> Bool -> Doc a
prettyB [(a, RigCount, Binder (TT a))]
env "(" ") ->" a
n TT a
t
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (PVar Rig1 t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> Bool -> Doc a
prettyB [(a, RigCount, Binder (TT a))]
env "pat 1 " "." a
n TT a
t
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (PVar _ t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> Bool -> Doc a
prettyB [(a, RigCount, Binder (TT a))]
env "pat" "." a
n TT a
t
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (PVTy t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> Bool -> Doc a
prettyB [(a, RigCount, Binder (TT a))]
env "pty" "." a
n TT a
t
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Let Rig1 t :: TT a
t v :: TT a
v) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> Bool -> Doc a
prettyBv [(a, RigCount, Binder (TT a))]
env "let 1 " "in" a
n TT a
t TT a
v
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Let _ t :: TT a
t v :: TT a
v) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> Bool -> Doc a
prettyBv [(a, RigCount, Binder (TT a))]
env "let" "in" a
n TT a
t TT a
v
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (NLet t :: TT a
t v :: TT a
v) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> Bool -> Doc a
prettyBv [(a, RigCount, Binder (TT a))]
env "nlet" "in" a
n TT a
t TT a
v
prettySb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Guess t :: TT a
t v :: TT a
v) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> Bool -> Doc a
prettyBv [(a, RigCount, Binder (TT a))]
env "??" "in" a
n TT a
t TT a
v
prettyB :: [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> Bool -> Doc a
prettyB env :: [(a, RigCount, Binder (TT a))]
env op :: String
op sc :: String
sc n :: a
n t :: TT a
t debug :: Bool
debug =
String -> Doc a
forall a. String -> Doc a
text String
op Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<> a -> Doc a
forall a ty. Pretty a ty => a -> Doc ty
pretty a
n Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> Doc a
forall a. Doc a
colon Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe 10 [(a, RigCount, Binder (TT a))]
env TT a
t Bool
debug Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<> String -> Doc a
forall a. String -> Doc a
text String
sc
prettyBv :: [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> Bool -> Doc a
prettyBv env :: [(a, RigCount, Binder (TT a))]
env op :: String
op sc :: String
sc n :: a
n t :: TT a
t v :: TT a
v debug :: Bool
debug =
String -> Doc a
forall a. String -> Doc a
text String
op Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<> a -> Doc a
forall a ty. Pretty a ty => a -> Doc ty
pretty a
n Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> Doc a
forall a. Doc a
colon Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe 10 [(a, RigCount, Binder (TT a))]
env TT a
t Bool
debug Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc a
forall a. String -> Doc a
text "=" Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<+>
t -> [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> Doc a
prettySe 10 [(a, RigCount, Binder (TT a))]
env TT a
v Bool
debug Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<> String -> Doc a
forall a. String -> Doc a
text String
sc
showEnv' :: [(a, RigCount, Binder (TT a))] -> TT a -> Bool -> String
showEnv' env :: [(a, RigCount, Binder (TT a))]
env t :: TT a
t dbg :: Bool
dbg = Integer -> [(a, RigCount, Binder (TT a))] -> TT a -> String
forall a t.
(Show a, Num t, Ord t, Eq a) =>
t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 10 [(a, RigCount, Binder (TT a))]
env TT a
t where
se :: t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (P nt :: NameType
nt n :: a
n t :: TT a
t) = a -> String
forall a. Show a => a -> String
show a
n
String -> ShowS
forall a. [a] -> [a] -> [a]
++ if Bool
dbg then "{" String -> ShowS
forall a. [a] -> [a] -> [a]
++ NameType -> String
forall a. Show a => a -> String
show NameType
nt String -> ShowS
forall a. [a] -> [a] -> [a]
++ " : " String -> ShowS
forall a. [a] -> [a] -> [a]
++ t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 10 [(a, RigCount, Binder (TT a))]
env TT a
t String -> ShowS
forall a. [a] -> [a] -> [a]
++ "}" else ""
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (V i :: Int
i) | Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< [(a, RigCount, Binder (TT a))] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [(a, RigCount, Binder (TT a))]
env Bool -> Bool -> Bool
&& Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= 0
= (a -> String
forall a. Show a => a -> String
show (a -> String) -> a -> String
forall a b. (a -> b) -> a -> b
$ (a, RigCount, Binder (TT a)) -> a
forall a b c. (a, b, c) -> a
fstEnv ((a, RigCount, Binder (TT a)) -> a)
-> (a, RigCount, Binder (TT a)) -> a
forall a b. (a -> b) -> a -> b
$ [(a, RigCount, Binder (TT a))]
env[(a, RigCount, Binder (TT a))]
-> Int -> (a, RigCount, Binder (TT a))
forall a. [a] -> Int -> a
!!Int
i) String -> ShowS
forall a. [a] -> [a] -> [a]
++
if Bool
dbg then "{" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i String -> ShowS
forall a. [a] -> [a] -> [a]
++ "}" else ""
| Bool
otherwise = "!!V " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i String -> ShowS
forall a. [a] -> [a] -> [a]
++ "!!"
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Bind n :: a
n b :: Binder (TT a)
b@(Pi rig :: RigCount
rig (Just _) t :: TT a
t k :: TT a
k) sc :: TT a
sc)
= t -> t -> ShowS
forall a. Ord a => a -> a -> ShowS
bracket t
p 2 ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ [(a, RigCount, Binder (TT a))] -> a -> Binder (TT a) -> String
sb [(a, RigCount, Binder (TT a))]
env a
n Binder (TT a)
b String -> ShowS
forall a. [a] -> [a] -> [a]
++ t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 10 ((a
n, RigCount
rig, Binder (TT a)
b)(a, RigCount, Binder (TT a))
-> [(a, RigCount, Binder (TT a))] -> [(a, RigCount, Binder (TT a))]
forall a. a -> [a] -> [a]
:[(a, RigCount, Binder (TT a))]
env) TT a
sc
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Bind n :: a
n b :: Binder (TT a)
b@(Pi rig :: RigCount
rig _ t :: TT a
t k :: TT a
k) sc :: TT a
sc)
| a -> TT a -> Bool
forall n. Eq n => n -> TT n -> Bool
noOccurrence a
n TT a
sc Bool -> Bool -> Bool
&& Bool -> Bool
not Bool
dbg = t -> t -> ShowS
forall a. Ord a => a -> a -> ShowS
bracket t
p 2 ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 1 [(a, RigCount, Binder (TT a))]
env TT a
t String -> ShowS
forall a. [a] -> [a] -> [a]
++ RigCount -> String
arrow RigCount
rig String -> ShowS
forall a. [a] -> [a] -> [a]
++ t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 10 ((a
n,RigCount
Rig0,Binder (TT a)
b)(a, RigCount, Binder (TT a))
-> [(a, RigCount, Binder (TT a))] -> [(a, RigCount, Binder (TT a))]
forall a. a -> [a] -> [a]
:[(a, RigCount, Binder (TT a))]
env) TT a
sc
where arrow :: RigCount -> String
arrow Rig0 = " 0-> "
arrow Rig1 = " -o "
arrow RigW = " -> "
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Bind n :: a
n b :: Binder (TT a)
b sc :: TT a
sc) = t -> t -> ShowS
forall a. Ord a => a -> a -> ShowS
bracket t
p 2 ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ [(a, RigCount, Binder (TT a))] -> a -> Binder (TT a) -> String
sb [(a, RigCount, Binder (TT a))]
env a
n Binder (TT a)
b String -> ShowS
forall a. [a] -> [a] -> [a]
++ t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 10 ((a
n,RigCount
Rig0,Binder (TT a)
b)(a, RigCount, Binder (TT a))
-> [(a, RigCount, Binder (TT a))] -> [(a, RigCount, Binder (TT a))]
forall a. a -> [a] -> [a]
:[(a, RigCount, Binder (TT a))]
env) TT a
sc
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (App _ f :: TT a
f a :: TT a
a) = t -> t -> ShowS
forall a. Ord a => a -> a -> ShowS
bracket t
p 1 ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 1 [(a, RigCount, Binder (TT a))]
env TT a
f String -> ShowS
forall a. [a] -> [a] -> [a]
++ " " String -> ShowS
forall a. [a] -> [a] -> [a]
++ t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 0 [(a, RigCount, Binder (TT a))]
env TT a
a
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Proj x :: TT a
x i :: Int
i) = t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 1 [(a, RigCount, Binder (TT a))]
env TT a
x String -> ShowS
forall a. [a] -> [a] -> [a]
++ "!" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Constant c :: Const
c) = Const -> String
forall a. Show a => a -> String
show Const
c
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env Erased = "[__]"
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env Impossible = "[impossible]"
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (Inferred t :: TT a
t) = "<" String -> ShowS
forall a. [a] -> [a] -> [a]
++ t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se t
p [(a, RigCount, Binder (TT a))]
env TT a
t String -> ShowS
forall a. [a] -> [a] -> [a]
++ ">"
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (TType i :: UExp
i) = "Type " String -> ShowS
forall a. [a] -> [a] -> [a]
++ UExp -> String
forall a. Show a => a -> String
show UExp
i
se p :: t
p env :: [(a, RigCount, Binder (TT a))]
env (UType u :: Universe
u) = Universe -> String
forall a. Show a => a -> String
show Universe
u
sb :: [(a, RigCount, Binder (TT a))] -> a -> Binder (TT a) -> String
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Lam Rig1 t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "\\ 1 " " => " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Lam _ t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "\\ " " => " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Hole t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "? " ". " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (GHole i :: Int
i ns :: [Name]
ns t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "?defer " ". " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Pi Rig1 (Just _) t :: TT a
t _) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "{" "} -o " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Pi _ (Just _) t :: TT a
t _) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "{" "} -> " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Pi Rig1 _ t :: TT a
t _) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "(" ") -0 " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Pi _ _ t :: TT a
t _) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "(" ") -> " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (PVar Rig0 t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "pat 0 " ". " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (PVar Rig1 t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "pat 1 " ". " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (PVar _ t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "pat " ". " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (PVTy t :: TT a
t) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb [(a, RigCount, Binder (TT a))]
env "pty " ". " a
n TT a
t
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Let Rig0 t :: TT a
t v :: TT a
v) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> String
showbv [(a, RigCount, Binder (TT a))]
env "let 0 " " in " a
n TT a
t TT a
v
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Let Rig1 t :: TT a
t v :: TT a
v) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> String
showbv [(a, RigCount, Binder (TT a))]
env "let 1 " " in " a
n TT a
t TT a
v
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Let _ t :: TT a
t v :: TT a
v) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> String
showbv [(a, RigCount, Binder (TT a))]
env "let " " in " a
n TT a
t TT a
v
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (NLet t :: TT a
t v :: TT a
v) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> String
showbv [(a, RigCount, Binder (TT a))]
env "nlet " " in " a
n TT a
t TT a
v
sb env :: [(a, RigCount, Binder (TT a))]
env n :: a
n (Guess t :: TT a
t v :: TT a
v) = [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> String
showbv [(a, RigCount, Binder (TT a))]
env "?? " " in " a
n TT a
t TT a
v
showb :: [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> String
showb env :: [(a, RigCount, Binder (TT a))]
env op :: String
op sc :: String
sc n :: a
n t :: TT a
t = String
op String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
n String -> ShowS
forall a. [a] -> [a] -> [a]
++ " : " String -> ShowS
forall a. [a] -> [a] -> [a]
++ t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 10 [(a, RigCount, Binder (TT a))]
env TT a
t String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
sc
showbv :: [(a, RigCount, Binder (TT a))]
-> String -> String -> a -> TT a -> TT a -> String
showbv env :: [(a, RigCount, Binder (TT a))]
env op :: String
op sc :: String
sc n :: a
n t :: TT a
t v :: TT a
v = String
op String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
n String -> ShowS
forall a. [a] -> [a] -> [a]
++ " : " String -> ShowS
forall a. [a] -> [a] -> [a]
++ t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 10 [(a, RigCount, Binder (TT a))]
env TT a
t String -> ShowS
forall a. [a] -> [a] -> [a]
++ " = " String -> ShowS
forall a. [a] -> [a] -> [a]
++
t -> [(a, RigCount, Binder (TT a))] -> TT a -> String
se 10 [(a, RigCount, Binder (TT a))]
env TT a
v String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
sc
bracket :: a -> a -> ShowS
bracket outer :: a
outer inner :: a
inner str :: String
str | a
inner a -> a -> Bool
forall a. Ord a => a -> a -> Bool
> a
outer = "(" String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
str String -> ShowS
forall a. [a] -> [a] -> [a]
++ ")"
| Bool
otherwise = String
str
pureTerm :: TT Name -> Bool
pureTerm :: Term -> Bool
pureTerm (App _ f :: Term
f a :: Term
a) = Term -> Bool
pureTerm Term
f Bool -> Bool -> Bool
&& Term -> Bool
pureTerm Term
a
pureTerm (Bind n :: Name
n b :: Binder Term
b sc :: Term
sc) = Name -> Bool
notInterfaceName Name
n Bool -> Bool -> Bool
&& Binder Term -> Bool
pureBinder Binder Term
b Bool -> Bool -> Bool
&& Term -> Bool
pureTerm Term
sc where
pureBinder :: Binder Term -> Bool
pureBinder (Hole _) = Bool
False
pureBinder (Guess _ _) = Bool
False
pureBinder (Let c :: RigCount
c t :: Term
t v :: Term
v) = Term -> Bool
pureTerm Term
t Bool -> Bool -> Bool
&& Term -> Bool
pureTerm Term
v
pureBinder t :: Binder Term
t = Term -> Bool
pureTerm (Binder Term -> Term
forall b. Binder b -> b
binderTy Binder Term
t)
notInterfaceName :: Name -> Bool
notInterfaceName (MN _ c :: Text
c) | Text
c Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== String -> Text
txt "__interface" = Bool
False
notInterfaceName _ = Bool
True
pureTerm _ = Bool
True
weakenTm :: Int -> TT n -> TT n
weakenTm :: Int -> TT n -> TT n
weakenTm i :: Int
i t :: TT n
t = Int -> Int -> TT n -> TT n
forall n. Int -> Int -> TT n -> TT n
wk Int
i 0 TT n
t
where wk :: Int -> Int -> TT n -> TT n
wk i :: Int
i min :: Int
min (V x :: Int
x) | Int
x Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
min = Int -> TT n
forall n. Int -> TT n
V (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
x)
wk i :: Int
i m :: Int
m (App s :: AppStatus n
s f :: TT n
f a :: TT n
a) = AppStatus n -> TT n -> TT n -> TT n
forall n. AppStatus n -> TT n -> TT n -> TT n
App AppStatus n
s (Int -> Int -> TT n -> TT n
wk Int
i Int
m TT n
f) (Int -> Int -> TT n -> TT n
wk Int
i Int
m TT n
a)
wk i :: Int
i m :: Int
m (Bind x :: n
x b :: Binder (TT n)
b sc :: TT n
sc) = n -> Binder (TT n) -> TT n -> TT n
forall n. n -> Binder (TT n) -> TT n -> TT n
Bind n
x (Int -> Int -> Binder (TT n) -> Binder (TT n)
wkb Int
i Int
m Binder (TT n)
b) (Int -> Int -> TT n -> TT n
wk Int
i (Int
m Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1) TT n
sc)
wk i :: Int
i m :: Int
m t :: TT n
t = TT n
t
wkb :: Int -> Int -> Binder (TT n) -> Binder (TT n)
wkb i :: Int
i m :: Int
m t :: Binder (TT n)
t = (TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Int -> Int -> TT n -> TT n
wk Int
i Int
m) Binder (TT n)
t
weakenEnv :: EnvTT n -> EnvTT n
weakenEnv :: EnvTT n -> EnvTT n
weakenEnv env :: EnvTT n
env = Int -> EnvTT n -> EnvTT n
forall a b n.
Int -> [(a, b, Binder (TT n))] -> [(a, b, Binder (TT n))]
wk (EnvTT n -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length EnvTT n
env Int -> Int -> Int
forall a. Num a => a -> a -> a
- 1) EnvTT n
env
where wk :: Int -> [(a, b, Binder (TT n))] -> [(a, b, Binder (TT n))]
wk i :: Int
i [] = []
wk i :: Int
i ((n :: a
n, c :: b
c, b :: Binder (TT n)
b) : bs :: [(a, b, Binder (TT n))]
bs) = (a
n, b
c, Int -> Binder (TT n) -> Binder (TT n)
forall n. Int -> Binder (TT n) -> Binder (TT n)
weakenTmB Int
i Binder (TT n)
b) (a, b, Binder (TT n))
-> [(a, b, Binder (TT n))] -> [(a, b, Binder (TT n))]
forall a. a -> [a] -> [a]
: Int -> [(a, b, Binder (TT n))] -> [(a, b, Binder (TT n))]
wk (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
- 1) [(a, b, Binder (TT n))]
bs
weakenTmB :: Int -> Binder (TT n) -> Binder (TT n)
weakenTmB i :: Int
i (Let c :: RigCount
c t :: TT n
t v :: TT n
v) = RigCount -> TT n -> TT n -> Binder (TT n)
forall b. RigCount -> b -> b -> Binder b
Let RigCount
c (Int -> TT n -> TT n
forall n. Int -> TT n -> TT n
weakenTm Int
i TT n
t) (Int -> TT n -> TT n
forall n. Int -> TT n -> TT n
weakenTm Int
i TT n
v)
weakenTmB i :: Int
i (Guess t :: TT n
t v :: TT n
v) = TT n -> TT n -> Binder (TT n)
forall b. b -> b -> Binder b
Guess (Int -> TT n -> TT n
forall n. Int -> TT n -> TT n
weakenTm Int
i TT n
t) (Int -> TT n -> TT n
forall n. Int -> TT n -> TT n
weakenTm Int
i TT n
v)
weakenTmB i :: Int
i t :: Binder (TT n)
t = Binder (TT n)
t { binderTy :: TT n
binderTy = Int -> TT n -> TT n
forall n. Int -> TT n -> TT n
weakenTm Int
i (Binder (TT n) -> TT n
forall b. Binder b -> b
binderTy Binder (TT n)
t) }
weakenTmEnv :: Int -> EnvTT n -> EnvTT n
weakenTmEnv :: Int -> EnvTT n -> EnvTT n
weakenTmEnv i :: Int
i = ((n, RigCount, Binder (TT n)) -> (n, RigCount, Binder (TT n)))
-> EnvTT n -> EnvTT n
forall a b. (a -> b) -> [a] -> [b]
map (\ (n :: n
n, c :: RigCount
c, b :: Binder (TT n)
b) -> (n
n, RigCount
c, (TT n -> TT n) -> Binder (TT n) -> Binder (TT n)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Int -> TT n -> TT n
forall n. Int -> TT n -> TT n
weakenTm Int
i) Binder (TT n)
b))
refsIn :: TT Name -> [Name]
refsIn :: Term -> [Name]
refsIn (P _ n :: Name
n _) = [Name
n]
refsIn (Bind n :: Name
n b :: Binder Term
b t :: Term
t) = [Name] -> [Name]
forall a. Eq a => [a] -> [a]
nub ([Name] -> [Name]) -> [Name] -> [Name]
forall a b. (a -> b) -> a -> b
$ Binder Term -> [Name]
nb Binder Term
b [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ Term -> [Name]
refsIn Term
t
where nb :: Binder Term -> [Name]
nb (Let _ t :: Term
t v :: Term
v) = [Name] -> [Name]
forall a. Eq a => [a] -> [a]
nub (Term -> [Name]
refsIn Term
t) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ [Name] -> [Name]
forall a. Eq a => [a] -> [a]
nub (Term -> [Name]
refsIn Term
v)
nb (Guess t :: Term
t v :: Term
v) = [Name] -> [Name]
forall a. Eq a => [a] -> [a]
nub (Term -> [Name]
refsIn Term
t) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ [Name] -> [Name]
forall a. Eq a => [a] -> [a]
nub (Term -> [Name]
refsIn Term
v)
nb t :: Binder Term
t = Term -> [Name]
refsIn (Binder Term -> Term
forall b. Binder b -> b
binderTy Binder Term
t)
refsIn (App s :: AppStatus Name
s f :: Term
f a :: Term
a) = [Name] -> [Name]
forall a. Eq a => [a] -> [a]
nub (Term -> [Name]
refsIn Term
f [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ Term -> [Name]
refsIn Term
a)
refsIn _ = []
allTTNames :: Eq n => TT n -> [n]
allTTNames :: TT n -> [n]
allTTNames = [n] -> [n]
forall a. Eq a => [a] -> [a]
nub ([n] -> [n]) -> (TT n -> [n]) -> TT n -> [n]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TT n -> [n]
forall a. TT a -> [a]
allNamesIn
where allNamesIn :: TT a -> [a]
allNamesIn (P _ n :: a
n _) = [a
n]
allNamesIn (Bind n :: a
n b :: Binder (TT a)
b t :: TT a
t) = [a
n] [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ Binder (TT a) -> [a]
nb Binder (TT a)
b [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ TT a -> [a]
allNamesIn TT a
t
where nb :: Binder (TT a) -> [a]
nb (Let _ t :: TT a
t v :: TT a
v) = TT a -> [a]
allNamesIn TT a
t [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ TT a -> [a]
allNamesIn TT a
v
nb (Guess t :: TT a
t v :: TT a
v) = TT a -> [a]
allNamesIn TT a
t [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ TT a -> [a]
allNamesIn TT a
v
nb t :: Binder (TT a)
t = TT a -> [a]
allNamesIn (Binder (TT a) -> TT a
forall b. Binder b -> b
binderTy Binder (TT a)
t)
allNamesIn (App _ f :: TT a
f a :: TT a
a) = TT a -> [a]
allNamesIn TT a
f [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ TT a -> [a]
allNamesIn TT a
a
allNamesIn _ = []
pprintTT :: [Name]
-> TT Name
-> Doc OutputAnnotation
pprintTT :: [Name] -> Term -> Doc OutputAnnotation
pprintTT bound :: [Name]
bound tm :: Term
tm = Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec [Name]
bound Term
tm
where
startPrec :: Integer
startPrec = 0
appPrec :: Integer
appPrec = 10
pp :: Integer -> [Name] -> Term -> Doc OutputAnnotation
pp p :: Integer
p bound :: [Name]
bound (P Bound n :: Name
n ty :: Term
ty) = OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Name -> Bool -> OutputAnnotation
AnnBoundName Name
n Bool
False) (String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation) -> String -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Name -> String
forall a. Show a => a -> String
show Name
n)
pp p :: Integer
p bound :: [Name]
bound (P nt :: NameType
nt n :: Name
n ty :: Term
ty) = OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Name
-> Maybe NameOutput
-> Maybe String
-> Maybe String
-> OutputAnnotation
AnnName Name
n Maybe NameOutput
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing)
(String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation) -> String -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Name -> String
forall a. Show a => a -> String
show Name
n)
pp p :: Integer
p bound :: [Name]
bound (V i :: Int
i)
| Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Name]
bound = let n :: Name
n = [Name]
bound [Name] -> Int -> Name
forall a. [a] -> Int -> a
!! Int
i
in OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Name -> Bool -> OutputAnnotation
AnnBoundName Name
n Bool
False) (String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation) -> String -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Name -> String
forall a. Show a => a -> String
show Name
n)
| Bool
otherwise = String -> Doc OutputAnnotation
forall a. String -> Doc a
text ("{{{V" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i String -> ShowS
forall a. [a] -> [a] -> [a]
++ "}}}")
pp p :: Integer
p bound :: [Name]
bound (Bind n :: Name
n b :: Binder Term
b sc :: Term
sc) = Integer
-> [Name]
-> Name
-> Binder Term
-> Doc OutputAnnotation
-> Doc OutputAnnotation
ppb Integer
p [Name]
bound Name
n Binder Term
b (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec (Name
nName -> [Name] -> [Name]
forall a. a -> [a] -> [a]
:[Name]
bound) Term
sc
pp p :: Integer
p bound :: [Name]
bound (App _ tm1 :: Term
tm1 tm2 :: Term
tm2) =
Integer -> Integer -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket Integer
p Integer
appPrec (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
appPrec [Name]
bound Term
tm1 Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<>
Integer -> [Name] -> Term -> Doc OutputAnnotation
pp (Integer
appPrec Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ 1) [Name]
bound Term
tm2
pp p :: Integer
p bound :: [Name]
bound (Constant c :: Const
c) = OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Const -> OutputAnnotation
AnnConst Const
c) (String -> Doc OutputAnnotation
forall a. String -> Doc a
text (Const -> String
forall a. Show a => a -> String
show Const
c))
pp p :: Integer
p bound :: [Name]
bound (Proj tm :: Term
tm i :: Int
i) =
Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec [Name]
bound Term
tm Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
rparen Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<>
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "!" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> String -> Doc OutputAnnotation
forall a. String -> Doc a
text (Int -> String
forall a. Show a => a -> String
show Int
i)
pp p :: Integer
p bound :: [Name]
bound Erased = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "<<<erased>>>"
pp p :: Integer
p bound :: [Name]
bound Impossible = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "<<<impossible>>>"
pp p :: Integer
p bound :: [Name]
bound (Inferred t :: Term
t) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "<" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
p [Name]
bound Term
t Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc OutputAnnotation
forall a. String -> Doc a
text ">"
pp p :: Integer
p bound :: [Name]
bound (TType ue :: UExp
ue) = OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (String -> String -> OutputAnnotation
AnnType "Type" "The type of types") (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Type"
pp p :: Integer
p bound :: [Name]
bound (UType u :: Universe
u) = String -> Doc OutputAnnotation
forall a. String -> Doc a
text (Universe -> String
forall a. Show a => a -> String
show Universe
u)
ppb :: Integer
-> [Name]
-> Name
-> Binder Term
-> Doc OutputAnnotation
-> Doc OutputAnnotation
ppb p :: Integer
p bound :: [Name]
bound n :: Name
n (Lam rig :: RigCount
rig ty :: Term
ty) sc :: Doc OutputAnnotation
sc =
Integer -> Integer -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket Integer
p Integer
startPrec (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "λ" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Name -> Bool -> Doc OutputAnnotation
bindingOf Name
n Bool
False Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc OutputAnnotation
forall a. String -> Doc a
text "." Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
sc
ppb p :: Integer
p bound :: [Name]
bound n :: Name
n (Pi rig :: RigCount
rig _ ty :: Term
ty k :: Term
k) sc :: Doc OutputAnnotation
sc =
Integer -> Integer -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket Integer
p Integer
startPrec (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> (Name -> Bool -> Doc OutputAnnotation
bindingOf Name
n Bool
False) Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
forall a. Doc a
colon Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
(Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align) (Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec [Name]
bound Term
ty) Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<>
Doc OutputAnnotation
forall a. Doc a
rparen Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> RigCount -> Doc OutputAnnotation
forall a. RigCount -> Doc a
mkArrow RigCount
rig Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
sc
where mkArrow :: RigCount -> Doc a
mkArrow Rig1 = String -> Doc a
forall a. String -> Doc a
text "⇴"
mkArrow Rig0 = String -> Doc a
forall a. String -> Doc a
text "⥛"
mkArrow _ = String -> Doc a
forall a. String -> Doc a
text "→"
ppb p :: Integer
p bound :: [Name]
bound n :: Name
n (Let _ ty :: Term
ty val :: Term
val) sc :: Doc OutputAnnotation
sc =
Integer -> Integer -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket Integer
p Integer
startPrec (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
(Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2) (OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate OutputAnnotation
AnnKeyword (String -> Doc OutputAnnotation
forall a. String -> Doc a
text "let") Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
Name -> Bool -> Doc OutputAnnotation
bindingOf Name
n Bool
False Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
forall a. Doc a
colon Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec [Name]
bound Term
ty Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "=" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<>
Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec [Name]
bound Term
val) Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<>
(Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2) (OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate OutputAnnotation
AnnKeyword (String -> Doc OutputAnnotation
forall a. String -> Doc a
text "in") Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
sc)
ppb p :: Integer
p bound :: [Name]
bound n :: Name
n (NLet ty :: Term
ty val :: Term
val) sc :: Doc OutputAnnotation
sc =
Integer -> Integer -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket Integer
p Integer
startPrec (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
(Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2) (OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate OutputAnnotation
AnnKeyword (String -> Doc OutputAnnotation
forall a. String -> Doc a
text "nlet") Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
Name -> Bool -> Doc OutputAnnotation
bindingOf Name
n Bool
False Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
forall a. Doc a
colon Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec [Name]
bound Term
ty Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "=" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<>
Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec [Name]
bound Term
val) Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<>
(Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2) (OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate OutputAnnotation
AnnKeyword (String -> Doc OutputAnnotation
forall a. String -> Doc a
text "in") Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
sc)
ppb p :: Integer
p bound :: [Name]
bound n :: Name
n (Hole ty :: Term
ty) sc :: Doc OutputAnnotation
sc =
Integer -> Integer -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket Integer
p Integer
startPrec (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "?" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Name -> Bool -> Doc OutputAnnotation
bindingOf Name
n Bool
False Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc OutputAnnotation
forall a. String -> Doc a
text "." Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
sc
ppb p :: Integer
p bound :: [Name]
bound n :: Name
n (GHole _ _ ty :: Term
ty) sc :: Doc OutputAnnotation
sc =
Integer -> Integer -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket Integer
p Integer
startPrec (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "¿" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Name -> Bool -> Doc OutputAnnotation
bindingOf Name
n Bool
False Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> String -> Doc OutputAnnotation
forall a. String -> Doc a
text "." Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
sc
ppb p :: Integer
p bound :: [Name]
bound n :: Name
n (Guess ty :: Term
ty val :: Term
val) sc :: Doc OutputAnnotation
sc =
Integer -> Integer -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket Integer
p Integer
startPrec (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "?" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Name -> Bool -> Doc OutputAnnotation
bindingOf Name
n Bool
False Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "≈" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec [Name]
bound Term
val Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "." Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
sc
ppb p :: Integer
p bound :: [Name]
bound n :: Name
n (PVar _ ty :: Term
ty) sc :: Doc OutputAnnotation
sc =
Integer -> Integer -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket Integer
p Integer
startPrec (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate OutputAnnotation
AnnKeyword (String -> Doc OutputAnnotation
forall a. String -> Doc a
text "pat") Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
Name -> Bool -> Doc OutputAnnotation
bindingOf Name
n Bool
False Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
forall a. Doc a
colon Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec [Name]
bound Term
ty Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "." Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<>
Doc OutputAnnotation
sc
ppb p :: Integer
p bound :: [Name]
bound n :: Name
n (PVTy ty :: Term
ty) sc :: Doc OutputAnnotation
sc =
Integer -> Integer -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a a. Ord a => a -> a -> Doc a -> Doc a
bracket Integer
p Integer
startPrec (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate OutputAnnotation
AnnKeyword (String -> Doc OutputAnnotation
forall a. String -> Doc a
text "patTy") Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
Name -> Bool -> Doc OutputAnnotation
bindingOf Name
n Bool
False Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
forall a. Doc a
colon Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Integer -> [Name] -> Term -> Doc OutputAnnotation
pp Integer
startPrec [Name]
bound Term
ty Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "." Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<> Doc OutputAnnotation
forall a. Doc a
line Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<>
Doc OutputAnnotation
sc
bracket :: a -> a -> Doc a -> Doc a
bracket outer :: a
outer inner :: a
inner doc :: Doc a
doc
| a
outer a -> a -> Bool
forall a. Ord a => a -> a -> Bool
> a
inner = Doc a
forall a. Doc a
lparen Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<> Doc a
doc Doc a -> Doc a -> Doc a
forall a. Doc a -> Doc a -> Doc a
<> Doc a
forall a. Doc a
rparen
| Bool
otherwise = Doc a
doc
pprintTTClause :: [(Name, Type)] -> Term -> Term -> Doc OutputAnnotation
pprintTTClause :: [(Name, Term)] -> Term -> Term -> Doc OutputAnnotation
pprintTTClause pvars :: [(Name, Term)]
pvars lhs :: Term
lhs rhs :: Term
rhs =
[(Name, Term)] -> Doc OutputAnnotation -> Doc OutputAnnotation
vars [(Name, Term)]
pvars (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
[Name] -> Term -> Doc OutputAnnotation
pprintTT (((Name, Term) -> Name) -> [(Name, Term)] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map (Name, Term) -> Name
forall a b. (a, b) -> a
fst [(Name, Term)]
pvars) Term
lhs Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<$>
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "↦" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<$>
([Name] -> Term -> Doc OutputAnnotation
pprintTT (((Name, Term) -> Name) -> [(Name, Term)] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map (Name, Term) -> Name
forall a b. (a, b) -> a
fst [(Name, Term)]
pvars) Term
rhs)
where vars :: [(Name, Term)] -> Doc OutputAnnotation -> Doc OutputAnnotation
vars [] terms :: Doc OutputAnnotation
terms = Doc OutputAnnotation
terms
vars (v :: (Name, Term)
v:vs :: [(Name, Term)]
vs) terms :: Doc OutputAnnotation
terms =
OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate OutputAnnotation
AnnKeyword (String -> Doc OutputAnnotation
forall a. String -> Doc a
text "var") Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align ([Doc OutputAnnotation] -> Doc OutputAnnotation
forall a. [Doc a] -> Doc a
sep (Doc OutputAnnotation
-> [Doc OutputAnnotation] -> [Doc OutputAnnotation]
forall a. Doc a -> [Doc a] -> [Doc a]
punctuate Doc OutputAnnotation
forall a. Doc a
comma ([Doc OutputAnnotation] -> [Doc OutputAnnotation]
forall a. [a] -> [a]
reverse ([Name] -> [(Name, Term)] -> [Doc OutputAnnotation]
bindVars [] ((Name, Term)
v(Name, Term) -> [(Name, Term)] -> [(Name, Term)]
forall a. a -> [a] -> [a]
:[(Name, Term)]
vs)))))) Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+>
OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate OutputAnnotation
AnnKeyword (String -> Doc OutputAnnotation
forall a. String -> Doc a
text ".") Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<$>
Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
indent 2 Doc OutputAnnotation
terms
bindVars :: [Name] -> [(Name, Term)] -> [Doc OutputAnnotation]
bindVars _ [] = []
bindVars ns :: [Name]
ns ((n :: Name
n, ty :: Term
ty):vs :: [(Name, Term)]
vs) =
Name -> Bool -> Doc OutputAnnotation
bindingOf Name
n Bool
False Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> Doc OutputAnnotation
forall a. Doc a
colon Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<+> [Name] -> Term -> Doc OutputAnnotation
pprintTT [Name]
ns Term
ty Doc OutputAnnotation
-> [Doc OutputAnnotation] -> [Doc OutputAnnotation]
forall a. a -> [a] -> [a]
: [Name] -> [(Name, Term)] -> [Doc OutputAnnotation]
bindVars (Name
nName -> [Name] -> [Name]
forall a. a -> [a] -> [a]
:[Name]
ns) [(Name, Term)]
vs
pprintRaw :: [Name]
-> Raw
-> Doc OutputAnnotation
pprintRaw :: [Name] -> Raw -> Doc OutputAnnotation
pprintRaw bound :: [Name]
bound (Var n :: Name
n) =
Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
(String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Var") Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<$> OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (if Name
n Name -> [Name] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Name]
bound
then Name -> Bool -> OutputAnnotation
AnnBoundName Name
n Bool
False
else Name
-> Maybe NameOutput
-> Maybe String
-> Maybe String
-> OutputAnnotation
AnnName Name
n Maybe NameOutput
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing)
(String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation) -> String -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Name -> String
forall a. Show a => a -> String
show Name
n)
pprintRaw bound :: [Name]
bound (RBind n :: Name
n b :: Binder Raw
b body :: Raw
body) =
Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
[Doc OutputAnnotation] -> Doc OutputAnnotation
forall a. [Doc a] -> Doc a
vsep [ String -> Doc OutputAnnotation
forall a. String -> Doc a
text "RBind"
, OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Name -> Bool -> OutputAnnotation
AnnBoundName Name
n Bool
False) (String -> Doc OutputAnnotation
forall a. String -> Doc a
text (String -> Doc OutputAnnotation) -> String -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$ Name -> String
forall a. Show a => a -> String
show Name
n)
, Binder Raw -> Doc OutputAnnotation
ppb Binder Raw
b
, [Name] -> Raw -> Doc OutputAnnotation
pprintRaw (Name
nName -> [Name] -> [Name]
forall a. a -> [a] -> [a]
:[Name]
bound) Raw
body]
where
ppb :: Binder Raw -> Doc OutputAnnotation
ppb (Lam _ ty :: Raw
ty) = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Lam" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<$> [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
ty
ppb (Pi _ _ ty :: Raw
ty k :: Raw
k) = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
[Doc OutputAnnotation] -> Doc OutputAnnotation
forall a. [Doc a] -> Doc a
vsep [String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Pi", [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
ty, [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
k]
ppb (Let c :: RigCount
c ty :: Raw
ty v :: Raw
v) = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
[Doc OutputAnnotation] -> Doc OutputAnnotation
forall a. [Doc a] -> Doc a
vsep [String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Let", [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
ty, [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
v]
ppb (NLet ty :: Raw
ty v :: Raw
v) = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
[Doc OutputAnnotation] -> Doc OutputAnnotation
forall a. [Doc a] -> Doc a
vsep [String -> Doc OutputAnnotation
forall a. String -> Doc a
text "NLet", [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
ty, [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
v]
ppb (Hole ty :: Raw
ty) = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Hole" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<$> [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
ty
ppb (GHole _ _ ty :: Raw
ty) = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "GHole" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<$> [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
ty
ppb (Guess ty :: Raw
ty v :: Raw
v) = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
[Doc OutputAnnotation] -> Doc OutputAnnotation
forall a. [Doc a] -> Doc a
vsep [String -> Doc OutputAnnotation
forall a. String -> Doc a
text "Guess", [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
ty, [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
v]
ppb (PVar _ ty :: Raw
ty) = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "PVar" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<$> [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
ty
ppb (PVTy ty :: Raw
ty) = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "PVTy" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<$> [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
ty
pprintRaw bound :: [Name]
bound (RApp f :: Raw
f x :: Raw
x) =
Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> ([Doc OutputAnnotation] -> Doc OutputAnnotation)
-> [Doc OutputAnnotation]
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> ([Doc OutputAnnotation] -> Doc OutputAnnotation)
-> [Doc OutputAnnotation]
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> ([Doc OutputAnnotation] -> Doc OutputAnnotation)
-> [Doc OutputAnnotation]
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> ([Doc OutputAnnotation] -> Doc OutputAnnotation)
-> [Doc OutputAnnotation]
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Doc OutputAnnotation] -> Doc OutputAnnotation
forall a. [Doc a] -> Doc a
vsep ([Doc OutputAnnotation] -> Doc OutputAnnotation)
-> [Doc OutputAnnotation] -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
[String -> Doc OutputAnnotation
forall a. String -> Doc a
text "RApp", [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
f, [Name] -> Raw -> Doc OutputAnnotation
pprintRaw [Name]
bound Raw
x]
pprintRaw bound :: [Name]
bound RType = String -> Doc OutputAnnotation
forall a. String -> Doc a
text "RType"
pprintRaw bound :: [Name]
bound (RUType u :: Universe
u) = Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
String -> Doc OutputAnnotation
forall a. String -> Doc a
text "RUType" Doc OutputAnnotation
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a
<$> String -> Doc OutputAnnotation
forall a. String -> Doc a
text (Universe -> String
forall a. Show a => a -> String
show Universe
u)
pprintRaw bound :: [Name]
bound (RConstant c :: Const
c) =
Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall a. Doc a -> Doc a -> Doc a -> Doc a
enclose Doc OutputAnnotation
forall a. Doc a
lparen Doc OutputAnnotation
forall a. Doc a
rparen (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
group (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Doc a -> Doc a
align (Doc OutputAnnotation -> Doc OutputAnnotation)
-> (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation
-> Doc OutputAnnotation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. Int -> Doc a -> Doc a
hang 2 (Doc OutputAnnotation -> Doc OutputAnnotation)
-> Doc OutputAnnotation -> Doc OutputAnnotation
forall a b. (a -> b) -> a -> b
$
[Doc OutputAnnotation] -> Doc OutputAnnotation
forall a. [Doc a] -> Doc a
vsep [String -> Doc OutputAnnotation
forall a. String -> Doc a
text "RConstant", OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Const -> OutputAnnotation
AnnConst Const
c) (String -> Doc OutputAnnotation
forall a. String -> Doc a
text (Const -> String
forall a. Show a => a -> String
show Const
c))]
bindingOf :: Name
-> Bool
-> Doc OutputAnnotation
bindingOf :: Name -> Bool -> Doc OutputAnnotation
bindingOf n :: Name
n imp :: Bool
imp = OutputAnnotation -> Doc OutputAnnotation -> Doc OutputAnnotation
forall a. a -> Doc a -> Doc a
annotate (Name -> Bool -> OutputAnnotation
AnnBoundName Name
n Bool
imp) (String -> Doc OutputAnnotation
forall a. String -> Doc a
text (Name -> String
forall a. Show a => a -> String
show Name
n))