Re: [Haskell-cafe] Assignment, Substitution or what?

2007-10-01 Thread Malte Milatz
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. ___

Re: [Haskell-cafe] Composition Operator

2007-09-22 Thread Malte Milatz
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

Re: [Haskell-cafe] Norvig's Sudoku Solver in Haskell

2007-08-26 Thread Malte Milatz
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

Re: [Haskell-cafe] How to fix linker errors when creating a package using cabal

2007-08-25 Thread Malte Milatz
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

Re: [Haskell-cafe] Question of a manual computation on Reader Monad.

2007-08-25 Thread Malte Milatz
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 $

Re: [Haskell-cafe] help understanding lazy evaluation

2007-08-23 Thread Malte Milatz
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*

Re: [Haskell-cafe] Explaining monads

2007-08-14 Thread Malte Milatz
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

Re: [Haskell-cafe] IO within parser

2007-08-12 Thread Malte Milatz
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

Re: [Haskell-cafe] Derivation of Eq given Ord

2007-08-09 Thread Malte Milatz
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 }

Re: [Haskell-cafe] Derivation of Eq given Ord

2007-08-09 Thread Malte Milatz
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

Re: [Haskell-cafe] GHC 6.6.1: Where is Graphics.SOE ?

2007-07-17 Thread Malte Milatz
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

[Haskell-cafe] SHA1 again

2007-07-15 Thread Malte Milatz
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

Re: [Haskell-cafe] Re: SHA1 again

2007-07-15 Thread Malte Milatz
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

Re: [Haskell-cafe] Re: SHA1 again

2007-07-15 Thread Malte Milatz
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

Re: [Haskell-cafe] Re: SHA1 again

2007-07-15 Thread Malte Milatz
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

Re: [Haskell-cafe] ANNOUNCE: HCL v1.0 -High-level library for building command line interfaces

2007-07-10 Thread Malte Milatz
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

Re: [Haskell-cafe] Fun with ByteStrings [was: A very edgy language]

2007-07-08 Thread Malte Milatz
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:

Re: [Haskell-cafe] Fun with ByteStrings [was: A very edgy language]

2007-07-08 Thread Malte Milatz
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

[Haskell-cafe] HDBC and Sqlite3: SqlValue is restricted to SqlString

2007-06-27 Thread Malte Milatz
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);

Re: [Haskell-cafe] Building Yi (and wider Cabal stuff)

2007-06-17 Thread Malte Milatz
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

Re: [Haskell-cafe] Re: New book: Real-World Haskell!

2007-05-31 Thread Malte Milatz
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

Re: [Haskell-cafe] Re: (Chaos) [An interesting toy]

2007-05-07 Thread Malte Milatz
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.