PR Stanley:
f x = x + x
Is the x use to create a pattern in the definition and when f is
called it's replaced by a value?
Those equation-like definitions are syntactic sugar for lambda
abstractions. f could as well be defined as f = \x - x + x.
___
Peter Verswyvelen:
Personally I also find the following a good explanation, since it does
not introduce lambdas or other scary things for newbies.
f . g = composite
where composite x = f (g x)
I suppose that the usual definition, which is (f . g) x = f (g x), is
clear enough. No
manu [EMAIL PROTECTED]:
After reading Peter Norvig's take on writing a Sudoku solver (http://
norvig.com/sudoku.html)
I decided that I would port his program to Haskell
Your program was wrapped by your mail client, so you may want to hpaste
your program for easier digestion.
Being a
Peter Verswyvelen:
However, when building an example that uses that package, I get a lot of
linker errors (see log below)
What options did you use when compiling the example?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Peter Cai:
Hi all,
In order to improve my understanding of monad, I am trying to do some manual
computation on Reader Monad but I got some problem.
The computation is like this:
--instance Monad (Reader e) where
--return a = Reader $ \e - a
--(Reader r) = f = Reader $
Stefan O'Rear wrote:
As is usual for mathematical things, there are many equivalent
definitions. My two favorites are:
1. Normal order reduction
In the λ-calculus, lazy evaluation can be defined as the (unique up to
always giving the same answer) evaluation method, which, if *any*
Dan Piponi, Tue, 14 Aug 2007 11:52:16 -0700:
All functions can be viewed as recipes. (+) is a recipe. Give me some
ingredients (two numbers) and I'll use (+) to give you back their sum.
(+) is not a recipe, it is a chef. On the other hand,
(return 5 :: State Integer) is a recipe. You need a
Gregory Propf, Sat, 11 Aug 2007 13:06:43 -0700:
but the type of liftIO is baffling
class Monad m = MonadIO m where
liftIO :: IO a - m a
But how do you define this function? There is no constructor for IO a that
you can take apart.
If not using unsafePerformIO, which is usually not
Dougal Stanton, Thu, 9 Aug 2007 16:57:26 +0100:
Is there a reason why automatic derivation of Ord without Eq doesn't
do the sensible thing and just derive Eq anyway?
newtype Id a = Id { a :: String }
deriving (Read, Show, Eq, Ord)
newtype Ego a = Ego { b :: String }
I wrote:
instance Eq Ego = Eq Ord where ...
This should have been
instance Eq (Ego a) = Ord (Ego a)
Malte
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Dmitri O.Kondratiev:
It looks like Graphics.SOE does not anymore exist in GHC 6.6.1.
Where one can get it or what to use instead of it?
You may try Gtk2Hs, which includes an implementation of SOE, called
Graphics.SOE.Gtk. (It works independently of the actual Gtk API.) Use
then the darcs
See the following link for a purely functional and straight-forward
implementation of SHA1. Disclaimer: Please be kind to me, I haven't
done much Haskell (yet). And I know nothing about SHA1 except its
specification.
http://hpaste.org/1695#a2
It performs better than the SHA1 algorithm
Dominic Steinitz:
Malte Milatz:
http://hpaste.org/1695#a2
It performs better than the SHA1 algorithm in Crypto: It is faster by a
factor of approximately e. It is also competitive (regarding time)
with the »unsafe« SHA1 implementation posted here some days ago,
Great. Can you
I wrote:
Before I started tweaking (with the help of the IRC channel), I had read
the input in as a ByteString, then unpacked it to [Word8] for further
processing.
I forgot to mention that I still used ByteString.length here. That may
be a very important factor.
Malte
Anatoly Yakovenko:
you probably got crappy timings with mine because it was compiled with
-prof, and without all the optimization options.
Alright, with your current version and without -prof I get
real0m1.176s
user0m1.104s
sys 0m0.056s
while mine doesn't get better than (thanks
Justin Bailey:
I'm please to announce HCL 1.0 - a library for building command line
interfaces. [...]
Included with the library is a hangman game, so if nothing else you
can enjoy that.
When building on Linux something gets confused because of filenames in
Windows style. Namely, hangman
Tillmann Rendel:
As I understand it (wich may or may not be correct):
A normal Haskell string is basically [Word8]
Hm, let's see whether I understand it better or worse. Actually it is
[Char], and Char is a Unicode code point in the range 0..1114111 (at
least in GHC). Compare:
Stefan O'Rear:
Char is just a code point. It's a 32 bit integer (64 on 64-bit
platforms due to infelicities in the GHC backend) with a code point.
[...]
The GHC IO functions truncate down to 8 bits. There is no way in GHC to
read or write full UTF-8, short of doing the encoding yourself
It's always good to know there's a general Haskell mailing list to ask
questions. I'm experimenting with the HDBC package in combination with
Sqlite3.
Here's my example table:
sqlite .schema foos
CREATE TABLE foos (id integer primary key, flag bool,
comment text);
Michael T. Richter:
I'm trying to build Yi (from the darcs repository) to take a look at
it.
I tried that, too, and it seems to me that if you use a different GHC
version than the developers have, you're very likely to be struck. (Now
how will I know what version they use?)
The README that
Simon Marlow:
While we're on fish, what's wrong with the humble Haddock? :-)
It may at least make for a tasty curry ...
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Sorry, my mail client fooled me, too, so here it is again:
Andrew Coppin:
What I'm trying to say is, I would have expected, say,
resultant :: [Vector2] - Vector2
resultant = sum
to run faster than
resultant = sum
In the latter case, we have resultant :: (Num n) = [n] - n.
22 matches
Mail list logo