[Haskell-cafe] Instance deps (was: [announcement] filtrable: class of filtrable containers)

amindfv at gmail.com amindfv at gmail.com
Wed Feb 17 18:34:53 UTC 2016



> El 17 feb 2016, a las 12:16, M Farkas-Dyck <m.farkasdyck at gmail.com> escribió:
> 
>> On 17/02/2016, Joachim Breitner <mail at joachim-breitner.de> wrote:
>> You might want to add laws in the style of
>> 
>>    If this is also a Foldable, then
>>       toList . mapMaybe f = mapMapybe f . toList
>>       toList . catMaybes = catMaybes . toList
>>       toList . filter f = filter f . toList
> 
> Shall do.
> 
>> Do you plan to add instances for all the other data structures in base
>> that are filtrable?
> 
> Yes, if i missed any, please let me know which ☺
> 
>> On 17/02/2016, Oleg Grenrus <oleg.grenrus at iki.fi> wrote:
>> - I’d also like to see instances for types in containers,
>> unordered-containers, vector and semigroup.
> 
> I was hoping to have no deps but base... alas, Cabal and Hackage seem
> to have no good way to have instance deps, so the instances must be in
> either the package defining the class or the one defining the types
> which are instances of it.

Are there any existing proposals for a solution to this?

Tom


> 
>> If you don’t mind I can make a PR for the instances.
> 
> Feel free to do so for containers and vector at least. I may want this
> to not transitively depend on unordered-containers → hashable → text,
> but if enough potential users want these instances i'll include them
> (containers and vector come with GHC so it's not so bad). What types
> in semigroups would you add instances of?
> 
>> - The OtherLicense seems a bit scary (even the contents aren’t),
>>  is there a good reason why you don’t use more familiar MIT or BSD3?
> 
> Too verbose. I might use ISC if it weren't also an OtherLicense...
> 
>> The law:
>> 
>>    filter f = mapMaybe (liftA2 (<$) id (guard ∘ f))
>> 
>> is very hard to understand.
> 
> Rewritten.
> 
>> On 17/02/2016, Simon Jakobi <simon.jakobi at googlemail.com> wrote:
>> your package looks very similar to
>> http://hackage.haskell.org/package/witherable!
> 
> Witherable has Traversable superclass, but some Filtrable types may
> not be Traversable.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list