Add NonEmptyMap and NonEmptySet to containers

Andreas Abel andreas.abel at ifi.lmu.de
Mon Apr 29 06:26:15 UTC 2019


 > I’m not sure what you mean here by “always requires a type synonym”
 > ...
 > example :: NonEmpty X -> Y

Jon, here you are exactly demonstrating the problem.  NonEmpty what? 
List, Set, Map, HashMap, IntMap, ...?

On 2019-04-28 00:07, Jon Purdy wrote:
> 
> 
> On Thu, Apr 18, 2019 at 11:49 PM Andreas Abel <andreas.abel at ifi.lmu.de 
> <mailto: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
> 


More information about the Libraries mailing list