[Haskell-cafe] Safe Haskell at the export symbol granularity?

Antoine Latter aslatter at gmail.com
Thu May 17 16:48:45 CEST 2012


On Thu, May 17, 2012 at 8:50 AM, Ryan Newton <rrnewton at gmail.com> wrote:
> Thanks David.
>
> I'm glad to see it was discussed in the wiki.  (Btw, my 2 cents is that I
> like the comment pragmas more than new keywords.)
>
> The issue that I think doesn't make it into the wiki is of splitting, not
> modules, but type-classes. That's where I think it becomes a more serious
> issue.
>
> Do you think a symbol-level Safe Haskell would be able to distinguish one
> method of a type class as unsafe, while the others are safe?
>

You can still do this at the module level, with the down-side of
potentially not being able to implement a class with the safe version:

> module Unsafe where
>
> class MyClass a where
>   safeOp :: a -> Int -> IO ()
>   unsafeOp :: a -> Int -> IO ()
>
> instance MyClass A where ...


> module Safe
>   (MyClass(safeOp))
>   where
>
> import Unsafe

I think this works.

Antoine



More information about the Haskell-Cafe mailing list