Hi Kean,
looks cool.
I get your point about static typing.
I guess that adding a fold operator would make your implementation more
complete.
Oleg has also encountered some of your operations (as you probably know):
http://www.haskell.org/pipermail/haskell/2003-August/012355.html
(Oleg also
I did not know about Oleg's posting, as I originally said, I based my implementation on
a paper by Conor McBride. Oleg is addressing the question of type safe casting, rather
than generic storage, so his code is a bit different. Infact his class:
class TypeSeq t s where
type_index:: t - s -
I have written a first attempt at a fold function for the heterogenious list:
class RFold i r where
rFold :: (forall a . a - i - i) - i - r - i
instance RFold i RNil where
rFold f i RNil = i
instance RFold i r = RFold i (a `RCons` r) where
rFold f i (x `RCons` xs) = f x (rFold f i xs)
I have written a first attempt at a fold function for the heterogenious list:
class RFold i r where
rFold :: (forall a . a - i - i) - i - r - i
instance RFold i RNil where
rFold f i RNil = i
instance RFold i r = RFold i (a `RCons` r) where
rFold f i (x `RCons` xs) = f x (rFold f i xs)
Though I haven't tried it, the explicit 'Sat' dictionary representation
would probably work here, something like:
data ShowD a = ShowD { showD :: a - String }
-- our explicit dictionary for show, would need one of
-- these for each class we care about
-- the satisfaction class:
class
On Tue, Mar 09, 2004 at 01:04:59AM +0100, Wolfgang Thaller wrote:
So I assume this is on powerpc-linux?
Yup, sorry (and the others are all Linux too).
Thanks
Ian
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
Hi,
If I have this Foo.hs:
---
module Foo (foo) where
import Word (Word8)
import Control.Monad.ST (ST)
import Data.Array.ST (STUArray, writeArray)
foo :: STUArray s Int Word8 - [Word8] - Int - ST s ()
foo arr ps i = writeArray arr i w
where i' = 4 * i
w =
Ok... After playing with these types, I could not get it to work with
the satFold
below. However it did inspire me to try something else, and this seems
to work
quite well.
First redefine the RFold function to use RFoldFn class as its operator.
Then create
instances of RFoldFn to do what you
On 09.03.2004, at 15:53, Ian Lynagh wrote:
On Tue, Mar 09, 2004 at 01:04:59AM +0100, Wolfgang Thaller wrote:
So I assume this is on powerpc-linux?
Yup, sorry (and the others are all Linux too).
Ah yes, that -static flag was lurking there from the old AIX port. It's
definitely OK to remove it.