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


Groups > comp.lang.haskell > #566

Re: Nested "Maybe"

Path csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.haskell
Subject Re: Nested "Maybe"
Date Fri, 09 Apr 2021 14:27:12 -0700
Organization A noiseless patient Spider
Lines 10
Message-ID <877dlb87yn.fsf@nightsong.com> (permalink)
References <878s5rtb4g.fsf@bsb.me.uk> <87blan883u.fsf@nightsong.com>
Mime-Version 1.0
Content-Type text/plain
Injection-Info reader02.eternal-september.org; posting-host="1b119873b4e364aebe8352f3ae5ece3f"; logging-data="13611"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7qXXjtw2DISEtvlx528C6"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock sha1:49/wS1mdP1HrDcf/GS7LFJxwfHk= sha1:fQ6d2otKb0kTNKpcCcqTeFy5SFE=
Xref csiph.com comp.lang.haskell:566

Show key headers only | 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