Pudu programming language
Menu
API reference

Std.Mappable.Mappable

1 declaration

trait

Mappable

This declaration names behavior that types can implement.

What it does

Something that holds values and can have every one of them transformed

without changing its shape.

Every collection here already has a map, and until parameters could stand

for a constructor the five of them could not be related: Array, Option,

Tree and the rest each named the same operation and no function could take

"some container" and transform what it held.

F stands for the constructor, not for a type. F[_] says it takes one

argument, so a member may write F[A] and F[B] and mean the same

container holding different things.

The law this asks of an implementation, and does not check: transforming by

a function that answers what it was given must leave the container as it

was. A mapped that reordered, dropped, or duplicated would satisfy the

type and break every caller that relied on the shape surviving.

Read the signature

  • This declaration has no value signature because it introduces a type or trait.

Back to Std.MappableSearch related declarations