suggestion: A common type class for mutable variables

Petr Pudlák petr.mvd at gmail.com
Thu May 30 23:16:56 CEST 2013


OK, I didn't know about the variety of available packages, and I didn't 
realize that this would introduce new language extensions into base. I 
got carried away by the parallel with MArray, which is actually in a 
separate package. I retract the suggestion.

Best regards,
Petr

Čt 30. květen 2013, 22:59:21 CEST, Edward Kmett napsal:
> There are no MPTCs or type families in base outside of the GHC.* at this time and there are several libraries that provide this functionality as a layer on top.
>
> I don't really see the need to bless one over the rest by folding it into base, as there are several points in the design space available and each is better for different audiences. MPTCs+FD for portability, MPTCs+TFs for GHC-specifics, even MPTCs without either or with the FD running the other direction, to permit the combinatory to work on more ref types in exchange for worse inference.
>
> In fact there is a strong case against including it in base:
>
> If the FD or TF went from the monad to the ref type, then you'd want it to auto lift over transformers without orphan instances, but this would require transformers to break Haskell 98/2010, which isn't palatable given transformers' stated goals!
>
> The requisite layering is better served (and only possible) by this being a non-base package, which is precisely the status quo.
>
> -1
>
> -Edward
>
> On May 30, 2013, at 2:53 PM, Petr Pudlák <petr.mvd at gmail.com> wrote:
>
>> Dear Haskellers,
>>
>> I noticed that there is no common typeclass that would unify STRefs and IORefs. We already have MArray for ST(U)Arrays and IO(U)Arrays, so why not for references as well? This would allow writing generic code that can use both ST- and IO-based variables.
>>
>> I've found that there is a package that provides such a type class:
>> http://hackage.haskell.org/package/reference
>> I'd suggest to add similar functionality to base, perhaps with some different wording - I'd rather use Data.MRef (as "mutable reference").
>>
>> If there is some interest in it, I'd prepare a concrete code for consideration.
>>
>>   Best regards,
>>   Petr Pudlak
>>
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries





More information about the Libraries mailing list