Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.haskell > #566

Re: Nested "Maybe"

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.haskell
Subject Re: Nested "Maybe"
Date 2021-04-09 14:27 -0700
Organization A noiseless patient Spider
Message-ID <877dlb87yn.fsf@nightsong.com> (permalink)
References <878s5rtb4g.fsf@bsb.me.uk> <87blan883u.fsf@nightsong.com>

Show all headers | View raw


Paul Rubin <no.email@nospam.invalid> writes:
> data Precision a = Roughly a | Exactly a
> data Approximate a = Maybe (Precision a)

Alternatively maybe you want an actual 3-way Maybe, e.g.

data Approximate a = Invalid | Roughly a | Exactly a

and then you could write typeclass instances (monad, monoid, etc.)
analogously with Maybe.

Back to comp.lang.haskell | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Nested "Maybe" Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-09 22:13 +0100
  Re: Nested "Maybe" Paul Rubin <no.email@nospam.invalid> - 2021-04-09 14:24 -0700
    Re: Nested "Maybe" Paul Rubin <no.email@nospam.invalid> - 2021-04-09 14:27 -0700
  Re: Nested "Maybe" Mark Carroll <mtbc@bcs.org> - 2021-04-09 17:33 -0400

csiph-web