[Haskell-cafe] forall & ST monad

Kim-Ee Yeoh a.biurvOir4 at asuhan.com
Thu Feb 19 13:35:14 EST 2009



Jonathan Cast-2 wrote:
> 
> Taking the `let open' syntax from `First-class
> Modules for Haskell' [1], we can say
> 
>   let open runST' = runST in
>   let
>     ref = runST' $ newSTRef 0
>     !() = runST' $ writeSTRef ref 1
>     !() = runST' $ writeSTRef ref 2
>   in runST' $ readSTRef ref
> 
> This type-checks because the let open gives us the *same* skolemized
> constant for s everywhere in the sequel.
> 

One answer, of course, is to lift the skolem type-constant into a
kind of IO-like type-monad. Sort of like getLine :: IO String,
which is still "constant" in a way, since the program 
doesn't vary.

You'd then want kind-level functions like
returnK :: * -> M * and the rest. It would be interesting
to see this made explicit in System F.

-- 
View this message in context: http://www.nabble.com/forall---ST-monad-tp22024677p22106898.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list