DiffArray is an unsaturated type?

Hi, I note that in the base libraries, Data.Array.Diff is defined as: type DiffArray = IOToDiffArray IOArray However, IOToDiffArray takes 3 parameters. I thought this was not allowed in Haskell 98? Its annoying from my point of view because Hoogle wants to know the arity of a type, and if it has to chase down the arity of the RHS to do it, I probably just won't bother. Is there any difference between the above definition and: type DiffArray a b = IOToDiffArray IOArray a b Is the first prefered for any reason? Thanks Neil

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:Bulat.Ziganshin@gmail.com
participants (2)
-
Bulat Ziganshin
-
Neil Mitchell