Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data MatchCase loc a = MatchCase {
- matchPattern :: Pattern loc
- matchGuard :: Maybe a
- matchBody :: a
- matchPattern_ :: Lens' (MatchCase loc a) (Pattern loc)
- data F typeVar typeAnn patternAnn a
- = Int Int64
- | Nat Word64
- | Float Double
- | Boolean Bool
- | Text Text
- | Char Char
- | Blank (Blank typeAnn)
- | Ref Reference
- | Constructor ConstructorReference
- | Request ConstructorReference
- | Handle a a
- | App a a
- | Ann a (Type typeVar typeAnn)
- | List (Seq a)
- | If a a a
- | And a a
- | Or a a
- | Lam a
- | LetRec IsTop [a] a
- | Let IsTop a a
- | Match a [MatchCase patternAnn a]
- | TermLink Referent
- | TypeLink Reference
- _Ref :: Prism' (F tv ta pa a) Reference
- _Match :: Prism' (F tv ta pa a) (a, [MatchCase pa a])
- _Constructor :: Prism' (F tv ta pa a) ConstructorReference
- _Request :: Prism' (F tv ta pa a) ConstructorReference
- _Ann :: Prism' (F tv ta pa a) (a, Term F tv ta)
- _TermLink :: Prism' (F tv ta pa a) Referent
- _TypeLink :: Prism' (F tv ta pa a) Reference
- getTypeAnnotation :: Term v a -> Maybe (Type v a)
- type IsTop = Bool
- type Term v a = Term2 v a a v a
- type Term' vt v a = Term2 vt a a v a
- type Term2 vt at ap v a = Term (F vt at ap) v a
- type Term3 v a = Term2 v () () v a
- type Term0 v = Term v ()
- type Term0' vt v = Term' vt v ()
- bindNames :: forall v a. Var v => (v -> Name) -> (Name -> v) -> Set v -> Names -> Term v a -> ResolutionResult a (Term v a)
- prepareTDNR :: Var v => Term (F vt b ap) v b -> Term (F vt b ap) v b
- amap :: Ord v => (a -> a2) -> Term v a -> Term v a2
- patternMap :: (Pattern ap -> Pattern ap2) -> Term2 vt at ap v a -> Term2 vt at ap2 v a
- vmap :: Ord v2 => (v -> v2) -> Term v a -> Term v2 a
- vtmap :: Ord vt2 => (vt -> vt2) -> Term' vt v a -> Term' vt2 v a
- typeMap :: Ord vt2 => (Type vt at -> Type vt2 at2) -> Term2 vt at ap v a -> Term2 vt2 at2 ap v a
- extraMap' :: (Ord vt, Ord vt') => (vt -> vt') -> (at -> at') -> (ap -> ap') -> Term2 vt at ap v a -> Term2 vt' at' ap' v a
- extraMap :: (Ord vt, Ord vt') => (vt -> vt') -> (at -> at') -> (ap -> ap') -> F vt at ap a -> F vt' at' ap' a
- matchCaseExtraMap :: (loc -> loc') -> MatchCase loc a -> MatchCase loc' a
- unannotate :: forall vt at ap v a. Ord v => Term2 vt at ap v a -> Term0' vt v
- wrapV :: Ord v => Term v a -> Term (V v) a
- allVars :: Ord v => Term v a -> Set v
- freeVars :: Term' vt v a -> Set v
- freeTypeVars :: Ord vt => Term' vt v a -> Set vt
- freeTypeVarAnnotations :: Ord vt => Term' vt v a -> Map vt [a]
- substTypeVars :: (Ord v, Var vt) => [(vt, Type vt b)] -> Term' vt v a -> Term' vt v a
- substTypeVar :: (Ord v, Var vt) => vt -> Type vt b -> Term' vt v a -> Term' vt v a
- renameTypeVar :: (Ord v, Var vt) => vt -> vt -> Term' vt v a -> Term' vt v a
- generalizeTypeSignatures :: (Var vt, Var v) => Term' vt v a -> Term' vt v a
- pattern Var' :: v -> Term f v a
- pattern Cycle' :: [v] -> f (Term f v a) -> Term f v a
- pattern Abs' :: (Foldable f, Functor f, Var v) => Subst f v a -> Term f v a
- pattern Int' :: Int64 -> Term (F typeVar typeAnn patternAnn) v a
- pattern Nat' :: Word64 -> Term (F typeVar typeAnn patternAnn) v a
- pattern Float' :: Double -> Term (F typeVar typeAnn patternAnn) v a
- pattern Boolean' :: Bool -> Term (F typeVar typeAnn patternAnn) v a
- pattern Text' :: Text -> Term (F typeVar typeAnn patternAnn) v a
- pattern Char' :: Char -> Term (F typeVar typeAnn patternAnn) v a
- pattern Blank' :: Blank typeAnn -> Term (F typeVar typeAnn patternAnn) v a
- pattern Ref' :: Reference -> Term (F typeVar typeAnn patternAnn) v a
- pattern TermLink' :: Referent -> Term (F typeVar typeAnn patternAnn) v a
- pattern TypeLink' :: Reference -> Term (F typeVar typeAnn patternAnn) v a
- pattern Builtin' :: Text -> Term (F typeVar typeAnn patternAnn) v a
- pattern App' :: Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a
- pattern Match' :: Term (F typeVar typeAnn patternAnn) v a -> [MatchCase patternAnn (Term (F typeVar typeAnn patternAnn) v a)] -> Term (F typeVar typeAnn patternAnn) v a
- pattern Constructor' :: ConstructorReference -> Term (F typeVar typeAnn patternAnn) v a
- pattern Request' :: ConstructorReference -> Term (F typeVar typeAnn patternAnn) v a
- pattern RequestOrCtor' :: ConstructorReference -> Term2 vt at ap v a
- pattern If' :: Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a
- pattern And' :: Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a
- pattern Or' :: Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a
- pattern Handle' :: Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a
- pattern Apps' :: Term2 vt at ap v a -> [Term2 vt at ap v a] -> Term2 vt at ap v a
- pattern Ands' :: [Term2 vt at ap v a] -> Term2 vt at ap v a -> Term2 vt at ap v a
- pattern Ors' :: [Term2 vt at ap v a] -> Term2 vt at ap v a -> Term2 vt at ap v a
- pattern AppsPred' :: Term2 vt at ap v a -> [Term2 vt at ap v a] -> (Term2 vt at ap v a, Term2 vt at ap v a -> Bool)
- pattern BinaryApp' :: Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a
- pattern BinaryApps' :: [(Term2 vt at ap v a, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a
- pattern BinaryAppsPred' :: [(Term2 vt at ap v a, Term2 vt at ap v a)] -> Term2 vt at ap v a -> (Term2 vt at ap v a, Term2 vt at ap v a -> Bool)
- pattern BinaryAppPred' :: Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a -> (Term2 vt at ap v a, Term2 vt at ap v a -> Bool)
- pattern OverappliedBinaryAppPred' :: Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a -> [Term2 vt at ap v a] -> (Term2 vt at ap v a, Term2 vt at ap v a -> Bool)
- pattern Ann' :: Term (F typeVar typeAnn patternAnn) v a -> Type typeVar typeAnn -> Term (F typeVar typeAnn patternAnn) v a
- pattern List' :: Seq (Term (F typeVar typeAnn patternAnn) v a) -> Term (F typeVar typeAnn patternAnn) v a
- pattern Lam' :: Var v => Subst (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a
- pattern Delay' :: Var v => Term2 vt at ap v a -> Term2 vt at ap v a
- unDelay :: Var v => Term2 vt at ap v a -> Maybe (Term2 vt at ap v a)
- pattern LamNamed' :: v -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a
- pattern LamsNamed' :: [v] -> Term2 vt at ap v a -> Term2 vt at ap v a
- pattern LamsNamedOpt' :: [v] -> Term2 vt at ap v a -> Term2 vt at ap v a
- pattern LamsNamedPred' :: [v] -> Term2 vt at ap v a -> (Term2 vt at ap v a, v -> Bool)
- pattern LamsNamedOrDelay' :: Var v => [v] -> Term2 vt at ap v a -> Term2 vt at ap v a
- pattern Let1' :: Var v => Term' vt v a -> Subst (F vt a a) v a -> Term' vt v a
- pattern Let1Top' :: Var v => IsTop -> Term' vt v a -> Subst (F vt a a) v a -> Term' vt v a
- pattern Let1Named' :: v -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a
- pattern Let1NamedTop' :: IsTop -> v -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a
- pattern Lets' :: [(IsTop, v, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a
- pattern LetRecNamed' :: [(v, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a
- pattern LetRecNamedTop' :: IsTop -> [(v, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a
- pattern LetRec' :: (Monad m, Var v) => ((v -> m v) -> m ([(v, Term2 vt at ap v a)], Term2 vt at ap v a)) -> Term2 vt at ap v a
- pattern LetRecTop' :: (Monad m, Var v) => IsTop -> ((v -> m v) -> m ([(v, Term2 vt at ap v a)], Term2 vt at ap v a)) -> Term2 vt at ap v a
- pattern LetRecNamedAnnotated' :: a -> [((a, v), Term' vt v a)] -> Term' vt v a -> Term' vt v a
- pattern LetRecNamedAnnotatedTop' :: IsTop -> a -> [((a, v), Term' vt v a)] -> Term' vt v a -> Term' vt v a
- fresh :: Var v => Term0 v -> v -> v
- var :: a -> v -> Term2 vt at ap v a
- var' :: Var v => Text -> Term0' vt v
- ref :: Ord v => a -> Reference -> Term2 vt at ap v a
- pattern Referent' :: Referent -> Term2 vt at ap v a
- unReferent :: Term2 vt at ap v a -> Maybe Referent
- refId :: Ord v => a -> Id -> Term2 vt at ap v a
- termLink :: Ord v => a -> Referent -> Term2 vt at ap v a
- typeLink :: Ord v => a -> Reference -> Term2 vt at ap v a
- builtin :: Ord v => a -> Text -> Term2 vt at ap v a
- float :: Ord v => a -> Double -> Term2 vt at ap v a
- boolean :: Ord v => a -> Bool -> Term2 vt at ap v a
- int :: Ord v => a -> Int64 -> Term2 vt at ap v a
- nat :: Ord v => a -> Word64 -> Term2 vt at ap v a
- text :: Ord v => a -> Text -> Term2 vt at ap v a
- char :: Ord v => a -> Char -> Term2 vt at ap v a
- watch :: (Var v, Semigroup a) => a -> String -> Term v a -> Term v a
- watchMaybe :: (Var v, Semigroup a) => Maybe String -> Term v a -> Term v a
- blank :: Ord v => a -> Term2 vt at ap v a
- placeholder :: Ord v => a -> String -> Term2 vt a ap v a
- resolve :: Ord v => at -> ab -> String -> Term2 vt ab ap v at
- missingResult :: Ord v => at -> ab -> Term2 vt ab ap v at
- constructor :: Ord v => a -> ConstructorReference -> Term2 vt at ap v a
- request :: Ord v => a -> ConstructorReference -> Term2 vt at ap v a
- app_ :: Ord v => Term0' vt v -> Term0' vt v -> Term0' vt v
- app :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a
- match :: Ord v => a -> Term2 vt at a v a -> [MatchCase a (Term2 vt at a v a)] -> Term2 vt at a v a
- handle :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a
- and :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a
- or :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a
- list :: Ord v => a -> [Term2 vt at ap v a] -> Term2 vt at ap v a
- list' :: Ord v => a -> Seq (Term2 vt at ap v a) -> Term2 vt at ap v a
- apps :: Ord v => Term2 vt at ap v a -> [(a, Term2 vt at ap v a)] -> Term2 vt at ap v a
- apps' :: (Ord v, Semigroup a) => Term2 vt at ap v a -> [Term2 vt at ap v a] -> Term2 vt at ap v a
- iff :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a
- ann_ :: Ord v => Term0' vt v -> Type vt () -> Term0' vt v
- ann :: Ord v => a -> Term2 vt at ap v a -> Type vt at -> Term2 vt at ap v a
- lam :: Ord v => a -> (a, v) -> Term2 vt at ap v a -> Term2 vt at ap v a
- lam' :: Ord v => a -> [(a, v)] -> Term2 vt at ap v a -> Term2 vt at ap v a
- lamWithoutBindingAnns :: Ord v => a -> [v] -> Term2 vt at ap v a -> Term2 vt at ap v a
- delay :: Var v => a -> Term2 vt at ap v a -> Term2 vt at ap v a
- isLam :: Term2 vt at ap v a -> Bool
- arity :: Term2 vt at ap v a -> Int
- unLetRecNamedAnnotated :: Term' vt v a -> Maybe (IsTop, a, [((a, v), Term' vt v a)], Term' vt v a)
- letRec' :: (Ord v, Monoid a) => Bool -> [(v, a, Term' vt v a)] -> Term' vt v a -> Term' vt v a
- consLetRec :: (Ord v, Semigroup a) => Bool -> a -> (a, v, Term' vt v a) -> Term' vt v a -> Term' vt v a
- letRec :: forall v vt a. Ord v => Bool -> a -> [((a, v), Term' vt v a)] -> Term' vt v a -> Term' vt v a
- letRec_ :: Ord v => IsTop -> [(v, Term0' vt v)] -> Term0' vt v -> Term0' vt v
- let1_ :: Ord v => IsTop -> [(v, Term0' vt v)] -> Term0' vt v -> Term0' vt v
- let1 :: (Ord v, Semigroup a) => IsTop -> [((a, v), Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a
- let1' :: (Semigroup a, Ord v) => IsTop -> [(v, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a
- singleLet :: Ord v => IsTop -> a -> a -> (v, Term2 vt at ap v a) -> Term2 vt at ap v a -> Term2 vt at ap v a
- unLet1 :: Var v => Term' vt v a -> Maybe (IsTop, Term' vt v a, Subst (F vt a a) v a)
- unLet :: Term2 vt at ap v a -> Maybe ([(IsTop, v, Term2 vt at ap v a)], Term2 vt at ap v a)
- unLetRecNamed :: Term2 vt at ap v a -> Maybe (IsTop, [(v, Term2 vt at ap v a)], Term2 vt at ap v a)
- unLetRec :: (Monad m, Var v) => Term2 vt at ap v a -> Maybe (IsTop, (v -> m v) -> m ([(v, Term2 vt at ap v a)], Term2 vt at ap v a))
- unAnds :: Term2 vt at ap v a -> Maybe ([Term2 vt at ap v a], Term2 vt at ap v a)
- unOrs :: Term2 vt at ap v a -> Maybe ([Term2 vt at ap v a], Term2 vt at ap v a)
- unApps :: Term2 vt at ap v a -> Maybe (Term2 vt at ap v a, [Term2 vt at ap v a])
- unAppsPred :: (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) -> Maybe (Term2 vt at ap v a, [Term2 vt at ap v a])
- unBinaryApp :: Term2 vt at ap v a -> Maybe (Term2 vt at ap v a, Term2 vt at ap v a, Term2 vt at ap v a)
- unOverappliedBinaryAppPred :: (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) -> Maybe (Term2 vt at ap v a, Term2 vt at ap v a, Term2 vt at ap v a, [Term2 vt at ap v a])
- unBinaryApps :: Term2 vt at ap v a -> Maybe ([(Term2 vt at ap v a, Term2 vt at ap v a)], Term2 vt at ap v a)
- unBinaryAppsPred :: (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) -> Maybe ([(Term2 vt at ap v a, Term2 vt at ap v a)], Term2 vt at ap v a)
- unBinaryAppPred :: (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) -> Maybe (Term2 vt at ap v a, Term2 vt at ap v a, Term2 vt at ap v a)
- unLams' :: Term2 vt at ap v a -> Maybe ([v], Term2 vt at ap v a)
- unLamsOpt' :: Term2 vt at ap v a -> Maybe ([v], Term2 vt at ap v a)
- unLamsUntilDelay' :: Var v => Term2 vt at ap v a -> Maybe ([v], Term2 vt at ap v a)
- unLamsPred' :: (Term2 vt at ap v a, v -> Bool) -> Maybe ([v], Term2 vt at ap v a)
- unReqOrCtor :: Term2 vt at ap v a -> Maybe ConstructorReference
- dependencies :: (Ord v, Ord vt) => Term2 vt at ap v a -> DefnsF Set TermReference TypeReference
- termDependencies :: (Ord v, Ord vt) => Term2 vt at ap v a -> Set TermReference
- typeDependencies :: (Ord v, Ord vt) => Term2 vt at ap v a -> Set Reference
- constructorDependencies :: (Ord v, Ord vt) => Term2 vt at ap v a -> Set Reference
- generalizedDependencies :: (Ord v, Ord vt, Ord r) => (Reference -> r) -> (Reference -> r) -> (Reference -> r) -> (Reference -> ConstructorId -> r) -> (Reference -> r) -> (Reference -> ConstructorId -> r) -> (Reference -> r) -> Term2 vt at ap v a -> Set r
- labeledDependencies :: (Ord v, Ord vt) => Term2 vt at ap v a -> Set LabeledDependency
- updateDependencies :: Ord v => Map Referent Referent -> Map Reference Reference -> Term v a -> Term v a
- betaReduce :: Var v => Term0 v -> Term0 v
- betaNormalForm :: Var v => Term0 v -> Term0 v
- etaNormalForm :: Ord v => Term0 v -> Term0 v
- etaReduceEtaVars :: Var v => Term0 v -> Term0 v
- unhashComponent :: forall v a. Var v => Map Id (Term v a) -> Map Id (v, Term v a)
- fromReferent :: Ord v => a -> Referent -> Term2 vt at ap v a
- containsExpression :: (Var v, Var typeVar, Eq typeAnn) => Term2 typeVar typeAnn loc v a -> Term2 typeVar typeAnn loc v a -> Bool
- containsCaseTerm :: Var v1 => Term2 tv ta tb v1 loc -> Term2 typeVar typeAnn loc v2 a -> Maybe Bool
- containsCase :: Pattern loc -> Term2 typeVar typeAnn loc v a -> Bool
- containsSignature :: (Ord v, Var vt, Show vt) => Type vt at -> Term2 vt at ap v a -> Bool
- rewriteSignatures :: (Ord v, Var vt, Show vt) => Type vt at -> Type vt at -> Term2 vt at ap v a -> Maybe (Term2 vt at ap v a)
- rewriteCasesLHS :: forall v typeVar typeAnn a. (Var v, Var typeVar, Ord v, Show typeVar, Eq typeAnn, Semigroup a) => Term2 typeVar typeAnn a v a -> Term2 typeVar typeAnn a v a -> Term2 typeVar typeAnn a v a -> Maybe (Term2 typeVar typeAnn a v a)
- toPattern :: Var v => Term2 tv ta tb v loc -> Maybe (Pattern loc)
- matchCaseFromTerm :: Var v => Term2 typeVar typeAnn a v a -> Maybe (MatchCase a (Term2 typeVar typeAnn a v a))
- matchCaseToTerm :: (Semigroup a, Ord v) => MatchCase a (Term2 typeVar typeAnn a v a) -> Term2 typeVar typeAnn a v a
Documentation
MatchCase | |
|
Instances
data F typeVar typeAnn patternAnn a Source #
Base functor for terms in the Unison language
We need typeVar
because the term and type variables may differ.
Int Int64 | |
Nat Word64 | |
Float Double | |
Boolean Bool | |
Text Text | |
Char Char | |
Blank (Blank typeAnn) | |
Ref Reference | |
Constructor ConstructorReference | |
Request ConstructorReference | |
Handle a a | |
App a a | |
Ann a (Type typeVar typeAnn) | |
List (Seq a) | |
If a a a | |
And a a | |
Or a a | |
Lam a | |
LetRec IsTop [a] a | |
Let IsTop a a | |
Match a [MatchCase patternAnn a] | |
TermLink Referent | |
TypeLink Reference |
Instances
_Constructor :: Prism' (F tv ta pa a) ConstructorReference Source #
getTypeAnnotation :: Term v a -> Maybe (Type v a) Source #
Returns the top-level type annotation for a term if it has one.
type Term v a = Term2 v a a v a Source #
Like `Term v`, but with an annotation of type a
at every level in the tree
type Term2 vt at ap v a = Term (F vt at ap) v a Source #
Allow type variables, term variables, type annotations and term annotations to all differ
type Term3 v a = Term2 v () () v a Source #
Like `Term v a`, but with only () for type and pattern annotations.
type Term0 v = Term v () Source #
Terms are represented as ABTs over the base functor F, with variables in v
bindNames :: forall v a. Var v => (v -> Name) -> (Name -> v) -> Set v -> Names -> Term v a -> ResolutionResult a (Term v a) Source #
typeMap :: Ord vt2 => (Type vt at -> Type vt2 at2) -> Term2 vt at ap v a -> Term2 vt2 at2 ap v a Source #
extraMap' :: (Ord vt, Ord vt') => (vt -> vt') -> (at -> at') -> (ap -> ap') -> Term2 vt at ap v a -> Term2 vt' at' ap' v a Source #
extraMap :: (Ord vt, Ord vt') => (vt -> vt') -> (at -> at') -> (ap -> ap') -> F vt at ap a -> F vt' at' ap' a Source #
matchCaseExtraMap :: (loc -> loc') -> MatchCase loc a -> MatchCase loc' a Source #
allVars :: Ord v => Term v a -> Set v Source #
All variables mentioned in the given term. Includes both term and type variables, both free and bound.
pattern App' :: Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern Match' :: Term (F typeVar typeAnn patternAnn) v a -> [MatchCase patternAnn (Term (F typeVar typeAnn patternAnn) v a)] -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern Constructor' :: ConstructorReference -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern RequestOrCtor' :: ConstructorReference -> Term2 vt at ap v a Source #
pattern If' :: Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern And' :: Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern Or' :: Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern Handle' :: Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern AppsPred' :: Term2 vt at ap v a -> [Term2 vt at ap v a] -> (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) Source #
pattern BinaryApp' :: Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
pattern BinaryApps' :: [(Term2 vt at ap v a, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
pattern BinaryAppsPred' :: [(Term2 vt at ap v a, Term2 vt at ap v a)] -> Term2 vt at ap v a -> (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) Source #
pattern BinaryAppPred' :: Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a -> (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) Source #
pattern OverappliedBinaryAppPred' :: Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a -> [Term2 vt at ap v a] -> (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) Source #
pattern Ann' :: Term (F typeVar typeAnn patternAnn) v a -> Type typeVar typeAnn -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern List' :: Seq (Term (F typeVar typeAnn patternAnn) v a) -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern Lam' :: Var v => Subst (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern LamNamed' :: v -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern LamsNamed' :: [v] -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
pattern LamsNamedOpt' :: [v] -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
pattern Let1Named' :: v -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern Let1NamedTop' :: IsTop -> v -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a -> Term (F typeVar typeAnn patternAnn) v a Source #
pattern Lets' :: [(IsTop, v, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
pattern LetRecNamed' :: [(v, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
pattern LetRecNamedTop' :: IsTop -> [(v, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
pattern LetRec' :: (Monad m, Var v) => ((v -> m v) -> m ([(v, Term2 vt at ap v a)], Term2 vt at ap v a)) -> Term2 vt at ap v a Source #
pattern LetRecTop' :: (Monad m, Var v) => IsTop -> ((v -> m v) -> m ([(v, Term2 vt at ap v a)], Term2 vt at ap v a)) -> Term2 vt at ap v a Source #
pattern LetRecNamedAnnotated' :: a -> [((a, v), Term' vt v a)] -> Term' vt v a -> Term' vt v a Source #
pattern LetRecNamedAnnotatedTop' :: IsTop -> a -> [((a, v), Term' vt v a)] -> Term' vt v a -> Term' vt v a Source #
missingResult :: Ord v => at -> ab -> Term2 vt ab ap v at Source #
constructor :: Ord v => a -> ConstructorReference -> Term2 vt at ap v a Source #
match :: Ord v => a -> Term2 vt at a v a -> [MatchCase a (Term2 vt at a v a)] -> Term2 vt at a v a Source #
apps' :: (Ord v, Semigroup a) => Term2 vt at ap v a -> [Term2 vt at ap v a] -> Term2 vt at ap v a Source #
iff :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
Add a lambda with a single argument.
Add a lambda with a list of arguments.
lamWithoutBindingAnns :: Ord v => a -> [v] -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
Only use this variant if you don't have source annotations for the binding arguments available.
unLetRecNamedAnnotated :: Term' vt v a -> Maybe (IsTop, a, [((a, v), Term' vt v a)], Term' vt v a) Source #
letRec' :: (Ord v, Monoid a) => Bool -> [(v, a, Term' vt v a)] -> Term' vt v a -> Term' vt v a Source #
consLetRec :: (Ord v, Semigroup a) => Bool -> a -> (a, v, Term' vt v a) -> Term' vt v a -> Term' vt v a Source #
letRec :: forall v vt a. Ord v => Bool -> a -> [((a, v), Term' vt v a)] -> Term' vt v a -> Term' vt v a Source #
letRec_ :: Ord v => IsTop -> [(v, Term0' vt v)] -> Term0' vt v -> Term0' vt v Source #
Smart constructor for let rec blocks. Each binding in the block may reference any other binding in the block in its body (including itself), and the output expression may also reference any binding in the block.
let1_ :: Ord v => IsTop -> [(v, Term0' vt v)] -> Term0' vt v -> Term0' vt v Source #
Smart constructor for let blocks. Each binding in the block may reference only previous bindings in the block, not including itself. The output expression may reference any binding in the block. todo: delete me
let1 :: (Ord v, Semigroup a) => IsTop -> [((a, v), Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
annotations are applied to each nested Let expression
let1' :: (Semigroup a, Ord v) => IsTop -> [(v, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
singleLet :: Ord v => IsTop -> a -> a -> (v, Term2 vt at ap v a) -> Term2 vt at ap v a -> Term2 vt at ap v a Source #
Like let1
, but for a single binding, avoiding the Semigroup constraint.
unLet :: Term2 vt at ap v a -> Maybe ([(IsTop, v, Term2 vt at ap v a)], Term2 vt at ap v a) Source #
Satisfies `unLet (let' bs e) == Just (bs, e)`
unLetRecNamed :: Term2 vt at ap v a -> Maybe (IsTop, [(v, Term2 vt at ap v a)], Term2 vt at ap v a) Source #
Satisfies `unLetRec (letRec bs e) == Just (bs, e)`
unLetRec :: (Monad m, Var v) => Term2 vt at ap v a -> Maybe (IsTop, (v -> m v) -> m ([(v, Term2 vt at ap v a)], Term2 vt at ap v a)) Source #
unAppsPred :: (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) -> Maybe (Term2 vt at ap v a, [Term2 vt at ap v a]) Source #
unBinaryApp :: Term2 vt at ap v a -> Maybe (Term2 vt at ap v a, Term2 vt at ap v a, Term2 vt at ap v a) Source #
unOverappliedBinaryAppPred :: (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) -> Maybe (Term2 vt at ap v a, Term2 vt at ap v a, Term2 vt at ap v a, [Term2 vt at ap v a]) Source #
unBinaryApps :: Term2 vt at ap v a -> Maybe ([(Term2 vt at ap v a, Term2 vt at ap v a)], Term2 vt at ap v a) Source #
unBinaryAppsPred :: (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) -> Maybe ([(Term2 vt at ap v a, Term2 vt at ap v a)], Term2 vt at ap v a) Source #
unBinaryAppPred :: (Term2 vt at ap v a, Term2 vt at ap v a -> Bool) -> Maybe (Term2 vt at ap v a, Term2 vt at ap v a, Term2 vt at ap v a) Source #
unReqOrCtor :: Term2 vt at ap v a -> Maybe ConstructorReference Source #
dependencies :: (Ord v, Ord vt) => Term2 vt at ap v a -> DefnsF Set TermReference TypeReference Source #
termDependencies :: (Ord v, Ord vt) => Term2 vt at ap v a -> Set TermReference Source #
generalizedDependencies :: (Ord v, Ord vt, Ord r) => (Reference -> r) -> (Reference -> r) -> (Reference -> r) -> (Reference -> ConstructorId -> r) -> (Reference -> r) -> (Reference -> ConstructorId -> r) -> (Reference -> r) -> Term2 vt at ap v a -> Set r Source #
labeledDependencies :: (Ord v, Ord vt) => Term2 vt at ap v a -> Set LabeledDependency Source #
updateDependencies :: Ord v => Map Referent Referent -> Map Reference Reference -> Term v a -> Term v a Source #
betaReduce :: Var v => Term0 v -> Term0 v Source #
If the outermost term is a function application, perform substitution of the argument into the body
containsExpression :: (Var v, Var typeVar, Eq typeAnn) => Term2 typeVar typeAnn loc v a -> Term2 typeVar typeAnn loc v a -> Bool Source #
containsCaseTerm :: Var v1 => Term2 tv ta tb v1 loc -> Term2 typeVar typeAnn loc v2 a -> Maybe Bool Source #
rewriteSignatures :: (Ord v, Var vt, Show vt) => Type vt at -> Type vt at -> Term2 vt at ap v a -> Maybe (Term2 vt at ap v a) Source #
rewriteCasesLHS :: forall v typeVar typeAnn a. (Var v, Var typeVar, Ord v, Show typeVar, Eq typeAnn, Semigroup a) => Term2 typeVar typeAnn a v a -> Term2 typeVar typeAnn a v a -> Term2 typeVar typeAnn a v a -> Maybe (Term2 typeVar typeAnn a v a) Source #