What is the basic philosophy for Bool being a member of Ord?
What justifies False True?
The implication ordering,
which on this smallest non-trivial Boolean algebra
happens to be a linear order,
is therefore the natural candidate for Ord,
the type class of ``default linear orders''.
P.S. Have some cute code:
Control.Monad.Fix.fix ((1:) . scanl (+) 1)
Cute!
But what an un-cute qualified name:
:t Control.Monad.Fix.fix
Control.Monad.Fix.fix :: (a - a) - a
Has nothing to do with monads,
and would perhaps be considered as ``out of Control'' in any case...
;-)
Jules Bean [EMAIL PROTECTED] wrote,
concerning the problem of getting at the types of local definitions:
Simon Peyton-Jones wrote:
The principal difficulties here are to do with what do we want
rather the implementation challenges.
1. Should the compiler print the type of every
* It would be nice if this worked inside the do-notation, too:
do x :: Ordering
x - m
(This is curently a syntax error.)
I think the following works with -fglasgow-exts:
do (x :: Ordering) - m
I know, but it is not as nice!
;-)
Wolfram
For absorbing the functional style of programming (which is what you really
should be working on at this point),
For functional style and the reasoning attitude associated with lazy
functional programming, the following book is a good introduction:
@Book{Bird-2000,
author = {Richard
If you look at the definition of 'powers' you'll note it's infinite. So
there's no easy way to take the product of this list, if I don't know
how many items to take from it.
So you need finite lists.
-- how many of the prime p are in the unique factorisation
-- of the integer n?
\begin{code}
catWithLen :: [a] - (Int - [a]) - [a]
catWithLen xs f = h 0 xs
where
h k [] = f k
h k (x : xs) = case succ k of-- forcing evaluation
k' - x : h k' xs
\end{code}
Thanks but this gives a different problem:
I have re-written SHA1 so that is more idiomatically haskell and it is easy
to
see how it implements the specification. The only problem is I now have a
space leak. I can see where the leak is but I'm less sure what to do about
getting rid of it.
Here's the offending
Hi Connor,
A puzzle for you (and for me too). I just tried to translate an old
Epigram favourite (which predates Epigram by some time) into GADT-speak.
It went wrong. I had a feeling it might. I wonder how to fix it: I
imagine it's possible to fix it, but that some cunning may be
Tomasz Zielonka [EMAIL PROTECTED] wrote
Wed, 26 Oct 2005 13:37:29 +0200:
Speaking about casts, I was playing with using GADTs to create a
non-extensible version of Data.Typeable and Data.Dynamic.
I wonder if it's possible to write such a thing without GADTs (and
unsafeCoerce, which is
On 26 Oct 2005 10:11:25 -0400, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Tomasz Zielonka [EMAIL PROTECTED] wrote
Wed, 26 Oct 2005 13:37:29 +0200:
Speaking about casts, I was playing with using GADTs to create a
non-extensible version of Data.Typeable and Data.Dynamic.
11 matches
Mail list logo