Re: [Haskell-cafe] N and R are categories, no?

2007-03-15 Thread Ulf Norell
On 3/15/07, Steve Downey [EMAIL PROTECTED] wrote: EOk, i'm trying to write down, not another monad tutorial, because I don't know that much yet, but an explication of my current understanding of monads. But before I write down something that is just flat worng, I thought I'd get a cross check.

Re: [Haskell-cafe] Logic programming using lazy evaluation

2007-02-27 Thread Ulf Norell
On 2/27/07, Henning Thielemann [EMAIL PROTECTED] wrote: I suspect that someone has already done this: A Haskell library which solves a system of simple equations, where it is only necessary to derive a value from an equation where all but one variables are determined. Say You might want to

Re: [Haskell-cafe] Happy outputs parE - ideas on what to change in my .y file?

2007-01-29 Thread Ulf Norell
On Jan 27, 2007, at 11:11 AM, Mark Wassell wrote: Sometimes happy outputs 'parE' when I run it on my .y file? I believe it is coming from a part of Grammer.lhs which has the comment line This bit is a real mess, mainly because of the error message support. Are there any suggestions on

Re: [Haskell-cafe] Article review: Category Theory

2007-01-19 Thread Ulf Norell
On Jan 18, 2007, at 10:09 PM, Yitzchak Gale wrote: I wrote: Will (id :: A - A $!) do the trick? Ulf Norell wrote: The problem is not with id, it's with composition. For any f and g we have f . g = \x - f (g x) So _|_ . g = \x - _|_ for any g. OK, so then how about f .! g = ((.) $! f

Re: [Haskell-cafe] Article review: Category Theory

2007-01-19 Thread Ulf Norell
On Jan 19, 2007, at 1:06 PM, Yitzchak Gale wrote: Hmm. I wrote: for simplicity, we will ignore these distinctions But do we really want to do that? Are the monads that we use every day in Haskell really monads if we check the axioms using (.!) instead of (.) as we should? I'm not so sure

Re: [Haskell-cafe] Article review: Category Theory

2007-01-18 Thread Ulf Norell
On Jan 16, 2007, at 7:22 PM, David House wrote: Hey all, I've written a chapter for the Wikibook that attempts to teach some basic Category Theory in a Haskell hacker-friendly fashion. http://en.wikibooks.org/wiki/Haskell/Category_theory In the section on the category laws you say that the

Re: [Haskell-cafe] Re: Reversing a string of words: C# v Perl V Ruby v Haskell

2006-12-13 Thread Ulf Norell
On Dec 13, 2006, at 3:54 AM, Yitz Gale wrote: Nice. Here is something similar: reverseWords = concat . reverse . groupBy eqsp where eqsp x y = isSpace x == isSpace y This can be made even nicer using the 'on' function [1]: reverseWords = concat . reverse . groupBy ((==) `on` isSpace)

Re: [Haskell-cafe] Simple GADT parser for the eval example

2006-10-31 Thread Ulf Norell
On Oct 31, 2006, at 2:19 AM, Dimitrios Vytiniotis wrote: -- Give a GADT for representation types data R a where Rint :: R Int Rbool :: R Bool Rpair :: R a - R b - R (a,b) -- Give an existential type with a type representation data TermEx where MkTerm :: R a - Term a - TermEx -- we

Re: [Haskell-cafe] Last statement in 'do' must be an expression error.

2006-08-17 Thread Ulf Norell
On Aug 17, 2006, at 10:18 AM, Szymon ZÄ…bkiewicz wrote: Hi. When trying to compilke this code: {...} 8.if (a == 0) (b == 0) 9. then do 10. nr1 - read (prompt enter 1. number: ) 11. nr2 - read (prompt enter 2. number: ) 12. else do 13.let nr1 =