Re: [Haskell-cafe] Selecting Array type

2008-02-21 Thread Justin Bailey
2008/2/20 Jeff φ [EMAIL PROTECTED]: I'd love to find a good article that describes the ins and outs of multi parameter types, functional dependencies, and type assertions, in enough detail to resolve these surprises. A step-by-step walk through showing how the compiler resolve a type and

Re: [Haskell-cafe] Selecting Array type

2008-02-21 Thread Ryan Ingram
On 2/20/08, Jeff φ [EMAIL PROTECTED] wrote: -- SURPRISE 1: If function, arrTypeCast, is removed, (from both -- the class and instance) GHC assumes the kind of a and b are *, -- instead of * - * - * and produce . . . -- -- report3.hs:37:24: -- `UArray' is not applied to enough type

Re: [Haskell-cafe] Selecting Array type

2008-02-21 Thread Ryan Ingram
On 2/21/08, Jeff φ [EMAIL PROTECTED] wrote: Thanks again. I'm not familiar with type equality constraints. I could not find information on this in the GHC users guide. Is it documented somewhere? Section 7.3 here talks about equality constraints.

Re: [Haskell-cafe] Selecting Array type

2008-02-20 Thread Brent Yorgey
2008/2/19 Jeff φ [EMAIL PROTECTED]: instance SmartArraySelector UArray Bool where instance SmartArraySelector UArray Char where instance SmartArraySelector UArray Double where instance SmartArraySelector UArray Float where instance SmartArraySelector UArray Intwhere Well, I'm not

Re: [Haskell-cafe] Selecting Array type

2008-02-20 Thread Henning Thielemann
On Wed, 20 Feb 2008, Brent Yorgey wrote: 2008/2/19 Jeff ö [EMAIL PROTECTED]: instance SmartArraySelector UArray Bool where instance SmartArraySelector UArray Char where instance SmartArraySelector UArray Double where instance SmartArraySelector UArray Float where instance

Re: [Haskell-cafe] Selecting Array type

2008-02-20 Thread Ryan Ingram
Oleg's done a lot of work here; there's a bunch of magic that can be done with TypeCast. I took my inspiration from here: http://okmij.org/ftp/Haskell/typecast.html#ambiguity-resolution Here are some tests in ghci (note that I specialized the index type in test to Int to make this shorter; doing

Re: [Haskell-cafe] Selecting Array type

2008-02-20 Thread Jeff φ
On 2/19/08, Ryan Ingram [EMAIL PROTECTED] wrote: Oleg's done a lot of work here; there's a bunch of magic that can be done with TypeCast. I took my inspiration from here: http://okmij.org/ftp/Haskell/typecast.html#ambiguity-resolution . . . The trick is to represent whether a type is

[Haskell-cafe] Selecting Array type

2008-02-19 Thread Jeff φ
I'm trying to create a type called SmartArray. It is a type synonym for an array. If the element type can be unboxed, then SmartArray is an unboxed array. Otherwise, it is a boxed array. For instance, (SmartArray Int Double) is the same as (UArray Int Double) (SmartArray Int String) is the