
Matthias Fischmann wrote:
Do you expect the contained type x to change during a sequence of monadic actions? e.g. would you ever use (>>=) at the type 'Permutation Int -> (Int -> Permutation Bool) -> Permutation Bool'?
no, i don't need that. but aside from the fact that
data Permutation k v = Permutation [(k, v)] instance (Ix k) => Monad (Permutation k)
is redundant (i think of the permutation as a function applicable to arbitrary lists): how would that change anything? my definition of return still doesn't work. or how would you redefine 'return'?
Ah. Yes, my approach falls over because it lacks two things. #1: a distinguished value of the Ix-constrained type k, to pair off with return's argument. #2: a purpose. I don't have a clear idea of what a do-block in a permutation monad ought to mean. Whoops! <font color=red>:-]</font> Regards, Tom (crawling back under his rock)

On Sun, Oct 08, 2006 at 10:57:46PM +1300, tpledger@ihug.co.nz wrote:
To: haskell-cafe@haskell.org From: tpledger@ihug.co.nz Date: Sun, 08 Oct 2006 22:57:46 +1300 Subject: [Haskell-cafe] collection monads
Matthias Fischmann wrote:
Do you expect the contained type x to change during a sequence of monadic actions? e.g. would you ever use (>>=) at the type 'Permutation Int -> (Int -> Permutation Bool) -> Permutation Bool'?
no, i don't need that. but aside from the fact that
data Permutation k v = Permutation [(k, v)] instance (Ix k) => Monad (Permutation k)
is redundant (i think of the permutation as a function applicable to arbitrary lists): how would that change anything? my definition of return still doesn't work. or how would you redefine 'return'?
Ah. Yes, my approach falls over because it lacks two things. #1: a distinguished value of the Ix-constrained type k, to pair off with return's argument. #2: a purpose. I don't have a clear idea of what a do-block in a permutation monad ought to mean. Whoops! <font color=red>:-]</font>
yes, me neither. i thought of something like sequencial execution of permutations, and was hoping it was similar enough to strings and concat / join. but it seems it's something else... ok, permutations are not that monadic, really. i'll try to live with it. (-: matthias
participants (2)
-
Matthias Fischmann
-
tpledger@ihug.co.nz