Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data F a
- = Ref TypeReference
- | Arrow a a
- | Ann a Kind
- | App a a
- | Effect a a
- | Effects [a]
- | Forall a
- | IntroOuter a
- _Ref :: Prism' (F a) TypeReference
- type Type v a = Term F v a
- type TypeF v a r = Term' F v a r
- wrapV :: Ord v => Type v a -> Type (V v) a
- freeVars :: Type v a -> Set v
- bindExternal :: Var v => [(v, TypeReference)] -> Type v a -> Type v a
- bindReferences :: Var v => (v -> Name) -> Set v -> Map Name TypeReference -> Type v a -> ResolutionResult a (Type v a)
- newtype Monotype v a = Monotype {
- getPolytype :: Type v a
- monotype :: Var v => Type v a -> Maybe (Monotype v a)
- arity :: Type v a -> Int
- pattern Ref' :: TypeReference -> Term F v a
- pattern Arrow' :: Term F v a -> Term F v a -> Term F v a
- pattern Arrow'' :: Ord v => Term F v a -> [Type v a] -> Type v a -> Term F v a
- pattern Arrows' :: [Type v a] -> Type v a
- pattern EffectfulArrows' :: Type v a -> [(Maybe [Type v a], Type v a)] -> Type v a
- pattern Ann' :: Term F v a -> Kind -> Term F v a
- pattern App' :: Term F v a -> Term F v a -> Term F v a
- pattern Apps' :: Type v a -> [Type v a] -> Type v a
- pattern Pure' :: Ord v => Type v a -> Type v a
- pattern Request' :: [Type v a] -> Type v a -> Type v a
- pattern Effects' :: [Term F v a] -> Term F v a
- pattern Effect1' :: Term F v a -> Term F v a -> Term F v a
- pattern Effect' :: Ord v => [Type v a] -> Type v a -> Type v a
- pattern Effect'' :: Ord v => [Type v a] -> Type v a -> Type v a
- pattern Effect0' :: Ord v => [Type v a] -> Type v a -> Type v a
- pattern Forall' :: Var v => Subst F v a -> Term F v a
- pattern IntroOuter' :: Var v => Subst F v a -> Term F v a
- pattern IntroOuterNamed' :: v -> Term F v a -> Term F v a
- pattern ForallsNamed' :: [v] -> Type v a -> Type v a
- pattern ForallsNamedOpt' :: [v] -> Type v a -> Type v a
- unForallsOpt :: Type v a -> ([v], Type v a)
- pattern ForallNamed' :: v -> Term F v a -> Term F 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
- unPure :: Ord v => Type v a -> Maybe (Type v a)
- unArrows :: Type v a -> Maybe [Type v a]
- unEffectfulArrows :: Type v a -> Maybe (Type v a, [(Maybe [Type v a], Type v a)])
- unApps :: Type v a -> Maybe (Type v a, [Type v a])
- unIntroOuters :: Type v a -> Maybe ([v], Type v a)
- stripIntroOuters :: Type v a -> Type v a
- unForalls :: Type v a -> Maybe ([v], Type v a)
- unEffect0 :: Ord v => Type v a -> ([Type v a], Type v a)
- unEffects1 :: Ord v => Type v a -> Maybe ([Type v a], Type v a)
- isArrow :: Var v => Type v a -> Bool
- ref :: Ord v => a -> TypeReference -> Type v a
- refId :: Ord v => a -> Id -> Type v a
- termLink :: Ord v => a -> Type v a
- typeLink :: Ord v => a -> Type v a
- derivedBase32Hex :: Ord v => TypeReference -> a -> Type v a
- intRef :: TypeReference
- natRef :: TypeReference
- floatRef :: TypeReference
- booleanRef :: TypeReference
- textRef :: TypeReference
- charRef :: TypeReference
- listRef :: TypeReference
- bytesRef :: TypeReference
- effectRef :: TypeReference
- termLinkRef :: TypeReference
- typeLinkRef :: TypeReference
- builtinIORef :: TypeReference
- fileHandleRef :: TypeReference
- filePathRef :: TypeReference
- threadIdRef :: TypeReference
- socketRef :: TypeReference
- udpSocketRef :: TypeReference
- udpListenSocketRef :: TypeReference
- udpClientSockAddrRef :: TypeReference
- processHandleRef :: TypeReference
- scopeRef :: TypeReference
- refRef :: TypeReference
- iarrayRef :: TypeReference
- marrayRef :: TypeReference
- ibytearrayRef :: TypeReference
- mbytearrayRef :: TypeReference
- mvarRef :: TypeReference
- tvarRef :: TypeReference
- ticketRef :: TypeReference
- promiseRef :: TypeReference
- tlsRef :: TypeReference
- stmRef :: TypeReference
- patternRef :: TypeReference
- charClassRef :: TypeReference
- tlsClientConfigRef :: TypeReference
- tlsServerConfigRef :: TypeReference
- tlsSignedCertRef :: TypeReference
- tlsPrivateKeyRef :: TypeReference
- tlsCipherRef :: TypeReference
- tlsVersionRef :: TypeReference
- hashAlgorithmRef :: TypeReference
- codeRef :: TypeReference
- valueRef :: TypeReference
- anyRef :: TypeReference
- timeSpecRef :: TypeReference
- any :: Ord v => a -> Type v a
- builtin :: Ord v => a -> Text -> Type v a
- int :: Ord v => a -> Type v a
- nat :: Ord v => a -> Type v a
- float :: Ord v => a -> Type v a
- boolean :: Ord v => a -> Type v a
- text :: Ord v => a -> Type v a
- char :: Ord v => a -> Type v a
- fileHandle :: Ord v => a -> Type v a
- processHandle :: Ord v => a -> Type v a
- threadId :: Ord v => a -> Type v a
- builtinIO :: Ord v => a -> Type v a
- scopeType :: Ord v => a -> Type v a
- refType :: Ord v => a -> Type v a
- iarrayType :: Ord v => a -> Type v a
- marrayType :: Ord v => a -> Type v a
- ibytearrayType :: Ord v => a -> Type v a
- mbytearrayType :: Ord v => a -> Type v a
- socket :: Ord v => a -> Type v a
- udpSocket :: Ord v => a -> Type v a
- udpListenSocket :: Ord v => a -> Type v a
- udpClientSockAddr :: Ord v => a -> Type v a
- list :: Ord v => a -> Type v a
- bytes :: Ord v => a -> Type v a
- effectType :: Ord v => a -> Type v a
- code :: Ord v => a -> Type v a
- value :: Ord v => a -> Type v a
- app :: Ord v => a -> Type v a -> Type v a -> Type v a
- apps :: Ord v => Type v a -> [(a, Type v a)] -> Type v a
- app' :: (Ord v, Semigroup a) => Type v a -> Type v a -> Type v a
- apps' :: (Semigroup a, Ord v) => Type v a -> [Type v a] -> Type v a
- arrow :: Ord v => a -> Type v a -> Type v a -> Type v a
- arrow' :: (Semigroup a, Ord v) => Type v a -> Type v a -> Type v a
- ann :: Ord v => a -> Type v a -> Kind -> Type v a
- forAll :: Ord v => a -> v -> Type v a -> Type v a
- introOuter :: Ord v => a -> v -> Type v a -> Type v a
- iff :: Var v => Type v ()
- iff' :: Var v => a -> Type v a
- iff2 :: Var v => a -> Type v a
- andor :: Ord v => Type v ()
- andor' :: Ord v => a -> Type v a
- var :: Ord v => a -> v -> Type v a
- v' :: Var v => Text -> Type v ()
- av' :: Var v => a -> Text -> Type v a
- forAll' :: Var v => a -> [Text] -> Type v a -> Type v a
- foralls :: Ord v => a -> [v] -> Type v a -> Type v a
- arrows :: Ord v => [(a, Type v a)] -> Type v a -> Type v a
- effect :: Ord v => a -> [Type v a] -> Type v a -> Type v a
- effects :: Ord v => a -> [Type v a] -> Type v a
- effect1 :: Ord v => a -> Type v a -> Type v a -> Type v a
- flattenEffects :: Type v a -> [Type v a]
- effectV :: Ord v => a -> (a, Type v a) -> (a, Type v a) -> Type v a
- stripEffect :: Ord v => Type v a -> ([Type v a], Type v a)
- flipApply :: Var v => Type v () -> Type v ()
- generalize' :: Var v => Type -> Type v a -> Type v a
- generalize :: Ord v => [v] -> Type v a -> Type v a
- unforall :: Type v a -> Type v a
- unforall' :: Type v a -> ([v], Type v a)
- dependencies :: Ord v => Type v a -> Set TypeReference
- labeledDependencies :: Ord v => Type v a -> Set LabeledDependency
- updateDependencies :: Ord v => Map TypeReference TypeReference -> Type v a -> Type v a
- usesEffects :: Ord v => Type v a -> Bool
- freeEffectVars :: Ord v => Type v a -> Set v
- existentializeArrows :: (Ord v, Monad m) => m v -> Type v a -> m (Type v a)
- purifyArrows :: Ord v => Type v a -> Type v a
- removeEffectVars :: Var v => Bool -> Set v -> Type v a -> Type v a
- removeAllEffectVars :: Var v => Type v a -> Type v a
- removeEmptyEffects :: Ord v => Type v a -> Type v a
- removePureEffects :: Var v => Bool -> Type v a -> Type v a
- editFunctionResult :: forall v a. Ord v => (Type v a -> Type v a) -> Type v a -> Type v a
- functionResult :: Type v a -> Maybe (Type v a)
- generalizeLowercase :: Var v => Set v -> Type v a -> Type v a
- freeVarsToOuters :: Ord v => Set v -> Type v a -> Type v a
- normalizeForallOrder :: forall v a. Var v => Type v a -> Type v a
- cleanupVars :: Var v => [Type v a] -> [Type v a]
- cleanupVarsMap :: Var v => [Type v a] -> Map v v
- cleanupVars1' :: Var v => Map v v -> Type v a -> Type v a
- cleanupVars1 :: Var v => Type v a -> Type v a
- cleanupAbilityLists :: Var v => Type v a -> Type v a
- cleanups :: Var v => [Type v a] -> [Type v a]
- cleanup :: Var v => Type v a -> Type v a
- builtinAbilities :: Set TypeReference
Documentation
Base functor for types in the Unison language
Ref TypeReference | |
Arrow a a | |
Ann a Kind | |
App a a | |
Effect a a | |
Effects [a] | |
Forall a | |
IntroOuter a |
Instances
type Type v a = Term F v a Source #
Types are represented as ABTs over the base functor F, with variables in v
bindExternal :: Var v => [(v, TypeReference)] -> Type v a -> Type v a Source #
bindReferences :: Var v => (v -> Name) -> Set v -> Map Name TypeReference -> Type v a -> ResolutionResult a (Type v a) Source #
Monotype | |
|
pattern ForallsNamed' :: [v] -> Type v a -> Type v a Source #
pattern ForallsNamedOpt' :: [v] -> Type v a -> Type v a Source #
unForallsOpt :: Type v a -> ([v], Type v a) Source #
stripIntroOuters :: Type v a -> Type v a Source #
isArrow :: Var v => Type v a -> Bool Source #
True if the given type is a function, possibly quantified
derivedBase32Hex :: Ord v => TypeReference -> a -> Type v a Source #
fileHandle :: Ord v => a -> Type v a Source #
processHandle :: Ord v => a -> Type v a Source #
iarrayType :: Ord v => a -> Type v a Source #
marrayType :: Ord v => a -> Type v a Source #
ibytearrayType :: Ord v => a -> Type v a Source #
mbytearrayType :: Ord v => a -> Type v a Source #
udpListenSocket :: Ord v => a -> Type v a Source #
udpClientSockAddr :: Ord v => a -> Type v a Source #
effectType :: Ord v => a -> Type v a Source #
flattenEffects :: Type v a -> [Type v a] Source #
generalize :: Ord v => [v] -> Type v a -> Type v a Source #
Bind the given variables with an outer forAll
, if they are used in t
.
dependencies :: Ord v => Type v a -> Set TypeReference Source #
labeledDependencies :: Ord v => Type v a -> Set LabeledDependency Source #
updateDependencies :: Ord v => Map TypeReference TypeReference -> Type v a -> Type v a Source #
generalizeLowercase :: Var v => Set v -> Type v a -> Type v a Source #
Bind all free variables (not in except
) that start with a lowercase
letter and are unqualified with an outer forall
.
`a -> a` becomes `∀ a . a -> a`
`B -> B` becomes `B -> B` (not changed)
`.foo -> .foo` becomes `.foo -> .foo` (not changed)
`.foo.bar -> blarrg.woot` becomes `.foo.bar -> blarrg.woot` (unchanged)
cleanupVars :: Var v => [Type v a] -> [Type v a] Source #
This function removes all variable shadowing from the types and reduces fresh ids to the minimum possible to avoid ambiguity. Useful when showing two different types.