[Haskell-cafe] [announcement] filtrable: class of filtrable containers

Joachim Breitner mail at joachim-breitner.de
Wed Feb 17 12:28:37 UTC 2016


Hi,

Am Mittwoch, den 17.02.2016, 15:21 +0300 schrieb Kosyrev Serge:
> Does this monster
> 
>   liftA2 (<$) id (guard ∘ f)
> 
> really stand for
> 
>   \x -> if f x then Just x else Nothing
> 
> ?
> 
> Is there really no simpler "compact" representation for this trivial
> idea in Haskell?

I vaguely remember a discussion about adding a combinator doing that to
the libray, and some googling turned out that there was a proposal 6
years ago by... me: https://ghc.haskell.org/trac/ghc/ticket/3446

(Well, not quite, the type was
  justIf :: a -> Bool -> Just a
and not
  justIf :: a -> (a -> Bool) -> Just a
and this shows that there are probably too many variants to warrant an
addition of some or all of them to the standard library).

The corresponding discussion on the libraries¹ list discussed some of
the variants, and also turned up an even older equivalent proposal by
Henning Thielemann² from 12 years ago.


Greetings,
Joachim

¹ https://mail.haskell.org/pipermail/libraries/2009-August/012413.html
² https://mail.haskell.org/pipermail/libraries/2004-July/002381.html

-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttps://www.joachim-breitner.de/
  XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160217/3edd5b9c/attachment.sig>


More information about the Haskell-Cafe mailing list