Add NonEmptyMap and NonEmptySet to containers

Jon Purdy evincarofautumn at gmail.com
Sat Apr 27 22:07:48 UTC 2019


On Thu, Apr 18, 2019 at 11:49 PM Andreas Abel <andreas.abel at ifi.lmu.de>
wrote:

>
> We definitely should /not/ repeat the choice made for
> Data.List.NonEmpty.NonEmpty.  Using non-empty lists /always/ requires a
> type synonym, like
>
>    import qualified Data.List.NonEmpty as NEList
>    type NEList = NEList.NonEmpty
>
> which is quite ugly, and type synonyms are sometimes expanded in GHC
> error messages, which causes additional trouble.
>

I’m not sure what you mean here by “always requires a type synonym”—I
typically use NonEmpty like any other module meant to be imported
qualified, like Text, Vector, Map, Set, &c.:

import Data.List.NonEmpty (NonEmpty)
import qualified Data.List.NonEmpty as NonEmpty  -- or NE if I’m lazy

example :: NonEmpty X -> Y
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190427/9253847f/attachment.html>


More information about the Libraries mailing list