On Fri, Mar 4, 2011 at 3:45 PM, Yves Parès limestr...@gmail.com wrote:
Hello,
For testing purposes, I am trying to make an overlay to IO which carries a
phantom type to ensure a context.
I define contexts using empty type classes :
class CtxFoo c
class CtxBar c
The overlay :
newtype
On Sat, 2011-03-05 at 00:51 +0100, Yves Parès wrote:
But I don't have an explicit type to put.
I cound do:
data CtxFooInst
instance CtxFoo CtxFooInst
and declare runFoo as this:
runFoo :: MyIO CtxFooInst a - IO a
But I loose the ability to make functions that can run several
Message: 8
Date: Sat, 5 Mar 2011 00:45:33 +0100
From: Yves Par?s limestr...@gmail.com
Subject: [Haskell-cafe] Use of uninstantiated type class
To: Haskell-Cafe haskell-cafe@haskell.org
Message-ID:
AANLkTimBg5TyG6ZNWCKaOT9dP=QE95MtC=q_t7rrp...@mail.gmail.com
Content-Type: text/plain
Hello,
For testing purposes, I am trying to make an overlay to IO which carries a
phantom type to ensure a context.
I define contexts using empty type classes :
class CtxFoo c
class CtxBar c
The overlay :
newtype MyIO c a = MyIO (IO a)
Then I define some methods that run only a specific
On 5 March 2011 10:45, Yves Parès limestr...@gmail.com wrote:
Hello,
For testing purposes, I am trying to make an overlay to IO which carries a
phantom type to ensure a context.
I define contexts using empty type classes :
class CtxFoo c
class CtxBar c
The overlay :
newtype MyIO c a =
But I don't have an explicit type to put.
I cound do:
data CtxFooInst
instance CtxFoo CtxFooInst
and declare runFoo as this:
runFoo :: MyIO CtxFooInst a - IO a
But I loose the ability to make functions that can run several contexts.
2011/3/5 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com
Okay, I found something which I'm sure already exists somewhere:
{-# LANGUAGE TypeFamilies, TypeOperators, EmptyDataDecls #-}
data True
type family a `Or` b :: *
type instance True `Or` a = True
type instance a `Or` True = True
type family Ctx ref impl :: *
data Foo
data Bar
type instance Ctx