[Haskell-cafe] Safe lens?

Greg Fitzgerald garious at gmail.com
Mon Oct 29 21:38:07 CET 2012

There's no dependency on TH here.  I'm hoping to do the same thing as
I have done with fclabels, which is to have a Trustworthy module that
imports Control.Lens.TH, derive lenses, and then allow all users of
that data type to Safely import only the Getter/Setter modules.  So,
I'm curious:

* Could Control.Lens.Getter have a LANGUAGE dependency it doesn't need?
* Is there something fundamental in the design of lens (compared to
fclabels), that its getters require unsafe language features?
* Maybe the Internal module should be marked Trustworthy?


On Mon, Oct 29, 2012 at 10:14 AM, Petr P <petr.mvd at gmail.com> wrote:
>   Hi
> I believe the reason is that it uses TemplateHaskell for automatic
> derivation of labels. And TemplateHaskell is of course unsafe, since
> it could convert your code into something entirely different.
>   Best regards,
>   Petr Pudlak
> 2012/10/29 Greg Fitzgerald <garious at gmail.com>:
>> Why are getters from the 'lens' package unsafe?  Is there a subset
>> like Data.Label.Pure from 'fclabels' that can be imported safely?
>> $ cat a.hs
>> {-# LANGUAGE Safe #-}
>> import Control.Lens.Getter
>> main = print 123
>> $ runghc a.hs
>> a.hs:3:1:
>>     Control.Lens.Getter: Can't be safely imported!
>>     The module itself isn't safe.
>> Thanks,
>> Greg
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list