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
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
[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
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
[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
=
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
::