Skip to content

Commit

Permalink
Update README with synopsis
Browse files Browse the repository at this point in the history
  • Loading branch information
jferris committed Dec 15, 2017
1 parent 0581584 commit c538e19
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
Monocats provides mono-functor and similar instances from [mono-traversable] for
Scala developers using cats.

## Synopsis

Monocats provides mono instances which are similar to their cats counterparts,
but don't allow the parameterized type to change during mapping, which allows
instances to be defined for more types.

For example, you can't define a Functor instance for `String`, because `String`
does not have a parameterized type, and mapping from a `Char` to an `Int` can't
produce a new `String`. However, you can define a `MonoFunctor` instance,
because mapping must preserve the `Char` type:

new MonoFunctor[String] {
type Element = Char

def map(string: String)(f: Char => Char): String = string.map(f)
}

## Contributing

Please see [CONTRIBUTING.md](/CONTRIBUTING.md).
Expand Down

0 comments on commit c538e19

Please sign in to comment.