Search results

liftA1 :: forall f a b. Applicative f => (a -> b) -> f a -> f b

liftA1 provides a default implementation of (<$>) for any Applicative functor, without using (<$>) as provided by the Functor-Applicative superclass relationship.

liftA1 can therefore be used to write Functor instances as follows:

instance functorF :: Functor F where
  map = liftA1
liftM1 :: forall m a b. Monad m => (a -> b) -> m a -> m b

liftM1 provides a default implementation of (<$>) for any Monad, without using (<$>) as provided by the Functor-Monad superclass relationship.

liftM1 can therefore be used to write Functor instances as follows:

instance functorF :: Functor F where
  map = liftM1
map :: forall f a b. Functor f => (a -> b) -> f a -> f b
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

squigglyMap :: forall f a b. Functor f => (a -> b) -> f a -> f b
map :: forall p q a b. Dissect p q => (a -> b) -> p a -> p b

A tail-recursive map operation, implemented in terms of Dissect.

map :: forall a c b. HasMap a => (b -> c) -> a b -> a c
map :: forall f a b. Functor f => (a -> b) -> f a -> f b
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.

map :: forall a b. Ord b => (a -> b) -> NonEmptySet a -> NonEmptySet 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.

map :: forall a b. Hashable b => (a -> b) -> HashSet a -> HashSet b

Construct a new set by applying a function to each element of an input set.

If distinct inputs map to the same output, this changes the cardinality of the set, therefore hash set is not a Functor. Also, the order in which elements appear in the new set is entirely dependent on the hash function for type b.

withUor :: forall a b. (a -> b) -> UndefinedOr a -> UndefinedOr b
pseudoMap :: forall a b. (a -> b) -> Opt a -> Opt b
mapEvent :: forall b a. (a -> b) -> HTML a -> HTML b

Map HTML with event type a to HTML with event type b.

It's important that memoize is only used at a top-level declaration – not inside a view. This is because PureScript is eagerly evaluated like JavaScript. If memoize is used inside a view it will recreate the memoized function every time the view is called.

map :: forall a b. Ord b => (a -> b) -> OSet a -> OSet 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.

map :: forall a b. (a -> b) -> Seq a -> Seq b

O(n). Apply a function to every element within a sequence. Note that this function is performed lazily — the actual call is almost instantaneous, regardless of the length of the sequence, because the function is not applied to all elements immediately. The eventual running time (assuming all elements are later requested) is O(n), though.

map :: forall b a. NotJSPromise b => (a -> b) -> PromiseSpec a -> PromiseSpec b

map the value in a promise spec

map :: forall b a. Hashable b => (a -> b) -> MultiSet a -> MultiSet b
extent' :: forall m d. Magnitude m => (d -> m) -> Array d -> Array m
fmap :: forall b a. (a -> b) -> Event a -> Event b
map :: forall b a. (a -> b) -> List a -> List b
map :: forall msgA msgB. (msgA -> msgB) -> Document msgA -> Document msgB
mapChange :: forall c d. (c -> d) -> Change c -> Change d

Transform a Change by applying a function to both old and new values.

mapImpl :: forall a b. (a -> b) -> AffList a -> AffList b
mapNullable :: forall b a. NeverNull b => (a -> b) -> Nullable a -> Nullable b

Change the value inside a Nullable using a function.

mMap :: forall a b. (a -> b) -> Music a -> Music b
pMap :: forall a b. (a -> b) -> Primitive a -> Primitive b
smap :: forall b a. (a -> b) -> Slice a -> Slice b

Apply a function to each element in a slice, creating a new slice.

smap :: forall b a. (a -> b) -> Slice a -> Slice b

Apply a function to each element in a slice, creating a new slice.

uop :: forall a b. (a -> b) -> AudioParameter_ a -> AudioParameter_ b
updateBody :: forall a b. (a -> b) -> Response a -> Response b
map :: forall b a. (a -> b) -> SortedArray a -> Array b

Functor-like convenience function, equivalent to unwrapping and applying the Array map.

s_fmap :: forall b a. (a -> b) -> Signal a -> SigBuilder b
shouldNotSatisfyM_Flipped :: forall m a. MonadThrow Error m => Show a => (a -> Boolean) -> m a -> m Unit
shouldSatisfyM_Flipped :: forall m a. MonadThrow Error m => Show a => (a -> Boolean) -> m a -> m Unit
use1 :: forall a x. (a -> x) -> (Case1 a -> F x)
mapRecord :: forall a b rin rout. HFoldlWithIndex (MapRecord a b) (Builder (Record ()) (Record ())) (Record rin) (Builder (Record ()) (Record rout)) => (a -> b) -> Record rin -> Record rout

Recursively maps a record using a function f.

let
  f :: Int -> String
  f i = show (i + 1)
mapRecord  f { a : { b : 10, c : { d: 20, e : Just "hello" }}, f : 30 }
-- { a : { b : "11", c : { d: "21", e : Just "hello" }, f : "31" }
mapUniformRecord :: forall row xs a b row'. RowToList row xs => MapUniformRecord xs row a b () row' => (a -> b) -> Record row -> Record row'
mapRecord :: forall row xs a b row'. RowToList row xs => MapRecord xs row a b () row' => (a -> b) -> Record row -> Record row'
alter' :: forall a b. (a -> b /\ (Array (Tree b))) -> Tree a -> Tree b

Traverse the nodes of given tree with the function, building a new tree with updated values and children |

defaultFilter :: forall a h f. BooleanEq h => Applicative f => Foldable f => Monoid (f a) => (a -> h) -> f a -> f a
filter :: forall f h a. Filterable f => BooleanEq h => (a -> h) -> f a -> f a
mapRecord :: forall a b rin rout. HFoldlWithIndex (MapRecord a b) (Builder (Record ()) (Record ())) (Record rin) (Builder (Record ()) (Record rout)) => (a -> b) -> Record rin -> Record rout

Recursively maps a record using a function f.

let
  f :: Int -> String
  f i = show (i + 1)
mapRecord  f { a : { b : 10, c : { d: 20, e : Just "hello" }}, f : 30 }
-- { a : { b : "11", c : { d: "21", e : Just "hello" }, f : "31" }
mapRecord :: forall row rowList a b row'. RowToList row rowList => MapRecord rowList row a b () row' => (a -> b) -> Record row -> Record row'
modifyNodeValue :: forall a. (a -> a) -> Tree a -> Tree a

Modify the value of a node.

modifyValue :: forall a. (a -> a) -> Loc a -> Loc a

Modify the value of the current Node.

filter :: forall f a. Filterable f => (a -> Boolean) -> f a -> f a
filterDefault :: forall f a. Filterable f => (a -> Boolean) -> f a -> f a

A default implementation of filter using filterMap.

filterDefaultPartition :: forall f a. Filterable f => (a -> Boolean) -> f a -> f a

A default implementation of filter using partition.

filterDefaultPartitionMap :: forall f a. Filterable f => (a -> Boolean) -> f a -> f a

A default implementation of filter using partitionMap.