Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- data Fixity
- data Expr
- data Pattern
- data Decl = Define {}
- data TopLevel
- bt :: a
- mapTopLevel :: (Expr -> Expr) -> TopLevel -> TopLevel
- mapTopLevel' :: Functor f => (Expr -> f Expr) -> TopLevel -> f TopLevel
- lookupFix :: String -> (Assoc (), Int)
- minPrec :: Int
- maxPrec :: Int
- comp :: Expr
- flip' :: Expr
- id' :: Expr
- const' :: Expr
- scomb :: Expr
- cons :: Expr
- nil :: Expr
- fix' :: Expr
- if' :: Expr
- readM :: (Monad m, Read a) => String -> m a
- makeList :: [Expr] -> Expr
- getList :: Expr -> ([Expr], Expr)
- data Assoc l
- = AssocNone l
- | AssocLeft l
- | AssocRight l
- fromMaybe :: a -> Maybe a -> a
- fromJust :: Maybe a -> a
- isJust :: Maybe a -> Bool
- first :: Arrow a => a b c -> a (b, d) (c, d)
- second :: Arrow a => a b c -> a (d, b) (d, c)
- (***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c')
- (&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
- (|||) :: ArrowChoice a => a b d -> a c d -> a (Either b c) d
- (+++) :: ArrowChoice a => a b c -> a b' c' -> a (Either b b') (Either c c')
- minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- intersperse :: a -> [a] -> [a]
- module Control.Monad
- assert :: Bool -> a -> a
Documentation
Associativity of an operator.
AssocNone l | non-associative operator (declared with |
AssocLeft l | left-associative operator (declared with |
AssocRight l | right-associative operator (declared with |
Instances
Functor Assoc | |
Foldable Assoc | |
Defined in Language.Haskell.Exts.Syntax fold :: Monoid m => Assoc m -> m # foldMap :: Monoid m => (a -> m) -> Assoc a -> m # foldr :: (a -> b -> b) -> b -> Assoc a -> b # foldr' :: (a -> b -> b) -> b -> Assoc a -> b # foldl :: (b -> a -> b) -> b -> Assoc a -> b # foldl' :: (b -> a -> b) -> b -> Assoc a -> b # foldr1 :: (a -> a -> a) -> Assoc a -> a # foldl1 :: (a -> a -> a) -> Assoc a -> a # elem :: Eq a => a -> Assoc a -> Bool # maximum :: Ord a => Assoc a -> a # minimum :: Ord a => Assoc a -> a # | |
Traversable Assoc | |
Annotated Assoc | |
Eq l => Eq (Assoc l) | |
Data l => Data (Assoc l) | |
Defined in Language.Haskell.Exts.Syntax gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Assoc l -> c (Assoc l) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Assoc l) # toConstr :: Assoc l -> Constr # dataTypeOf :: Assoc l -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Assoc l)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Assoc l)) # gmapT :: (forall b. Data b => b -> b) -> Assoc l -> Assoc l # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Assoc l -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Assoc l -> r # gmapQ :: (forall d. Data d => d -> u) -> Assoc l -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Assoc l -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Assoc l -> m (Assoc l) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Assoc l -> m (Assoc l) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Assoc l -> m (Assoc l) # | |
Ord l => Ord (Assoc l) | |
Defined in Language.Haskell.Exts.Syntax | |
Show l => Show (Assoc l) | |
Generic (Assoc l) | |
Pretty (Assoc l) | |
Defined in Language.Haskell.Exts.Pretty prettyPrec :: Int -> Assoc l -> Doc | |
type Rep (Assoc l) | |
Defined in Language.Haskell.Exts.Syntax type Rep (Assoc l) = D1 (MetaData "Assoc" "Language.Haskell.Exts.Syntax" "haskell-src-exts-1.20.2-2ICFwnD62Z41OwyyQu0OCQ" False) (C1 (MetaCons "AssocNone" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 l)) :+: (C1 (MetaCons "AssocLeft" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 l)) :+: C1 (MetaCons "AssocRight" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 l)))) |
fromMaybe :: a -> Maybe a -> a #
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
first :: Arrow a => a b c -> a (b, d) (c, d) #
Send the first component of the input through the argument arrow, and copy the rest unchanged to the output.
second :: Arrow a => a b c -> a (d, b) (d, c) #
A mirror image of first
.
The default definition may be overridden with a more efficient version if desired.
(***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c') infixr 3 #
Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.
The default definition may be overridden with a more efficient version if desired.
(&&&) :: Arrow a => a b c -> a b c' -> a b (c, c') infixr 3 #
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.
(|||) :: ArrowChoice a => a b d -> a c d -> a (Either b c) d infixr 2 #
Fanin: Split the input between the two argument arrows and merge their outputs.
The default definition may be overridden with a more efficient version if desired.
(+++) :: ArrowChoice a => a b c -> a b' c' -> a (Either b b') (Either c c') infixr 2 #
Split the input between the two argument arrows, retagging and merging their outputs. Note that this is in general not a functor.
The default definition may be overridden with a more efficient version if desired.
minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a #
The least element of a non-empty structure with respect to the given comparison function.
intersperse :: a -> [a] -> [a] #
The intersperse
function takes an element and a list and
`intersperses' that element between the elements of the list.
For example,
>>>
intersperse ',' "abcde"
"a,b,c,d,e"
module Control.Monad
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.