Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- (&) :: a -> (a -> b) -> b
- (&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
- (<&>) :: Functor f => f a -> (a -> b) -> f b
- toList :: Foldable t => t a -> [a]
- bool :: a -> a -> Bool -> a
- first :: Bifunctor p => (a -> b) -> p a c -> p b c
- second :: Bifunctor p => (b -> c) -> p a b -> p a c
- on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
- isNothing :: Maybe a -> Bool
- isJust :: Maybe a -> Bool
- fromMaybe :: a -> Maybe a -> a
- guard :: Alternative f => Bool -> f ()
- foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
- fold :: (Foldable t, Monoid m) => t m -> m
- for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
- throw :: forall (r :: RuntimeRep) (a :: TYPE r) e. Exception e => e -> a
- join :: Monad m => m (m a) -> m a
- (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- ($>) :: Functor f => f a -> b -> f b
- fromRight :: b -> Either a b -> b
- isRight :: Either a b -> Bool
- void :: Functor f => f a -> f ()
- through :: Functor f => (a -> f b) -> a -> f a
- coerce :: forall (k :: RuntimeRep) (a :: TYPE k) (b :: TYPE k). Coercible a b => a -> b
- class Generic a
- class NFData a
- data Natural
- data NonEmpty a = a :| [a]
- data Word8
- class Applicative f => Alternative (f :: Type -> Type) where
- class (Typeable e, Show e) => Exception e
- newtype PairT b f a = PairT {
- unPairT :: f (b, a)
- class a ~R# b => Coercible (a :: k) (b :: k)
- class Typeable (a :: k)
- type Lens' s a = Lens s s a a
- lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b
- (^.) :: s -> Getting a s a -> a
- view :: MonadReader s m => Getting a s a -> m a
- (.~) :: ASetter s t a b -> b -> s -> t
- set :: ASetter s t a b -> b -> s -> t
- (%~) :: ASetter s t a b -> (a -> b) -> s -> t
- over :: ASetter s t a b -> (a -> b) -> s -> t
- traceShowId :: Show a => a -> a
- trace :: String -> a -> a
- (.*) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
- (<<$>>) :: (Functor f1, Functor f2) => (a -> b) -> f1 (f2 a) -> f1 (f2 b)
- (<<*>>) :: (Applicative f1, Applicative f2) => f1 (f2 (a -> b)) -> f1 (f2 a) -> f1 (f2 b)
- mtraverse :: (Monad m, Traversable m, Applicative f) => (a -> f (m b)) -> m a -> f (m b)
- foldMapM :: (Foldable f, Monad m, Monoid b) => (a -> m b) -> f a -> m b
- reoption :: (Foldable f, Alternative g) => f a -> g a
- enumeration :: (Bounded a, Enum a) => [a]
- tabulateArray :: (Bounded i, Enum i, Ix i) => (i -> a) -> Array i a
- (?) :: Alternative f => Bool -> a -> f a
- ensure :: Alternative f => (a -> Bool) -> a -> f a
- asksM :: MonadReader r m => (r -> m a) -> m a
- data Doc ann
- newtype ShowPretty a = ShowPretty {
- unShowPretty :: a
- class Pretty a where
- pretty :: a -> Doc ann
- prettyList :: [a] -> Doc ann
- class PrettyBy config a where
- prettyBy :: config -> a -> Doc ann
- prettyListBy :: config -> [a] -> Doc ann
- type family HasPrettyDefaults config :: Bool
- type PrettyDefaultBy config = DispatchPrettyDefaultBy (NonStuckHasPrettyDefaults config) config
- newtype PrettyAny a = PrettyAny {
- unPrettyAny :: a
- class Render str where
- display :: forall str a. (Pretty a, Render str) => a -> str
- printPretty :: Pretty a => a -> IO ()
- showText :: Show a => a -> Text
Reexports from base
(&&&) :: Arrow a => a b c -> a b c' -> a b (c, c') infixr 3 Source #
Fanout: send the input to both argument arrows and combine their output.
The default definition may be overridden with a more efficient version if desired.
toList :: Foldable t => t a -> [a] Source #
List of elements of a structure, from left to right.
Since: base-4.8.0.0
bool :: a -> a -> Bool -> a Source #
Case analysis for the Bool
type.
evaluates to bool
x y px
when p
is False
, and evaluates to y
when p
is True
.
This is equivalent to if p then y else x
; that is, one can
think of it as an if-then-else construct with its arguments
reordered.
Examples
Basic usage:
>>>
bool "foo" "bar" True
"bar">>>
bool "foo" "bar" False
"foo"
Confirm that
and bool
x y pif p then y else x
are
equivalent:
>>>
let p = True; x = "bar"; y = "foo"
>>>
bool x y p == if p then y else x
True>>>
let p = False
>>>
bool x y p == if p then y else x
True
Since: base-4.7.0.0
on :: (b -> b -> c) -> (a -> b) -> a -> a -> c infixl 0 Source #
fromMaybe :: a -> Maybe a -> a Source #
The fromMaybe
function takes a default value and and Maybe
value. If the Maybe
is Nothing
, it returns the default values;
otherwise, it returns the value contained in the Maybe
.
Examples
Basic usage:
>>>
fromMaybe "" (Just "Hello, World!")
"Hello, World!"
>>>
fromMaybe "" Nothing
""
Read an integer from a string using readMaybe
. If we fail to
parse an integer, we want to return 0
by default:
>>>
import Text.Read ( readMaybe )
>>>
fromMaybe 0 (readMaybe "5")
5>>>
fromMaybe 0 (readMaybe "")
0
guard :: Alternative f => Bool -> f () Source #
Conditional failure of Alternative
computations. Defined by
guard True =pure
() guard False =empty
Examples
Common uses of guard
include conditionally signaling an error in
an error monad and conditionally rejecting the current choice in an
Alternative
-based parser.
As an example of signaling an error in the error monad Maybe
,
consider a safe division function safeDiv x y
that returns
Nothing
when the denominator y
is zero and
otherwise. For example:Just
(x `div`
y)
>>> safeDiv 4 0 Nothing >>> safeDiv 4 2 Just 2
A definition of safeDiv
using guards, but not guard
:
safeDiv :: Int -> Int -> Maybe Int safeDiv x y | y /= 0 = Just (x `div` y) | otherwise = Nothing
A definition of safeDiv
using guard
and Monad
do
-notation:
safeDiv :: Int -> Int -> Maybe Int safeDiv x y = do guard (y /= 0) return (x `div` y)
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b Source #
Left-associative fold of a structure but with strict application of the operator.
This ensures that each step of the fold is forced to weak head normal
form before being applied, avoiding the collection of thunks that would
otherwise occur. This is often what you want to strictly reduce a finite
list to a single, monolithic result (e.g. length
).
For a general Foldable
structure this should be semantically identical
to,
foldl' f z =foldl'
f z .toList
Since: base-4.6.0.0
fold :: (Foldable t, Monoid m) => t m -> m Source #
Combine the elements of a structure using a monoid.
for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b) Source #
throw :: forall (r :: RuntimeRep) (a :: TYPE r) e. Exception e => e -> a Source #
Throw an exception. Exceptions may be thrown from purely
functional code, but may only be caught within the IO
monad.
join :: Monad m => m (m a) -> m a Source #
The join
function is the conventional monad join operator. It
is used to remove one level of monadic structure, projecting its
bound argument into the outer level.
'
' can be understood as the join
bssdo
expression
do bs <- bss bs
Examples
A common use of join
is to run an IO
computation returned from
an STM
transaction, since STM
transactions
can't perform IO
directly. Recall that
atomically
:: STM a -> IO a
is used to run STM
transactions atomically. So, by
specializing the types of atomically
and join
to
atomically
:: STM (IO b) -> IO (IO b)join
:: IO (IO b) -> IO b
we can compose them as
join
.atomically
:: STM (IO b) -> IO b
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 Source #
Left-to-right composition of Kleisli arrows.
'(bs
' can be understood as the >=>
cs) ado
expression
do b <- bs a cs b
($>) :: Functor f => f a -> b -> f b infixl 4 Source #
Flipped version of <$
.
Using ApplicativeDo
: 'as
' can be understood as the
$>
bdo
expression
do as pure b
with an inferred Functor
constraint.
Examples
Replace the contents of a
with a constant
Maybe
Int
String
:
>>>
Nothing $> "foo"
Nothing>>>
Just 90210 $> "foo"
Just "foo"
Replace the contents of an
with a constant Either
Int
Int
String
, resulting in an
:Either
Int
String
>>>
Left 8675309 $> "foo"
Left 8675309>>>
Right 8675309 $> "foo"
Right "foo"
Replace each element of a list with a constant String
:
>>>
[1,2,3] $> "foo"
["foo","foo","foo"]
Replace the second element of a pair with a constant String
:
>>>
(1,2) $> "foo"
(1,"foo")
Since: base-4.7.0.0
fromRight :: b -> Either a b -> b Source #
Return the contents of a Right
-value or a default value otherwise.
Examples
Basic usage:
>>>
fromRight 1 (Right 3)
3>>>
fromRight 1 (Left "foo")
1
Since: base-4.10.0.0
isRight :: Either a b -> Bool Source #
Return True
if the given value is a Right
-value, False
otherwise.
Examples
Basic usage:
>>>
isRight (Left "foo")
False>>>
isRight (Right 3)
True
Assuming a Left
value signifies some sort of error, we can use
isRight
to write a very simple reporting function that only
outputs "SUCCESS" when a computation has succeeded.
This example shows how isRight
might be used to avoid pattern
matching when one does not care about the value contained in the
constructor:
>>>
import Control.Monad ( when )
>>>
let report e = when (isRight e) $ putStrLn "SUCCESS"
>>>
report (Left "parse error")
>>>
report (Right 1)
SUCCESS
Since: base-4.7.0.0
void :: Functor f => f a -> f () Source #
discards or ignores the result of evaluation, such
as the return value of an void
valueIO
action.
Using ApplicativeDo
: '
' can be understood as the
void
asdo
expression
do as pure ()
with an inferred Functor
constraint.
Examples
Replace the contents of a
with unit:Maybe
Int
>>>
void Nothing
Nothing>>>
void (Just 3)
Just ()
Replace the contents of an
with unit, resulting in an Either
Int
Int
:Either
Int
()
>>>
void (Left 8675309)
Left 8675309>>>
void (Right 8675309)
Right ()
Replace every element of a list with unit:
>>>
void [1,2,3]
[(),(),()]
Replace the second element of a pair with unit:
>>>
void (1,2)
(1,())
Discard the result of an IO
action:
>>>
mapM print [1,2]
1 2 [(),()]>>>
void $ mapM print [1,2]
1 2
through :: Functor f => (a -> f b) -> a -> f a Source #
Makes an effectful function ignore its result value and return its input value.
coerce :: forall (k :: RuntimeRep) (a :: TYPE k) (b :: TYPE k). Coercible a b => a -> b Source #
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 runtime-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
.
Representable types of kind *
.
This class is derivable in GHC with the DeriveGeneric
flag on.
A Generic
instance must satisfy the following laws:
from
.to
≡id
to
.from
≡id
Instances
A class of types that can be fully evaluated.
Since: deepseq-1.1.0.0
Instances
Type representing arbitrary-precision non-negative integers.
>>>
2^100 :: Natural
1267650600228229401496703205376
Operations whose result would be negative
,throw
(Underflow
:: ArithException
)
>>>
-1 :: Natural
*** Exception: arithmetic underflow
Since: base-4.8.0.0
Instances
Enum Natural | Since: base-4.8.0.0 |
Defined in GHC.Enum succ :: Natural -> Natural Source # pred :: Natural -> Natural Source # toEnum :: Int -> Natural Source # fromEnum :: Natural -> Int Source # enumFrom :: Natural -> [Natural] Source # enumFromThen :: Natural -> Natural -> [Natural] Source # enumFromTo :: Natural -> Natural -> [Natural] Source # enumFromThenTo :: Natural -> Natural -> Natural -> [Natural] Source # | |
Eq Natural | Since: base-4.8.0.0 |
Integral Natural | Since: base-4.8.0.0 |
Defined in GHC.Real quot :: Natural -> Natural -> Natural Source # rem :: Natural -> Natural -> Natural Source # div :: Natural -> Natural -> Natural Source # mod :: Natural -> Natural -> Natural Source # quotRem :: Natural -> Natural -> (Natural, Natural) Source # | |
Data Natural | Since: base-4.8.0.0 |
Defined in Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Natural -> c Natural Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Natural Source # toConstr :: Natural -> Constr Source # dataTypeOf :: Natural -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Natural) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Natural) Source # gmapT :: (forall b. Data b => b -> b) -> Natural -> Natural Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Natural -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Natural -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Natural -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Natural -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Natural -> m Natural Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Natural -> m Natural Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Natural -> m Natural Source # | |
Num Natural | Note that Since: base-4.8.0.0 |
Defined in GHC.Num | |
Ord Natural | Since: base-4.8.0.0 |
Read Natural | Since: base-4.8.0.0 |
Real Natural | Since: base-4.8.0.0 |
Show Natural | Since: base-4.8.0.0 |
Ix Natural | Since: base-4.8.0.0 |
PrintfArg Natural | Since: base-4.8.0.0 |
Defined in Text.Printf formatArg :: Natural -> FieldFormatter Source # parseFormat :: Natural -> ModifierParser Source # | |
Bits Natural | Since: base-4.8.0 |
Defined in Data.Bits (.&.) :: Natural -> Natural -> Natural Source # (.|.) :: Natural -> Natural -> Natural Source # xor :: Natural -> Natural -> Natural Source # complement :: Natural -> Natural Source # shift :: Natural -> Int -> Natural Source # rotate :: Natural -> Int -> Natural Source # bit :: Int -> Natural Source # setBit :: Natural -> Int -> Natural Source # clearBit :: Natural -> Int -> Natural Source # complementBit :: Natural -> Int -> Natural Source # testBit :: Natural -> Int -> Bool Source # bitSizeMaybe :: Natural -> Maybe Int Source # bitSize :: Natural -> Int Source # isSigned :: Natural -> Bool Source # shiftL :: Natural -> Int -> Natural Source # unsafeShiftL :: Natural -> Int -> Natural Source # shiftR :: Natural -> Int -> Natural Source # unsafeShiftR :: Natural -> Int -> Natural Source # rotateL :: Natural -> Int -> Natural Source # | |
NFData Natural | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
FromJSON Natural | |
Defined in Data.Aeson.Types.FromJSON parseJSON :: Value -> Parser Natural parseJSONList :: Value -> Parser [Natural] | |
FromJSONKey Natural | |
Defined in Data.Aeson.Types.FromJSON fromJSONKey :: FromJSONKeyFunction Natural fromJSONKeyList :: FromJSONKeyFunction [Natural] | |
ToJSON Natural | |
Defined in Data.Aeson.Types.ToJSON toEncoding :: Natural -> Encoding toJSONList :: [Natural] -> Value toEncodingList :: [Natural] -> Encoding | |
ToJSONKey Natural | |
Defined in Data.Aeson.Types.ToJSON toJSONKey :: ToJSONKeyFunction Natural toJSONKeyList :: ToJSONKeyFunction [Natural] | |
Hashable Natural | |
Defined in Data.Hashable.Class | |
UniformRange Natural | |
Defined in System.Random.Internal | |
NoThunks Natural | |
Subtractive Natural | |
FromField Natural | |
Defined in Data.Csv.Conversion parseField :: Field -> Parser Natural | |
ToField Natural | |
Defined in Data.Csv.Conversion | |
Pretty Natural | |
Defined in Prettyprinter.Internal | |
Serialise Natural | |
Defined in Codec.Serialise.Class encodeList :: [Natural] -> Encoding decodeList :: Decoder s [Natural] | |
Pretty Natural | |
Defined in Text.PrettyPrint.Annotated.WL prettyList :: [Natural] -> Doc b | |
Corecursive Natural | |
Defined in Data.Functor.Foldable embed :: Base Natural Natural -> Natural ana :: (a -> Base Natural a) -> a -> Natural apo :: (a -> Base Natural (Either Natural a)) -> a -> Natural postpro :: Recursive Natural => (forall b. Base Natural b -> Base Natural b) -> (a -> Base Natural a) -> a -> Natural gpostpro :: (Recursive Natural, Monad m) => (forall b. m (Base Natural b) -> Base Natural (m b)) -> (forall c. Base Natural c -> Base Natural c) -> (a -> Base Natural (m a)) -> a -> Natural | |
Recursive Natural | |
Defined in Data.Functor.Foldable project :: Natural -> Base Natural Natural cata :: (Base Natural a -> a) -> Natural -> a para :: (Base Natural (Natural, a) -> a) -> Natural -> a gpara :: (Corecursive Natural, Comonad w) => (forall b. Base Natural (w b) -> w (Base Natural b)) -> (Base Natural (EnvT Natural w a) -> a) -> Natural -> a prepro :: Corecursive Natural => (forall b. Base Natural b -> Base Natural b) -> (Base Natural a -> a) -> Natural -> a gprepro :: (Corecursive Natural, Comonad w) => (forall b. Base Natural (w b) -> w (Base Natural b)) -> (forall c. Base Natural c -> Base Natural c) -> (Base Natural (w a) -> a) -> Natural -> a | |
Lift Natural | |
PrettyDefaultBy config Natural => PrettyBy config Natural | |
Defined in Text.PrettyBy.Internal | |
DefaultPrettyBy config Natural | |
Defined in Text.PrettyBy.Internal defaultPrettyBy :: config -> Natural -> Doc ann defaultPrettyListBy :: config -> [Natural] -> Doc ann | |
type Difference Natural | |
Defined in Basement.Numerical.Subtractive | |
type IntBaseType Natural | |
Defined in Data.IntCast type IntBaseType Natural = 'BigWordTag | |
type Base Natural | |
Defined in Data.Functor.Foldable |
Non-empty (and non-strict) list type.
Since: base-4.9.0.0
a :| [a] infixr 5 |
Instances
Monad NonEmpty | Since: base-4.9.0.0 |
Functor NonEmpty | Since: base-4.9.0.0 |
MonadFix NonEmpty | Since: base-4.9.0.0 |
Applicative NonEmpty | Since: base-4.9.0.0 |
Foldable NonEmpty | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => NonEmpty m -> m Source # foldMap :: Monoid m => (a -> m) -> NonEmpty a -> m Source # foldMap' :: Monoid m => (a -> m) -> NonEmpty a -> m Source # foldr :: (a -> b -> b) -> b -> NonEmpty a -> b Source # foldr' :: (a -> b -> b) -> b -> NonEmpty a -> b Source # foldl :: (b -> a -> b) -> b -> NonEmpty a -> b Source # foldl' :: (b -> a -> b) -> b -> NonEmpty a -> b Source # foldr1 :: (a -> a -> a) -> NonEmpty a -> a Source # foldl1 :: (a -> a -> a) -> NonEmpty a -> a Source # toList :: NonEmpty a -> [a] Source # null :: NonEmpty a -> Bool Source # length :: NonEmpty a -> Int Source # elem :: Eq a => a -> NonEmpty a -> Bool Source # maximum :: Ord a => NonEmpty a -> a Source # minimum :: Ord a => NonEmpty a -> a Source # | |
Traversable NonEmpty | Since: base-4.9.0.0 |
Defined in Data.Traversable | |
Eq1 NonEmpty | Since: base-4.10.0.0 |
Ord1 NonEmpty | Since: base-4.10.0.0 |
Defined in Data.Functor.Classes | |
Read1 NonEmpty | Since: base-4.10.0.0 |
Defined in Data.Functor.Classes liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (NonEmpty a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [NonEmpty a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (NonEmpty a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [NonEmpty a] Source # | |
Show1 NonEmpty | Since: base-4.10.0.0 |
NFData1 NonEmpty | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
FromJSON1 NonEmpty | |
Defined in Data.Aeson.Types.FromJSON liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (NonEmpty a) liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [NonEmpty a] | |
ToJSON1 NonEmpty | |
Defined in Data.Aeson.Types.ToJSON liftToJSON :: (a -> Value) -> ([a] -> Value) -> NonEmpty a -> Value liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [NonEmpty a] -> Value liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> NonEmpty a -> Encoding liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [NonEmpty a] -> Encoding | |
Hashable1 NonEmpty | |
Defined in Data.Hashable.Class | |
Comonad NonEmpty | |
Traversable1 NonEmpty | |
Apply NonEmpty | |
Bind NonEmpty | |
ComonadApply NonEmpty | |
Foldable1 NonEmpty | |
Defined in Data.Semigroup.Foldable.Class | |
Alt NonEmpty | |
Defined in Data.Functor.Alt | |
FoldableWithIndex Int NonEmpty | |
Defined in WithIndex | |
FunctorWithIndex Int NonEmpty | |
TraversableWithIndex Int NonEmpty | |
Lift a => Lift (NonEmpty a :: Type) | Since: template-haskell-2.15.0.0 |
PrettyDefaultBy config (NonEmpty a) => PrettyBy config (NonEmpty a) | |
Defined in Text.PrettyBy.Internal | |
PrettyBy config a => DefaultPrettyBy config (NonEmpty a) | |
Defined in Text.PrettyBy.Internal defaultPrettyBy :: config -> NonEmpty a -> Doc ann defaultPrettyListBy :: config -> [NonEmpty a] -> Doc ann | |
IsList (NonEmpty a) | Since: base-4.9.0.0 |
Eq a => Eq (NonEmpty a) | Since: base-4.9.0.0 |
Data a => Data (NonEmpty a) | Since: base-4.9.0.0 |
Defined in Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NonEmpty a -> c (NonEmpty a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (NonEmpty a) Source # toConstr :: NonEmpty a -> Constr Source # dataTypeOf :: NonEmpty a -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (NonEmpty a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NonEmpty a)) Source # gmapT :: (forall b. Data b => b -> b) -> NonEmpty a -> NonEmpty a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NonEmpty a -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NonEmpty a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> NonEmpty a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> NonEmpty a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> NonEmpty a -> m (NonEmpty a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NonEmpty a -> m (NonEmpty a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NonEmpty a -> m (NonEmpty a) Source # | |
Ord a => Ord (NonEmpty a) | Since: base-4.9.0.0 |
Defined in GHC.Base compare :: NonEmpty a -> NonEmpty a -> Ordering Source # (<) :: NonEmpty a -> NonEmpty a -> Bool Source # (<=) :: NonEmpty a -> NonEmpty a -> Bool Source # (>) :: NonEmpty a -> NonEmpty a -> Bool Source # (>=) :: NonEmpty a -> NonEmpty a -> Bool Source # | |
Read a => Read (NonEmpty a) | Since: base-4.11.0.0 |
Show a => Show (NonEmpty a) | Since: base-4.11.0.0 |
Generic (NonEmpty a) | Since: base-4.6.0.0 |
Semigroup (NonEmpty a) | Since: base-4.9.0.0 |
NFData a => NFData (NonEmpty a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
FromJSON a => FromJSON (NonEmpty a) | |
Defined in Data.Aeson.Types.FromJSON parseJSON :: Value -> Parser (NonEmpty a) parseJSONList :: Value -> Parser [NonEmpty a] | |
ToJSON a => ToJSON (NonEmpty a) | |
Defined in Data.Aeson.Types.ToJSON toEncoding :: NonEmpty a -> Encoding toJSONList :: [NonEmpty a] -> Value toEncodingList :: [NonEmpty a] -> Encoding | |
Hashable a => Hashable (NonEmpty a) | |
Defined in Data.Hashable.Class | |
NoThunks a => NoThunks (NonEmpty a) | |
Pretty a => Pretty (NonEmpty a) | |
Defined in Prettyprinter.Internal | |
Serialise a => Serialise (NonEmpty a) | |
Defined in Codec.Serialise.Class encode :: NonEmpty a -> Encoding decode :: Decoder s (NonEmpty a) encodeList :: [NonEmpty a] -> Encoding decodeList :: Decoder s [NonEmpty a] | |
Ixed (NonEmpty a) | |
Defined in Control.Lens.At | |
Reversing (NonEmpty a) | |
Defined in Control.Lens.Internal.Iso | |
Wrapped (NonEmpty a) | |
Defined in Control.Lens.Wrapped type Unwrapped (NonEmpty a) | |
Ixed (NonEmpty a) | |
Defined in Lens.Micro.Internal | |
Pretty a => Pretty (NonEmpty a) | |
Defined in Text.PrettyPrint.Annotated.WL prettyList :: [NonEmpty a] -> Doc b | |
Corecursive (NonEmpty a) | |
Defined in Data.Functor.Foldable embed :: Base (NonEmpty a) (NonEmpty a) -> NonEmpty a ana :: (a0 -> Base (NonEmpty a) a0) -> a0 -> NonEmpty a apo :: (a0 -> Base (NonEmpty a) (Either (NonEmpty a) a0)) -> a0 -> NonEmpty a postpro :: Recursive (NonEmpty a) => (forall b. Base (NonEmpty a) b -> Base (NonEmpty a) b) -> (a0 -> Base (NonEmpty a) a0) -> a0 -> NonEmpty a gpostpro :: (Recursive (NonEmpty a), Monad m) => (forall b. m (Base (NonEmpty a) b) -> Base (NonEmpty a) (m b)) -> (forall c. Base (NonEmpty a) c -> Base (NonEmpty a) c) -> (a0 -> Base (NonEmpty a) (m a0)) -> a0 -> NonEmpty a | |
Recursive (NonEmpty a) | |
Defined in Data.Functor.Foldable project :: NonEmpty a -> Base (NonEmpty a) (NonEmpty a) cata :: (Base (NonEmpty a) a0 -> a0) -> NonEmpty a -> a0 para :: (Base (NonEmpty a) (NonEmpty a, a0) -> a0) -> NonEmpty a -> a0 gpara :: (Corecursive (NonEmpty a), Comonad w) => (forall b. Base (NonEmpty a) (w b) -> w (Base (NonEmpty a) b)) -> (Base (NonEmpty a) (EnvT (NonEmpty a) w a0) -> a0) -> NonEmpty a -> a0 prepro :: Corecursive (NonEmpty a) => (forall b. Base (NonEmpty a) b -> Base (NonEmpty a) b) -> (Base (NonEmpty a) a0 -> a0) -> NonEmpty a -> a0 gprepro :: (Corecursive (NonEmpty a), Comonad w) => (forall b. Base (NonEmpty a) (w b) -> w (Base (NonEmpty a) b)) -> (forall c. Base (NonEmpty a) c -> Base (NonEmpty a) c) -> (Base (NonEmpty a) (w a0) -> a0) -> NonEmpty a -> a0 | |
MonoFoldable (NonEmpty a) | |
Defined in Data.MonoTraversable ofoldMap :: Monoid m => (Element (NonEmpty a) -> m) -> NonEmpty a -> m ofoldr :: (Element (NonEmpty a) -> b -> b) -> b -> NonEmpty a -> b ofoldl' :: (a0 -> Element (NonEmpty a) -> a0) -> a0 -> NonEmpty a -> a0 otoList :: NonEmpty a -> [Element (NonEmpty a)] oall :: (Element (NonEmpty a) -> Bool) -> NonEmpty a -> Bool oany :: (Element (NonEmpty a) -> Bool) -> NonEmpty a -> Bool olength64 :: NonEmpty a -> Int64 ocompareLength :: Integral i => NonEmpty a -> i -> Ordering otraverse_ :: Applicative f => (Element (NonEmpty a) -> f b) -> NonEmpty a -> f () ofor_ :: Applicative f => NonEmpty a -> (Element (NonEmpty a) -> f b) -> f () omapM_ :: Applicative m => (Element (NonEmpty a) -> m ()) -> NonEmpty a -> m () oforM_ :: Applicative m => NonEmpty a -> (Element (NonEmpty a) -> m ()) -> m () ofoldlM :: Monad m => (a0 -> Element (NonEmpty a) -> m a0) -> a0 -> NonEmpty a -> m a0 ofoldMap1Ex :: Semigroup m => (Element (NonEmpty a) -> m) -> NonEmpty a -> m ofoldr1Ex :: (Element (NonEmpty a) -> Element (NonEmpty a) -> Element (NonEmpty a)) -> NonEmpty a -> Element (NonEmpty a) ofoldl1Ex' :: (Element (NonEmpty a) -> Element (NonEmpty a) -> Element (NonEmpty a)) -> NonEmpty a -> Element (NonEmpty a) headEx :: NonEmpty a -> Element (NonEmpty a) lastEx :: NonEmpty a -> Element (NonEmpty a) unsafeHead :: NonEmpty a -> Element (NonEmpty a) unsafeLast :: NonEmpty a -> Element (NonEmpty a) maximumByEx :: (Element (NonEmpty a) -> Element (NonEmpty a) -> Ordering) -> NonEmpty a -> Element (NonEmpty a) minimumByEx :: (Element (NonEmpty a) -> Element (NonEmpty a) -> Ordering) -> NonEmpty a -> Element (NonEmpty a) | |
MonoTraversable (NonEmpty a) | |
Defined in Data.MonoTraversable | |
MonoFunctor (NonEmpty a) | |
GrowingAppend (NonEmpty a) | |
Defined in Data.MonoTraversable | |
MonoPointed (NonEmpty a) | |
Defined in Data.MonoTraversable | |
SemiSequence (NonEmpty a) | |
Defined in Data.Sequences type Index (NonEmpty a) intersperse :: Element (NonEmpty a) -> NonEmpty a -> NonEmpty a reverse :: NonEmpty a -> NonEmpty a find :: (Element (NonEmpty a) -> Bool) -> NonEmpty a -> Maybe (Element (NonEmpty a)) sortBy :: (Element (NonEmpty a) -> Element (NonEmpty a) -> Ordering) -> NonEmpty a -> NonEmpty a | |
Generic1 NonEmpty | Since: base-4.6.0.0 |
t ~ NonEmpty b => Rewrapped (NonEmpty a) t | |
Defined in Control.Lens.Wrapped | |
Reference n t => Reference (NonEmpty n) t Source # | |
Defined in PlutusCore.Check.Scoping referenceVia :: (forall name. ToScopedName name => name -> NameAnn) -> NonEmpty n -> t NameAnn -> t NameAnn Source # | |
Each (NonEmpty a) (NonEmpty b) a b | |
Defined in Control.Lens.Each | |
Each (NonEmpty a) (NonEmpty b) a b | |
Defined in Lens.Micro.Internal | |
type Rep (NonEmpty a) | |
Defined in GHC.Generics type Rep (NonEmpty a) = D1 ('MetaData "NonEmpty" "GHC.Base" "base" 'False) (C1 ('MetaCons ":|" ('InfixI 'LeftAssociative 9) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a]))) | |
type Item (NonEmpty a) | |
type Index (NonEmpty a) | |
Defined in Control.Lens.At | |
type IxValue (NonEmpty a) | |
Defined in Control.Lens.At type IxValue (NonEmpty a) = a | |
type Unwrapped (NonEmpty a) | |
Defined in Control.Lens.Wrapped type Unwrapped (NonEmpty a) = (a, [a]) | |
type Index (NonEmpty a) | |
Defined in Lens.Micro.Internal | |
type IxValue (NonEmpty a) | |
Defined in Lens.Micro.Internal type IxValue (NonEmpty a) = a | |
type Base (NonEmpty a) | |
Defined in Data.Functor.Foldable type Base (NonEmpty a) = NonEmptyF a | |
type Element (NonEmpty a) | |
Defined in Data.MonoTraversable type Element (NonEmpty a) = a | |
type Index (NonEmpty a) | |
Defined in Data.Sequences | |
type Rep1 NonEmpty | |
Defined in GHC.Generics type Rep1 NonEmpty = D1 ('MetaData "NonEmpty" "GHC.Base" "base" 'False) (C1 ('MetaCons ":|" ('InfixI 'LeftAssociative 9) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 []))) |
8-bit unsigned integer type
Instances
Bounded Word8 | Since: base-2.1 |
Enum Word8 | Since: base-2.1 |
Defined in GHC.Word succ :: Word8 -> Word8 Source # pred :: Word8 -> Word8 Source # toEnum :: Int -> Word8 Source # fromEnum :: Word8 -> Int Source # enumFrom :: Word8 -> [Word8] Source # enumFromThen :: Word8 -> Word8 -> [Word8] Source # enumFromTo :: Word8 -> Word8 -> [Word8] Source # enumFromThenTo :: Word8 -> Word8 -> Word8 -> [Word8] Source # | |
Eq Word8 | Since: base-2.1 |
Integral Word8 | Since: base-2.1 |
Defined in GHC.Word | |
Data Word8 | Since: base-4.0.0.0 |
Defined in Data.Data gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word8 -> c Word8 Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word8 Source # toConstr :: Word8 -> Constr Source # dataTypeOf :: Word8 -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word8) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word8) Source # gmapT :: (forall b. Data b => b -> b) -> Word8 -> Word8 Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word8 -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word8 -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Word8 -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word8 -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 Source # | |
Num Word8 | Since: base-2.1 |
Ord Word8 | Since: base-2.1 |
Read Word8 | Since: base-2.1 |
Real Word8 | Since: base-2.1 |
Show Word8 | Since: base-2.1 |
Ix Word8 | Since: base-2.1 |
Defined in GHC.Word | |
PrintfArg Word8 | Since: base-2.1 |
Defined in Text.Printf formatArg :: Word8 -> FieldFormatter Source # parseFormat :: Word8 -> ModifierParser Source # | |
Storable Word8 | Since: base-2.1 |
Defined in Foreign.Storable sizeOf :: Word8 -> Int Source # alignment :: Word8 -> Int Source # peekElemOff :: Ptr Word8 -> Int -> IO Word8 Source # pokeElemOff :: Ptr Word8 -> Int -> Word8 -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Word8 Source # pokeByteOff :: Ptr b -> Int -> Word8 -> IO () Source # | |
Bits Word8 | Since: base-2.1 |
Defined in GHC.Word (.&.) :: Word8 -> Word8 -> Word8 Source # (.|.) :: Word8 -> Word8 -> Word8 Source # xor :: Word8 -> Word8 -> Word8 Source # complement :: Word8 -> Word8 Source # shift :: Word8 -> Int -> Word8 Source # rotate :: Word8 -> Int -> Word8 Source # setBit :: Word8 -> Int -> Word8 Source # clearBit :: Word8 -> Int -> Word8 Source # complementBit :: Word8 -> Int -> Word8 Source # testBit :: Word8 -> Int -> Bool Source # bitSizeMaybe :: Word8 -> Maybe Int Source # bitSize :: Word8 -> Int Source # isSigned :: Word8 -> Bool Source # shiftL :: Word8 -> Int -> Word8 Source # unsafeShiftL :: Word8 -> Int -> Word8 Source # shiftR :: Word8 -> Int -> Word8 Source # unsafeShiftR :: Word8 -> Int -> Word8 Source # rotateL :: Word8 -> Int -> Word8 Source # | |
FiniteBits Word8 | Since: base-4.6.0.0 |
NFData Word8 | |
Defined in Control.DeepSeq | |
FromJSON Word8 | |
Defined in Data.Aeson.Types.FromJSON parseJSON :: Value -> Parser Word8 parseJSONList :: Value -> Parser [Word8] | |
FromJSONKey Word8 | |
Defined in Data.Aeson.Types.FromJSON fromJSONKey :: FromJSONKeyFunction Word8 fromJSONKeyList :: FromJSONKeyFunction [Word8] | |
ToJSON Word8 | |
Defined in Data.Aeson.Types.ToJSON | |
ToJSONKey Word8 | |
Defined in Data.Aeson.Types.ToJSON toJSONKey :: ToJSONKeyFunction Word8 toJSONKeyList :: ToJSONKeyFunction [Word8] | |
Hashable Word8 | |
Defined in Data.Hashable.Class | |
Unbox Word8 | |
Defined in Data.Vector.Unboxed.Base | |
Prim Word8 | |
Defined in Data.Primitive.Types alignment# :: Word8 -> Int# indexByteArray# :: ByteArray# -> Int# -> Word8 readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word8 #) writeByteArray# :: MutableByteArray# s -> Int# -> Word8 -> State# s -> State# s setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Word8 -> State# s -> State# s indexOffAddr# :: Addr# -> Int# -> Word8 readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word8 #) writeOffAddr# :: Addr# -> Int# -> Word8 -> State# s -> State# s setOffAddr# :: Addr# -> Int# -> Int# -> Word8 -> State# s -> State# s | |
Uniform Word8 | |
Defined in System.Random.Internal | |
UniformRange Word8 | |
Defined in System.Random.Internal | |
ByteSource Word8 | |
Defined in Data.UUID.Types.Internal.Builder | |
NoThunks Word8 | |
PrimType Word8 | |
Defined in Basement.PrimType primSizeInBytes :: Proxy Word8 -> CountOf Word8 primShiftToBytes :: Proxy Word8 -> Int primBaUIndex :: ByteArray# -> Offset Word8 -> Word8 primMbaURead :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset Word8 -> prim Word8 primMbaUWrite :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset Word8 -> Word8 -> prim () primAddrIndex :: Addr# -> Offset Word8 -> Word8 primAddrRead :: PrimMonad prim => Addr# -> Offset Word8 -> prim Word8 primAddrWrite :: PrimMonad prim => Addr# -> Offset Word8 -> Word8 -> prim () | |
BitOps Word8 | |
FiniteBitsOps Word8 | |
Subtractive Word8 | |
PrimMemoryComparable Word8 | |
Defined in Basement.PrimType | |
FromField Word8 | |
Defined in Data.Csv.Conversion parseField :: Field -> Parser Word8 | |
ToField Word8 | |
Defined in Data.Csv.Conversion | |
Pretty Word8 | |
Defined in Prettyprinter.Internal | |
Serialise Word8 | |
Defined in Codec.Serialise.Class encodeList :: [Word8] -> Encoding decodeList :: Decoder s [Word8] | |
Pretty Word8 | |
Defined in Text.PrettyPrint.Annotated.WL prettyList :: [Word8] -> Doc b | |
Default Word8 | |
Defined in Data.Default.Class | |
Lift Word8 | |
IArray UArray Word8 | |
Defined in Data.Array.Base bounds :: Ix i => UArray i Word8 -> (i, i) Source # numElements :: Ix i => UArray i Word8 -> Int unsafeArray :: Ix i => (i, i) -> [(Int, Word8)] -> UArray i Word8 unsafeAt :: Ix i => UArray i Word8 -> Int -> Word8 unsafeReplace :: Ix i => UArray i Word8 -> [(Int, Word8)] -> UArray i Word8 unsafeAccum :: Ix i => (Word8 -> e' -> Word8) -> UArray i Word8 -> [(Int, e')] -> UArray i Word8 unsafeAccumArray :: Ix i => (Word8 -> e' -> Word8) -> Word8 -> (i, i) -> [(Int, e')] -> UArray i Word8 | |
Vector Vector Word8 | |
Defined in Data.Vector.Unboxed.Base basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) Word8 -> m (Vector Word8) basicUnsafeThaw :: PrimMonad m => Vector Word8 -> m (Mutable Vector (PrimState m) Word8) basicLength :: Vector Word8 -> Int basicUnsafeSlice :: Int -> Int -> Vector Word8 -> Vector Word8 basicUnsafeIndexM :: Monad m => Vector Word8 -> Int -> m Word8 basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) Word8 -> Vector Word8 -> m () | |
MVector MVector Word8 | |
Defined in Data.Vector.Unboxed.Base basicLength :: MVector s Word8 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Word8 -> MVector s Word8 basicOverlaps :: MVector s Word8 -> MVector s Word8 -> Bool basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) Word8) basicInitialize :: PrimMonad m => MVector (PrimState m) Word8 -> m () basicUnsafeReplicate :: PrimMonad m => Int -> Word8 -> m (MVector (PrimState m) Word8) basicUnsafeRead :: PrimMonad m => MVector (PrimState m) Word8 -> Int -> m Word8 basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) Word8 -> Int -> Word8 -> m () basicClear :: PrimMonad m => MVector (PrimState m) Word8 -> m () basicSet :: PrimMonad m => MVector (PrimState m) Word8 -> Word8 -> m () basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) Word8 -> MVector (PrimState m) Word8 -> m () basicUnsafeMove :: PrimMonad m => MVector (PrimState m) Word8 -> MVector (PrimState m) Word8 -> m () basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) Word8 -> Int -> m (MVector (PrimState m) Word8) | |
PrettyDefaultBy config Word8 => PrettyBy config Word8 | |
Defined in Text.PrettyBy.Internal | |
DefaultPrettyBy config Word8 | |
Defined in Text.PrettyBy.Internal defaultPrettyBy :: config -> Word8 -> Doc ann defaultPrettyListBy :: config -> [Word8] -> Doc ann | |
Cons ByteString ByteString Word8 Word8 | |
Defined in Control.Lens.Cons | |
Cons ByteString ByteString Word8 Word8 | |
Defined in Control.Lens.Cons | |
Snoc ByteString ByteString Word8 Word8 | |
Defined in Control.Lens.Cons | |
Snoc ByteString ByteString Word8 Word8 | |
Defined in Control.Lens.Cons | |
MArray (STUArray s) Word8 (ST s) | |
Defined in Data.Array.Base getBounds :: Ix i => STUArray s i Word8 -> ST s (i, i) Source # getNumElements :: Ix i => STUArray s i Word8 -> ST s Int newArray :: Ix i => (i, i) -> Word8 -> ST s (STUArray s i Word8) Source # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word8) Source # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word8) unsafeRead :: Ix i => STUArray s i Word8 -> Int -> ST s Word8 unsafeWrite :: Ix i => STUArray s i Word8 -> Int -> Word8 -> ST s () | |
newtype Vector Word8 | |
Defined in Data.Vector.Unboxed.Base | |
type Difference Word8 | |
Defined in Basement.Numerical.Subtractive | |
type NatNumMaxBound Word8 | |
Defined in Basement.Nat type NatNumMaxBound Word8 = 255 | |
type PrimSize Word8 | |
Defined in Basement.PrimType type PrimSize Word8 = 1 | |
type IntBaseType Word8 | |
Defined in Data.IntCast type IntBaseType Word8 = 'FixedWordTag 8 | |
newtype MVector s Word8 | |
Defined in Data.Vector.Unboxed.Base | |
type ByteSink Word8 g | |
Defined in Data.UUID.Types.Internal.Builder type ByteSink Word8 g = Takes1Byte g |
class Applicative f => Alternative (f :: Type -> Type) where Source #
A monoid on applicative functors.
If defined, some
and many
should be the least solutions
of the equations:
The identity of <|>
(<|>) :: f a -> f a -> f a infixl 3 Source #
An associative binary operation
One or more.
Zero or more.
Instances
class (Typeable e, Show e) => Exception e Source #
Any type that you wish to throw or catch as an exception must be an
instance of the Exception
class. The simplest case is a new exception
type directly below the root:
data MyException = ThisException | ThatException deriving Show instance Exception MyException
The default method definitions in the Exception
class do what we need
in this case. You can now throw and catch ThisException
and
ThatException
as exceptions:
*Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException)) Caught ThisException
In more complicated examples, you may wish to define a whole hierarchy of exceptions:
--------------------------------------------------------------------- -- Make the root exception type for all the exceptions in a compiler data SomeCompilerException = forall e . Exception e => SomeCompilerException e instance Show SomeCompilerException where show (SomeCompilerException e) = show e instance Exception SomeCompilerException compilerExceptionToException :: Exception e => e -> SomeException compilerExceptionToException = toException . SomeCompilerException compilerExceptionFromException :: Exception e => SomeException -> Maybe e compilerExceptionFromException x = do SomeCompilerException a <- fromException x cast a --------------------------------------------------------------------- -- Make a subhierarchy for exceptions in the frontend of the compiler data SomeFrontendException = forall e . Exception e => SomeFrontendException e instance Show SomeFrontendException where show (SomeFrontendException e) = show e instance Exception SomeFrontendException where toException = compilerExceptionToException fromException = compilerExceptionFromException frontendExceptionToException :: Exception e => e -> SomeException frontendExceptionToException = toException . SomeFrontendException frontendExceptionFromException :: Exception e => SomeException -> Maybe e frontendExceptionFromException x = do SomeFrontendException a <- fromException x cast a --------------------------------------------------------------------- -- Make an exception type for a particular frontend compiler exception data MismatchedParentheses = MismatchedParentheses deriving Show instance Exception MismatchedParentheses where toException = frontendExceptionToException fromException = frontendExceptionFromException
We can now catch a MismatchedParentheses
exception as
MismatchedParentheses
, SomeFrontendException
or
SomeCompilerException
, but not other types, e.g. IOException
:
*Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses)) Caught MismatchedParentheses *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException)) Caught MismatchedParentheses *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException)) Caught MismatchedParentheses *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: IOException)) *** Exception: MismatchedParentheses
Instances
class a ~R# b => Coercible (a :: k) (b :: k) Source #
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-4.7.0.0
class Typeable (a :: k) Source #
The class Typeable
allows a concrete representation of a type to
be calculated.
typeRep#
Lens
Debugging
traceShowId :: Show a => a -> a Source #
Like traceShow
but returns the shown value instead of a third value.
>>>
traceShowId (1+2+3, "hello" ++ "world")
(6,"helloworld") (6,"helloworld")
Since: base-4.7.0.0
trace :: String -> a -> a Source #
The trace
function outputs the trace message given as its first argument,
before returning the second argument as its result.
For example, this returns the value of f x
but first outputs the message.
>>>
let x = 123; f = show
>>>
trace ("calling f with x = " ++ show x) (f x)
"calling f with x = 123 123"
The trace
function should only be used for debugging, or for monitoring
execution. The function is not referentially transparent: its type indicates
that it is a pure function but it has the side effect of outputting the
trace message.
Reexports from Control.Composition
Custom functions
(<<*>>) :: (Applicative f1, Applicative f2) => f1 (f2 (a -> b)) -> f1 (f2 a) -> f1 (f2 b) infixl 4 Source #
mtraverse :: (Monad m, Traversable m, Applicative f) => (a -> f (m b)) -> m a -> f (m b) Source #
reoption :: (Foldable f, Alternative g) => f a -> g a Source #
This function generalizes eitherToMaybe
, eitherToList
,
listToMaybe
and other such functions.
enumeration :: (Bounded a, Enum a) => [a] Source #
tabulateArray :: (Bounded i, Enum i, Ix i) => (i -> a) -> Array i a Source #
Basically a Data.Functor.Representable
instance for Array
.
We can't provide an actual instance because of the Distributive
superclass: Array i
is not
Distributive
unless we assume that indices in an array range over the entirety of i
.
(?) :: Alternative f => Bool -> a -> f a infixr 2 Source #
b ? x
is equal to pure x
whenever b
holds and is empty
otherwise.
ensure :: Alternative f => (a -> Bool) -> a -> f a Source #
ensure p x
is equal to pure x
whenever p x
holds and is empty
otherwise.
Pretty-printing
Instances
newtype ShowPretty a Source #
A newtype wrapper around a
whose point is to provide a Show
instance
for anything that has a Pretty
instance.
ShowPretty | |
|
Instances
Eq a => Eq (ShowPretty a) Source # | |
Defined in PlutusPrelude (==) :: ShowPretty a -> ShowPretty a -> Bool Source # (/=) :: ShowPretty a -> ShowPretty a -> Bool Source # | |
Pretty a => Show (ShowPretty a) Source # | |
Defined in PlutusPrelude |
Instances
class PrettyBy config a where #
Nothing
Instances
type family HasPrettyDefaults config :: Bool #
Instances
type HasPrettyDefaults () | |
Defined in Text.PrettyBy.Internal | |
type HasPrettyDefaults PrettyConfigPlc Source # | |
Defined in PlutusCore.Pretty.Plc | |
type HasPrettyDefaults ConstConfig Source # | |
Defined in PlutusCore.Pretty.PrettyConst | |
type HasPrettyDefaults (PrettyConfigReadable _1) Source # | |
Defined in PlutusCore.Pretty.Readable | |
type HasPrettyDefaults (PrettyConfigClassic _1) Source # | |
Defined in PlutusCore.Pretty.Classic |
type PrettyDefaultBy config = DispatchPrettyDefaultBy (NonStuckHasPrettyDefaults config) config #
PrettyAny | |
|
Instances
GHCi
printPretty :: Pretty a => a -> IO () Source #
A command suitable for use in GHCi as an interactive printer.
Text
Orphan instances
PrettyDefaultBy config (Either a b) => PrettyBy config (Either a b) Source # | An instance extending the set of types supporting default pretty-printing with |
(PrettyBy config a, PrettyBy config b) => DefaultPrettyBy config (Either a b) Source # | Default pretty-printing for the spine of |
defaultPrettyBy :: config -> Either a b -> Doc ann defaultPrettyListBy :: config -> [Either a b] -> Doc ann | |
(Pretty a, Pretty b) => Pretty (Either a b) Source # | |