Re: [Haskell-cafe] Circular enums

2008-02-04 Thread Henning Thielemann
On Sat, 2 Feb 2008, Ben Butler-Cole wrote: > [Resend with formatting maybe fixed.] > > Hello > > I'm trying to define functions that allow you to traverse a bounded > enumeration, "wrapping" at the start and the end. > > My implementation looks like this: > > next, prev :: (Enum a, Bounded a

Re: [Haskell-cafe] Circular enums

2008-02-02 Thread Ben Butler-Cole
On Feb 2, 2008, at 18:41 , I wrote: > No instance for (Bounded a) > arising from use of `maxBound' at Hbot.hs:6:34-41 > (...) > My (clearly flawed) understanding of the signature I've specified > for 'turn' means *exactly* that a is Bounded. Br

[Haskell-cafe] Circular enums

2008-02-02 Thread Ben Butler-Cole
[Resend with formatting maybe fixed.] Hello I'm trying to define functions that allow you to traverse a bounded enumeration, "wrapping" at the start and the end. My implementation looks like this: next, prev :: (Enum a, Bounded a) => a -> a next = turn 1 prev = turn (-1) t

Re: [Haskell-cafe] Circular enums

2008-02-02 Thread Brandon S. Allbery KF8NH
On Feb 2, 2008, at 18:41 , Ben Butler-Cole wrote: No instance for (Bounded a) arising from use of `maxBound' at Hbot.hs:6:34-41 (...) My (clearly flawed) understanding of the signature I've specified for 'turn' means *exactly* that a is Bounded. The problem is that the scope of a

[Haskell-cafe] Circular enums - resend

2008-02-02 Thread Ben Butler-Cole
[Resending with formatting fixed.] Hello I'm trying to define functions that allow you to traverse a bounded enumeration, "wrapping" at the start and the end. My implementation looks like this: next, prev :: (Enum a, Bounded a) => a -> a next =

[Haskell-cafe] Circular enums

2008-02-02 Thread Ben Butler-Cole
Hello I'm trying to define functions that allow you to traverse a bounded enumeration, "wrapping" at the start and the end. My implementation looks like this: next, prev :: (Enum a, Bounded a) => a -> a next = turn 1 prev = turn (-1) turn ::