both: Like Maybe, but with a different Monoid instance.

[ data, library, mit ] [ Propose Tags ]

The Monoid instance for Maybe behaves like so:

instance Monoid a => Monoid (Maybe a) where
  mappend (Just x) (Just y) = Just $ x <> y
  mappend (Just x) Nothing  = Just x
  mappend Nothing  (Just y) = Just y
  mappend Nothing  Nothing  = Nothing

  mempty = Nothing

Both is a newtype wrapper around Maybe providing this instance:

instance Monoid a => Monoid (Both a) where
  mappend (Just x) (Just y) = Just $ x <> y
  mappend _ _ = Nothing

  mempty = Just mempty
Versions [faq] 0.1.0.0, 0.1.1.0
Dependencies base (>=4.7 && <5.0), semigroups (>=0.16), zero (==0.1.*) [details]
License MIT
Author Michael Walker
Maintainer mike@barrucadu.co.uk
Revised Revision 1 made by barrucadu at Sun May 12 20:42:34 UTC 2019
Category Data
Home page https://github.com/barrucadu/both
Bug tracker https://github.com/barrucadu/both/issues
Source repo head: git clone https://github.com/barrucadu/both.git
this: git clone https://github.com/barrucadu/both.git(tag 0.1.1.0)
Uploaded by barrucadu at Thu May 26 11:10:13 UTC 2016
Distributions LTSHaskell:0.1.1.0, NixOS:0.1.1.0, Stackage:0.1.1.0
Downloads 995 total (32 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2016-05-26 [all 1 reports]

Modules

[Index]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees