Records in Haskell
AntC
anthony_clayden at clear.net.nz
Fri Mar 2 02:04:13 CET 2012
Ian Lynagh <igloo <at> earth.li> writes:
>
> > * an extra arg to Has (how does the constraint sugar cope?)
>
> You can infer ft from the f.
>
Let me explain better what I mean by "two private namespaces", then we'll try
to understand how your proposal goes ...
module T where
data FieldT = Field
data RecT = RecT{ Field :: Int }
...
module U where
data FieldU = Field
data RecU = RecU{ Field :: Bool }
...
module V where
import T -- also consider either/both
import U -- imports hiding (Field)
data RecV = RecV{ Field :: String } -- am I sharing this Field?
-- who with?
...
... r.Field ... -- is this valid?, if not what is?
... r{ Field = e } -- likewise
(Oh yeah, imports and hiding: how do I do that for these non-String-type-Kinds?
And is this allowed?:
data NotaField = Constr Int Bool
data AmIaRec = AmI{ Constr :: String }
...
... r.Constr ...
It's all getting very tangled trying to squeeze constructors into other roles.)
AntC
More information about the Glasgow-haskell-users
mailing list