Isaac Dupree wrote:

var :: IORef Int
var = {-# EVALUATE_THIS_TEXT_ONLY_ONCE #-} (unsafePerformIO (newIORef 3))

I think I still prefer..

var :: IORef Int
var <- newIORef 3

or, more likely..

var :: IORef Int
var <- ACIO.newIORef 3

The <- syntax should make the intended semantics clear and unambiguous,
so it becomes the problem of individual implementors (not standards
writers) to make sure that whatever optimisations or transformations
that may be appropriate for their implementation preserve those
semantics. (IOW there's no need to worry about what a pragma really
means in operational terms, AFAICS).

The ACIO monad also restricts what programmers may use on the rhs of
the <-.

But if you want a good name for the pragma how about this..

var :: IORef Int
var = {-# <- #-} (unsafePerformIO (newIORef 3))

:-)

Regards
--
Adrian Hey








_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime

Reply via email to