Haskell-Cafe -- confirmation of subscription -- request 321501

2002-08-08 Thread Cyril Baratoff
 

Combining type constraints

2002-08-08 Thread Andrew J Bromage
G'day all. I have a large number of functions all of which use the same set of type constraints, such as: > foo :: (Monad m, Ord t, Show t) => ... Ideally, I'd like to combine them into one typeclass. At the moment, I'm using the equivalent of: > class (Monad m, Ord t, Show t) => Constr

Re: Modification of State Transformer

2002-08-08 Thread Shawn P. Garbett
> Btw: This has already been done, in GHC: see the ST module in GHC's > library > . This list is great. The implementation in the ST module solves the problem and I understand how it works. Shawn -- You're in a maze of

Transformations of cyclic graphs [Was: Efficiency of list indices in definitions]

2002-08-08 Thread oleg
[Moved to Haskell-Cafe] Hello! Cycles sure make it difficult to transform graphs in a pure non-strict language. Cycles in a source graph require us to devise a way to mark traversed nodes -- however we cannot mutate nodes and cannot even compare nodes with a generic ('derived') equality operato

Re: Modification of State Transformer

2002-08-08 Thread Jon Cast
"Shawn P. Garbett" <[EMAIL PROTECTED]> wrote: > I'm trying to modify Richard Bird's state transformer. The example > in his book (_Introduction_to_Functional_Programming_using_Haskell_) > has State defined as a explicit type. > I.e. Here's the relevant snippet: > -- State transformer definition

Re: Modification of State Transformer

2002-08-08 Thread Ken Shan
On 2002-08-08T14:11:54-0500, Shawn P. Garbett wrote: > newtype St a s = MkSt (s -> (a, s)) > instance Monad St where This line should say instance Monad (St a) where because it is (St a) that is a Monad, not St by itself. -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ke

Modification of State Transformer

2002-08-08 Thread Tom Pledger
Tom Pledger writes: | Shawn P. Garbett writes: : | | Inferred kind: (* -> * -> *) -> * : | In turn, s corresponds to the third * in the inferred kind in the | error message. Oops! Sorry, the third * is the result of applying St to two types. The second of those two types, s, corre

Modification of State Transformer

2002-08-08 Thread Tom Pledger
Shawn P. Garbett writes: : | What I want is something like this, so that the state transformer has a | generic state type: | | newtype St a s = MkSt (s -> (a, s)) | | apply :: St a s -> s -> (a, s) | apply (MkSt f) s = f s | | instance Monad St where | return x = Mk