Safe Haskell | Safe-Inferred |
---|
A local Prelude, meant to be imported unqualified.
Synopsis
- data Proxy (t :: k) = Proxy
- data Map k a
- data Set a
- data IntMap a
- data IntSet
- data HashMap k v
- data HashSet a
- (<|>) :: Alternative f => f a -> f a -> f a
- first :: Bifunctor p => (a -> b) -> p a c -> p b c
- second :: Bifunctor p => (b -> c) -> p a b -> p a c
- bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d
- class Semigroup a => Monoid a where
- class Semigroup a where
- while :: Monad m => m Bool -> m a -> m [a]
- while_ :: Monad m => m Bool -> m a -> m ()
- allM :: Monad m => (a -> m Bool) -> [a] -> m Bool
- anyM :: Monad m => (a -> m Bool) -> [a] -> m Bool
- ifM :: Monad m => m Bool -> m a -> m a -> m a
- andM :: Monad m => [m Bool] -> m Bool
- orM :: Monad m => [m Bool] -> m Bool
- findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a)
- partitionM :: Monad m => (a -> m Bool) -> [a] -> m ([a], [a])
- unlessM :: Monad m => m Bool -> m () -> m ()
- whenM :: Monad m => m Bool -> m () -> m ()
- whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m ()
- whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m ()
- foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
- mconcatMap :: Monoid b => (a -> b) -> [a] -> b
- concatMapM :: (Monad m, Monoid b) => (a -> m b) -> [a] -> m b
- mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]
- mapMaybe :: (a -> Maybe b) -> [a] -> [b]
- fromMaybe :: a -> Maybe a -> a
- justm :: Monad m => m (Maybe a) -> (a -> m (Maybe b)) -> m (Maybe b)
- rightm :: Monad m => m (Either err a) -> (a -> m (Either err b)) -> m (Either err b)
- firstJust :: Monad m => m (Maybe a) -> m (Maybe a) -> m (Maybe a)
- firstJusts :: Monad m => [m (Maybe a)] -> m (Maybe a)
- errorStack :: Stack => Text -> a
- errorIO :: Stack => MonadIO m => Text -> m a
- justErr :: err -> Maybe a -> Either err a
- tryJust :: MonadError e m => e -> Maybe a -> m a
- tryRight :: MonadError e m => Either e a -> m a
- class Pretty a
- pretty :: Pretty a => a -> Text
- prettys :: Pretty a => a -> String
- type Lens a b = a :-> b
- (#) :: Lens a b -> Lens b c -> Lens a c
- (#$) :: Lens f a -> f -> a
- (#=) :: Lens f a -> a -> f -> f
- (%=) :: Lens f a -> (a -> a) -> f -> f
- (<#>) :: Functor f => Lens a b -> f a -> f b
- guard :: Alternative f => Bool -> f ()
- zipWithM_ :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m ()
- zipWithM :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c]
- unless :: Applicative f => Bool -> f () -> f ()
- replicateM_ :: Applicative m => Int -> m a -> m ()
- replicateM :: Applicative m => Int -> 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
- filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a]
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
- forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)
- msum :: (Foldable t, MonadPlus m) => t (m a) -> m a
- forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
- void :: Functor f => f a -> f ()
- mplus :: MonadPlus m => m a -> m a -> m a
- mzero :: MonadPlus m => m a
- when :: Applicative f => Bool -> f () -> f ()
- liftM :: Monad m => (a1 -> r) -> m a1 -> m r
- ap :: Monad m => m (a -> b) -> m a -> m b
- class (Functor t, Foldable t) => Traversable (t :: Type -> Type) where
- traverse :: Applicative f => (a -> f b) -> t a -> f (t b)
- class Foldable (t :: TYPE LiftedRep -> Type) where
- class Monad m => MonadIO (m :: Type -> Type)
- lift :: (MonadTrans t, Monad m) => m a -> t m a
- liftIO :: MonadIO m => IO a -> m a
- data NonEmpty a = a :| [a]
- data Text
- txt :: String -> Text
- untxt :: Text -> String
- showt :: Show a => a -> Text
Documentation
Proxy
is a type that holds no data, but has a phantom parameter of
arbitrary type (or even kind). Its use is to provide type information, even
though there is no value available of that type (or it may be too costly to
create one).
Historically,
is a safer alternative to the
Proxy
:: Proxy
a
idiom.undefined
:: a
>>>
Proxy :: Proxy (Void, Int -> Int)
Proxy
Proxy can even hold types of higher kinds,
>>>
Proxy :: Proxy Either
Proxy
>>>
Proxy :: Proxy Functor
Proxy
>>>
Proxy :: Proxy complicatedStructure
Proxy
Instances
Generic1 (Proxy :: k -> Type) | |
ApplicativeB (Proxy :: (k -> Type) -> Type) | |
ConstraintsB (Proxy :: (k -> Type) -> Type) | |
DistributiveB (Proxy :: (k -> Type) -> Type) | |
Defined in Barbies.Internal.DistributiveB | |
FunctorB (Proxy :: (k -> Type) -> Type) | |
Defined in Barbies.Internal.FunctorB | |
TraversableB (Proxy :: (k -> Type) -> Type) | |
Defined in Barbies.Internal.TraversableB btraverse :: Applicative e => (forall (a :: k0). f a -> e (g a)) -> Proxy f -> e (Proxy g) # | |
Foldable (Proxy :: TYPE LiftedRep -> Type) | Since: base-4.7.0.0 |
Defined in Data.Foldable fold :: Monoid m => Proxy m -> m # foldMap :: Monoid m => (a -> m) -> Proxy a -> m # foldMap' :: Monoid m => (a -> m) -> Proxy a -> m # foldr :: (a -> b -> b) -> b -> Proxy a -> b # foldr' :: (a -> b -> b) -> b -> Proxy a -> b # foldl :: (b -> a -> b) -> b -> Proxy a -> b # foldl' :: (b -> a -> b) -> b -> Proxy a -> b # foldr1 :: (a -> a -> a) -> Proxy a -> a # foldl1 :: (a -> a -> a) -> Proxy a -> a # elem :: Eq a => a -> Proxy a -> Bool # maximum :: Ord a => Proxy a -> a # minimum :: Ord a => Proxy a -> a # | |
Eq1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Ord1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Read1 (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Functor.Classes | |
Show1 (Proxy :: TYPE LiftedRep -> Type) | Since: base-4.9.0.0 |
Traversable (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Alternative (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
Applicative (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Functor (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
Monad (Proxy :: Type -> Type) | Since: base-4.7.0.0 |
MonadPlus (Proxy :: Type -> Type) | Since: base-4.9.0.0 |
NFData1 (Proxy :: TYPE LiftedRep -> Type) | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
Hashable1 (Proxy :: Type -> Type) | |
Defined in Data.Hashable.Class | |
FromJSON1 (Proxy :: Type -> Type) | |
ToJSON1 (Proxy :: TYPE LiftedRep -> Type) | |
Defined in Data.Aeson.Types.ToJSON liftToJSON :: (a -> Value) -> ([a] -> Value) -> Proxy a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Proxy a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Proxy a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Proxy a] -> Encoding # | |
Monoid (Proxy s) | Since: base-4.7.0.0 |
Semigroup (Proxy s) | Since: base-4.9.0.0 |
Bounded (Proxy t) | Since: base-4.7.0.0 |
Enum (Proxy s) | Since: base-4.7.0.0 |
Generic (Proxy t) | |
Ix (Proxy s) | Since: base-4.7.0.0 |
Defined in Data.Proxy | |
Read (Proxy t) | Since: base-4.7.0.0 |
Show (Proxy s) | Since: base-4.7.0.0 |
NFData (Proxy a) | Since: deepseq-1.4.0.0 |
Defined in Control.DeepSeq | |
Eq (Proxy s) | Since: base-4.7.0.0 |
Ord (Proxy s) | Since: base-4.7.0.0 |
Hashable (Proxy a) | |
Defined in Data.Hashable.Class | |
FromJSON (Proxy a) | |
ToJSON (Proxy a) | |
Defined in Data.Aeson.Types.ToJSON | |
type AllB (c :: k -> Constraint) (Proxy :: (k -> Type) -> Type) | |
Defined in Barbies.Internal.ConstraintsB | |
type Rep1 (Proxy :: k -> Type) | Since: base-4.6.0.0 |
type Rep (Proxy t) | Since: base-4.6.0.0 |
A Map from keys k
to values a
.
The Semigroup
operation for Map
is union
, which prefers
values from the left operand. If m1
maps a key k
to a value
a1
, and m2
maps the same key to a different value a2
, then
their union m1 <> m2
maps k
to a1
.
Instances
Bifoldable Map | Since: containers-0.6.3.1 |
Eq2 Map | Since: containers-0.5.9 |
Ord2 Map | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
Show2 Map | Since: containers-0.5.9 |
Show Builtins Source # | |
Hashable2 Map | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
(OutputableP env key, OutputableP env elt) => OutputableP env (Map key elt) | |
Defined in GHC.Utils.Outputable | |
(Ord k, Arbitrary k) => Arbitrary1 (Map k) | |
Defined in Test.QuickCheck.Arbitrary liftArbitrary :: Gen a -> Gen (Map k a) # liftShrink :: (a -> [a]) -> Map k a -> [Map k a] # | |
Foldable (Map k) | Folds in order of increasing key. |
Defined in Data.Map.Internal fold :: Monoid m => Map k m -> m # foldMap :: Monoid m => (a -> m) -> Map k a -> m # foldMap' :: Monoid m => (a -> m) -> Map k a -> m # foldr :: (a -> b -> b) -> b -> Map k a -> b # foldr' :: (a -> b -> b) -> b -> Map k a -> b # foldl :: (b -> a -> b) -> b -> Map k a -> b # foldl' :: (b -> a -> b) -> b -> Map k a -> b # foldr1 :: (a -> a -> a) -> Map k a -> a # foldl1 :: (a -> a -> a) -> Map k a -> a # elem :: Eq a => a -> Map k a -> Bool # maximum :: Ord a => Map k a -> a # minimum :: Ord a => Map k a -> a # | |
Eq k => Eq1 (Map k) | Since: containers-0.5.9 |
Ord k => Ord1 (Map k) | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
(Ord k, Read k) => Read1 (Map k) | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
Show k => Show1 (Map k) | Since: containers-0.5.9 |
Traversable (Map k) | Traverses in order of increasing key. |
Functor (Map k) | |
Ord k => TrieMap (Map k) | |
Defined in GHC.Data.TrieMap | |
Hashable k => Hashable1 (Map k) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
(FromJSONKey k, Ord k) => FromJSON1 (Map k) | |
ToJSONKey k => ToJSON1 (Map k) | |
Defined in Data.Aeson.Types.ToJSON liftToJSON :: (a -> Value) -> ([a] -> Value) -> Map k a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [Map k a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> Map k a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [Map k a] -> Encoding # | |
(Ord k, Arbitrary k, Arbitrary v) => Arbitrary (Map k v) | |
(CoArbitrary k, CoArbitrary v) => CoArbitrary (Map k v) | |
Defined in Test.QuickCheck.Arbitrary coarbitrary :: Map k v -> Gen b -> Gen b # | |
(Data k, Data a, Ord k) => Data (Map k a) | |
Defined in Data.Map.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Map k a -> c (Map k a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Map k a) # toConstr :: Map k a -> Constr # dataTypeOf :: Map k a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Map k a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Map k a)) # gmapT :: (forall b. Data b => b -> b) -> Map k a -> Map k a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Map k a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Map k a -> r # gmapQ :: (forall d. Data d => d -> u) -> Map k a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Map k a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # | |
Ord k => Monoid (Map k v) | |
Ord k => Semigroup (Map k v) | |
Ord k => IsList (Map k v) | Since: containers-0.5.6.2 |
(Ord k, Read k, Read e) => Read (Map k e) | |
(Show k, Show a) => Show (Map k a) | |
(Binary k, Binary e) => Binary (Map k e) | |
(Ord k, Serialize k, Serialize e) => Serialize (Map k e) | |
(NFData k, NFData a) => NFData (Map k a) | |
Defined in Data.Map.Internal | |
(Outputable key, Outputable elt) => Outputable (Map key elt) | |
Defined in GHC.Utils.Outputable | |
(Eq k, Eq a) => Eq (Map k a) | |
(Ord k, Ord v) => Ord (Map k v) | |
(Hashable k, Hashable v) => Hashable (Map k v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
(SizeOf k, SizeOf a) => SizeOf (Map k a) Source # | |
(Pretty k, Pretty v) => Pretty (Map k v) Source # | |
(Ord k, Serialize k, Serialize v) => Serialize (Map k v) Source # | |
(FromJSONKey k, Ord k, FromJSON v) => FromJSON (Map k v) | |
(ToJSON v, ToJSONKey k) => ToJSON (Map k v) | |
Defined in Data.Aeson.Types.ToJSON | |
type Key (Map k) | |
Defined in GHC.Data.TrieMap | |
type Item (Map k v) | |
Defined in Data.Map.Internal |
A set of values a
.
Instances
Foldable Set | Folds in order of increasing key. |
Defined in Data.Set.Internal 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 | |
ToJSON1 Set | |
Defined in Data.Aeson.Types.ToJSON | |
OutputableP env a => OutputableP env (Set a) | |
Defined in GHC.Utils.Outputable | |
(Ord a, Arbitrary a) => Arbitrary (Set a) | |
CoArbitrary a => CoArbitrary (Set a) | |
Defined in Test.QuickCheck.Arbitrary coarbitrary :: Set a -> Gen b -> Gen b # | |
(Data a, Ord a) => Data (Set a) | |
Defined in Data.Set.Internal 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) | |
Binary a => Binary (Set a) | |
(Ord a, Serialize a) => Serialize (Set a) | |
NFData a => NFData (Set a) | |
Defined in Data.Set.Internal | |
Outputable a => Outputable (Set a) | |
Defined in GHC.Utils.Outputable | |
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 | |
ShowVal a => ShowVal (Set a) Source # | |
ToVal a => ToVal (Set a) Source # | |
(Typecheck a, Ord a) => Typecheck (Set a) Source # | |
Pretty a => Pretty (Set a) Source # | |
(Ord a, Serialize a) => Serialize (Set a) Source # | |
(Ord a, FromJSON a) => FromJSON (Set a) | |
ToJSON a => ToJSON (Set a) | |
Defined in Data.Aeson.Types.ToJSON | |
type Item (Set a) | |
Defined in Data.Set.Internal |
A map of integers to values a
.
Instances
Arbitrary1 IntMap | |
Defined in Test.QuickCheck.Arbitrary liftArbitrary :: Gen a -> Gen (IntMap a) # liftShrink :: (a -> [a]) -> IntMap a -> [IntMap a] # | |
Foldable IntMap | Folds in order of increasing key. |
Defined in Data.IntMap.Internal fold :: Monoid m => IntMap m -> m # foldMap :: Monoid m => (a -> m) -> IntMap a -> m # foldMap' :: Monoid m => (a -> m) -> IntMap a -> m # foldr :: (a -> b -> b) -> b -> IntMap a -> b # foldr' :: (a -> b -> b) -> b -> IntMap a -> b # foldl :: (b -> a -> b) -> b -> IntMap a -> b # foldl' :: (b -> a -> b) -> b -> IntMap a -> b # foldr1 :: (a -> a -> a) -> IntMap a -> a # foldl1 :: (a -> a -> a) -> IntMap a -> a # elem :: Eq a => a -> IntMap a -> Bool # maximum :: Ord a => IntMap a -> a # minimum :: Ord a => IntMap a -> a # | |
Eq1 IntMap | Since: containers-0.5.9 |
Ord1 IntMap | Since: containers-0.5.9 |
Defined in Data.IntMap.Internal | |
Read1 IntMap | Since: containers-0.5.9 |
Defined in Data.IntMap.Internal | |
Show1 IntMap | Since: containers-0.5.9 |
Traversable IntMap | Traverses in order of increasing key. |
Functor IntMap | |
TrieMap IntMap | |
Defined in GHC.Data.TrieMap | |
Hashable1 IntMap | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
FromJSON1 IntMap | |
ToJSON1 IntMap | |
Defined in Data.Aeson.Types.ToJSON liftToJSON :: (a -> Value) -> ([a] -> Value) -> IntMap a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [IntMap a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> IntMap a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [IntMap a] -> Encoding # | |
Arbitrary a => Arbitrary (IntMap a) | |
CoArbitrary a => CoArbitrary (IntMap a) | |
Defined in Test.QuickCheck.Arbitrary coarbitrary :: IntMap a -> Gen b -> Gen b # | |
Data a => Data (IntMap a) | |
Defined in Data.IntMap.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IntMap a -> c (IntMap a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (IntMap a) # toConstr :: IntMap a -> Constr # dataTypeOf :: IntMap a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (IntMap a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (IntMap a)) # gmapT :: (forall b. Data b => b -> b) -> IntMap a -> IntMap a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntMap a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntMap a -> r # gmapQ :: (forall d. Data d => d -> u) -> IntMap a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> IntMap a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> IntMap a -> m (IntMap a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IntMap a -> m (IntMap a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IntMap a -> m (IntMap a) # | |
Monoid (IntMap a) | |
Semigroup (IntMap a) | Since: containers-0.5.7 |
IsList (IntMap a) | Since: containers-0.5.6.2 |
Read e => Read (IntMap e) | |
Show a => Show (IntMap a) | |
Binary e => Binary (IntMap e) | |
Serialize e => Serialize (IntMap e) | |
NFData a => NFData (IntMap a) | |
Defined in Data.IntMap.Internal | |
Outputable elt => Outputable (IntMap elt) | |
Defined in GHC.Utils.Outputable | |
Eq a => Eq (IntMap a) | |
Ord a => Ord (IntMap a) | |
Defined in Data.IntMap.Internal | |
Hashable v => Hashable (IntMap v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
Pretty v => Pretty (IntMap v) Source # | |
FromJSON a => FromJSON (IntMap a) | |
ToJSON a => ToJSON (IntMap a) | |
Defined in Data.Aeson.Types.ToJSON | |
type Key IntMap | |
Defined in GHC.Data.TrieMap | |
type Item (IntMap a) | |
Defined in Data.IntMap.Internal |
A set of integers.
Instances
Arbitrary IntSet | |
CoArbitrary IntSet | |
Defined in Test.QuickCheck.Arbitrary coarbitrary :: IntSet -> Gen b -> Gen b # | |
Data IntSet | |
Defined in Data.IntSet.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IntSet -> c IntSet # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IntSet # toConstr :: IntSet -> Constr # dataTypeOf :: IntSet -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c IntSet) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntSet) # gmapT :: (forall b. Data b => b -> b) -> IntSet -> IntSet # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntSet -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntSet -> r # gmapQ :: (forall d. Data d => d -> u) -> IntSet -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> IntSet -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> IntSet -> m IntSet # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IntSet -> m IntSet # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IntSet -> m IntSet # | |
Monoid IntSet | |
Semigroup IntSet | Since: containers-0.5.7 |
IsList IntSet | Since: containers-0.5.6.2 |
Read IntSet | |
Show IntSet | |
Binary IntSet | |
Serialize IntSet | |
NFData IntSet | |
Defined in Data.IntSet.Internal | |
Outputable IntSet | |
Defined in GHC.Utils.Outputable | |
Eq IntSet | |
Ord IntSet | |
Hashable IntSet | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
FromJSON IntSet | |
ToJSON IntSet | |
Defined in Data.Aeson.Types.ToJSON | |
type Item IntSet | |
Defined in Data.IntSet.Internal |
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 |
Foldable (HashMap k) | |
Defined in Data.HashMap.Internal 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) | |
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 | |
(FromJSONKey k, Eq k, Hashable k) => FromJSON1 (HashMap k) | |
ToJSONKey k => ToJSON1 (HashMap k) | |
Defined in Data.Aeson.Types.ToJSON 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 # | |
(Data k, Data v, Eq k, Hashable k) => Data (HashMap k v) | |
Defined in Data.HashMap.Internal 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 substitutivity 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 | |
(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 | |
type Item (HashMap k v) | |
Defined in Data.HashMap.Internal |
A set of values. A set cannot contain duplicate values.
Instances
Foldable HashSet | |
Defined in Data.HashSet.Internal fold :: Monoid m => HashSet m -> m # foldMap :: Monoid m => (a -> m) -> HashSet a -> m # foldMap' :: Monoid m => (a -> m) -> HashSet a -> m # foldr :: (a -> b -> b) -> b -> HashSet a -> b # foldr' :: (a -> b -> b) -> b -> HashSet a -> b # foldl :: (b -> a -> b) -> b -> HashSet a -> b # foldl' :: (b -> a -> b) -> b -> HashSet a -> b # foldr1 :: (a -> a -> a) -> HashSet a -> a # foldl1 :: (a -> a -> a) -> HashSet a -> a # elem :: Eq a => a -> HashSet a -> Bool # maximum :: Ord a => HashSet a -> a # minimum :: Ord a => HashSet a -> a # | |
Eq1 HashSet | |
Ord1 HashSet | |
Defined in Data.HashSet.Internal | |
Show1 HashSet | |
NFData1 HashSet | Since: unordered-containers-0.2.14.0 |
Defined in Data.HashSet.Internal | |
Hashable1 HashSet | |
Defined in Data.HashSet.Internal | |
ToJSON1 HashSet | |
Defined in Data.Aeson.Types.ToJSON liftToJSON :: (a -> Value) -> ([a] -> Value) -> HashSet a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [HashSet a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> HashSet a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [HashSet a] -> Encoding # | |
Lift a => Lift (HashSet a :: TYPE LiftedRep) | Since: unordered-containers-0.2.17.0 |
(Data a, Eq a, Hashable a) => Data (HashSet a) | |
Defined in Data.HashSet.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HashSet a -> c (HashSet a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HashSet a) # toConstr :: HashSet a -> Constr # dataTypeOf :: HashSet a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HashSet a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HashSet a)) # gmapT :: (forall b. Data b => b -> b) -> HashSet a -> HashSet a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HashSet a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HashSet a -> r # gmapQ :: (forall d. Data d => d -> u) -> HashSet a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HashSet a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) # | |
(Hashable a, Eq a) => Monoid (HashSet a) | \(O(n+m)\) To obtain good performance, the smaller set must be presented as the first argument. Examples
|
(Hashable a, Eq a) => Semigroup (HashSet a) | \(O(n+m)\) To obtain good performance, the smaller set must be presented as the first argument. Examples
|
(Eq a, Hashable a) => IsList (HashSet a) | |
(Eq a, Hashable a, Read a) => Read (HashSet a) | |
Show a => Show (HashSet a) | |
NFData a => NFData (HashSet a) | |
Defined in Data.HashSet.Internal | |
Eq a => Eq (HashSet a) | Note that, in the presence of hash collisions, equal
In general, the lack of substitutivity can be observed with any function that depends on the key ordering, such as folds and traversals. |
Ord a => Ord (HashSet a) | |
Defined in Data.HashSet.Internal | |
Hashable a => Hashable (HashSet a) | |
Defined in Data.HashSet.Internal | |
(Eq a, Hashable a, FromJSON a) => FromJSON (HashSet a) | |
ToJSON a => ToJSON (HashSet a) | |
Defined in Data.Aeson.Types.ToJSON | |
type Item (HashSet a) | |
Defined in Data.HashSet.Internal |
(<|>) :: Alternative f => f a -> f a -> f a infixl 3 #
An associative binary operation
class Semigroup a => Monoid a where #
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following:
- Right identity
x
<>
mempty
= x- Left identity
mempty
<>
x = x- Associativity
x
(<>
(y<>
z) = (x<>
y)<>
zSemigroup
law)- Concatenation
mconcat
=foldr
(<>
)mempty
The method names refer to the monoid of lists under concatenation, but there are many other instances.
Some types can be viewed as a monoid in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtype
s and make those instances
of Monoid
, e.g. Sum
and Product
.
NOTE: Semigroup
is a superclass of Monoid
since base-4.11.0.0.
Identity of mappend
>>>
"Hello world" <> mempty
"Hello world"
An associative operation
NOTE: This method is redundant and has the default
implementation
since base-4.11.0.0.
Should it be implemented manually, since mappend
= (<>
)mappend
is a synonym for
(<>
), it is expected that the two functions are defined the same
way. In a future GHC release mappend
will be removed from Monoid
.
Fold a list using the monoid.
For most types, the default definition for mconcat
will be
used, but the function is included in the class definition so
that an optimized version can be provided for specific types.
>>>
mconcat ["Hello", " ", "Haskell", "!"]
"Hello Haskell!"
Instances
The class of semigroups (types with an associative binary operation).
Instances should satisfy the following:
Since: base-4.9.0.0
(<>) :: a -> a -> a infixr 6 #
An associative operation.
>>>
[1,2,3] <> [4,5,6]
[1,2,3,4,5,6]
Reduce a non-empty list with <>
The default definition should be sufficient, but this can be overridden for efficiency.
>>>
import Data.List.NonEmpty (NonEmpty (..))
>>>
sconcat $ "Hello" :| [" ", "Haskell", "!"]
"Hello Haskell!"
stimes :: Integral b => b -> a -> a #
Repeat a value n
times.
Given that this works on a Semigroup
it is allowed to fail if
you request 0 or fewer repetitions, and the default definition
will do so.
By making this a member of the class, idempotent semigroups
and monoids can upgrade this to execute in \(\mathcal{O}(1)\) by
picking stimes =
or stimesIdempotent
stimes =
respectively.stimesIdempotentMonoid
>>>
stimes 4 [1]
[1,1,1,1]
Instances
allM :: Monad m => (a -> m Bool) -> [a] -> m Bool #
A version of all
lifted to a monad. Retains the short-circuiting behaviour.
allM Just [True,False,undefined] == Just False allM Just [True,True ,undefined] == undefined \(f :: Int -> Maybe Bool) xs -> anyM f xs == orM (map f xs)
anyM :: Monad m => (a -> m Bool) -> [a] -> m Bool #
A version of any
lifted to a monad. Retains the short-circuiting behaviour.
anyM Just [False,True ,undefined] == Just True anyM Just [False,False,undefined] == undefined \(f :: Int -> Maybe Bool) xs -> anyM f xs == orM (map f xs)
andM :: Monad m => [m Bool] -> m Bool #
A version of and
lifted to a monad. Retains the short-circuiting behaviour.
andM [Just True,Just False,undefined] == Just False andM [Just True,Just True ,undefined] == undefined \xs -> Just (and xs) == andM (map Just xs)
orM :: Monad m => [m Bool] -> m Bool #
A version of or
lifted to a monad. Retains the short-circuiting behaviour.
orM [Just False,Just True ,undefined] == Just True orM [Just False,Just False,undefined] == undefined \xs -> Just (or xs) == orM (map Just xs)
findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a) #
Like find
, but where the test can be monadic.
findM (Just . isUpper) "teST" == Just (Just 'S') findM (Just . isUpper) "test" == Just Nothing findM (Just . const True) ["x",undefined] == Just (Just "x")
partitionM :: Monad m => (a -> m Bool) -> [a] -> m ([a], [a]) #
A version of partition
that works with a monadic predicate.
partitionM (Just . even) [1,2,3] == Just ([2], [1,3]) partitionM (const Nothing) [1,2,3] == Nothing
whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m () Source #
list
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b #
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 structure to a single strict result (e.g. sum
).
For a general Foldable
structure this should be semantically identical
to,
foldl' f z =foldl'
f z .toList
Since: base-4.6.0.0
mconcatMap :: Monoid b => (a -> b) -> [a] -> b Source #
This is foldMap
specialized to lists.
concatMapM :: (Monad m, Monoid b) => (a -> m b) -> [a] -> m b Source #
This is actually a mconcatMapM.
A further generalized version would be:
foldMapA :: (Applicative f, Traversable t, Monoid m) => (a -> f m) -> t a -> f m foldMapA f = fmap Foldable.fold . traverse f
mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b] #
A version of mapMaybe
that works with a monadic predicate.
mapMaybe :: (a -> Maybe b) -> [a] -> [b] #
The mapMaybe
function is a version of map
which can throw
out elements. In particular, the functional argument returns
something of type
. If this is Maybe
bNothing
, no element
is added on to the result list. If it is
, then Just
bb
is
included in the result list.
Examples
Using
is a shortcut for mapMaybe
f x
in most cases:catMaybes
$ map
f x
>>>
import Text.Read ( readMaybe )
>>>
let readMaybeInt = readMaybe :: String -> Maybe Int
>>>
mapMaybe readMaybeInt ["1", "Foo", "3"]
[1,3]>>>
catMaybes $ map readMaybeInt ["1", "Foo", "3"]
[1,3]
If we map the Just
constructor, the entire list should be returned:
>>>
mapMaybe Just [1,2,3]
[1,2,3]
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
error
justm :: Monad m => m (Maybe a) -> (a -> m (Maybe b)) -> m (Maybe b) Source #
Run the second action only if the first action returns Just.
This is like MaybeT, but using MaybeT itself required lots of annoying explicit lifting.
rightm :: Monad m => m (Either err a) -> (a -> m (Either err b)) -> m (Either err b) Source #
The Either equivalent of justm
. EitherT solves the same problem, but
requires a runEitherT and lots of hoistEithers.