[Haskell-cafe] DiffArray is an unsaturated type?

Bulat Ziganshin bulat.ziganshin at gmail.com
Tue Aug 22 14:00:29 EDT 2006

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

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

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Locking.hs
Type: application/octet-stream
Size: 6466 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20060822/ca2d5494/Locking.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kinds2.hs
Type: application/octet-stream
Size: 498 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20060822/ca2d5494/kinds2.obj

More information about the Haskell-Cafe mailing list