Re: [Haskell-cafe] Can't cabal install readline

2008-12-05 Thread Philip Weaver
On Fri, Dec 5, 2008 at 2:08 PM, Judah Jacobson [EMAIL PROTECTED]wrote: On Fri, Dec 5, 2008 at 1:10 PM, Martijn van Steenbergen [EMAIL PROTECTED] wrote: Hello, This week I upgraded to GHC 6.10 using the .pkg installer. It installed without a single hiccup -- thanks! I've noticed two

Re: [Haskell-cafe] TimeDiff to Int?

2008-11-12 Thread Philip Weaver
2008/11/12 Lyle Kopnicky [EMAIL PROTECTED] Hi folks, I had some code using the oldtime package, and want to convert it to use the time package. One of the things I need to do is calculate the number of seconds since midnight. The easy part is getting a TimeDiff result: utc -

Re: [Haskell-cafe] Temlpate Haskell: [d| ... |]

2008-10-17 Thread Philip Weaver
On Fri, Oct 17, 2008 at 9:26 AM, Achim Schneider [EMAIL PROTECTED] wrote: [d| ... |], where the ... is a list of top-level declarations; the quotation has type Q [Dec]. ( http://www.haskell.org/ghc/docs/latest/html/users_guide/template-haskell.html ) Can someone elaborate on what a list

Re: [Haskell-cafe] How to check if two Haskell files are the same?

2008-09-16 Thread Philip Weaver
On Tue, Sep 16, 2008 at 7:30 AM, Mauricio [EMAIL PROTECTED] wrote: Hi, I would like to write a Haskell pretty-printer, using standard libraries for that. How can I check if the original and the pretty-printed versions are the same? For instance, is there a file generated by GHC at the

Re: [Haskell-cafe] What monad am I in?

2008-09-02 Thread Philip Weaver
On Tue, Sep 2, 2008 at 5:33 PM, Ryan Ingram [EMAIL PROTECTED] wrote: ghci has some crazy defaulting rules for expressions at the top level. In particular, it tries to unify those expressions with a few different types, including IO. On the other hand, the let-expression is typed like

Re: [Haskell-cafe] Syntax of 'do'

2008-08-29 Thread Philip Weaver
On Fri, Aug 29, 2008 at 6:41 AM, Maurí­cio [EMAIL PROTECTED] wrote: Hi, http://haskell.org/haskellwiki/Keywords says that: - [do is a] syntactic sugar for use with monadic expressions. For example: do { x ; result - y ; foo result } is shorthand for: x y = \result -

Re: [Haskell-cafe] Syntax of 'do'

2008-08-29 Thread Philip Weaver
On Fri, Aug 29, 2008 at 8:50 AM, David House [EMAIL PROTECTED] wrote: 2008/8/29 Philip Weaver [EMAIL PROTECTED]: It sounds like you tried to redefine () and (=) and make 'do' use the new definitions. This is not possible, regardless of what types you give () and (=). Watch out

Re: [Haskell-cafe] Named field syntax

2008-08-29 Thread Philip Weaver
On Fri, Aug 29, 2008 at 1:59 PM, Roman Cheplyaka [EMAIL PROTECTED] wrote: * Johannes Waldmann [EMAIL PROTECTED] [2008-08-29 15:39:15+0200] data Test = Test Integer {b::String} positional (= unnamed) record notation is a language design error :-) and its use should be discouraged. -

Re: [Haskell-cafe] best runProcess solution to work with windows and linux

2008-08-27 Thread Philip Weaver
On Wed, Aug 27, 2008 at 5:40 AM, Andrew U. Frank [EMAIL PROTECTED] wrote: i use System.POSIX.IO to run a process and access the handles (after due transformation) to get the values back. this solution is unfortunately not portable and works only on unix (or cygwin) but not for plain windows.

Re: [Haskell-cafe] Cabal and Strings and CPP

2008-07-29 Thread Philip Weaver
On Tue, Jul 29, 2008 at 3:14 AM, Malcolm Wallace [EMAIL PROTECTED] wrote: Philip Weaver [EMAIL PROTECTED] wrote: I'm trying to use CPP-defined strings in a Haskell module, like this: main :: IO () main = putStrLn FOO This of course will not work: ghc -DFOO=hello world --make

[Haskell-cafe] Cabal and Strings and CPP

2008-07-28 Thread Philip Weaver
Hello all, I'm trying to use CPP-defined strings in a Haskell module, like this: main :: IO () main = putStrLn FOO This of course will not work: ghc -DFOO=hello world --make Main.hs -o test You'll get this error message: ./Main.hs:6:16: Not in scope: `hello' ./Main.hs:6:22:

Re: [Haskell-cafe] FPGA / Lava and haskell

2008-07-09 Thread Philip Weaver
On Wed, Jul 9, 2008 at 2:22 AM, Marc Weber [EMAIL PROTECTED] wrote: You're going to design something like that with an FPGA in it? :) The FPGA is only used for developement. If everything works fine I'd like to put it on the market. My hope is to get one low cost chip doing everything this

Re: [Haskell-cafe] FPGA / Lava and haskell

2008-07-08 Thread Philip Weaver
On Tue, Jul 8, 2008 at 5:43 PM, Marc Weber [EMAIL PROTECTED] wrote: Is Haskell still used (in industry as well ?) to write (V)HDL code to program FPGAs and create circuits on chips? Indeed! Galois maintains a language called Cryptol. Almost all tools for this language, including an FPGA

Re: [Haskell-cafe] GHCi gives type signature that won't compile.

2008-06-05 Thread Philip Weaver
On Thu, Jun 5, 2008 at 9:36 AM, Miguel Mitrofanov [EMAIL PROTECTED] wrote: Check your types for typos. On 5 Jun 2008, at 20:31, A A wrote: Hi All I can successfully compile the following code using ghci import Data.Array.IArray makeArray (lower, upper) f = listArray (lower, upper) [(f

Re: [Haskell-cafe] A simple beginner question

2008-06-03 Thread Philip Weaver
On Tue, Jun 3, 2008 at 5:11 PM, Adam Smyczek [EMAIL PROTECTED] wrote: Example: data SampleType = A | B Int | C String | D -- etc. sampleTypes = [A, B 5, C test] :: [SampleType] How do I find for example element A in the sampleTypes list? Do I have to create e.g.: isA :: SampleType -

Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-05-30 Thread Philip Weaver
On Fri, May 30, 2008 at 5:28 PM, Martin Blais [EMAIL PROTECTED] wrote: Allright, this is a definitely a newbie question. I'm learning Haskell and going through the exercises in the beautiful Hutton book, and one of them requires for me to write a loop that queries a line from the user

Re: [Haskell-cafe] [Newbie question] -- Looping stdin until condition is met

2008-05-30 Thread Philip Weaver
On Fri, May 30, 2008 at 5:14 PM, Martin Blais [EMAIL PROTECTED] wrote: On Fri, 30 May 2008 16:54:18 -0700, Philip Weaver [EMAIL PROTECTED] said: 1. How do I catch the exception that is raised from read? I think you want readIO, which yields a computation in the IO monad, so it can

Re: [Haskell-cafe] An alternative break

2008-05-28 Thread Philip Weaver
On Wed, May 28, 2008 at 2:53 PM, Pieter Laeremans [EMAIL PROTECTED] wrote: Hello, I need a break function that splits the list one element further than the ordinary break. This is the simplest solution I could imagine: breakI :: (a - Bool) - [a] - ([a], [a]) breakI p s = case break p s of

Re: [Haskell-cafe] runInteractiveCommand: program ends before writing or reading all the output

2008-05-15 Thread Philip Weaver
2008/5/15 Olivier Boudry [EMAIL PROTECTED]: Hi all, It's the first time I use the runInteractiveCommand and I was probably bitten by laziness. When I run the following program and send its output to a file using '' redirection I get the full output of the called process. But if I run it in

Re: [Haskell-cafe] runInteractiveCommand: program ends before writing or reading all the output

2008-05-15 Thread Philip Weaver
On Thu, May 15, 2008 at 11:42 AM, Ronald Guida [EMAIL PROTECTED] wrote: It looks like a simple race condition to me. You are using waitForProcess pid to wait for runInteractiveCommand to finish, but you don't seem to have anything that waits for createDefFile to finish. Whoops, sorry, I

Re: [Haskell-cafe] build version problem?

2008-05-10 Thread Philip Weaver
Ok, I'll ask the obvious question... did you try to re-configure? runhaskell Setup.hs configure 2008/5/9 Galchin, Vasili [EMAIL PROTECTED]: Hello, I changed the version # in a cabal file and now I get ... runhaskell Setup.hs configure Configuring unix-2.4.0.0... [EMAIL

Re: [Haskell-cafe] Maybe a, The Rationale

2008-05-10 Thread Philip Weaver
On Sat, May 10, 2008 at 3:10 PM, PR Stanley [EMAIL PROTECTED] wrote: Paul: Hi folks data Maybe a = Nothing | Just a What is the underlying rationale for the Maybe data type? is it the safe style of programming it encourages/ Something tells me this is going to start a

Re: [Haskell-cafe] asserting the type of a binding in a do expression

2008-04-26 Thread Philip Weaver
On Fri, Apr 25, 2008 at 11:49 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On Apr 26, 2008, at 2:36 , Ken Takusagawa wrote: But this does not: foo::IO a; foo = do{ (x::a) - bar; return x;}; Error message: A pattern type signature cannot bind scoped type

Re: [Haskell-cafe] Cabalizing darcs

2008-04-23 Thread Philip Weaver
It looks quite clean (no funny business in Setup.lhs). I would favor using this cabalized version over the other. Thanks! So, autoconf/configure generate cryptol.buildinfo from cryptol.buildinfo.in. Did you change configure.ac much? And the Makefile is no longer needed at all, right? - Phil

Re: [Haskell-cafe] Cabalizing darcs

2008-04-23 Thread Philip Weaver
On Wed, Apr 23, 2008 at 4:49 PM, Gwern Branwen [EMAIL PROTECTED] wrote: On 2008.04.23 12:26:35 -0700, Philip Weaver [EMAIL PROTECTED] scribbled 1.2K characters: It looks quite clean (no funny business in Setup.lhs). I would favor using this cabalized version over the other. Thanks

Re: [Haskell-cafe] ghc

2008-04-10 Thread Philip Weaver
2008/4/10 Cetin Sert [EMAIL PROTECTED]: Hi, Is GHC required to be installed on the target OS I compile Haskell binaries for in order for these binaries to run? I need a quick answer on that! If I parse your question correctly, the answer is no, you do not need GHC installed to run the

Re: [Haskell-cafe] GHC + interactive input/output

2008-02-08 Thread Philip Weaver
Your gsi is buffered because there's no newline at the end. To flush the buffer and force it to be printed immediately, use 'hFlush' from the System.IO library, or use 'hSetBuffering' from that same library: http://haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html I believe you can

Re: [Haskell-cafe] Haskell purity and printing

2007-12-18 Thread Philip Weaver
On Dec 18, 2007 1:00 PM, Cristian Baboi [EMAIL PROTECTED] wrote: This is what I understand so far ... Suppose we have these two values: a) \x-x + x b) \x-2 * x Because these to values are equal, all functions definable in Haskell must preserve this. This is why I am not allowed to define

Re: [Haskell-cafe] Questions about the Functor class and it's use in Data types à la carte

2007-12-14 Thread Philip Weaver
On Dec 14, 2007 11:44 AM, Corey O'Connor [EMAIL PROTECTED] wrote: I'm working through the interesting paper Data type à la carte and am confused by the Functor instance for Val. I think this stems from some confusion of mine regarding the Functor class in general. I'll try to explain, but I

Re: [Haskell-cafe] parsebinaryoperations

2007-12-09 Thread Philip Weaver
Maybe you should look into Parsec, a Haskell library for writing parsers. Google should find what you need. - Phil On Dec 9, 2007 1:58 AM, Ryan Bloor [EMAIL PROTECTED] wrote: hi I have a function parseInt... which needs an error guard for when the input is not an Int. parseInt :: Parser

Re: [Haskell-cafe] annoying output

2007-12-08 Thread Philip Weaver
Well, you're choosing to parse each digit of your integer as a separate integer, so if you want to combine them after reading you'll need to multiply by powers of two. Or, you can just read in all the digits in one 'read' command, like this: parseInt :: String - (Expr, String) parseInt xs

Re: [Haskell-cafe] annoying output

2007-12-08 Thread Philip Weaver
I mean powers of *ten* :) On Dec 8, 2007 10:48 PM, Philip Weaver [EMAIL PROTECTED] wrote: Well, you're choosing to parse each digit of your integer as a separate integer, so if you want to combine them after reading you'll need to multiply by powers of two. Or, you can just read in all

Re: [Haskell-cafe] Pattern matching error

2007-12-06 Thread Philip Weaver
If you add a third pattern, you can see exactly what it's failing to match: kmerge x = error (show x) In order to do this, you just need to add Show constraints for a and b in the type of kmerge: kmerge :: (Show a, Show b, Eq a) = [(a,[b])]-[(a,[b])] You'll find that the pattern that

Re: [Haskell-cafe] Illegal type def

2007-12-01 Thread Philip Weaver
Should work with glasgow extensions (-fglasgow-exts). - Phil On Dec 1, 2007 6:43 PM, PR Stanley [EMAIL PROTECTED] wrote: Hi type assoc k v = [(k, v)] works beautifully and everything makes sense. type Assoc v = (Ord k) = [(k, v)] This doesn't work. Is there any wayof defining k as