Re: [Haskell-cafe] Bathroom reading

2007-08-14 Thread Brent Yorgey
So you decide to print up some one-liner style programs into a little booklet. Something between credit-card and postcard sized, with a neat but mind-bending program on it. Don Stewart occasionally swoops in with some fixpoint malarkey to defuse heated discussions. I mean that kind of thing,

Re: [Haskell-cafe] Bathroom reading

2007-08-14 Thread Brent Yorgey
On 8/14/07, Dougal Stanton [EMAIL PROTECTED] wrote: On 14/08/07, Brent Yorgey [EMAIL PROTECTED] wrote: Clearly, we need to actually put together such a book! I'm imagining something where you have two mostly blank facing pages, with the code by itself in the middle of the right page

Re: [Haskell-cafe] Looking at program execution

2007-08-16 Thread Brent Yorgey
On 8/16/07, Ian Duncan [EMAIL PROTECTED] wrote: Is there any way to view the steps that a haskell program goes through step by step? I'm thinking something similar to what I've seen in things I've been reading. For example: foldl (+) 0 [1..10] = (0+1) = ((0+1)+2) = (((0+1)+2)+3) = etc.

Re: [Haskell-cafe] Basic question....

2007-08-17 Thread Brent Yorgey
On 8/17/07, rodrigo.bonifacio [EMAIL PROTECTED] wrote: Hi all. I want to create the following polymorphic type (EnvItem) that we can apply two functions (envKey and envValue). I tried the following: type Key = String data EnvItem a = EnvItem (Key, a) envKey :: EnvItem (Key, a) -

Re: workaround found, pipe it through ghci Re: [Haskell-cafe] -f flag to runghc broken, or is it just me? (because trying switch elegantly between ghc 6.6 and ghc 6.7)

2007-08-22 Thread Brent Yorgey
this works. now if only there were a quiet option for ghci... But there is! It's called -v0. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] defining mapPairs function

2007-08-29 Thread Brent Yorgey
On 8/29/07, Alexteslin [EMAIL PROTECTED] wrote: Hello, I just came across with this question on the exam and can not think of implementing it. Wait, is this an exam for a class you're taking? Or just a problem from an exam that you're trying to solve for fun? If the former, it really

Re: [Haskell-cafe] Looking for suggestions to improve my algorithm

2007-08-29 Thread Brent Yorgey
On 8/29/07, David Frey [EMAIL PROTECTED] wrote: Hello Haskellers, I have been trying to learn a bit about Haskell by solving Project Euler problems. For those of you who don't know what Project Euler is, see http://projecteuler.net After solving problem 21, which is related to amicable

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Brent Yorgey
On 8/30/07, Peter Hercek [EMAIL PROTECTED] wrote: Hi, I find the feature that the construct let x = f x in expr assigns fixed point of f to x annoying. The reason is that I can not simply chain mofifications a variable like e.g. this: f x = let x = x * scale in let x = x +

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Brent Yorgey
On 8/30/07, Brent Yorgey [EMAIL PROTECTED] wrote: The way to combine functions into a pipeline is by using function concatenation: Oops, of course I meant function composition instead of function concatenation. -Brent ___ Haskell-Cafe mailing

Re: [Haskell-cafe] let and fixed point operator

2007-08-30 Thread Brent Yorgey
It's really maddening to write 50,000 lines of code, eventually get it to compile, run it, and have the program lock up and start consuming so much virtual memory that the entire PC becomes unstable within seconds. (This isn't helped by the fact that Ctrl+C doesn't seem to make either GHCi

Re: [Haskell-cafe] defining mapPairs function

2007-09-01 Thread Brent Yorgey
On 9/1/07, Alexteslin [EMAIL PROTECTED] wrote: Hi, It is the former, but I sat an exam and trying to discuss my exam answers which will make no difference to what so ever to an exam, as an exam duration was 1.5 hours. Which means that no matter how much i would like to try to amend my

Re: [Haskell-cafe] [Off topic] Proving an impossibility

2007-09-03 Thread Brent Yorgey
On 9/3/07, Vimal [EMAIL PROTECTED] wrote: Hi In my Paradigms of Programming course, my professor presents this piece of code: while E do S if F then break end T end He then asked us to *prove* that the above programming fragment cannot be implemented just using if and

Re: [Haskell-cafe] Learning advice

2007-09-06 Thread Brent Yorgey
On 9/6/07, Chris Saunders [EMAIL PROTECTED] wrote: So far I'm finding Haskell difficult – I may be too thick. Once upon a time there was a young man who wanted to be a race car driver. He bought an old, junky car with a souped-up engine (after all, that's what all his friends were using). It

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Brent Yorgey
Just bookmark: http://haskell.org/hoogle It's not perfect, but it probably solves lots of your problems. And if you use Firefox, you can even install Hoogle as one of the search engines in the upper-right search box. Nice and fast! -Brent ___

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Brent Yorgey
Well, for the default Google searchbox the advantage is: Ctrl-K search phrase ENTER versus grab mouse .. point ... click ... move hand back to keyboard ... type search phrase, ENTER I never used any of the secondary search bars. Unless I can define a shortcut to access hoogle

Re: [Haskell-cafe] Can somebody give any advice for beginners?

2007-09-11 Thread Brent Yorgey
On 9/11/07, clisper [EMAIL PROTECTED] wrote: haskell is greate but i don't know how to start. A good place to start is the Haskell wiki: http://haskell.org/haskellwiki/Haskell On the left, look under Learning Haskell -- there's all kinds of great stuff linked from there. I would also

Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread Brent Yorgey
On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote: Hi take 1000 [1..3] still yields [1,2,3] I thought it was supposed to return an error. Any ideas? Thanks, Paul If for some reason you want a version that does return an error in that situation, you could do something like the following:

Re: [Haskell-cafe] Is take behaving correctly?

2007-09-11 Thread Brent Yorgey
On 9/11/07, Don Stewart [EMAIL PROTECTED] wrote: byorgey: On 9/11/07, PR Stanley [EMAIL PROTECTED] wrote: Hi take 1000 [1..3] still yields [1,2,3] I thought it was supposed to return an error. Any ideas? Thanks, Paul If for some reason you want a

Re: [Haskell-cafe] Haskell Cheat Sheet?

2007-09-25 Thread Brent Yorgey
On 9/25/07, brad clawsie [EMAIL PROTECTED] wrote: On Tue, Sep 25, 2007 at 01:04:56PM -0700, Evan Klitzke wrote: Has anybody made (or have a link to) a Haskell reference cheat sheet? the zvon ref is pretty close: http://www.zvon.org/other/haskell/Outputglobal/index.html in that it

Re: [Haskell-cafe] int to bin, bin to int

2007-09-28 Thread Brent Yorgey
On 9/27/07, PR Stanley [EMAIL PROTECTED] wrote: Hi intToBin :: Int - [Int] intToBin 1 = [1] intToBin n = (intToBin (n`div`2)) ++ [n `mod` 2] binToInt :: [Integer] - Integer binToInt [] = 0 binToInt (x:xs) = (x*2^(length xs)) + (binToInt xs) Any comments and/or criticisms on the above

Re: [Haskell-cafe] Newb question about map and a list of lists

2007-09-28 Thread Brent Yorgey
Just be careful to write: (map.map) read l or map.map $ read l actually, map . map $ read l does not work, that's the same as (map . map) (read l), whereas (map . map) read l is the same as ((map . map) read) l. My guess is that Jules wrote that part while asleep. =) -Brent

Re: [Haskell-cafe] Rewriting ord (revisited)

2007-09-30 Thread Brent Yorgey
The compiler must be one hell of a machine. I wonder if the source code is available to the public. It is, and it is. =) http://hackage.haskell.org/trac/ghc/wiki/Building/GettingTheSources -Brent ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Rewriting filter with foldr

2007-09-30 Thread Brent Yorgey
On 9/30/07, PR Stanley [EMAIL PROTECTED] wrote: Hi filter :: (a - Bool) - [a] - [a] filter f = foldr (\x - \xs - if (f x) then (x:xs) else xs) [] Somehow I feel this could be done more elegantly. What does the list think? Thanks, Paul Well, note that foldr takes a function of x, which

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

2007-10-01 Thread Brent Yorgey
On 10/1/07, PR Stanley [EMAIL PROTECTED] wrote: 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] Puzzled

2007-10-06 Thread Brent Yorgey
Just to be clear, I doubt the difference had anything to do with tail-recursion per se. My guess is that with the mysum version, ghc was able to do some strictness analysis/optimization that it wasn't able to do (for whatever reason) with the first version. The best solution (as others have

[Haskell-cafe] Re: [Haskell] Converting Double from String

2007-10-08 Thread Brent Yorgey
(moving to haskell-cafe...) On 10/8/07, Johan Tibell [EMAIL PROTECTED] wrote: On 10/8/07, bjornie [EMAIL PROTECTED] wrote: Hi! I'm kind of new to functional programming with Haskell, I'm reading a university course you see. Now I'm having some problems with one of our lab assignments,

Re: [Haskell-cafe] Re: New slogan for haskell.org

2007-10-09 Thread Brent Yorgey
On 10/8/07, Alex Tarkovsky [EMAIL PROTECTED] wrote: Alex Tarkovsky wrote: Brandon S. Allbery KF8NH wrote: I can has English? :) This comment inspired what could be either the beginning of an infectious Haskell recruitment campaign, or just a sign that some of us are mad. I present

Re: [Haskell-cafe] Re: New slogan for haskell.org

2007-10-09 Thread Brent Yorgey
On 10/9/07, Henning Thielemann [EMAIL PROTECTED] wrote: On Tue, 9 Oct 2007, Alex Tarkovsky wrote: Brent Yorgey wrote: Aren't you going to make one featuring a catamorphism? =) Done, thanks for the contribution! ;) I wish concat or concatMap :-) ask and ye shall receive! =) http

Re: [Haskell-cafe] Re: New slogan for haskell.org

2007-10-09 Thread Brent Yorgey
On 10/9/07, Andrew Coppin [EMAIL PROTECTED] wrote: Brent Yorgey wrote: On 10/9/07, *Henning Thielemann* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I wish concat or concatMap :-) ask and ye shall receive! =) http://wso.williams.edu/~byorgey/concatMap.png http

Re: [Haskell-cafe] Dual Parser Failure???

2007-10-13 Thread Brent Yorgey
On 10/12/07, PR Stanley [EMAIL PROTECTED] wrote: Hi failure :: (Parser a) failure = \inp - [] The code might contain some syntax errors and I'd be grateful for any corrections. What is a dual parser failure? You should probably put the definition on a separate line, thus: failure ::

Re: [Haskell-cafe] On the verge of ... giving up!

2007-10-17 Thread Brent Yorgey
Well anyway, as you can see, I'm back. Mainly because I have questions that I need answers for... glad you're back. =) This mailing list is the only place I know of that is inhabited by people who actually think Haskell is something worth persuing. don't forget about the IRC channel!

Re: [Haskell-cafe] Stack overflow in ghci

2007-10-17 Thread Brent Yorgey
On 10/17/07, Maurí­cio [EMAIL PROTECTED] wrote: Hi, I get this error message when testing a function in ghci: *** Exception: stack overflow I admit I didn't care about efficiency when I wrote that function, but I'm almost sure it is not supposed to eat all my memory. Do I need to say

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Brent Yorgey
On 10/20/07, Andrew Coppin [EMAIL PROTECTED] wrote: I'm writing some code where I take an expression tree and transform it into another equivilent one. Now it's moderately easy to write the code that does the transformation. But what I *really* want is to print out the transformation

Re: [Haskell-cafe] What algorithm to use ?

2007-10-22 Thread Brent Yorgey
On 10/22/07, manu [EMAIL PROTECTED] wrote: Hello I am not sure it is appropriate to post to this mailing list to inquire about a peculiar algorithm, if not let me know... I was looking at one particular puzzle posted on the Facebook site, 'Wiretaps'

[Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Brent Yorgey
Hi all, I'm pleased to announce the release of a somewhat silly -- yet perhaps somewhat useful -- library module, Math.OEIShttp://hackage.haskell.org/cgi-bin/hackage-scripts/package/oeis-0.1, intended for the enjoyment of combinatorial dilettantes, Project Euler addicts, and the merely curious

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Brent Yorgey
The Online Encyclopedia of Integer Sequences should really contain more Haskell code for describing the sequences. Agreed! I propose an OEIS party where we all sit around one day and submit Haskell code. =) (I'm only half joking...) -Brent ___

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Brent Yorgey
probably want to write an FFI binding to MathLink. On 22/10/2007, Stefan O'Rear [EMAIL PROTECTED] wrote: On Mon, Oct 22, 2007 at 07:20:47AM -0400, Brent Yorgey wrote: * returning a lazy infinite list for infinite sequences via an embedded general AI and Mathematica interpreter. Assuming

Re: [Haskell-cafe] Function Types

2007-10-22 Thread Brent Yorgey
On 10/22/07, PR Stanley [EMAIL PROTECTED] wrote: Hi What are the rules for calculating function types? Is there a set procedure ? Thanks, Paul There must be a set procedure, since otherwise the compiler could not function! =) Seriously, though, I'm not exactly sure what you're asking for.

Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a million element list)

2007-10-22 Thread Brent Yorgey
I wonder if there are tricks or lore that could be applied to get better results or insight. t. Just a quick note, I doubt ghc -e does any optimizations. You'd probably get better results by putting these tests in files and compiling with -O2. In particular I wonder whether that would stop

Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a million element list)

2007-10-24 Thread Brent Yorgey
On 10/23/07, Thomas Hartman [EMAIL PROTECTED] wrote: Actually I can't compile it, with or without -O2. loads fine into ghci, but when I try to create an executable I get ghc quicksort.hs -o quicksort quicksort.o: In function `r1Nc_info': undefined reference to

Re: [Haskell-cafe] Haskell Report??

2007-10-24 Thread Brent Yorgey
On 10/23/07, Galchin Vasili [EMAIL PROTECTED] wrote: Hello, I am trying to use a Haskell shell (Hsh.hs). I am a little frustrated. There are two modules that are imported: import LibPosix import LibSystem I am running WinHugs (Windows) and hugs/ghci can't find LibSystem. I am

Re: [Haskell-cafe] lazily traversing a foreign data structure

2007-10-26 Thread Brent Yorgey
On 10/26/07, Graham Fawcett [EMAIL PROTECTED] wrote: On 10/25/07, Derek Elkins [EMAIL PROTECTED] wrote: On Thu, 2007-10-25 at 11:30 -0400, Graham Fawcett wrote: I'm writing a Gnu DBM module as an exercise for learning Haskell and its FFI. I'm wondering how I might write a function that

Re: [Haskell-cafe] binary operator modifiers

2007-10-31 Thread Brent Yorgey
On 10/29/07, Tim Newsham [EMAIL PROTECTED] wrote: I would love to have the ability to define binary operator modifiers. For example: f \overline{op} g = liftM2 op f g f \overleftarrow{op} n = liftM2 op f (return n) n \overrightarrow{op} g = liftM2 op (return n) f

Re: [Haskell-cafe] ghc -e with standard input

2007-11-05 Thread Brent Yorgey
On Nov 5, 2007 1:46 PM, Maurí­cio [EMAIL PROTECTED] wrote: Hi, Is there a way to run 'ghc -e' taking input from standard input? I would like to use it in a pipe. xargs ought to do the trick nicely. -Brent ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Sinus in Haskell

2007-11-09 Thread Brent Yorgey
On Nov 9, 2007 2:08 PM, Hans van Thiel [EMAIL PROTECTED] wrote: Hello All, Can anybody explain the results for 1.0, 2.0 and 3.0 times pi below? GHCi yields the same results. I did search the Haskell report and my text books, but to no avail. Thanks in advance, Hans van Thiel Hugs sin (0.0

Re: [Haskell-cafe] recursion issues...

2007-11-10 Thread Brent Yorgey
On Nov 10, 2007 11:54 AM, Ryan Bloor [EMAIL PROTECTED] wrote: hiya I was wondering how I would get the second function do recursively do the function for poolNews xs tried that and it fails. Ryan --Give wins, draws a rating. poolNews :: Result *-* PoolNews *-* PoolNews

Re: [Haskell-cafe] Somewhat random history question - chicken and egg

2007-11-11 Thread Brent Yorgey
GHC can be compiled with GHC 5.0 (or something around there). If they add a new feature, they don't use it in GHC for years and years. *Can* be compiled with GHC 5.0, or *is* compiled? http://haskell.org/ghc/docs/6.8.1/html/users_guide/release-6-8-1.html says that the pointer tagging in 6.8.1

Re: [Haskell-cafe] missed clause???

2007-11-11 Thread Brent Yorgey
On Nov 11, 2007 6:37 AM, Ryan Bloor [EMAIL PROTECTED] wrote: hi I was testing my code when I came across a strange predicament. The input is a list of ints and a Results type which is of type [(int,...),(Int..)..]. I am comparing each int from the list to the first element in

Re: [Haskell-cafe] Upgrading X11

2007-11-11 Thread Brent Yorgey
On Nov 11, 2007 9:26 AM, Jim Burton [EMAIL PROTECTED] wrote: I have X11 1.2.2 installed and wanted to upgrade to 1.3 (to satisfy the dependencies of another package), but Setup configure tells me I don't have the headers installed. I do, and when I configure 1.2.2 they're detected. Is this

Re: [Haskell-cafe] Somewhat random history question - chicken and egg

2007-11-11 Thread Brent Yorgey
Expressiveness certainly makes it easier, but nothing (other than sanity...) stops you from writing a Haskell compiler in, say, COBOL. *I* would stop you. Friends don't let friends write in COBOL. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Somewhat random history question - chicken and egg

2007-11-11 Thread Brent Yorgey
I would be the last who wanted to spoil such a good joke. But... tell me please, ANYONE, who takes part in this inspiring exchange: How many COBOL programs have you written in your life? How many programs in Cobol have you actually SEEN? My current project at work has a bunch of legacy

Re: [Haskell-cafe] List of all powers

2007-11-14 Thread Brent Yorgey
On Nov 14, 2007 12:32 PM, Kurt Hutchinson [EMAIL PROTECTED] wrote: As part of a solution I'm working on for Project Euler problem 119, I wanted to create an ordered list of all powers of all positive integers (starting with squares). This is what I came up with: powers = ( uniq . map fst .

Re: [Haskell-cafe] List of all powers

2007-11-14 Thread Brent Yorgey
On Nov 14, 2007 2:57 PM, Kurt Hutchinson [EMAIL PROTECTED] wrote: On Nov 14, 2007 1:06 PM, Brent Yorgey [EMAIL PROTECTED] wrote: On Nov 14, 2007 12:32 PM, Kurt Hutchinson [EMAIL PROTECTED] wrote: The merging can be done much more simply and efficiently (this is code I wrote when computing

Re: [Haskell-cafe] Re: List of all powers

2007-11-14 Thread Brent Yorgey
apfelmus, does someone pay you to write so many thorough, insightful and well-explained analyses on haskell-cafe? I'm guessing the answer is 'no', but clearly someone should! =) thanks! -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Re: Knot tying vs monads

2007-11-16 Thread Brent Yorgey
but isn't there a short text that describes in detail why foldl' is different from foldl and why foldr is better in many cases? I thought this faq would have been cached already :) Perhaps you're thinking of http://haskell.org/haskellwiki/Stack_overflow ? -Brent

Re: [Haskell-cafe] The percent operator

2007-11-16 Thread Brent Yorgey
On Nov 16, 2007 9:44 AM, PR Stanley [EMAIL PROTECTED] wrote: Hi I understand 2%4 will construct a fraction in Haskell. I've tried this in GHCI but got an error message. Is there such an operator in Prelude and if so how is it applied? Cheers, Paul It's in Data.Ratio. Prelude :m

Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-16 Thread Brent Yorgey
On Nov 16, 2007 11:14 AM, Valery V. Vorotyntsev [EMAIL PROTECTED] wrote: Add the following lines to your ~/.emacs: --- BEGIN OF ELISP CODE --- ;(global-set-key (kbd f9 s) 'delete-trailing-whitespace) (defun delete-trailing-whitespace-if-confirmed () Delete all the trailing

Re: [Haskell-cafe] Composing monads

2007-11-22 Thread Brent Yorgey
On Nov 22, 2007 1:22 PM, Jonathan Cast [EMAIL PROTECTED] wrote: On 22 Nov 2007, at 10:17 AM, Maurí cio wrote: Hi, If I have two computations a-IO b and b-IO c, can I join them to get an a-IO c computation? I imagine something like a liftM dot operator. This is called Kleisli

Re: [Haskell-cafe] An interesting monad: Prompt

2007-11-24 Thread Brent Yorgey
-- Just for fun, make it work with StateT as well -- (needs -fallow-undecidable-instances) instance (Monad (t m), MonadTrans t, MonadPrompt p m) = MonadPrompt p (tm) where prompt = lift . prompt Looks like that should be MonadPrompt p (t m) rather than (tm). Note the space. -Brent

Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-24 Thread Brent Yorgey
On Nov 24, 2007 10:55 PM, Conal Elliott [EMAIL PROTECTED] wrote: why care about trailing whitespace? Probably because it looks bad in darcs patch summaries (trailing whitespace -- little red dollar signs). Unless there's another reason I don't know about. -Brent

Re: [Haskell-cafe] About garbage collecting

2007-11-27 Thread Brent Yorgey
On Nov 27, 2007 10:43 AM, Maurí­cio [EMAIL PROTECTED] wrote: Hi, If available memory is low, is the garbage collector going to eliminate data that is still referenced, but it knows it can be recalculated when needed? If I understand it correctly, when a thunk is evaluated, it is actually

Re: [Haskell-cafe] A tale of Project Euler

2007-11-27 Thread Brent Yorgey
On Nov 27, 2007 2:34 PM, Andrew Coppin [EMAIL PROTECTED] wrote: Hi guys. Somebody just introduced me to a thing called Project Euler. I gather it's well known around here... Anyway, I was a little bit concerned about problem #7. The problem is basically figure out what the 10,001st prime

Re: [Haskell-cafe] foild function for expressions

2007-12-03 Thread Brent Yorgey
foldExp :: AlgExp a - Exp - a foldExp alg (LitI i) = litI alg i foldExp alg (LitB i) = litB alg i foldExp alg (add exp1 exp2) = ¿¿¿??? foldExp alg (and exp1 exp2) = ¿¿¿??? foldExp alg (ifte exp1 exp2 exp3) = ¿¿¿??? One comment: it looks like (add exp1 exp2), (and exp1 exp2) and so on

Re: [Haskell-cafe] isSpace

2007-12-04 Thread Brent Yorgey
On Dec 4, 2007 12:13 PM, Ryan Bloor [EMAIL PROTECTED] wrote: hi I am having trouble with a function that is supposed to eliminate spaces from the start of a String and return the resulting string. I reckon a dropWhile could be used but the isSpace bit is causing me problems... You need to

Re: [Haskell-cafe] isSpace

2007-12-04 Thread Brent Yorgey
On Dec 4, 2007 1:29 PM, Ryan Bloor [EMAIL PROTECTED] wrote: HI I will try and explain it better. I am meaning to write a function that takes a string, apple and eliminates the spaces at the start ONLY. called removeSpace :: String - String I decided to use the function

Re: [Haskell-cafe] type class question

2007-12-05 Thread Brent Yorgey
On Dec 3, 2007 7:43 AM, Peter Padawitz [EMAIL PROTECTED] wrote: What is wrong here? ghci tries (and fails) to deduce certain types for the comp functions that I did not expect. type Block = [Command] data Command = Skip | Assign String IntE | Cond BoolE Block Block | Loop

Re: [Haskell-cafe] Pattern matching error

2007-12-06 Thread Brent Yorgey
kmerge ((x,[y]):[]) = [(x,[y])] Matching on [y] like this will only match lists with a single element (and bind y to that element). You probably just want to say kmerge ((x,y):[]) = [(x,y)] etc., which will bind y to the entire list. -Brent ___

Re: [Haskell-cafe] parser

2007-12-07 Thread Brent Yorgey
On Dec 7, 2007 6:04 PM, Chris Eidhof [EMAIL PROTECTED] wrote: On 7 dec 2007, at 23:51, Ryan Bloor wrote: i am using hugs and the isDigit and anything 'is' doesn't work... they must have forgot to add them in! Does GHC work with them. Perhaps you need to import Data.Char? -Brent

Re: [Haskell-cafe] Folding Integrals

2007-12-12 Thread Brent Yorgey
On Dec 12, 2007 10:36 AM, Arie Groeneveld [EMAIL PROTECTED] wrote: Reinier Lamers schreef: printint :: Int - [Char] printint = map chr . map (+0x30) . reverse . map (`mod` 10) . takeWhile (0) . iterate (`div`10) Most of the time I use this: digits :: Integer - [Int] digits = map

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Brent Yorgey
On Dec 17, 2007 8:04 AM, Nicholls, Mark [EMAIL PROTECTED] wrote: No that's fineits all as clear as mud!..but that's not your fault. To recap... type introduces a synonym for another type, no new type is createdit's for readabilities sake. Newtype introduces an isomorphic copy

Re: [Haskell-cafe] Is StateT what I need?

2007-12-17 Thread Brent Yorgey
This is what I have so far: type Pid = FilePath type Uid = String type PsData = Map String Uid type PsChildren = Map Pid PsInfo data PsInfo = PsInfo PsData PsChildren type PsMap = Map Pid PsInfo type PsTree = Map Pid PsInfo parent :: PsData - Pid parent psData =

Re: [Haskell-cafe] nice simple problem for someone struggling....

2007-12-21 Thread Brent Yorgey
class ShapeInterface shape where area :: shape-Int now looks dubiousI want it to be something like class ShapeInterface shape where area :: Num numberType = shape-Int ? Rather, I think you probably want class ShapeInterface shape where area :: Num numberType =

Re: [Haskell-cafe] Re: The Worker/Wrapper Transformation

2008-01-03 Thread Brent Yorgey
On Jan 3, 2008 6:08 AM, Achim Schneider [EMAIL PROTECTED] wrote: Achim Schneider [EMAIL PROTECTED] wrote: [...] I'm trying to grok that [] = id ++ = . in the context of Hughes lists. I guess it would stop to slip away if I knew what : corresponds to. Well, (:) has type a - [a] -

Re: [Haskell-cafe] First time haskell - parse error!

2010-03-09 Thread Brent Yorgey
On Tue, Mar 09, 2010 at 08:42:44PM +0100, Sebastian Hungerecker wrote: On 09.03.2010 20:04, boblettoj wrote: score :: String - String - String score [s] [] = false score [s] [g] = if valid 4 g then (s1 ++ s2 ++ s3 ++ s4) where s1 = Golds s2 = show

Re: [Haskell-cafe] th-kinds v0.0.0

2010-03-16 Thread Brent Yorgey
of a specified type, type constructor, type family, type class, or pretty much anything else that has a kind. This package was developed in response to a sort-of challenge from Brent Yorgey on #haskell to create this functionality. So, uh, I stayed up last night until 5 am learning unification

[Haskell-cafe] Second Call for Copy: Monad.Reader Issue 16

2010-03-16 Thread Brent Yorgey
I already have one or two submissions, but a few more would be great. If you've been thinking about submitting something but weren't sure or haven't gotten around to it yet, now's the time! -- Whether you're an established academic or have only just started learning Haskell, if you

Re: [Haskell-cafe] Strange typing?

2010-03-19 Thread Brent Yorgey
On Fri, Mar 19, 2010 at 03:15:02PM +, Ozgur Akgun wrote: Hi Cafe! Disclaimer: I know what I'm going to ask is now available as a language feature normally. And sorry for the subject of this message, I couldn't compe up with a gooddescriptive subject. Is there any way to limit a

Re: [Haskell-cafe] Trace

2010-03-19 Thread Brent Yorgey
On Fri, Mar 19, 2010 at 04:03:52PM -0400, Ben Derrett wrote: trace2 a = trace (show a) a In the definition of `trace2': trace2 a = (show a) a These don't match. It looks like maybe you forgot the call to trace in your definition of trace2? -Brent

[Haskell-cafe] Haskell hackathon in Philadelphia (Hac phi 2) in May?

2010-03-20 Thread Brent Yorgey
We are gauging interest in another Haskell hackathon to be hosted at U Penn in May, the weekend of either May 15 or May 22. If you might be interested in attending such a thing, send me an email (please DON'T reply to all!) with your name and whether you have a strong preference for one or the

[Haskell-cafe] Strange error with type classes + associated types

2010-04-13 Thread Brent Yorgey
Hi all, Consider the following declarations. -- from vector-space package: (*.*) :: (HasBasis u, HasTrie (Basis u), HasBasis v, HasTrie (Basis v), VectorSpace w, Scalar v ~ Scalar w) = (v :-* w) - (u :-* v) - u :-* w -- my code: data

Re: [Haskell-cafe] Strange error with type classes + associated types

2010-04-14 Thread Brent Yorgey
On Wed, Apr 14, 2010 at 09:51:52AM +0100, Stephen Tetley wrote: On 14 April 2010 03:48, Brent Yorgey byor...@seas.upenn.edu wrote: Can someone more well-versed in the intricacies of type checking with associated types explain this?  Or is this a bug in GHC? If you take the definition

Re: [Haskell-cafe] Strange error with type classes + associated types

2010-04-14 Thread Brent Yorgey
On Thu, Apr 15, 2010 at 12:48:20AM +1000, Roman Leshchinskiy wrote: Right, this seems weird to me. Why is there still a 'u' mentioned in the constraints? Actually, I don't even see why there ought to be both v and v1. The type of (*.*) mentions three type variables, u, v, and w:

Re: [Haskell-cafe] Nomic game in Haskell

2010-04-14 Thread Brent Yorgey
On Wed, Apr 14, 2010 at 09:14:18PM +0200, Dupont Corentin wrote: Hello Café, do you know Nomic? It's a fabulous and strange game where you have the right to change the rules in the middle of the game! In fact, changing the rules is the goal of the game. Changing a rule is considered as a

Re: [Haskell-cafe] Strange error with type classes + associated types

2010-04-18 Thread Brent Yorgey
Conal, Thanks for looking into this! Making (:-*) into a proper type seems promising. I did try wrapping (:-*) in a newtype but that didn't help (although I didn't expect it to). I see you just uploaded a new version of vector-space; what's new in 0.6.2? -Brent On Sat, Apr 17, 2010 at

Re: [Haskell-cafe] Strange error with type classes + associated types

2010-04-19 Thread Brent Yorgey
On Mon, Apr 19, 2010 at 09:40:25AM -0700, Conal Elliott wrote: On Sun, Apr 18, 2010 at 9:02 PM, Brent Yorgey byor...@seas.upenn.eduwrote: Conal, Thanks for looking into this! Making (:-*) into a proper type seems promising. I did try wrapping (:-*) in a newtype but that didn't help

[Haskell-cafe] Philadelphia Haskell hackathon -- reduced hotel rate ends Friday April 23!

2010-04-21 Thread Brent Yorgey
There is still plenty of space to register [1] for Hac phi 2010, but time is running out to get a hotel room at a reduced rate --- if you want the special rate for the block of rooms we have reserved at the Club Quarters, you must contact the hotel by this Friday, April 23. Instructions are on the

[Haskell-cafe] ANN: Monad.Reader Issue 16

2010-05-12 Thread Brent Yorgey
I am very pleased to announce that Issue 16 of The Monad.Reader is now available [1]. Issue 16 consists of the following three articles: * Demand More of Your Automata by Aran Donohue * Iteratee: Teaching an Old Fold New Tricks by John W. Lato * Playing with Priority Queues by Louis

Re: [Haskell-cafe] ANN: Monad.Reader Issue 16

2010-05-14 Thread Brent Yorgey
On Fri, May 14, 2010 at 02:37:19PM +1000, Ivan Miljenovic wrote: On 13 May 2010 04:12, Brent Yorgey byor...@seas.upenn.edu wrote:    * Demand More of Your Automata by Aran Donohue Great, because of Aran I now can't change some of the bits of API in graphviz without making the code

Re: [Haskell-cafe] ANN: Monad.Reader Issue 16

2010-05-14 Thread Brent Yorgey
On Fri, May 14, 2010 at 11:30:40PM +1000, Ivan Lazar Miljenovic wrote: Brent Yorgey byor...@seas.upenn.edu writes: On Fri, May 14, 2010 at 02:37:19PM +1000, Ivan Miljenovic wrote: On 13 May 2010 04:12, Brent Yorgey byor...@seas.upenn.edu wrote:    * Demand More of Your Automata

Re: [Haskell-cafe] Intuitive function given type signature

2010-05-19 Thread Brent Yorgey
On Wed, May 19, 2010 at 04:27:14AM +, R J wrote: What are some simple functions that would naturally have the following type signatures: f :: (Integer - Integer) - Integer Well, this means f is given a function from Integer to Integer, and it has to somehow return an Integer, (possibly)

Re: [Haskell-cafe] (no subject)

2010-05-19 Thread Brent Yorgey
On Wed, May 19, 2010 at 01:37:49PM +, R J wrote: This is another proof-layout question, this time from Bird 1.4.7. We're asked to define the functions curry2 and uncurry2 for currying and uncurrying functions with two arguments. Simple enough: curry2 :: ((a, b) - c) - (a -

Re: [Haskell-cafe] Intuitive function given type signature

2010-05-20 Thread Brent Yorgey
On Thu, May 20, 2010 at 11:53:09AM +1200, Richard O'Keefe wrote: On May 20, 2010, at 3:18 AM, Brent Yorgey wrote: On Wed, May 19, 2010 at 04:27:14AM +, R J wrote: What are some simple functions that would naturally have the following type signatures: f :: (Integer - Integer) - Integer

Re: [Haskell-cafe] name of this monadic combinator?

2010-05-30 Thread Brent Yorgey
On Sun, May 30, 2010 at 11:15:40AM -0700, Mike Dillon wrote: begin Michael Snoyman quotation: http://hackage.haskell.org/packages/archive/base/4.2.0.1/doc/html/Control-Monad.html#v%3AliftM2 file:///usr/share/doc/ghc6-doc/html/libraries/base-4.2.0.0/Control-Monad.html#v%3AliftM2Strangely,

Re: [Haskell-cafe] How to build an Indicator Type for a type class?

2010-06-02 Thread Brent Yorgey
Perhaps something here may be of use? http://okmij.org/ftp/Haskell/types.html#class-based-overloading http://okmij.org/ftp/Haskell/types.html#class-based-dispatch -Brent On Mon, May 31, 2010 at 01:32:18PM +0200, Steffen Schuldenzucker wrote: Dear Cafe, let: data True data False

Re: [Haskell-cafe] Why this doesn't type checked

2010-06-28 Thread Brent Yorgey
On Mon, Jun 28, 2010 at 08:51:45AM +0400, Victor Nazarov wrote: What we get with this instances is following code. main =   do print (sizeof :: Sizeof Word16) Let's try it. $ runhaskell this.lhs this.lhs:78:14:     Couldn't match expected type `Int'            against

Re: [Haskell-cafe] Re: building a patched ghc

2010-06-28 Thread Brent Yorgey
I don't know the answer to your questions, but just wanted to note that you will probably get a better response on the glasgow-haskell-users mailing list. http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/mailing-lists-GHC.html -Brent On Fri, Jun 25, 2010 at 08:56:09PM -0700, braver

Re: [Haskell-cafe] Type-Level Programming

2010-06-28 Thread Brent Yorgey
On Fri, Jun 25, 2010 at 02:26:54PM -0700, Walt Rorie-Baety wrote: I've noticed over the - okay, over the months - that some folks enjoy the puzzle-like qualities of programming in the type system (poor Oleg, he's become #haskell's answer to the Chuck Norris meme commonly encountered in

Re: [Haskell-cafe] More experiments with ATs

2010-07-05 Thread Brent Yorgey
On Sun, Jul 04, 2010 at 10:31:34AM +0100, Andrew Coppin wrote: I have literally no idea what a type family is. I understand ATs (I think!), but TFs make no sense to me. ATs are just TFs which happen to be associated with a particular class. So if you understand ATs then you understand TFs

Re: [Haskell-cafe] Re: Functional dependencies and Peano numbers

2010-07-13 Thread Brent Yorgey
On Sun, Jul 11, 2010 at 12:43:47AM +0200, Jose A. Ortega Ruiz wrote: On Sat, Jul 10 2010, wren ng thornton wrote: [...] Yes, you can add multiple dependencies. The syntax is to use , after the first |. While having eight parameters is surely a desperate need for refactoring,

Re: [Haskell-cafe] lambda calculus and equational logic

2010-07-13 Thread Brent Yorgey
On Wed, Jul 07, 2010 at 09:56:08AM +0100, Patrick Browne wrote: Hi, In Haskell what roles are played by 1)lambda calculus and 2) equational logic? Are these roles related? Hopefully this question can be answered at a level suitable for this forum. Since no one else has responded I'll take a

  1   2   3   4   5   >