Skip to content

Commit 584b304

Browse files
authored
Add roles declarations to allow safe coercions (#20)
1 parent 45b6b30 commit 584b304

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/Effect.purs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import Control.Apply (lift2)
1515
-- | eventually produces a value of the type `Int` when it finishes.
1616
foreign import data Effect :: Type -> Type
1717

18+
type role Effect representational
19+
1820
instance functorEffect :: Functor Effect where
1921
map = liftA1
2022

src/Effect/Uncurried.purs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,45 @@ import Data.Monoid (class Monoid, class Semigroup, mempty, (<>))
136136
import Effect (Effect)
137137

138138
foreign import data EffectFn1 :: Type -> Type -> Type
139+
140+
type role EffectFn1 representational representational
141+
139142
foreign import data EffectFn2 :: Type -> Type -> Type -> Type
143+
144+
type role EffectFn2 representational representational representational
145+
140146
foreign import data EffectFn3 :: Type -> Type -> Type -> Type -> Type
147+
148+
type role EffectFn3 representational representational representational representational
149+
141150
foreign import data EffectFn4 :: Type -> Type -> Type -> Type -> Type -> Type
151+
152+
type role EffectFn4 representational representational representational representational representational
153+
142154
foreign import data EffectFn5 :: Type -> Type -> Type -> Type -> Type -> Type -> Type
155+
156+
type role EffectFn5 representational representational representational representational representational representational
157+
143158
foreign import data EffectFn6 :: Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type
159+
160+
type role EffectFn6 representational representational representational representational representational representational representational
161+
144162
foreign import data EffectFn7 :: Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type
163+
164+
type role EffectFn7 representational representational representational representational representational representational representational representational
165+
145166
foreign import data EffectFn8 :: Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type
167+
168+
type role EffectFn8 representational representational representational representational representational representational representational representational representational
169+
146170
foreign import data EffectFn9 :: Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type
171+
172+
type role EffectFn9 representational representational representational representational representational representational representational representational representational representational
173+
147174
foreign import data EffectFn10 :: Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type -> Type
148175

176+
type role EffectFn10 representational representational representational representational representational representational representational representational representational representational representational
177+
149178
foreign import mkEffectFn1 :: forall a r.
150179
(a -> Effect r) -> EffectFn1 a r
151180
foreign import mkEffectFn2 :: forall a b r.

0 commit comments

Comments
 (0)