[Haskell-cafe] RFC: rewrite-with-location proposal

Petr Pudlák petr.mvd at gmail.com
Mon Feb 25 14:02:28 CET 2013


2013/2/25 Michael Snoyman <michael at snoyman.com>

>
> At that point, we've now made two changes to REWRITE rules:
>
> 1. They can takes a new ALWAYS parameters.
> 2. There's a new, special identifier currentLocation available.
>
> What would be the advantage is of that approach versus introducing a
> single new REWRITE_WITH_LOCATION pragma?
>

Just a remark: 'currentLocation' is not a function (it's a special keyword)
but behaves like one - it returns some kind of value. But it's not
referentially transparent - it returns a different value depending on where
it's used. This is something that I really don't expect from Haskell.  So
having it return `IO Location` seems therefore much better option. And if
someone really wants to get the location as a pure value, (s)he can simply
wrap it with `unsafePerformIO`, which signals code readers to be careful
with that part.

  Best regards,
  Petr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130225/023e7276/attachment.htm>


More information about the Haskell-Cafe mailing list