| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Matterhorn.Prelude
Description
This module is for internal re-exports of commonly-used functions. This also lets us avoid churn between versions of GHC by putting changed functions behind CPP in a single place.
Synopsis
- module Prelude.Compat
- (<|>) :: Alternative f => f a -> f a -> f a
- isJust :: Maybe a -> Bool
- isNothing :: Maybe a -> Bool
- listToMaybe :: [a] -> Maybe a
- maybeToList :: Maybe a -> [a]
- fromMaybe :: a -> Maybe a -> a
- catMaybes :: [Maybe a] -> [a]
- readMaybe :: Read a => String -> Maybe a
- forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)
- forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
- filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a]
- when :: Applicative f => Bool -> f () -> f ()
- unless :: Applicative f => Bool -> f () -> f ()
- void :: Functor f => f a -> f ()
- join :: Monad m => m (m a) -> m a
- forever :: Applicative f => f a -> f b
- foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
- class Monad m => MonadIO (m :: Type -> Type) where
- toList :: Foldable t => t a -> [a]
- find :: Foldable t => (a -> Bool) -> t a -> Maybe a
- sort :: Ord a => [a] -> [a]
- intercalate :: [a] -> [[a]] -> [a]
- sortWith :: Ord b => (a -> b) -> [a] -> [a]
- groupWith :: Ord b => (a -> b) -> [a] -> [[a]]
- (&) :: a -> (a -> b) -> b
- (^.) :: s -> Getting a s a -> a
- (^?) :: s -> Getting (First a) s a -> Maybe a
- use :: MonadState s m => Getting a s a -> m a
- preuse :: MonadState s m => Getting (First a) s a -> m (Maybe a)
- nominalDay :: NominalDiffTime
- data Text
- data HashMap k v
- data Seq a
- data Set a
- data UTCTime
- data TimeZoneSeries
- data NominalDiffTime
Documentation
module Prelude.Compat
(<|>) :: Alternative f => f a -> f a -> f a infixl 3 #
An associative binary operation
listToMaybe :: [a] -> Maybe a #
The listToMaybe function returns Nothing on an empty list
or where Just aa is the first element of the list.
Examples
Basic usage:
>>>listToMaybe []Nothing
>>>listToMaybe [9]Just 9
>>>listToMaybe [1,2,3]Just 1
Composing maybeToList with listToMaybe should be the identity
on singleton/empty lists:
>>>maybeToList $ listToMaybe [5][5]>>>maybeToList $ listToMaybe [][]
But not on lists with more than one element:
>>>maybeToList $ listToMaybe [1,2,3][1]
maybeToList :: Maybe a -> [a] #
The maybeToList function returns an empty list when given
Nothing or a singleton list when given Just.
Examples
Basic usage:
>>>maybeToList (Just 7)[7]
>>>maybeToList Nothing[]
One can use maybeToList to avoid pattern matching when combined
with a function that (safely) works on lists:
>>>import Text.Read ( readMaybe )>>>sum $ maybeToList (readMaybe "3")3>>>sum $ maybeToList (readMaybe "")0
fromMaybe :: a -> Maybe a -> a #
The fromMaybe function takes a default value and a Maybe
value. If the Maybe is Nothing, it returns the default value;
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
catMaybes :: [Maybe a] -> [a] #
The catMaybes function takes a list of Maybes and returns
a list of all the Just values.
Examples
Basic usage:
>>>catMaybes [Just 1, Nothing, Just 3][1,3]
When constructing a list of Maybe values, catMaybes can be used
to return all of the "success" results (if the list is the result
of a map, then mapMaybe would be more appropriate):
>>>import Text.Read ( readMaybe )>>>[readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ][Just 1,Nothing,Just 3]>>>catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ][1,3]
readMaybe :: Read a => String -> Maybe a #
Parse a string using the Read instance.
Succeeds if there is exactly one valid result.
>>>readMaybe "123" :: Maybe IntJust 123
>>>readMaybe "hello" :: Maybe IntNothing
Since: base-4.6.0.0
forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b) #
filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a] #
This generalizes the list-based filter function.
when :: Applicative f => Bool -> f () -> f () #
Conditional execution of Applicative expressions. For example,
when debug (putStrLn "Debugging")
will output the string Debugging if the Boolean value debug
is True, and otherwise do nothing.
unless :: Applicative f => Bool -> f () -> f () #
The reverse of when.
void :: Functor f => f a -> f () #
discards or ignores the result of evaluation, such
as the return value of an void valueIO action.
Examples
Replace the contents of a with unit:Maybe Int
>>>void NothingNothing>>>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
join :: Monad m => m (m a) -> m a #
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
forever :: Applicative f => f a -> f b #
Repeat an action indefinitely.
Examples
A common use of forever is to process input from network sockets,
Handles, and channels
(e.g. MVar and
Chan).
For example, here is how we might implement an echo
server, using
forever both to listen for client connections on a network socket
and to echo client input on client connection handles:
echoServer :: Socket -> IO () echoServer socket =forever$ do client <- accept socketforkFinally(echo client) (\_ -> hClose client) where echo :: Handle -> IO () echo client =forever$ hGetLine client >>= hPutStrLn client
Note that "forever" isn't necessarily non-terminating.
If the action is in a and short-circuits after some number of iterations.
then MonadPlus actually returns forevermzero, effectively short-circuiting its caller.
foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b #
The foldM function is analogous to foldl, except that its result is
encapsulated in a monad. Note that foldM works from left-to-right over
the list arguments. This could be an issue where ( and the `folded
function' are not commutative.>>)
foldM f a1 [x1, x2, ..., xm] == do a2 <- f a1 x1 a3 <- f a2 x2 ... f am xm
If right-to-left evaluation is required, the input list should be reversed.
class Monad m => MonadIO (m :: Type -> Type) where #
Monads in which IO computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Methods
Lift a computation from the IO monad.
This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations
(i.e. IO is the base monad for the stack).
Example
import Control.Monad.Trans.State -- from the "transformers" library printState :: Show s => StateT s IO () printState = do state <- get liftIO $ print state
Had we omitted , we would have ended up with this error:liftIO
• Couldn't match type ‘IO’ with ‘StateT s IO’ Expected type: StateT s IO () Actual type: IO ()
The important part here is the mismatch between StateT s IO () and .IO ()
Luckily, we know of a function that takes an and returns an IO a(m a): ,
enabling us to run the program and see the expected results:liftIO
> evalStateT printState "hello" "hello" > evalStateT printState 3 3
Instances
toList :: Foldable t => t a -> [a] #
List of elements of a structure, from left to right. If the entire list is intended to be reduced via a fold, just fold the structure directly bypassing the list.
Examples
Basic usage:
>>>toList Nothing[]
>>>toList (Just 42)[42]
>>>toList (Left "foo")[]
>>>toList (Node (Leaf 5) 17 (Node Empty 12 (Leaf 8)))[5,17,12,8]
For lists, toList is the identity:
>>>toList [1, 2, 3][1,2,3]
Since: base-4.8.0.0
The sort function implements a stable sorting algorithm.
It is a special case of sortBy, which allows the programmer to supply
their own comparison function.
Elements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input.
>>>sort [1,6,4,3,2,5][1,2,3,4,5,6]
The argument must be finite.
intercalate :: [a] -> [[a]] -> [a] #
intercalate xs xss is equivalent to (.
It inserts the list concat (intersperse xs xss))xs in between the lists in xss and concatenates the
result.
>>>intercalate ", " ["Lorem", "ipsum", "dolor"]"Lorem, ipsum, dolor"
sortWith :: Ord b => (a -> b) -> [a] -> [a] #
The sortWith function sorts a list of elements using the
user supplied function to project something out of each element
In general if the user supplied function is expensive to compute then
you should probably be using sortOn, as it only needs
to compute it once for each element. sortWith, on the other hand
must compute the mapping function for every comparison that it performs.
groupWith :: Ord b => (a -> b) -> [a] -> [[a]] #
The groupWith function uses the user supplied function which
projects an element out of every list element in order to first sort the
input list and then to form groups by equality on these projected elements
(^.) :: s -> Getting a s a -> a infixl 8 #
(^.) applies a getter to a value; in other words, it gets a value out of a structure using a getter (which can be a lens, traversal, fold, etc.).
Getting 1st field of a tuple:
(^._1) :: (a, b) -> a (^._1) =fst
When (^.) is used with a traversal, it combines all results using the Monoid instance for the resulting type. For instance, for lists it would be simple concatenation:
>>>("str","ing") ^. each"string"
The reason for this is that traversals use Applicative, and the Applicative instance for Const uses monoid concatenation to combine “effects” of Const.
A non-operator version of (^.) is called view, and it's a bit more general than (^.) (it works in MonadReader). If you need the general version, you can get it from microlens-mtl; otherwise there's view available in Lens.Micro.Extras.
(^?) :: s -> Getting (First a) s a -> Maybe a infixl 8 #
s ^? t returns the 1st element t returns, or Nothing if t doesn't return anything. It's trivially implemented by passing the First monoid to the getter.
Safe head:
>>>[] ^? eachNothing
>>>[1..3] ^? eachJust 1
>>>Left 1 ^? _RightNothing
>>>Right 1 ^? _RightJust 1
A non-operator version of (^?) is called preview, and – like view – it's a bit more general than (^?) (it works in MonadReader). If you need the general version, you can get it from microlens-mtl; otherwise there's preview available in Lens.Micro.Extras.
use :: MonadState s m => Getting a s a -> m a #
use is (^.) (or view) which implicitly operates on the state; for instance, if your state is a record containing a field foo, you can write
x <- use foo
to extract foo from the state. In other words, use is the same as gets, but for getters instead of functions.
The implementation of use is straightforward:
usel =gets(viewl)
If you need to extract something with a fold or traversal, you need preuse.
nominalDay :: NominalDiffTime #
One day in NominalDiffTime.
A space efficient, packed, unboxed Unicode text type.
Instances
A map from keys to values. A map cannot contain duplicate keys; each key can map to at most one value.
Instances
| Bifoldable HashMap | Since: unordered-containers-0.2.11 |
| Eq2 HashMap | |
| Ord2 HashMap | |
Defined in Data.HashMap.Internal | |
| Show2 HashMap | |
| NFData2 HashMap | Since: unordered-containers-0.2.14.0 |
Defined in Data.HashMap.Internal | |
| Hashable2 HashMap | |
Defined in Data.HashMap.Internal | |
| (Lift k, Lift v) => Lift (HashMap k v :: Type) | Since: unordered-containers-0.2.17.0 |
| (FromJSONKey k, Eq k, Hashable k) => FromJSON1 (HashMap k) | |
| ToJSONKey k => ToJSON1 (HashMap k) | |
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a -> Value) -> ([a] -> Value) -> HashMap k a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [HashMap k a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> HashMap k a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [HashMap k a] -> Encoding # | |
| Foldable (HashMap k) | |
Defined in Data.HashMap.Internal Methods fold :: Monoid m => HashMap k m -> m # foldMap :: Monoid m => (a -> m) -> HashMap k a -> m # foldMap' :: Monoid m => (a -> m) -> HashMap k a -> m # foldr :: (a -> b -> b) -> b -> HashMap k a -> b # foldr' :: (a -> b -> b) -> b -> HashMap k a -> b # foldl :: (b -> a -> b) -> b -> HashMap k a -> b # foldl' :: (b -> a -> b) -> b -> HashMap k a -> b # foldr1 :: (a -> a -> a) -> HashMap k a -> a # foldl1 :: (a -> a -> a) -> HashMap k a -> a # toList :: HashMap k a -> [a] # length :: HashMap k a -> Int # elem :: Eq a => a -> HashMap k a -> Bool # maximum :: Ord a => HashMap k a -> a # minimum :: Ord a => HashMap k a -> a # | |
| Eq k => Eq1 (HashMap k) | |
| Ord k => Ord1 (HashMap k) | |
Defined in Data.HashMap.Internal | |
| (Eq k, Hashable k, Read k) => Read1 (HashMap k) | |
Defined in Data.HashMap.Internal | |
| Show k => Show1 (HashMap k) | |
| Traversable (HashMap k) | |
Defined in Data.HashMap.Internal | |
| Functor (HashMap k) | |
| NFData k => NFData1 (HashMap k) | Since: unordered-containers-0.2.14.0 |
Defined in Data.HashMap.Internal | |
| Hashable k => Hashable1 (HashMap k) | |
Defined in Data.HashMap.Internal | |
| (FromJSON v, FromJSONKey k, Eq k, Hashable k) => FromJSON (HashMap k v) | |
| (ToJSON v, ToJSONKey k) => ToJSON (HashMap k v) | |
Defined in Data.Aeson.Types.ToJSON | |
| (Data k, Data v, Eq k, Hashable k) => Data (HashMap k v) | |
Defined in Data.HashMap.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HashMap k v -> c (HashMap k v) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HashMap k v) # toConstr :: HashMap k v -> Constr # dataTypeOf :: HashMap k v -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HashMap k v)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HashMap k v)) # gmapT :: (forall b. Data b => b -> b) -> HashMap k v -> HashMap k v # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HashMap k v -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HashMap k v -> r # gmapQ :: (forall d. Data d => d -> u) -> HashMap k v -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HashMap k v -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) # | |
| (Eq k, Hashable k) => Monoid (HashMap k v) | If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples
|
| (Eq k, Hashable k) => Semigroup (HashMap k v) | If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples
|
| (Eq k, Hashable k) => IsList (HashMap k v) | |
| (Eq k, Hashable k, Read k, Read e) => Read (HashMap k e) | |
| (Show k, Show v) => Show (HashMap k v) | |
| (NFData k, NFData v) => NFData (HashMap k v) | |
Defined in Data.HashMap.Internal | |
| (Eq k, Eq v) => Eq (HashMap k v) | Note that, in the presence of hash collisions, equal
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals. |
| (Ord k, Ord v) => Ord (HashMap k v) | The ordering is total and consistent with the |
Defined in Data.HashMap.Internal | |
| (Hashable k, Hashable v) => Hashable (HashMap k v) | |
Defined in Data.HashMap.Internal | |
| (Eq k, Hashable k) => GrowingAppend (HashMap k v) | |
Defined in Data.MonoTraversable | |
| MonoFoldable (HashMap k v) | |
Defined in Data.MonoTraversable Methods ofoldMap :: Monoid m => (Element (HashMap k v) -> m) -> HashMap k v -> m # ofoldr :: (Element (HashMap k v) -> b -> b) -> b -> HashMap k v -> b # ofoldl' :: (a -> Element (HashMap k v) -> a) -> a -> HashMap k v -> a # otoList :: HashMap k v -> [Element (HashMap k v)] # oall :: (Element (HashMap k v) -> Bool) -> HashMap k v -> Bool # oany :: (Element (HashMap k v) -> Bool) -> HashMap k v -> Bool # onull :: HashMap k v -> Bool # olength :: HashMap k v -> Int # olength64 :: HashMap k v -> Int64 # ocompareLength :: Integral i => HashMap k v -> i -> Ordering # otraverse_ :: Applicative f => (Element (HashMap k v) -> f b) -> HashMap k v -> f () # ofor_ :: Applicative f => HashMap k v -> (Element (HashMap k v) -> f b) -> f () # omapM_ :: Applicative m => (Element (HashMap k v) -> m ()) -> HashMap k v -> m () # oforM_ :: Applicative m => HashMap k v -> (Element (HashMap k v) -> m ()) -> m () # ofoldlM :: Monad m => (a -> Element (HashMap k v) -> m a) -> a -> HashMap k v -> m a # ofoldMap1Ex :: Semigroup m => (Element (HashMap k v) -> m) -> HashMap k v -> m # ofoldr1Ex :: (Element (HashMap k v) -> Element (HashMap k v) -> Element (HashMap k v)) -> HashMap k v -> Element (HashMap k v) # ofoldl1Ex' :: (Element (HashMap k v) -> Element (HashMap k v) -> Element (HashMap k v)) -> HashMap k v -> Element (HashMap k v) # headEx :: HashMap k v -> Element (HashMap k v) # lastEx :: HashMap k v -> Element (HashMap k v) # unsafeHead :: HashMap k v -> Element (HashMap k v) # unsafeLast :: HashMap k v -> Element (HashMap k v) # maximumByEx :: (Element (HashMap k v) -> Element (HashMap k v) -> Ordering) -> HashMap k v -> Element (HashMap k v) # minimumByEx :: (Element (HashMap k v) -> Element (HashMap k v) -> Ordering) -> HashMap k v -> Element (HashMap k v) # | |
| MonoFunctor (HashMap k v) | |
| MonoTraversable (HashMap k v) | |
| type Item (HashMap k v) | |
Defined in Data.HashMap.Internal | |
| type Index (HashMap k a) | |
Defined in Lens.Micro.Platform | |
| type IxValue (HashMap k a) | |
Defined in Lens.Micro.Platform | |
| type IxValue (HashMap k a) | |
Defined in Lens.Micro.Platform | |
| type Element (HashMap k v) | |
Defined in Data.MonoTraversable | |
General-purpose finite sequences.
Instances
| FromJSON1 Seq | |
| ToJSON1 Seq | |
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a -> Value) -> ([a] -> Value) -> Seq a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Seq a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Seq a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Seq a] -> Encoding # | |
| MonadFix Seq | Since: containers-0.5.11 |
Defined in Data.Sequence.Internal | |
| MonadZip Seq |
|
| Foldable Seq | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Seq m -> m # foldMap :: Monoid m => (a -> m) -> Seq a -> m # foldMap' :: Monoid m => (a -> m) -> Seq a -> m # foldr :: (a -> b -> b) -> b -> Seq a -> b # foldr' :: (a -> b -> b) -> b -> Seq a -> b # foldl :: (b -> a -> b) -> b -> Seq a -> b # foldl' :: (b -> a -> b) -> b -> Seq a -> b # foldr1 :: (a -> a -> a) -> Seq a -> a # foldl1 :: (a -> a -> a) -> Seq a -> a # elem :: Eq a => a -> Seq a -> Bool # maximum :: Ord a => Seq a -> a # | |
| Eq1 Seq | Since: containers-0.5.9 |
| Ord1 Seq | Since: containers-0.5.9 |
Defined in Data.Sequence.Internal | |
| Read1 Seq | Since: containers-0.5.9 |
Defined in Data.Sequence.Internal | |
| Show1 Seq | Since: containers-0.5.9 |
| Traversable Seq | |
| Alternative Seq | Since: containers-0.5.4 |
| Applicative Seq | Since: containers-0.5.4 |
| Functor Seq | |
| Monad Seq | |
| MonadPlus Seq | |
| Reversible Seq | O(n) |
Defined in Brick.Widgets.List | |
| Splittable Seq | O(log(min(i,n-i))) |
| UnzipWith Seq | |
Defined in Data.Sequence.Internal Methods unzipWith' :: (x -> (a, b)) -> Seq x -> (Seq a, Seq b) | |
| Hashable1 Seq | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Lift a => Lift (Seq a :: Type) | Since: containers-0.6.6 |
| FromJSON a => FromJSON (Seq a) | |
| ToJSON a => ToJSON (Seq a) | |
Defined in Data.Aeson.Types.ToJSON | |
| Data a => Data (Seq a) | |
Defined in Data.Sequence.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Seq a -> c (Seq a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Seq a) # dataTypeOf :: Seq a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Seq a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Seq a)) # gmapT :: (forall b. Data b => b -> b) -> Seq a -> Seq a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Seq a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Seq a -> r # gmapQ :: (forall d. Data d => d -> u) -> Seq a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Seq a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # | |
| a ~ Char => IsString (Seq a) | Since: containers-0.5.7 |
Defined in Data.Sequence.Internal Methods fromString :: String -> Seq a # | |
| Monoid (Seq a) | |
| Semigroup (Seq a) | Since: containers-0.5.7 |
| IsList (Seq a) | |
| Read a => Read (Seq a) | |
| Show a => Show (Seq a) | |
| NFData a => NFData (Seq a) | |
Defined in Data.Sequence.Internal | |
| Eq a => Eq (Seq a) | |
| Ord a => Ord (Seq a) | |
| Hashable v => Hashable (Seq v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Ord a => Stream (Seq a) | Since: megaparsec-9.0.0 |
Defined in Text.Megaparsec.Stream Methods tokenToChunk :: Proxy (Seq a) -> Token (Seq a) -> Tokens (Seq a) # tokensToChunk :: Proxy (Seq a) -> [Token (Seq a)] -> Tokens (Seq a) # chunkToTokens :: Proxy (Seq a) -> Tokens (Seq a) -> [Token (Seq a)] # chunkLength :: Proxy (Seq a) -> Tokens (Seq a) -> Int # chunkEmpty :: Proxy (Seq a) -> Tokens (Seq a) -> Bool # take1_ :: Seq a -> Maybe (Token (Seq a), Seq a) # takeN_ :: Int -> Seq a -> Maybe (Tokens (Seq a), Seq a) # takeWhile_ :: (Token (Seq a) -> Bool) -> Seq a -> (Tokens (Seq a), Seq a) # | |
| GrowingAppend (Seq a) | |
Defined in Data.MonoTraversable | |
| MonoFoldable (Seq a) | |
Defined in Data.MonoTraversable Methods ofoldMap :: Monoid m => (Element (Seq a) -> m) -> Seq a -> m # ofoldr :: (Element (Seq a) -> b -> b) -> b -> Seq a -> b # ofoldl' :: (a0 -> Element (Seq a) -> a0) -> a0 -> Seq a -> a0 # otoList :: Seq a -> [Element (Seq a)] # oall :: (Element (Seq a) -> Bool) -> Seq a -> Bool # oany :: (Element (Seq a) -> Bool) -> Seq a -> Bool # ocompareLength :: Integral i => Seq a -> i -> Ordering # otraverse_ :: Applicative f => (Element (Seq a) -> f b) -> Seq a -> f () # ofor_ :: Applicative f => Seq a -> (Element (Seq a) -> f b) -> f () # omapM_ :: Applicative m => (Element (Seq a) -> m ()) -> Seq a -> m () # oforM_ :: Applicative m => Seq a -> (Element (Seq a) -> m ()) -> m () # ofoldlM :: Monad m => (a0 -> Element (Seq a) -> m a0) -> a0 -> Seq a -> m a0 # ofoldMap1Ex :: Semigroup m => (Element (Seq a) -> m) -> Seq a -> m # ofoldr1Ex :: (Element (Seq a) -> Element (Seq a) -> Element (Seq a)) -> Seq a -> Element (Seq a) # ofoldl1Ex' :: (Element (Seq a) -> Element (Seq a) -> Element (Seq a)) -> Seq a -> Element (Seq a) # headEx :: Seq a -> Element (Seq a) # lastEx :: Seq a -> Element (Seq a) # unsafeHead :: Seq a -> Element (Seq a) # unsafeLast :: Seq a -> Element (Seq a) # maximumByEx :: (Element (Seq a) -> Element (Seq a) -> Ordering) -> Seq a -> Element (Seq a) # minimumByEx :: (Element (Seq a) -> Element (Seq a) -> Ordering) -> Seq a -> Element (Seq a) # | |
| MonoFunctor (Seq a) | |
| MonoPointed (Seq a) | |
| MonoTraversable (Seq a) | |
| IsSequence (Seq a) | |
Defined in Data.Sequences Methods fromList :: [Element (Seq a)] -> Seq a # lengthIndex :: Seq a -> Index (Seq a) # break :: (Element (Seq a) -> Bool) -> Seq a -> (Seq a, Seq a) # span :: (Element (Seq a) -> Bool) -> Seq a -> (Seq a, Seq a) # dropWhile :: (Element (Seq a) -> Bool) -> Seq a -> Seq a # takeWhile :: (Element (Seq a) -> Bool) -> Seq a -> Seq a # splitAt :: Index (Seq a) -> Seq a -> (Seq a, Seq a) # unsafeSplitAt :: Index (Seq a) -> Seq a -> (Seq a, Seq a) # take :: Index (Seq a) -> Seq a -> Seq a # unsafeTake :: Index (Seq a) -> Seq a -> Seq a # drop :: Index (Seq a) -> Seq a -> Seq a # unsafeDrop :: Index (Seq a) -> Seq a -> Seq a # dropEnd :: Index (Seq a) -> Seq a -> Seq a # partition :: (Element (Seq a) -> Bool) -> Seq a -> (Seq a, Seq a) # uncons :: Seq a -> Maybe (Element (Seq a), Seq a) # unsnoc :: Seq a -> Maybe (Seq a, Element (Seq a)) # filter :: (Element (Seq a) -> Bool) -> Seq a -> Seq a # filterM :: Monad m => (Element (Seq a) -> m Bool) -> Seq a -> m (Seq a) # replicate :: Index (Seq a) -> Element (Seq a) -> Seq a # replicateM :: Monad m => Index (Seq a) -> m (Element (Seq a)) -> m (Seq a) # groupBy :: (Element (Seq a) -> Element (Seq a) -> Bool) -> Seq a -> [Seq a] # groupAllOn :: Eq b => (Element (Seq a) -> b) -> Seq a -> [Seq a] # subsequences :: Seq a -> [Seq a] # permutations :: Seq a -> [Seq a] # tailMay :: Seq a -> Maybe (Seq a) # initMay :: Seq a -> Maybe (Seq a) # unsafeTail :: Seq a -> Seq a # unsafeInit :: Seq a -> Seq a # index :: Seq a -> Index (Seq a) -> Maybe (Element (Seq a)) # indexEx :: Seq a -> Index (Seq a) -> Element (Seq a) # unsafeIndex :: Seq a -> Index (Seq a) -> Element (Seq a) # splitWhen :: (Element (Seq a) -> Bool) -> Seq a -> [Seq a] # | |
| SemiSequence (Seq a) | |
| type Item (Seq a) | |
Defined in Data.Sequence.Internal | |
| type Token (Seq a) | |
Defined in Text.Megaparsec.Stream | |
| type Tokens (Seq a) | |
Defined in Text.Megaparsec.Stream | |
| type Index (Seq a) | |
Defined in Lens.Micro.GHC | |
| type IxValue (Seq a) | |
Defined in Lens.Micro.GHC | |
| type Element (Seq a) | |
Defined in Data.MonoTraversable | |
| type Index (Seq a) | |
Defined in Data.Sequences | |
A set of values a.
Instances
| ToJSON1 Set | |
Defined in Data.Aeson.Types.ToJSON Methods liftToJSON :: (a -> Value) -> ([a] -> Value) -> Set a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Set a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Set a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Set a] -> Encoding # | |
| Foldable Set | Folds in order of increasing key. |
Defined in Data.Set.Internal Methods fold :: Monoid m => Set m -> m # foldMap :: Monoid m => (a -> m) -> Set a -> m # foldMap' :: Monoid m => (a -> m) -> Set a -> m # foldr :: (a -> b -> b) -> b -> Set a -> b # foldr' :: (a -> b -> b) -> b -> Set a -> b # foldl :: (b -> a -> b) -> b -> Set a -> b # foldl' :: (b -> a -> b) -> b -> Set a -> b # foldr1 :: (a -> a -> a) -> Set a -> a # foldl1 :: (a -> a -> a) -> Set a -> a # elem :: Eq a => a -> Set a -> Bool # maximum :: Ord a => Set a -> a # | |
| Eq1 Set | Since: containers-0.5.9 |
| Ord1 Set | Since: containers-0.5.9 |
Defined in Data.Set.Internal | |
| Show1 Set | Since: containers-0.5.9 |
| Hashable1 Set | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Lift a => Lift (Set a :: Type) | Since: containers-0.6.6 |
| (Ord a, FromJSON a) => FromJSON (Set a) | |
| ToJSON a => ToJSON (Set a) | |
Defined in Data.Aeson.Types.ToJSON | |
| (Data a, Ord a) => Data (Set a) | |
Defined in Data.Set.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Set a -> c (Set a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Set a) # dataTypeOf :: Set a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Set a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set a)) # gmapT :: (forall b. Data b => b -> b) -> Set a -> Set a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r # gmapQ :: (forall d. Data d => d -> u) -> Set a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Set a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # | |
| Ord a => Monoid (Set a) | |
| Ord a => Semigroup (Set a) | Since: containers-0.5.7 |
| Ord a => IsList (Set a) | Since: containers-0.5.6.2 |
| (Read a, Ord a) => Read (Set a) | |
| Show a => Show (Set a) | |
| NFData a => NFData (Set a) | |
Defined in Data.Set.Internal | |
| Eq a => Eq (Set a) | |
| Ord a => Ord (Set a) | |
| Hashable v => Hashable (Set v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Ord v => GrowingAppend (Set v) | |
Defined in Data.MonoTraversable | |
| Ord e => MonoFoldable (Set e) | |
Defined in Data.MonoTraversable Methods ofoldMap :: Monoid m => (Element (Set e) -> m) -> Set e -> m # ofoldr :: (Element (Set e) -> b -> b) -> b -> Set e -> b # ofoldl' :: (a -> Element (Set e) -> a) -> a -> Set e -> a # otoList :: Set e -> [Element (Set e)] # oall :: (Element (Set e) -> Bool) -> Set e -> Bool # oany :: (Element (Set e) -> Bool) -> Set e -> Bool # ocompareLength :: Integral i => Set e -> i -> Ordering # otraverse_ :: Applicative f => (Element (Set e) -> f b) -> Set e -> f () # ofor_ :: Applicative f => Set e -> (Element (Set e) -> f b) -> f () # omapM_ :: Applicative m => (Element (Set e) -> m ()) -> Set e -> m () # oforM_ :: Applicative m => Set e -> (Element (Set e) -> m ()) -> m () # ofoldlM :: Monad m => (a -> Element (Set e) -> m a) -> a -> Set e -> m a # ofoldMap1Ex :: Semigroup m => (Element (Set e) -> m) -> Set e -> m # ofoldr1Ex :: (Element (Set e) -> Element (Set e) -> Element (Set e)) -> Set e -> Element (Set e) # ofoldl1Ex' :: (Element (Set e) -> Element (Set e) -> Element (Set e)) -> Set e -> Element (Set e) # headEx :: Set e -> Element (Set e) # lastEx :: Set e -> Element (Set e) # unsafeHead :: Set e -> Element (Set e) # unsafeLast :: Set e -> Element (Set e) # maximumByEx :: (Element (Set e) -> Element (Set e) -> Ordering) -> Set e -> Element (Set e) # minimumByEx :: (Element (Set e) -> Element (Set e) -> Ordering) -> Set e -> Element (Set e) # | |
| MonoPointed (Set a) | |
| type Item (Set a) | |
Defined in Data.Set.Internal | |
| type Index (Set a) | |
Defined in Lens.Micro.GHC | |
| type IxValue (Set a) | |
Defined in Lens.Micro.GHC | |
| type Element (Set e) | |
Defined in Data.MonoTraversable | |
This is the simplest representation of UTC. It consists of the day number, and a time offset from midnight. Note that if a day has a leap second added to it, it will have 86401 seconds.
Instances
| FromJSON UTCTime | |
| FromJSONKey UTCTime | |
Defined in Data.Aeson.Types.FromJSON Methods | |
| ToJSON UTCTime | |
Defined in Data.Aeson.Types.ToJSON | |
| ToJSONKey UTCTime | |
Defined in Data.Aeson.Types.ToJSON | |
| Data UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCTime -> c UTCTime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UTCTime # toConstr :: UTCTime -> Constr # dataTypeOf :: UTCTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UTCTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UTCTime) # gmapT :: (forall b. Data b => b -> b) -> UTCTime -> UTCTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r # gmapQ :: (forall d. Data d => d -> u) -> UTCTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # | |
| NFData UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime | |
| Eq UTCTime | |
| Ord UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime | |
data TimeZoneSeries #
A TimeZoneSeries consists of a default TimeZone object and a
sequence of pairs of a UTCTime and a TimeZone object. Each
UTCTime indicates a moment at which the clocks changed, and the
corresponding TimeZone object describes the new state of the
clocks after the change. The default TimeZone object is used for
times preceding the earliest UTCTime, or if the sequence of pairs
is empty. The times in the sequence are in order from latest to
earlist (note that this is the opposite of the way that they are
stored in an Olson timezone file).
Instances
data NominalDiffTime #
This is a length of time, as measured by UTC. It has a precision of 10^-12 s.
Conversion functions such as fromInteger and realToFrac will treat it as seconds.
For example, (0.010 :: NominalDiffTime) corresponds to 10 milliseconds.
It has a precision of one picosecond (= 10^-12 s). Enumeration functions will treat it as picoseconds.
It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), regardless of whether a leap-second intervened.