Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Void
- data Nat
- data P (a :: k) = P
- data Lazy a = Lazy {
- unLazy :: ~a
- type 𝔹 = Bool
- newtype 𝐼 a = 𝐼 {
- un𝐼 :: forall b. (a -> b -> (b -> b) -> b) -> b -> (b -> b) -> b
- data 𝐿 a
- data 𝑂 a
- newtype 𝑄 a = 𝑄 {}
- type 𝕊 = Text
- newtype k ⇰ v = 𝐷 {}
- data a ∨ b
- data a ∧ b = a :* b
- type ℕ = Natural
- type ℕ64 = Word64
- type ℕ32 = Word32
- type ℕ16 = Word16
- type ℕ8 = Word8
- type ℤ = Integer
- type ℤ64 = Int64
- type ℤ32 = Int32
- type ℤ16 = Int16
- type ℤ8 = Int8
- type ℚ = Rational
- type ℚᴾ = Ratio ℕ
- type 𝔻 = Double
- newtype 𝔻ᴾ = 𝔻ᴾ {}
- data ℝ
- data ℝᴾ
- type ℂ = Char
- newtype 𝑆 a = 𝑆 {}
- newtype 𝑃 a = 𝑃 {}
- data (a :: k) ≟ (b :: k) :: ★ where
- data W (c :: Constraint) where
- data Ex (t :: k -> ★) :: ★ where
- data Ex_C (c :: k -> Constraint) (t :: k -> ★) :: ★ where
- Ex_C :: forall (k :: ★) (c :: k -> Constraint) (t :: k -> ★) (a :: k). c a => t a -> Ex_C c t
- type STACK = HasCallStack
- class CHS a b | b -> a where
- fail :: forall (r :: RuntimeRep) (a :: TYPE r) m. STACK => [ℂ] -> m a
- ($) :: forall r a (b :: TYPE r). (a -> b) -> a -> b
- error :: forall (r :: RuntimeRep) (a :: TYPE r). STACK => 𝕊 -> a
- uncurry :: ((a ∧ b) -> c) -> a -> b -> c
- id :: a -> a
- with :: W c -> (c => a) -> a
- fromRational :: Rational -> 𝔻
- negate :: ℕ -> ℤ
- not :: 𝔹 -> 𝔹
- const :: a -> b -> a
- flip :: (a -> b -> c) -> b -> a -> c
- rotateL :: (a -> b -> c -> d) -> b -> c -> a -> d
- rotateR :: (a -> b -> c -> d) -> c -> a -> b -> d
- curry :: (a -> b -> c) -> (a ∧ b) -> c
- on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
- unpack :: forall (k :: ★) (t :: k -> ★) (b :: ★). Ex t -> (forall (a :: k). t a -> b) -> b
- (⩔) :: 𝔹 -> 𝔹 -> 𝔹
- (⩓) :: 𝔹 -> 𝔹 -> 𝔹
- (∘) :: (b -> c) -> (a -> b) -> a -> c
- cond :: 𝔹 -> a -> a -> a
- exfalso :: Void -> a
- run𝐼 :: (b -> b) -> b -> (a -> b -> (b -> b) -> b) -> 𝐼 a -> b
- run𝐼On :: 𝐼 a -> (b -> b) -> b -> (a -> b -> (b -> b) -> b) -> b
- foldk𝐼 :: b -> (a -> b -> (b -> b) -> b) -> 𝐼 a -> b
- fold𝐼 :: b -> (a -> b -> b) -> 𝐼 a -> b
- foldr𝐼 :: b -> (a -> b -> b) -> 𝐼 a -> b
- map𝐼 :: (a -> b) -> 𝐼 a -> 𝐼 b
- null𝐼 :: 𝐼 a
- single𝐼 :: a -> 𝐼 a
- list𝐼 :: 𝐼 a -> 𝐿 a
- iter𝐿 :: 𝐿 a -> 𝐼 a
- lazyList𝐼 :: 𝐼 a -> [a]
- iterLL :: [a] -> 𝐼 a
- coerce_UNSAFE :: a -> b
- weq_UNSAFE :: P a -> P b -> W (a ~ b)
- void_UNSAFE :: Void
- unpack_C :: forall (k :: ★) (c :: k -> Constraint) (t :: k -> ★) (b :: ★). Ex_C c t -> (forall (a :: k). c a => t a -> b) -> b
- ifThenElse :: 𝔹 -> a -> a -> a
- 𝕤 :: [ℂ] -> 𝕊
- 𝕟 :: ℕ -> ℕ
- 𝕟64 :: ℕ -> ℕ64
- 𝕟32 :: ℕ -> ℕ32
- 𝕟16 :: ℕ -> ℕ16
- 𝕟8 :: ℕ -> ℕ8
- 𝕫 :: ℕ -> ℤ
- 𝕫64 :: ℕ -> ℤ64
- 𝕫32 :: ℕ -> ℤ32
- 𝕫16 :: ℕ -> ℤ16
- 𝕫8 :: ℕ -> ℤ8
- 𝕢 :: ℕ -> ℚ
- 𝕢ᴾ :: ℕ -> ℚᴾ
- 𝕕ᴾ :: 𝔻 -> 𝔻ᴾ
- tohsChars :: 𝕊 -> [ℂ]
- frhsChars :: [ℂ] -> 𝕊
- appto :: a -> (a -> b) -> b
- (∘∘) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
- (∘∘∘) :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e
- mirror :: (a -> b -> c -> d) -> c -> b -> a -> d
- tohs𝑂F :: (a -> b) -> 𝑂 a -> Maybe b
- tohs𝑂 :: 𝑂 a -> Maybe a
- frhs𝑂F :: (a -> b) -> Maybe a -> 𝑂 b
- frhs𝑂 :: Maybe a -> 𝑂 a
- assert :: Bool -> a -> a
- class a ~R# b => Coercible (a :: k) (b :: k)
- coerce :: forall {k :: RuntimeRep} (a :: TYPE k) (b :: TYPE k). Coercible a b => a -> b
- type Constraint = CONSTRAINT LiftedRep
- data CallStack
- callStack :: HasCallStack => CallStack
- withFrozenCallStack :: HasCallStack => (HasCallStack => a) -> a
- data Bool
- data Ordering
- data IO a
- class Eq a where
- class Eq a => Ord a where
- class Show a where
- otherwise :: Bool
- fromInteger :: Num a => Integer -> a
- undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
- fromString :: IsString a => String -> a
Documentation
Instances
Bind 𝐼 Source # | |
Functor 𝐼 Source # | |
FunctorM 𝐼 Source # | |
Monad 𝐼 Source # | |
Defined in UVMHS.Core.Data.Iter | |
Return 𝐼 Source # | |
Defined in UVMHS.Core.Data.Iter | |
MonadNondet 𝐼 Source # | |
Lift a => Lift (𝐼 a :: Type) Source # | |
Single a (𝐼 a) Source # | |
Defined in UVMHS.Core.Data.Iter | |
ToIter a (𝐼 a) Source # | |
𝕊 ⇄ (𝐼 ℂ) Source # | |
Show a => Show (𝐼 a) Source # | |
Append (𝐼 a) Source # | |
Monoid (𝐼 a) Source # | |
Defined in UVMHS.Core.Data.Iter | |
Null (𝐼 a) Source # | |
Defined in UVMHS.Core.Data.Iter | |
Pretty a => Pretty (𝐼 a) Source # | |
Instances
Bind 𝐿 Source # | |
Functor 𝐿 Source # | |
FunctorM 𝐿 Source # | |
Monad 𝐿 Source # | |
Defined in UVMHS.Core.Data.List | |
Return 𝐿 Source # | |
Defined in UVMHS.Core.Data.List | |
MonadNondet 𝐿 Source # | |
Lift a => Lift (𝐿 a :: Type) Source # | |
Single a (𝐿 a) Source # | |
Defined in UVMHS.Core.Data.List | |
ToIter a (𝐿 a) Source # | |
Show a => Show (𝐿 a) Source # | |
Eq a => Eq (𝐿 a) Source # | |
Ord a => Ord (𝐿 a) Source # | |
Append (𝐿 a) Source # | |
Monoid (𝐿 a) Source # | |
Defined in UVMHS.Core.Data.List | |
Null (𝐿 a) Source # | |
Defined in UVMHS.Core.Data.List | |
Pretty a => Pretty (𝐿 a) Source # | |
Fuzzy a => Fuzzy (𝐿 a) Source # | |
CHS a b => CHS (𝐿 a) [b] Source # | |
Instances
Bind 𝑂 Source # | |
Functor 𝑂 Source # | |
FunctorM 𝑂 Source # | |
Monad 𝑂 Source # | |
Defined in UVMHS.Core.Data.Option | |
Return 𝑂 Source # | |
Defined in UVMHS.Core.Data.Option | |
MonadFail 𝑂 Source # | |
Lift a => Lift (𝑂 a :: Type) Source # | |
ToIter a (𝑂 a) Source # | |
Show a => Show (𝑂 a) Source # | |
Eq a => Eq (𝑂 a) Source # | |
Ord a => Ord (𝑂 a) Source # | |
All a => All (𝑂 a) Source # | |
Append a => Append (𝑂 a) Source # | |
Monoid a => Monoid (𝑂 a) Source # | |
Defined in UVMHS.Core.Data.Option | |
Null a => Null (𝑂 a) Source # | |
Defined in UVMHS.Core.Data.Option | |
Pretty a => Pretty (𝑂 a) Source # | |
Fuzzy a => Fuzzy (𝑂 a) Source # | |
CHS a b => CHS (𝑂 a) (Maybe b) Source # | |
(𝑂 a) ⇄ (() ∨ a) Source # | |
Instances
Bind 𝑄 Source # | |
Functor 𝑄 Source # | |
Monad 𝑄 Source # | |
Defined in UVMHS.Core.Data.Sequence | |
Return 𝑄 Source # | |
Defined in UVMHS.Core.Data.Sequence | |
MonadNondet 𝑄 Source # | |
Single a (𝑄 a) Source # | |
Defined in UVMHS.Core.Data.Sequence | |
ToIter a (𝑄 a) Source # | |
Show a => Show (𝑄 a) Source # | |
Eq a => Eq (𝑄 a) Source # | |
Ord a => Ord (𝑄 a) Source # | |
Append (𝑄 a) Source # | |
Monoid (𝑄 a) Source # | |
Defined in UVMHS.Core.Data.Sequence | |
Null (𝑄 a) Source # | |
Defined in UVMHS.Core.Data.Sequence | |
Pretty a => Pretty (𝑄 a) Source # | |
newtype k ⇰ v infixr 1 Source #
Instances
Ord k => Lookup k a (k ⇰ a) Source # | |
Ord k => KBiFunctor k ((⇰) k) Source # | |
Ord k => KBiFunctorM k ((⇰) k) Source # | |
Ord k => KFunctor k ((⇰) k) Source # | |
Ord k => KFunctorM k ((⇰) k) Source # | |
Ord k => OKBiFunctor k ((⇰) k) Source # | |
Ord k => OKBiFunctorM k ((⇰) k) Source # | |
Ord k => OKFunctor k ((⇰) k) Source # | |
Ord k => OKFunctorM k ((⇰) k) Source # | |
Ord k => Dict k (𝑃 k) ((⇰) k) Source # | |
Defined in UVMHS.Core.Data.Dict (↦) :: k -> a -> k ⇰ a Source # dadd :: k -> a -> (k ⇰ a) -> k ⇰ a Source # drem :: k -> (k ⇰ a) -> k ⇰ a Source # dupd :: k -> (a -> 𝑂 a) -> (k ⇰ a) -> k ⇰ a Source # dlteBy :: (a -> a -> 𝔹) -> (k ⇰ a) -> (k ⇰ a) -> 𝔹 Source # dunionBy :: (a -> a -> a) -> (k ⇰ a) -> (k ⇰ a) -> k ⇰ a Source # dinterBy :: (a -> b -> c) -> (k ⇰ a) -> (k ⇰ b) -> k ⇰ c Source # dsdiffBy :: (a -> b -> 𝑂 a) -> (k ⇰ a) -> (k ⇰ b) -> k ⇰ a Source # (⋿) :: k -> (k ⇰ a) -> 𝔹 Source # (⫑) :: Eq a => (k ⇰ a) -> (k ⇰ a) -> 𝔹 Source # (⩌) :: (k ⇰ a) -> (k ⇰ a) -> k ⇰ a Source # (⩍) :: (k ⇰ a) -> (k ⇰ a) -> k ⇰ a Source # (⧅) :: Eq a => (k ⇰ a) -> (k ⇰ a) -> k ⇰ a Source # dminView :: (k ⇰ a) -> 𝑂 ((k ∧ a) ∧ (k ⇰ a)) Source # dmaxView :: (k ⇰ a) -> 𝑂 ((k ∧ a) ∧ (k ⇰ a)) Source # dkeyView :: k -> (k ⇰ a) -> 𝑂 (a ∧ (k ⇰ a)) Source # dminElem :: (k ⇰ a) -> 𝑂 (k ∧ a) Source # dmaxElem :: (k ⇰ a) -> 𝑂 (k ∧ a) Source # dkeep :: 𝑃 k -> (k ⇰ a) -> k ⇰ a Source # dtoss :: 𝑃 k -> (k ⇰ a) -> k ⇰ a Source # dict𝐼 :: 𝐼 (k ∧ a) -> k ⇰ a Source # | |
Ord k => BiFunctor ((⇰) k) Source # | |
Ord k => BiFunctorM ((⇰) k) Source # | |
Functor ((⇰) k) Source # | |
FunctorM ((⇰) k) Source # | |
Ord k => OBiFunctor ((⇰) k) Source # | |
Ord k => OBiFunctorM ((⇰) k) Source # | |
OFunctor ((⇰) k) Source # | |
OFunctorM ((⇰) k) Source # | |
(Show k, Show a) => Show (k ⇰ a) Source # | |
(Eq k, Eq v) => Eq (k ⇰ v) Source # | |
(Ord k, Ord v) => Ord (k ⇰ v) Source # | |
(Ord k, Plus a) => Additive (k ⇰ a) Source # | |
Defined in UVMHS.Core.Data.Dict | |
(Ord k, Additive k, Multiplicative a) => Multiplicative (k ⇰ a) Source # | |
Defined in UVMHS.Core.Data.Dict | |
(Ord k, Zero k, Zero a) => One (k ⇰ a) Source # | |
Defined in UVMHS.Core.Data.Dict | |
(Ord k, Plus a) => Plus (k ⇰ a) Source # | |
(Ord k, Plus k, Plus a, Times a) => Times (k ⇰ a) Source # | |
Zero (k ⇰ a) Source # | |
Defined in UVMHS.Core.Data.Dict | |
(Ord k, All k, All a) => All (k ⇰ a) Source # | |
CSized (k ⇰ a) Source # | |
Bot (k ⇰ a) Source # | |
Defined in UVMHS.Core.Data.Dict | |
(Ord k, Difference a) => Difference (k ⇰ a) Source # | |
(Ord k, Join a) => Join (k ⇰ a) Source # | |
(Ord k, Join a) => JoinLattice (k ⇰ a) Source # | |
Defined in UVMHS.Core.Data.Dict | |
(Ord k, Meet a) => Meet (k ⇰ a) Source # | |
(Ord k, POrd a) => POrd (k ⇰ a) Source # | |
(Ord k, Append a) => Append (k ⇰ a) Source # | |
(Ord k, Append k, Append a, Cross a) => Cross (k ⇰ a) Source # | |
(Ord k, Append a) => Monoid (k ⇰ a) Source # | |
Defined in UVMHS.Core.Data.Dict | |
Null (k ⇰ a) Source # | |
Defined in UVMHS.Core.Data.Dict | |
(Ord k, Monoid k, Prodoid a) => Prodoid (k ⇰ a) Source # | |
Defined in UVMHS.Core.Data.Dict | |
(Ord k, Null k, Null a) => Unit (k ⇰ a) Source # | |
Defined in UVMHS.Core.Data.Dict | |
(Pretty k, Pretty v) => Pretty (k ⇰ v) Source # | |
(Ord k, Fuzzy k, Fuzzy v) => Fuzzy (k ⇰ v) Source # | |
Ord k => Single (k ∧ a) (k ⇰ a) Source # | |
ToIter (k ∧ a) (k ⇰ a) Source # | |
Ord s => MonadWriter (s ⇰ 𝑃 𝕐) (SubstM s e) Source # | |
Instances
MonadError e ((∨) e :: Type -> Type) Source # | |
Bind ((∨) a) Source # | |
Functor ((∨) a) Source # | |
FunctorM ((∨) a) Source # | |
Monad ((∨) a) Source # | |
Defined in UVMHS.Core.Data.Choice | |
Return ((∨) a) Source # | |
Defined in UVMHS.Core.Data.Choice | |
(𝑂 a) ⇄ (() ∨ a) Source # | |
(Show a, Show b) => Show (a ∨ b) Source # | |
(Eq a, Eq b) => Eq (a ∨ b) Source # | |
(Ord a, Ord b) => Ord (a ∨ b) Source # | |
(Chunky a, Chunky b) => Chunky (a ∨ b) Source # | |
(ASized a, ASized b) => ASized (a ∨ b) Source # | |
(All a, All b) => All (a ∨ b) Source # | |
(Append a, Append b) => Append (a ∨ b) Source # | |
(Append a, Monoid b) => Monoid (a ∨ b) Source # | |
Defined in UVMHS.Core.Data.Choice | |
Null b => Null (a ∨ b) Source # | |
Defined in UVMHS.Core.Data.Choice | |
(Pretty a, Pretty b) => Pretty (a ∨ b) Source # | |
(Fuzzy a, Fuzzy b) => Fuzzy (a ∨ b) Source # | |
(CHS a₁ b₁, CHS a₂ b₂) => CHS (a₁ ∨ a₂) (Either b₁ b₂) Source # | |
a :* b infixl 8 |
Instances
Instances
Instances
Instances
Instances
Ord a => Single a (𝑃 a) Source # | |
Defined in UVMHS.Core.Data.Set | |
ToIter a (𝑃 a) Source # | |
Ord e => Set e (𝑃 e) Source # | |
Defined in UVMHS.Core.Data.Set padd :: e -> 𝑃 e -> 𝑃 e Source # prem :: e -> 𝑃 e -> 𝑃 e Source # (⊆) :: 𝑃 e -> 𝑃 e -> 𝔹 Source # (∪) :: 𝑃 e -> 𝑃 e -> 𝑃 e Source # (∩) :: 𝑃 e -> 𝑃 e -> 𝑃 e Source # (∖) :: 𝑃 e -> 𝑃 e -> 𝑃 e Source # pminView :: 𝑃 e -> 𝑂 (e ∧ 𝑃 e) Source # pmaxView :: 𝑃 e -> 𝑂 (e ∧ 𝑃 e) Source # pminElem :: 𝑃 e -> 𝑂 e Source # | |
Ord k => Dict k (𝑃 k) ((⇰) k) Source # | |
Defined in UVMHS.Core.Data.Dict (↦) :: k -> a -> k ⇰ a Source # dadd :: k -> a -> (k ⇰ a) -> k ⇰ a Source # drem :: k -> (k ⇰ a) -> k ⇰ a Source # dupd :: k -> (a -> 𝑂 a) -> (k ⇰ a) -> k ⇰ a Source # dlteBy :: (a -> a -> 𝔹) -> (k ⇰ a) -> (k ⇰ a) -> 𝔹 Source # dunionBy :: (a -> a -> a) -> (k ⇰ a) -> (k ⇰ a) -> k ⇰ a Source # dinterBy :: (a -> b -> c) -> (k ⇰ a) -> (k ⇰ b) -> k ⇰ c Source # dsdiffBy :: (a -> b -> 𝑂 a) -> (k ⇰ a) -> (k ⇰ b) -> k ⇰ a Source # (⋿) :: k -> (k ⇰ a) -> 𝔹 Source # (⫑) :: Eq a => (k ⇰ a) -> (k ⇰ a) -> 𝔹 Source # (⩌) :: (k ⇰ a) -> (k ⇰ a) -> k ⇰ a Source # (⩍) :: (k ⇰ a) -> (k ⇰ a) -> k ⇰ a Source # (⧅) :: Eq a => (k ⇰ a) -> (k ⇰ a) -> k ⇰ a Source # dminView :: (k ⇰ a) -> 𝑂 ((k ∧ a) ∧ (k ⇰ a)) Source # dmaxView :: (k ⇰ a) -> 𝑂 ((k ∧ a) ∧ (k ⇰ a)) Source # dkeyView :: k -> (k ⇰ a) -> 𝑂 (a ∧ (k ⇰ a)) Source # dminElem :: (k ⇰ a) -> 𝑂 (k ∧ a) Source # dmaxElem :: (k ⇰ a) -> 𝑂 (k ∧ a) Source # dkeep :: 𝑃 k -> (k ⇰ a) -> k ⇰ a Source # dtoss :: 𝑃 k -> (k ⇰ a) -> k ⇰ a Source # dict𝐼 :: 𝐼 (k ∧ a) -> k ⇰ a Source # | |
Show a => Show (𝑃 a) Source # | |
Eq a => Eq (𝑃 a) Source # | |
Ord a => Ord (𝑃 a) Source # | |
Ord a => Additive (𝑃 a) Source # | |
Defined in UVMHS.Core.Data.Set | |
(Ord a, Zero a) => One (𝑃 a) Source # | |
Defined in UVMHS.Core.Data.Set | |
Ord a => Plus (𝑃 a) Source # | |
(Ord a, Plus a) => Times (𝑃 a) Source # | |
Zero (𝑃 a) Source # | |
Defined in UVMHS.Core.Data.Set | |
(Ord a, All a) => All (𝑃 a) Source # | |
CSized (𝑃 a) Source # | |
Bot (𝑃 a) Source # | |
Defined in UVMHS.Core.Data.Set | |
Ord a => Difference (𝑃 a) Source # | |
Ord a => Join (𝑃 a) Source # | |
Ord a => JoinLattice (𝑃 a) Source # | |
Defined in UVMHS.Core.Data.Set | |
Ord a => Meet (𝑃 a) Source # | |
Ord a => POrd (𝑃 a) Source # | |
Ord a => Append (𝑃 a) Source # | |
(Ord a, Append a) => Cross (𝑃 a) Source # | |
Ord a => Monoid (𝑃 a) Source # | |
Defined in UVMHS.Core.Data.Set | |
Null (𝑃 a) Source # | |
Defined in UVMHS.Core.Data.Set | |
(Ord a, Monoid a) => Prodoid (𝑃 a) Source # | |
Defined in UVMHS.Core.Data.Set | |
(Ord a, Null a) => Unit (𝑃 a) Source # | |
Defined in UVMHS.Core.Data.Set | |
Pretty a => Pretty (𝑃 a) Source # | |
Ord s => MonadWriter (s ⇰ 𝑃 𝕐) (SubstM s e) Source # | |
data W (c :: Constraint) where Source #
data Ex_C (c :: k -> Constraint) (t :: k -> ★) :: ★ where Source #
Ex_C :: forall (k :: ★) (c :: k -> Constraint) (t :: k -> ★) (a :: k). c a => t a -> Ex_C c t |
type STACK = HasCallStack Source #
class CHS a b | b -> a where Source #
Instances
CHS ℤ64 Int Source # | |
a ~ b => CHS a b Source # | |
CHS a b => CHS (𝐿 a) [b] Source # | |
CHS a b => CHS (𝑂 a) (Maybe b) Source # | |
(CHS a₁ b₁, CHS a₂ b₂) => CHS (a₁ ∧ a₂) (b₁, b₂) Source # | |
(CHS a₁ b₁, CHS a₂ b₂) => CHS (a₁ ∨ a₂) (Either b₁ b₂) Source # | |
(CHS a₁ b₁, CHS a₂ b₂, CHS a₃ b₃) => CHS ((a₁ ∧ a₂) ∧ a₃) (b₁, b₂, b₃) Source # | |
(CHS a₁ b₁, CHS a₂ b₂, CHS a₃ b₃, CHS a₄ b₄) => CHS (((a₁ ∧ a₂) ∧ a₃) ∧ a₄) (b₁, b₂, b₃, b₄) Source # | |
fromRational :: Rational -> 𝔻 Source #
coerce_UNSAFE :: a -> b Source #
void_UNSAFE :: Void Source #
unpack_C :: forall (k :: ★) (c :: k -> Constraint) (t :: k -> ★) (b :: ★). Ex_C c t -> (forall (a :: k). c a => t a -> b) -> b Source #
ifThenElse :: 𝔹 -> a -> a -> a Source #
If the first argument evaluates to True
, then the result is the
second argument. Otherwise an AssertionFailed
exception
is raised, containing a String
with the source file and line number of the
call to assert
.
Assertions can normally be turned on or off with a compiler flag
(for GHC, assertions are normally on unless optimisation is turned on
with -O
or the -fignore-asserts
option is given). When assertions are turned off, the first
argument to assert
is ignored, and the second argument is
returned as the result.
class a ~R# b => Coercible (a :: k) (b :: k) #
Coercible
is a two-parameter class that has instances for types a
and b
if
the compiler can infer that they have the same representation. This class
does not have regular instances; instead they are created on-the-fly during
type-checking. Trying to manually declare an instance of Coercible
is an error.
Nevertheless one can pretend that the following three kinds of instances exist. First, as a trivial base-case:
instance Coercible a a
Furthermore, for every type constructor there is
an instance that allows to coerce under the type constructor. For
example, let D
be a prototypical type constructor (data
or
newtype
) with three type arguments, which have roles nominal
,
representational
resp. phantom
. Then there is an instance of
the form
instance Coercible b b' => Coercible (D a b c) (D a b' c')
Note that the nominal
type arguments are equal, the
representational
type arguments can differ, but need to have a
Coercible
instance themself, and the phantom
type arguments can be
changed arbitrarily.
The third kind of instance exists for every newtype NT = MkNT T
and
comes in two variants, namely
instance Coercible a T => Coercible a NT
instance Coercible T b => Coercible NT b
This instance is only usable if the constructor MkNT
is in scope.
If, as a library author of a type constructor like Set a
, you
want to prevent a user of your module to write
coerce :: Set T -> Set NT
,
you need to set the role of Set
's type parameter to nominal
,
by writing
type role Set nominal
For more details about this feature, please refer to Safe Coercions by Joachim Breitner, Richard A. Eisenberg, Simon Peyton Jones and Stephanie Weirich.
Since: ghc-prim-0.4.0
coerce :: forall {k :: RuntimeRep} (a :: TYPE k) (b :: TYPE k). Coercible a b => a -> b #
The function coerce
allows you to safely convert between values of
types that have the same representation with no run-time overhead. In the
simplest case you can use it instead of a newtype constructor, to go from
the newtype's concrete type to the abstract type. But it also works in
more complicated settings, e.g. converting a list of newtypes to a list of
concrete types.
This function is representation-polymorphic, but the
RuntimeRep
type argument is marked as Inferred
, meaning
that it is not available for visible type application. This means
the typechecker will accept coerce
Int
Age 42
.
type Constraint = CONSTRAINT LiftedRep #
The kind of lifted constraints
CallStack
s are a lightweight method of obtaining a
partial call-stack at any point in the program.
A function can request its call-site with the HasCallStack
constraint.
For example, we can define
putStrLnWithCallStack :: HasCallStack => String -> IO ()
as a variant of putStrLn
that will get its call-site and print it,
along with the string given as argument. We can access the
call-stack inside putStrLnWithCallStack
with callStack
.
>>>
:{
putStrLnWithCallStack :: HasCallStack => String -> IO () putStrLnWithCallStack msg = do putStrLn msg putStrLn (prettyCallStack callStack) :}
Thus, if we call putStrLnWithCallStack
we will get a formatted call-stack
alongside our string.
>>>
putStrLnWithCallStack "hello"
hello CallStack (from HasCallStack): putStrLnWithCallStack, called at <interactive>:... in interactive:Ghci...
GHC solves HasCallStack
constraints in three steps:
- If there is a
CallStack
in scope -- i.e. the enclosing function has aHasCallStack
constraint -- GHC will append the new call-site to the existingCallStack
. - If there is no
CallStack
in scope -- e.g. in the GHCi session above -- and the enclosing definition does not have an explicit type signature, GHC will infer aHasCallStack
constraint for the enclosing definition (subject to the monomorphism restriction). - If there is no
CallStack
in scope and the enclosing definition has an explicit type signature, GHC will solve theHasCallStack
constraint for the singletonCallStack
containing just the current call-site.
CallStack
s do not interact with the RTS and do not require compilation
with -prof
. On the other hand, as they are built up explicitly via the
HasCallStack
constraints, they will generally not contain as much
information as the simulated call-stacks maintained by the RTS.
A CallStack
is a [(String, SrcLoc)]
. The String
is the name of
function that was called, the SrcLoc
is the call-site. The list is
ordered with the most recently called function at the head.
NOTE: The intrepid user may notice that HasCallStack
is just an
alias for an implicit parameter ?callStack :: CallStack
. This is an
implementation detail and should not be considered part of the
CallStack
API, we may decide to change the implementation in the
future.
Since: base-4.8.1.0
Instances
IsList CallStack | Be aware that 'fromList . toList = id' only for unfrozen Since: base-4.9.0.0 |
Show CallStack | Since: base-4.9.0.0 |
NFData CallStack | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
Pretty CallStack Source # | |
type Item CallStack | |
Defined in GHC.IsList |
callStack :: HasCallStack => CallStack #
withFrozenCallStack :: HasCallStack => (HasCallStack => a) -> a #
Perform some computation without adding new entries to the CallStack
.
Since: base-4.9.0.0
Instances
Instances
Monoid Ordering | Since: base-2.1 |
Semigroup Ordering | Since: base-4.9.0.0 |
Bounded Ordering | Since: base-2.1 |
Enum Ordering | Since: base-2.1 |
Generic Ordering | |
Read Ordering | Since: base-2.1 |
Show Ordering | Since: base-2.1 |
NFData Ordering | |
Defined in Control.DeepSeq | |
Eq Ordering | |
Ord Ordering | |
Defined in GHC.Classes | |
Hashable Ordering | |
Defined in Data.Hashable.Class | |
Finite Ordering | |
Defined in System.Random.GFinite cardinality :: Proxy# Ordering -> Cardinality toFinite :: Integer -> Ordering fromFinite :: Ordering -> Integer | |
type Rep Ordering | Since: base-4.6.0.0 |
A value of type
is a computation which, when performed,
does some I/O before returning a value of type IO
aa
.
There is really only one way to "perform" an I/O action: bind it to
Main.main
in your program. When your program is run, the I/O will
be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the IO
monad and called
at some point, directly or indirectly, from Main.main
.
IO
is a monad, so IO
actions can be combined using either the do-notation
or the >>
and >>=
operations from the Monad
class.
Instances
The Eq
class defines equality (==
) and inequality (/=
).
All the basic datatypes exported by the Prelude are instances of Eq
,
and Eq
may be derived for any datatype whose constituents are also
instances of Eq
.
The Haskell Report defines no laws for Eq
. However, instances are
encouraged to follow these properties:
Instances
The Ord
class is used for totally ordered datatypes.
Instances of Ord
can be derived for any user-defined datatype whose
constituent types are in Ord
. The declared order of the constructors in
the data declaration determines the ordering in derived Ord
instances. The
Ordering
datatype allows a single comparison to determine the precise
ordering of two objects.
Ord
, as defined by the Haskell report, implements a total order and has the
following properties:
- Comparability
x <= y || y <= x
=True
- Transitivity
- if
x <= y && y <= z
=True
, thenx <= z
=True
- Reflexivity
x <= x
=True
- Antisymmetry
- if
x <= y && y <= x
=True
, thenx == y
=True
The following operator interactions are expected to hold:
x >= y
=y <= x
x < y
=x <= y && x /= y
x > y
=y < x
x < y
=compare x y == LT
x > y
=compare x y == GT
x == y
=compare x y == EQ
min x y == if x <= y then x else y
=True
max x y == if x >= y then x else y
=True
Note that (7.) and (8.) do not require min
and max
to return either of
their arguments. The result is merely required to equal one of the
arguments in terms of (==)
.
Minimal complete definition: either compare
or <=
.
Using compare
can be more efficient for complex types.
Instances
Conversion of values to readable String
s.
Derived instances of Show
have the following properties, which
are compatible with derived instances of Read
:
- The result of
show
is a syntactically correct Haskell expression containing only constants, given the fixity declarations in force at the point where the type is declared. It contains only the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used. - If the constructor is defined to be an infix operator, then
showsPrec
will produce infix applications of the constructor. - the representation will be enclosed in parentheses if the
precedence of the top-level constructor in
x
is less thand
(associativity is ignored). Thus, ifd
is0
then the result is never surrounded in parentheses; ifd
is11
it is always surrounded in parentheses, unless it is an atomic expression. - If the constructor is defined using record syntax, then
show
will produce the record-syntax form, with the fields given in the same order as the original declaration.
For example, given the declarations
infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a
the derived instance of Show
is equivalent to
instance (Show a) => Show (Tree a) where showsPrec d (Leaf m) = showParen (d > app_prec) $ showString "Leaf " . showsPrec (app_prec+1) m where app_prec = 10 showsPrec d (u :^: v) = showParen (d > up_prec) $ showsPrec (up_prec+1) u . showString " :^: " . showsPrec (up_prec+1) v where up_prec = 5
Note that right-associativity of :^:
is ignored. For example,
produces the stringshow
(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)"
.
Instances
fromInteger :: Num a => Integer -> a #
Conversion from an Integer
.
An integer literal represents the application of the function
fromInteger
to the appropriate value of type Integer
,
so such literals have type (
.Num
a) => a
undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a #
fromString :: IsString a => String -> a #