Hello Neil,

Monday, August 21, 2006, 7:23:41 PM, you wrote:

> type DiffArray  = IOToDiffArray IOArray

> Is there any difference between the above definition and:
> type DiffArray a b = IOToDiffArray IOArray a b

> Is the first prefered for any reason?

look at http://hackage.haskell.org/trac/ghc/ticket/785

i have a large experience of dealing with such beasts while i
redeveloped Array library. what i can say is that _both_ variants
create (different) problems. the following code demonstrates case
where "IOUArray i e" don't work:

{-# OPTIONS_GHC -cpp -fglasgow-exts #-}
data UnboxedMutableArray i e  =  UMA !i !i [e]
type IOUArray i e = UnboxedMutableArray i e   -- try "type IOUArray = 
UnboxedMutableArray"
data Dynamic a i e = Dynamic (a i e)
type DynamicIOUArray s = Dynamic IOUArray


i have also attached another example what simply don't works and i
don't know how to make it work (without changing Locking.hs)

saying about Array modules, there is a number of places where type
aliased should be used - in "instance IArray" declarations (what use
_constructor_ class and afaik H98 _prohibits_ using of
partially-applied type synonym!), in INSTANCE_TYPEABLE macros (i don't
remember exact problem but i exactly remember that i had problem with
one of declaration style)

one more interesting thing to mention is that GHC (but not Hugs)
allows to declare kinds of type arguments in "type" declarations:

-- | Type functions which converts universal ST/IO types to IO-specific ones
type IOSpecific  (a :: * -> *)           = a RealWorld
type IOSpecific2 (a :: * -> * -> *)      = a RealWorld
type IOSpecific3 (a :: * -> * -> * -> *) = a RealWorld

it will be interesting to include in Haskell kind declarations for type
synonyms:

type IOUArray :: * -> * -> *
type IOUArray = UnboxedMutableArray


-- 
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]

Attachment: Locking.hs
Description: Binary data

Attachment: kinds2.hs
Description: Binary data

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

Reply via email to