Re: [Haskell-cafe] Is there good place to post Haskell alorithms/data structures that follow Steven Skiena's book on algorithm design and also Haskell code snippets that follow some of Knuth's books?

2010-06-22 Thread C K Kashyap
Hi Casey, Do you have these snippets already? If so, I can't wait to see them :) On Tue, Jun 22, 2010 at 4:42 AM, Twan van Laarhoven twa...@gmail.comwrote: Casey Hawthorne wrote: Is there good place to post Haskell alorithms/data structures that follow Steven Skiena's book on algorithm

Re: [Haskell-cafe] Re: Installing Haskell on OSX

2010-06-22 Thread Giuseppe Luigi Punzi
Hi again, El mar, 22-06-2010 a las 13:36 +1200, Hamish Mackenzie escribió: On 22 Jun 2010, at 08:01, Giuseppe Luigi Punzi Ruiz wrote: uhmm.. Now, with all gtk2 rebuilded with +no_x11 and +quartz I get Linking dist/build/leksah/leksah ... ld: library not found for -lgtk-x11-2.0

Re: [Haskell-cafe] design question: decision tree from Programming Collective Intelligence

2010-06-22 Thread Stephen Tetley
Hello Maybe permutation trees are a viable starting point? See the paper Parsing Permutation Phrases which appears to be on CiteSeer. Some slides are also here - the data type definitions and Functor instance for permutation trees are on page 18 (pdf index page 19):

Re: [Haskell-cafe] Re: Different choice operations in a continuation monad

2010-06-22 Thread Sebastian Fischer
On Jun 19, 2010, at 1:48 PM, Heinrich Apfelmus wrote: In my code, mzero is indeed an identity for orElse [...] The observation is any action can be brought into one of the forms mzero return a `mplus` return b `mplus` ... which corresponds to the list type [a] . Ok that makes sense

[Haskell-cafe] Re: Haddock Problem

2010-06-22 Thread Dominic Steinitz
malcolm.wallace malcolm.wallace at me.com writes: I haven't been following closely, but how did you install haddock? From a binary dist? Is it possible that one of the Windows binary dists has a baked-in location for something on the E: drive, which existed on the packager's machine but

[Haskell-cafe] Re: Continuations and coroutines

2010-06-22 Thread Heinrich Apfelmus
Paul Johnson wrote: Yves Parès wrote: It helps me understand better, but would you have some simple code that would do that ? http://www.cs.chalmers.se/~koen/pubs/jfp99-monad.ps You can also understand coroutines and continuations in terms of operational semantics. Here is a

[Haskell-cafe] Re: Different choice operations in a continuation monad

2010-06-22 Thread Heinrich Apfelmus
Sebastian Fischer wrote: Heinrich Apfelmus wrote: [...] you can implement your type as newtype CMaybe a = CMaybe { forall b . (a - [b]) - [b] } Yes. For me it was interesting to see how far we get by wrapping `Maybe` in `Codensity`: we get more than `Maybe` but not as much as `[]`.

[Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-22 Thread José Romildo Malaquias
Hello. I have been teaching an introductory course on compiler construction to our undergraduates students using Appel's Modern Compiler Implementation in Java. There are also versions of the book in ML and C. The books explain how to write a compiler for the Tiger programming language. Now I

Re: [Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-22 Thread Vo Minh Thu
2010/6/22 José Romildo Malaquias j.romi...@gmail.com: Hello. I have been teaching an introductory course on compiler construction to our undergraduates students using Appel's Modern Compiler Implementation in Java. There are also versions of the book in ML and C. The books explain how to

Re: [Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-22 Thread Felipe Lessa
On Tue, Jun 22, 2010 at 09:33:22AM -0300, José Romildo Malaquias wrote: In the variable escaping analysis phase of the compiler, a function findEscape looks for escaping variables and record this information in the escape fields of the abstract syntax. To do this the entire abstract syntax

Re: [Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-22 Thread Stephen Tetley
Hello Doaitse Swierstra has a Tiger compiler written in Haskell + UUAG as a demonstration for UUAG attribute grammar system. The package on Hackage only contains the derived source - i.e not the original attribute grammar code, but the generated Haskell source after running UUAG on the *.ag

Re: [Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-22 Thread José Romildo Malaquias
On Tue, Jun 22, 2010 at 02:30:04PM +0100, Stephen Tetley wrote: Hello Doaitse Swierstra has a Tiger compiler written in Haskell + UUAG as a demonstration for UUAG attribute grammar system. The package on Hackage only contains the derived source - i.e not the original attribute grammar

Re: [Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-22 Thread José Romildo Malaquias
On Tue, Jun 22, 2010 at 02:54:08PM +0200, Vo Minh Thu wrote: 2010/6/22 José Romildo Malaquias j.romi...@gmail.com: Hello. I have been teaching an introductory course on compiler construction to our undergraduates students using Appel's Modern Compiler Implementation in Java. There are

Re: [Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-22 Thread Vo Minh Thu
2010/6/22 José Romildo Malaquias j.romi...@gmail.com: On Tue, Jun 22, 2010 at 02:54:08PM +0200, Vo Minh Thu wrote: 2010/6/22 José Romildo Malaquias j.romi...@gmail.com: Hello. I have been teaching an introductory course on compiler construction to our undergraduates students using

Re: [Haskell-cafe] Tiger compiler: variable escaping analysis phase

2010-06-22 Thread José Romildo Malaquias
On Tue, Jun 22, 2010 at 10:01:37AM -0300, Felipe Lessa wrote: On Tue, Jun 22, 2010 at 09:33:22AM -0300, José Romildo Malaquias wrote: In the variable escaping analysis phase of the compiler, a function findEscape looks for escaping variables and record this information in the escape fields

[Haskell-cafe] Inferring the most general type

2010-06-22 Thread Job Vranish
Esteemed fellow haskellers, I recently ran into a very simple real life case where Haskell's rules for inferring the types for mutually recursive definitions resulted in a type that was less general than it could be. It took me a while to realize that the type error I was getting wasn't actually

[Haskell-cafe] TH instance code.

2010-06-22 Thread Andy Stewart
Hi all, I have below duplicate code, but i don't know how to use TH instance code. -- duplicate code start -- instance Variable PageType where toVariant = toVariant . show fromVariant x = fmap (\v - read v :: PageType) $

Re: [Haskell-cafe] TH instance code.

2010-06-22 Thread Edward Kmett
What you're looking for is something like: deriveVariable _t = [d| instance Variable $t where toVariant = toVariant . show fromVariant x = fmap (\v - read v :: $t) $ fromVariant x|] deriveVariable (conT ''PageType) deriveVariable (conT ''Int) deriveVariable (conT ''Maybe

Re: [Haskell-cafe] TH instance code.

2010-06-22 Thread Edward Kmett
v-- I had accidentally elided the _'s before the t's in the quasiquotation before. What you're looking for is something like: deriveVariable _t = [d| instance Variable $_t where toVariant = toVariant . show fromVariant x = fmap (\v - read v :: $_t) $ fromVariant x|]

Re: [Haskell-cafe] TH instance code.

2010-06-22 Thread Michael Snoyman
On Tue, Jun 22, 2010 at 6:24 PM, Andy Stewart lazycat.mana...@gmail.comwrote: Hi all, I have below duplicate code, but i don't know how to use TH instance code. -- duplicate code start -- instance Variable PageType where toVariant

Re: [Haskell-cafe] TH instance code.

2010-06-22 Thread Claus Reinke
I have below duplicate code, but i don't know how to use TH instance code. -- duplicate code start -- instance Variable PageType where toVariant = toVariant . show fromVariant x = fmap (\v - read v :: PageType) $ fromVariant x If

Re: [Haskell-cafe] ANN: bitspeak 0.0.1

2010-06-22 Thread Andrew Coppin
John Meacham wrote: In particular, a Huffman coding: http://en.wikipedia.org/wiki/Huffman_coding is ideal for this (assuming you just are taking advantage of frequency analysis). A dynamic Huffman Tree will even adapt as it is being used to whatever the current language is. Huffman Trees are

[Haskell-cafe] ANN: srec-0.0.0

2010-06-22 Thread Tom Hawkins
A little library for reading s-record files: http://hackage.haskell.org/package/srec -Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Minix

2010-06-22 Thread Henk-Jan van Tuyl
L.S., I just read about Minix and found a discussion [1] about Andrew Tanenbaum (the creator of Minix) wanting to try drivers written in Haskell on Minix. It has been four years since, is there currently a way to (cross)compile Haskell programs for Minix? Haskell well suited to write

Re: [Haskell-cafe] Re: ANN: bitspeak 0.0.1

2010-06-22 Thread Tony Finch
On Mon, 21 Jun 2010, Maurí­cio CA wrote: bitspeak is a small proof of concept application that allows writing text using only two commands (yes/no, 1/2, top/down etc.). There is a parallel between data compression algorithms and this sort of task, expressing a sentence in the minimal

[Haskell-cafe] Huffman Codes in Haskell

2010-06-22 Thread John Meacham
On Tue, Jun 22, 2010 at 06:24:22PM +0100, Andrew Coppin wrote: John Meacham wrote: In particular, a Huffman coding: http://en.wikipedia.org/wiki/Huffman_coding is ideal for this (assuming you just are taking advantage of frequency analysis). A dynamic Huffman Tree will even adapt as it is

Re: [Haskell-cafe] Huffman Codes in Haskell

2010-06-22 Thread Don Stewart
john: On Tue, Jun 22, 2010 at 06:24:22PM +0100, Andrew Coppin wrote: John Meacham wrote: In particular, a Huffman coding: http://en.wikipedia.org/wiki/Huffman_coding is ideal for this (assuming you just are taking advantage of frequency analysis). A dynamic Huffman Tree will even adapt

Re: [Haskell-cafe] Rewriting a famous library and using the same name: pros and cons

2010-06-22 Thread John Meacham
On Tue, Jun 08, 2010 at 11:21:54AM -0700, Gregory Crosswhite wrote: Or you just put an upper bound on the versions of the fgl library that your program will build against, as you should be doing anyway, and then nothing breaks. Until some package you rely on decides to upgrade and start using

Re: [Haskell-cafe] Huffman Codes in Haskell

2010-06-22 Thread Andrew Coppin
Don Stewart wrote: http://hackage.haskell.org/package/huffman A simple and pure Haskell implementation of the Huffman encoding algorithm. What the...? Oh, I see. It uses another package to handle the tricky sorting and searching stuff. Well, yeah, that would make the code a bit

Re: [Haskell-cafe] Rewriting a famous library and using the same name: pros and cons

2010-06-22 Thread Edward Kmett
The problem is that nothing breaks immediately. Then someone else comes along and transitively depends on your package and on another package, which depends on the newer version. Your users wind up with strange conflicts like that if they are using Parsec 3 they can't use HTTP. Or if they use

Re: [Haskell-cafe] Minix

2010-06-22 Thread Felipe Lessa
On Tue, Jun 22, 2010 at 08:54:26PM +0200, Henk-Jan van Tuyl wrote: I just read about Minix and found a discussion [1] about Andrew Tanenbaum (the creator of Minix) wanting to try drivers written in Haskell on Minix. It has been four years since, is there currently a way to (cross)compile

Re: [Haskell-cafe] Rewriting a famous library and using the same name: pros and cons

2010-06-22 Thread Gregory Crosswhite
There is no reason that your program couldn't link to multiple versions of the same package so that each library can access the version that it needs. In fact, GHC already does this, doesn't it? For example, I use a mixture of libraries in my programs that link to QuickCheck 1 and QuickCheck

Re: [Haskell-cafe] TH instance code.

2010-06-22 Thread Andy Stewart
Hi Edward, Thank you very much, your code works perfect! -- Andy Edward Kmett ekm...@gmail.com writes: v-- I had accidentally elided the _'s before the t's in the quasiquotation before. What you're looking for is something like: deriveVariable _t = [d|     instance Variable $_t where

Re: [Haskell-cafe] Huffman Codes in Haskell

2010-06-22 Thread Edward Kmett
On Tue, Jun 22, 2010 at 4:18 PM, Andrew Coppin andrewcop...@btinternet.comwrote: What the...? Oh, I see. It uses another package to handle the tricky sorting and searching stuff. Well, yeah, that would make the code a bit shorter... ;-) Even so, it's not nearly as elegant to behold as,

Re: [Haskell-cafe] Huffman Codes in Haskell

2010-06-22 Thread Max Rabkin
On Tue, Jun 22, 2010 at 10:18 PM, Andrew Coppin andrewcop...@btinternet.com wrote: Don Stewart wrote:    http://hackage.haskell.org/package/huffman    A simple and pure Haskell implementation of the Huffman encoding algorithm. What the...? Oh, I see. It uses another package to handle

Re: [Haskell-cafe] Re: Installing Haskell on OSX

2010-06-22 Thread Giuseppe Luigi Punzi Ruiz
I uninstalled all ports and macports, to try with gtk-osx Once I did all of this, leksah builds, but leksah-server don't, with problems with version of libgthread2. I'm at jhbuild build meta-gtk-osx-bootstrap step of GTK-OSX. Once the next step (jhbuild build meta-gtk-osx-core) is finished,

[Haskell-cafe] TypeFamillies and UndecidableInstances - why?

2010-06-22 Thread Maciej Piechotka
When I tried to do something like: {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies #-} class Test a where type TestMonad a :: * - * from :: a b - TestMonad a b to :: TestMonad a b - a b data Testable a b = Testable (a b) instance (Test a, Functor

Re: [Haskell-cafe] TypeFamillies and UndecidableInstances - why?

2010-06-22 Thread Brandon S. Allbery KF8NH
On Jun 22, 2010, at 21:41 , Maciej Piechotka wrote: test.hs:11:0: Constraint is no smaller than the instance head in the constraint: Functor (TestMonad a) (Use -XUndecidableInstances to permit this) In the instance declaration for `Functor (Testable a)' What is undecidable? a

[Haskell-cafe] Re: TypeFamillies and UndecidableInstances - why?

2010-06-22 Thread Maciej Piechotka
On Tue, 2010-06-22 at 21:51 -0400, Brandon S. Allbery KF8NH wrote: On Jun 22, 2010, at 21:41 , Maciej Piechotka wrote: test.hs:11:0: Constraint is no smaller than the instance head in the constraint: Functor (TestMonad a) (Use -XUndecidableInstances to permit this) In the

Re: [Haskell-cafe] ANN: srec-0.0.0

2010-06-22 Thread Ivan Miljenovic
For those others like me who have no idea what s-record files are: http://en.wikipedia.org/wiki/S-record On 23 June 2010 03:36, Tom Hawkins tomahawk...@gmail.com wrote: A little library for reading s-record files: http://hackage.haskell.org/package/srec -Tom

Re: [Haskell-cafe] TypeFamillies and UndecidableInstances - why?

2010-06-22 Thread Daniel Fischer
On Wednesday 23 June 2010 03:41:47, Maciej Piechotka wrote: When I tried to do something like: {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies #-} class Test a where type TestMonad a :: * - * from :: a b - TestMonad a b to :: TestMonad a b - a b data

Re: [Haskell-cafe] Huffman Codes in Haskell

2010-06-22 Thread ajb
G'day all. Quoting Andrew Coppin andrewcop...@btinternet.com: What the...? Oh, I see. It uses another package to handle the tricky sorting and searching stuff. Well, yeah, that would make the code a bit shorter... ;-) Even so, it's not nearly as elegant to behold as, say, the quicksort

Re: [Haskell-cafe] ANN: srec-0.0.0

2010-06-22 Thread Tom Hawkins
On Tue, Jun 22, 2010 at 9:08 PM, Ivan Miljenovic ivan.miljeno...@gmail.com wrote: For those others like me who have no idea what s-record files are: http://en.wikipedia.org/wiki/S-record Sorry, I should have been more clear. In embedded systems development, s-records are typically used to hold

[Haskell-cafe] Control.Alternative --- some and many?

2010-06-22 Thread Gregory Crosswhite
Hey everyone, Could someone explain to me (or point me to a reference explaining) the purpose of the some and many methods of the Alternative class? Also, there is a link posted in the documentation for Control.Applicative to a paper which describes the motivation behind the Applicative

[Haskell-cafe] Relating generated asm to Core

2010-06-22 Thread Rami Mukhtar
Hi, Can anyone tell me a way to identify the generated assembly (as found in the intermediate files produced by GHC) corresponding to a particular fragment of Core code. Thanks, Rami The information in this e-mail may be confidential and subject to legal

Re: [Haskell-cafe] Relating generated asm to Core

2010-06-22 Thread Don Stewart
Rami.Mukhtar: Hi, Can anyone tell me a way to identify the generated assembly (as found in the intermediate files produced by GHC) corresponding to a particular fragment of Core code. Hey Rami, I use the ghc-core tool: http://hackage.haskell.org/package/ghc-core Which displays both

[Haskell-cafe] checking types with type families

2010-06-22 Thread Evan Laforge
I have a parameterized data type: data Val result = VNum Double | VThunk (SomeMonad result) type Environ result = Map Symbol (Val result) I have a class to make it easier to typecheck Vals: class Typecheck a where from_val :: Val result - Maybe a instance Typecheck Double where

Re: [Haskell-cafe] checking types with type families

2010-06-22 Thread Ivan Miljenovic
On 23 June 2010 13:46, Evan Laforge qdun...@gmail.com wrote: I have a parameterized data type: data Val result = VNum Double | VThunk (SomeMonad result) type Environ result = Map Symbol (Val result) I have a class to make it easier to typecheck Vals: class Typecheck a where   from_val ::

Re: [Haskell-cafe] checking types with type families

2010-06-22 Thread Daniel Fischer
On Wednesday 23 June 2010 05:46:46, Evan Laforge wrote: I have a parameterized data type: data Val result = VNum Double | VThunk (SomeMonad result) type Environ result = Map Symbol (Val result) I have a class to make it easier to typecheck Vals: class Typecheck a where from_val :: Val

Re: [Haskell-cafe] TypeFamillies and UndecidableInstances - why?

2010-06-22 Thread Christopher Lane Hinson
On Wed, 23 Jun 2010, Maciej Piechotka wrote: When I tried to do something like: {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies #-} class Test a where type TestMonad a :: * - * from :: a b - TestMonad a b to :: TestMonad a b - a b data Testable a b =

[Haskell-cafe] Re: Huffman Codes in Haskell

2010-06-22 Thread Andrew Bromage
G'day all. But honestly, it's just not that hard to do in linear time, assuming the symbols are sorted by frequency: Or maybe not so easy. Andrew Bromage ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Control.Alternative --- some and many?

2010-06-22 Thread Christopher Done
I'm not sure how Alternative differs from MonadPlus, other than being defined for Applicative rather than Monad. They have the same laws (identity and associativity). Some and many are probably motivated by their usefulness in parsers. Hence optional, etc. I'm sure there are plenty of other