Search results

map :: forall a b f. Functor f => (a -> b) -> f a -> f b
P prelude M Data.Functor

Map k v represents maps from keys of type k to values of type v.

P ordered-collections M Data.Map.Internal
map :: forall a b. Ord b => (a -> b) -> Set a -> Set b

Maps over the values in a set.

This operation is not structure-preserving for sets, so is not a valid Functor. An example case: mapping const x over a set with n > 0 elements will result in a set with one element.

P ordered-collections M Data.Set
P erl-maps M Erl.Data.Map
mapEnv :: forall e a b. (a -> b) -> Env e a -> Env e b

Change the data type in an Env computation.

P transformers M Control.Comonad.Env
mapRWS :: forall r w1 w2 s a1 a2. (RWSResult s a1 w1 -> RWSResult s a2 w2) -> RWS r w1 s a1 -> RWS r w2 s a2

Change the types of the result and accumulator in a RWS action

P transformers M Control.Monad.RWS
mapEnvT :: forall e w1 w2 a b. (w1 a -> w2 b) -> EnvT e w1 a -> EnvT e w2 b

Change the underlying comonad and data type in an EnvT context.

P transformers M Control.Comonad.Env.Trans
mapRWST :: forall r w1 w2 s m1 m2 a1 a2. (m1 (RWSResult s a1 w1) -> m2 (RWSResult s a2 w2)) -> RWST r w1 s m1 a1 -> RWST r w2 s m2 a2

Change the result and accumulator types in a RWST monad action.

P transformers M Control.Monad.RWS.Trans
mapMaybe :: forall a b. (a -> Maybe b) -> List a -> List b

Apply a function to each element in a list, keeping only the results which contain a value.

Running time: O(n)

P lists M Data.List
mapMaybe :: forall a b. (a -> Maybe b) -> List a -> List b

Apply a function to each element in a list, keeping only the results which contain a value.

Running time: O(n)

P lists M Data.List.Lazy
mapMaybe :: forall a b. (a -> Maybe b) -> NonEmptyList a -> List b
P lists M Data.List.NonEmpty
mapMaybe :: forall a b. (a -> Maybe b) -> Array a -> Array b

Apply a function to each element in an array, keeping only the results which contain a value, creating a new array.

parseEmail :: String -> Maybe Email
parseEmail = ...

mapMaybe parseEmail ["a.com", "hello@example.com", "--"]
   = [Email {user: "hello", domain: "example.com"}]
P arrays M Data.Array
mapMaybe :: forall a b. (a -> Maybe b) -> NonEmptyArray a -> Array b
P arrays M Data.Array.NonEmpty
mapContT :: forall r m a. (m r -> m r) -> ContT r m a -> ContT r m a

Modify the underlying action in a ContT monad action.

P transformers M Control.Monad.Cont.Trans
mapMaybe :: forall a b. (a -> Maybe b) -> List a -> List b

Apply a function to each element in a list, keeping only the results which contain a value.

Running time: O(n)

P erl-lists M Erl.Data.List
mapMaybe :: forall f a b. Functor f => (a -> Maybe b) -> ListT f a -> ListT f b

Apply a function to the elements of a list, keeping only those return values which contain a result.

P transformers M Control.Monad.List.Trans
mapState :: forall s a b. (Tuple a s -> Tuple b s) -> State s a -> State s b

Change the type of the result in a State action

P transformers M Control.Monad.State
mapAccumL :: forall a b s f. Traversable f => (s -> a -> Accum s b) -> s -> f a -> Accum s (f b)

Fold a data structure from the left, keeping all intermediate results instead of only the final result.

Unlike scanl, mapAccumL allows the type of accumulator to differ from the element type of the final data structure.

P foldable-traversable M Data.Traversable
mapAccumR :: forall a b s f. Traversable f => (s -> a -> Accum s b) -> s -> f a -> Accum s (f b)

Fold a data structure from the right, keeping all intermediate results instead of only the final result.

Unlike scanr, mapAccumR allows the type of accumulator to differ from the element type of the final data structure.

P foldable-traversable M Data.Traversable
mapExcept :: forall e e' a b. (Either e a -> Either e' b) -> Except e a -> Except e' b

Transform the unwrapped computation using the given function.

P transformers M Control.Monad.Except
mapMaybeT :: forall m1 m2 a b. (m1 (Maybe a) -> m2 (Maybe b)) -> MaybeT m1 a -> MaybeT m2 b

Change the result type of a MaybeT monad action.

P transformers M Control.Monad.Maybe.Trans
mapReader :: forall r a b. (a -> b) -> Reader r a -> Reader r b

Change the type of the result in a Reader monad action.

P transformers M Control.Monad.Reader
mapStateT :: forall s m1 m2 a b. (m1 (Tuple a s) -> m2 (Tuple b s)) -> StateT s m1 a -> StateT s m2 b

Change the result type in a StateT monad action.

P transformers M Control.Monad.State.Trans
mapWriter :: forall w1 w2 a b. (Tuple a w1 -> Tuple b w2) -> Writer w1 a -> Writer w2 b

Change the result and accumulator types in a Writer monad action

P transformers M Control.Monad.Writer
mapFlipped :: forall f a b. Functor f => f a -> (a -> b) -> f b

mapFlipped is map with its arguments reversed. For example:

[1, 2, 3] <#> \n -> n * n
P prelude M Data.Functor
mapDefault :: forall i f a b. FunctorWithIndex i f => (a -> b) -> f a -> f b

A default implementation of Functor's map in terms of mapWithIndex

P foldable-traversable M Data.FunctorWithIndex
mapExceptT :: forall e e' m n a b. (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b

Transform the unwrapped computation using the given function.

P transformers M Control.Monad.Except.Trans
mapReaderT :: forall r m1 m2 a b. (m1 a -> m2 b) -> ReaderT r m1 a -> ReaderT r m2 b

Change the type of the result in a ReaderT monad action.

P transformers M Control.Monad.Reader.Trans
mapWriterT :: forall w1 w2 m1 m2 a b. (m1 (Tuple a w1) -> m2 (Tuple b w2)) -> WriterT w1 m1 a -> WriterT w2 m2 b

Change the accumulator and base monad types in a WriterT monad action.

P transformers M Control.Monad.Writer.Trans
mapWithIndex :: forall a b f i. FunctorWithIndex i f => (i -> a -> b) -> f a -> f b
P foldable-traversable M Data.FunctorWithIndex
mapWithIndex :: forall a b. (Int -> a -> b) -> List a -> List b

Apply a function to each element and its index in a list starting at 0.

Deprecated. Use Data.FunctorWithIndex instead.

P lists M Data.List
mapWithIndex :: forall a b. (Int -> a -> b) -> NonEmptyList a -> NonEmptyList b
P lists M Data.List.NonEmpty
mapWithIndex :: forall a b. (Int -> a -> b) -> Array a -> Array b

Apply a function to each element in an array, supplying a generated zero-based index integer along with the element, creating an array with the new elements.

prefixIndex index element = show index <> element

mapWithIndex prefixIndex ["Hello", "World"] = ["0Hello", "1World"]
P arrays M Data.Array
mapWithIndex :: forall a b. (a -> Int -> b) -> List a -> List b

Apply a function to each element and its index in a list starting at 0.

P erl-lists M Erl.Data.List
mapAccumLWithIndex :: forall i a b s f. TraversableWithIndex i f => (i -> s -> a -> Accum s b) -> s -> f a -> Accum s (f b)

Fold a data structure from the left with access to the indices, keeping all intermediate results instead of only the final result.

Unlike scanlWithIndex, mapAccumLWithIndex allows the type of accumulator to differ from the element type of the final data structure.

P foldable-traversable M Data.TraversableWithIndex
mapAccumRWithIndex :: forall i a b s f. TraversableWithIndex i f => (i -> s -> a -> Accum s b) -> s -> f a -> Accum s (f b)

Fold a data structure from the right with access to the indices, keeping all intermediate results instead of only the final result.

Unlike scanrWithIndex, imapAccumRWithIndex allows the type of accumulator to differ from the element type of the final data structure.

P foldable-traversable M Data.TraversableWithIndex

No further results.