Re: question about GADT's and error messages

2014-05-14 Thread Richard Eisenberg
My understanding of OutsideIn leads me to believe that GHC 7.8 has the behavior closer to that spec. See Section 5.2 of that paper (http://research.microsoft.com/en-us/um/people/simonpj/Papers/constraints/jfp-outsidein.pdf), which is a relatively accessible explanation of this phenomenon.

Re: question about GADT's and error messages

2014-05-13 Thread Daniel Wagner
I just hit a similar error the other day. I think the gist of it is that there are two perfectly good types, and neither is more general than the other. A slightly different example shows why more clearly: foo (AInt i) = (3 :: Int) Now, what type should this have? foo :: Any a - a foo :: Any

Re: question about GADT's and error messages

2014-05-13 Thread Andres Löh
Hi. Daniel is certainly right to point out general problems with GADT pattern matching and principal types. Nevertheless, the changing behaviour of GHC over time is currently a bit confusing to me. In GHC-6.12.3, Doaitse's program fails with three errors (demo1, demo2, demo4, all the GADT

RE: Question about correct GHC-API use for type checking (or zonking, or tidying)

2013-09-11 Thread p.k.f.holzenspies
-Jones [mailto:simo...@microsoft.com] Sent: dinsdag 10 september 2013 14:19 To: Holzenspies, P.K.F. (EWI) Cc: glasgow-haskell-users@haskell.org Subject: RE: Question about correct GHC-API use for type checking (or zonking, or tidying) What goes wrong if you follow my suggestion below

RE: Question about correct GHC-API use for type checking (or zonking, or tidying)

2013-09-04 Thread Simon Peyton-Jones
...@utwente.nl [mailto:p.k.f.holzensp...@utwente.nl] Sent: 03 September 2013 14:18 To: Simon Peyton-Jones; glasgow-haskell-users@haskell.org Subject: RE: Question about correct GHC-API use for type checking (or zonking, or tidying) Dear Simon, et al, I had a chance to try it now. The strange thing

RE: Question about correct GHC-API use for type checking (or zonking, or tidying)

2013-09-02 Thread Simon Peyton-Jones
; glasgow-haskell-users@haskell.org Subject: Re: Question about correct GHC-API use for type checking (or zonking, or tidying) I feel so unbelievably ignorant now. I thought with all the IORefs in the type checking process that zonking did this in these refs. Somehow I started thinking that some

Re: Question about correct GHC-API use for type checking (or zonking, or tidying)

2013-08-30 Thread p.k.f.holzenspies
...@utwente.nl,glasgow-haskell-users@haskell.org Subject: RE: Question about correct GHC-API use for type checking (or zonking, or tidying) Haskell is a *functional* language. Consider say $ pre-zonk: ++ pp all_expr_ty zonkTcType all_expr_ty say $ post-zonk: ++ pp all_expr_ty pp

RE: Question about correct GHC-API use for type checking (or zonking, or tidying)

2013-08-30 Thread Simon Peyton-Jones
Haskell is a *functional* language. Consider say $ pre-zonk: ++ pp all_expr_ty zonkTcType all_expr_ty say $ post-zonk: ++ pp all_expr_ty pp is a pure function; it is given the same input both times, so of course it produces the same output. If you collect the result of

Re: Question about Haskell AST

2011-02-22 Thread Ian Lynagh
Hi Jane, On Mon, Feb 21, 2011 at 11:46:16PM -0800, Jane Ren wrote: Did you mean I have to include the dflags like below to get the parsetree of a base library file like libraries/base/GHC/List.lhs I am stilling getting the same error AstWalker: panic! (the 'impossible' happened)

RE: Question about Haskell AST

2011-02-22 Thread Simon Peyton-Jones
-users@haskell.org | Subject: Re: Question about Haskell AST | | | Hi Jane, | | On Mon, Feb 21, 2011 at 11:46:16PM -0800, Jane Ren wrote: | | Did you mean I have to include the dflags like below to get the parsetree | of a base library file like libraries/base/GHC/List.lhs | | I am stilling

RE: Question about Haskell AST

2011-02-21 Thread Jane Ren
- | From: Jane Ren [mailto:j2...@ucsd.edu] | Sent: 24 January 2011 17:20 | To: Simon Peyton-Jones; glasgow-haskell-users@haskell.org | Subject: RE: Question about Haskell AST | | Hi Simon, | | That is exactly what I needed. However, although I was able to get the | patterns from the parse tree for test

Re: Question about Haskell AST

2011-02-08 Thread Christiaan Baaij
Does the following code help you out? (Do note it's for the GHC 6.12.* API) It just uses the the default GHC driver, meaning you don't have to separately call the desugerar, simplifier, etc. It's what I use for my CλaSH tool. Cheers, Christiaan -- External Modules import qualified GHC.Paths

Re: Question about Haskell AST

2011-02-06 Thread Tim Chevalier
On Mon, Jan 10, 2011 at 9:21 AM, Jane Ren j2...@ucsd.edu wrote: Hi, I need to be able to take a piece of Haskell source code and get an simplified, typed, intermediate representation of the AST, which means I need to use compiler/coreSyn/CoreSyn.lhs So I'm first trying to get the

RE: Question about Haskell AST

2011-02-04 Thread Jane Ren
] Sent: Tuesday, January 25, 2011 1:34 AM To: Jane Ren Cc: Simon Peyton-Jones; glasgow-haskell-users@haskell.org Subject: Re: Question about Haskell AST On 24 January 2011 17:20, Jane Ren j2...@ucsd.edu wrote: When I try this, I get AstWalker: panic! (the 'impossible' happened) (GHC version

Re: Question about Haskell AST

2011-01-25 Thread Max Bolingbroke
On 24 January 2011 17:20, Jane Ren j2...@ucsd.edu wrote: When I try this, I get AstWalker: panic! (the 'impossible' happened)  (GHC version 7.0.1 for x86_64-apple-darwin):        lexical error at character 'i' It looks like you need to add the CPP extension to the DynFlags:

RE: Question about Haskell AST

2011-01-25 Thread Simon Peyton-Jones
...@ucsd.edu] | Sent: 24 January 2011 17:20 | To: Simon Peyton-Jones; glasgow-haskell-users@haskell.org | Subject: RE: Question about Haskell AST | | Hi Simon, | | That is exactly what I needed. However, although I was able to get the | patterns from the parse tree for test modules that I wrote, I

RE: Question about Haskell AST

2011-01-24 Thread Jane Ren
augment that wiki page. Thanks Jane From: Simon Peyton-Jones [simo...@microsoft.com] Sent: Tuesday, January 11, 2011 12:06 AM To: Jane Ren; glasgow-haskell-users@haskell.org Subject: RE: Question about Haskell AST desugarModule returns a GHC.DesugaredModule

RE: Question about Haskell AST

2011-01-11 Thread Simon Peyton-Jones
desugarModule returns a GHC.DesugaredModule Inside a DesugaredModule is a field dm_core_module :: HscTypes.ModGuts Inside a ModGuts is a field mg_binds :: [CoreSyn.CoreBind] And there are your bindings! Does that tell you what you wanted to know? Simon PS: When you have it clear, would you

Re: question about hsc2hs

2010-02-03 Thread Jose A. Ortega Ruiz
Ross Paterson r...@soi.city.ac.uk writes: If you compile your C program with -D_FILE_OFFSET_BITS=64 you'll get the same numbers that hsc2hs does. Aha, that was the key to solve my problem: programs or libraries compiled with that flag must use statfs64() instead of statfs(). Binding to the

Re: question about hsc2hs

2010-02-02 Thread Ross Paterson
On Tue, Feb 02, 2010 at 03:51:18PM +0100, Jose A. Ortega Ruiz wrote: [...] The problem is that the size and some of the offsets of the C struct statfs computed by hsc2c are wrong: i'm in a 32bit linux system, and i've checked, using a C program, that sizeof(struct statfs) is 64 (hsc2 is giving

Re: question about hsc2hs

2010-02-02 Thread Jose A. Ortega Ruiz
Ross Paterson r...@soi.city.ac.uk writes: On Tue, Feb 02, 2010 at 03:51:18PM +0100, Jose A. Ortega Ruiz wrote: [...] The problem is that the size and some of the offsets of the C struct statfs computed by hsc2c are wrong: i'm in a 32bit linux system, and i've checked, using a C program, that

Re: Question regarding combinator call convention

2010-02-01 Thread Simon Marlow
On 29/01/2010 21:02, Tyson Whitehead wrote: I was looking through the code for 6.12.1 and am a bit confused about 11.1.3 in the runtime system documentation docs/rts/rts.tex. That's a very old document and is inaccurate in various ways. The Commentary is more up to date:

Re: Question regarding combinator call convention

2010-02-01 Thread Tyson Whitehead
On February 1, 2010 06:43:40 Simon Marlow wrote: That's a very old document and is inaccurate in various ways. The Commentary is more up to date: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts That's good to know. Thanks for the link. : ) Cheers! -Tyson signature.asc

Re: Question regarding the GHC users manual

2010-01-25 Thread Max Bolingbroke
Hi Tyson, I don't think this is a bug. type family F a b :: * - *   -- F's arity is 2,                              -- although its overall kind is * - * - * - * F Char [Int]       -- OK!  Kind: * - * Char :: * [Int] :: * So we can fill in the first two * in the kind * - * - * - * to get *

Re: Question regarding the GHC users manual

2010-01-25 Thread Niklas Broberg
type family F a b :: * - *   -- F's arity is 2,                              -- although its overall kind is * - * - * - * I believe what you're missing is that with the definition F a b :: * - *, F needs three arguments (of kind *) in order to become kind *. If F a b :: * - * as stated, then F

Re: Question regarding the GHC users manual

2010-01-25 Thread Tyson Whitehead
Hi Max and Niklas, Thank you both for your answers. I get it now. I didn't read carefully enough to note that the explicit type on F a b was the type of F and the type of F (although, in retrospect, this last interpretation wouldn't have worked as we would have need at least * - * - *).

[Haskell-cafe] Re: Question about haskell.cs.yale.edu/

2009-09-17 Thread Magnus Therning
Today I received the request below. At first the URL confused me, but apparently www.haskell.org is known under two names :-) The request should probably be handled by someone involved in ICFP. /M On Wed, Sep 16, 2009 at 11:53 PM, Peter Green peter.gr...@frixo.com wrote: Hi, I was wondering

Re: question about -fno-pre-inlining

2009-06-26 Thread John Lato
In case anyone else was following this, I've discovered the source of the differing output. I had made some assumptions about when some code would be executed based upon faulty reasoning. Without pre-inlining those assumptions happened to hold, but they did not when pre-inlining was enabled.

RE: question about -fno-pre-inlining

2009-06-18 Thread Simon Peyton-Jones
John | When compiled with -fno-pre-inlining, my test program gives a | different result than compiled without (0.988... :: Double, compared | to 1.0). It's numerical code, and was originally compiled with That's entirely unexpected. I am very surprised that turning off pre-inlining a) affects

Re: question about -fno-pre-inlining

2009-06-18 Thread John Lato
Simon, Thanks for the quick reply, and also the link. I'll be sure to read it. I don't know what pre-inlining is; I was testing different compiler options with acovea, which indicated the performance boost. When I tried it myself, I noticed the differing value. I'm pretty sure the affected

[Haskell-cafe] Re: Question on rank-N polymorphism

2009-06-09 Thread oleg
Ryan Ingram discussed a question of writing fs f g = (f fst, g snd) so that fs ($ (1, 2)) type checks. This is not that difficult: {-# LANGUAGE RankNTypes, MultiParamTypeClasses -#} {-# LANGUAGE FunctionalDependencies, FlexibleInstances #-} class Apply f x y | f x - y where apply ::

[Haskell-cafe] Re: Question about IO, interact functions,

2009-05-19 Thread Ertugrul Soeylemez
David Leimbach leim...@gmail.com wrote: main = interact (unlines . lines) This *appears* to somewhat reliably get me functionality that looks like take a line of input, and print it out. Is this behavior something I can rely on working? I like the idea that lines can pull lines lazily from

[Haskell-cafe] Re: Question concerning Haskell Foundation

2009-05-07 Thread Ahn, Ki Yung
Don Stewart wrote: vigalchin: Hello, With Haskell Foundation, 1) Can we still publish packages on Hackage? 2) Is Hackage going away? ??? -- Don Don, I think he's referring to your recent announcement about the Haskell platform. And, at that thread you also mentioned

[Haskell-cafe] Re: Question about touchForeignPtr

2009-01-12 Thread Simon Marlow
Patrick Perry wrote: I have the following code: IOVector n e = IOVector !ConjEnum !Int (ForeignPtr e)! (Ptr e)! Int! newtype Vector n e = IOVector n e unsafeAtVector :: Vector n e - Int - e unsafeAtVector (Vector (IOVector c _ f p inc)) i = let g = if c == Conj then conjugate else id

[Haskell-cafe] Re: Question about fastcgi

2008-11-28 Thread ChrisK
Er, no. A fastcgi executable is (like a cgi executable) controlled by the front end web server. I run my fastcgi using Apache as the front end. The front end web server will control things like the port number. Mauricio wrote: Hi, I'm learnng to use fastcgi and, reading the examples, I

Re: [Haskell-cafe] Re: Question about fastcgi

2008-11-28 Thread Colin Paul Adams
ChrisK == ChrisK [EMAIL PROTECTED] writes: ChrisK Er, no. A fastcgi executable is (like a cgi executable) ChrisK controlled by the front end web server. I run my fastcgi ChrisK using Apache as the front end. The front end web server ChrisK will control things like the port

[Haskell-cafe] Re: Question about fastcgi

2008-11-28 Thread ChrisK
I have only used this, all of these are from Haskell: pamac-cek10:~ chrisk$ cat /etc/apache2/other/httpd-fastcgi.conf IfModule mod_fastcgi.c Alias /fcgi-bin/ /Library/WebServer/FastCGI-Executables/ Directory /Library/WebServer/FastCGI-Executables/ AllowOverride None Options None

[Haskell-cafe] Re: Question about fastcgi

2008-11-28 Thread Mauricio
I was able to get this working with lighttpd, and I did had to choose a port, but only at lighttpd configuration, not at the Haskell source. Thanks, Maurício ChrisK a écrit : I have only used this, all of these are from Haskell: pamac-cek10:~ chrisk$ cat /etc/apache2/other/httpd-fastcgi.conf

[Haskell-cafe] Re: question about faulting in Haskell packages ...

2008-08-03 Thread Ben Franksen
david48 wrote: for each package you have to type (*) : runhaskell Setup.hs configure runhaskell Setup.hs build sudo runhaskell Setup.hs install (*) sometimes it'll be Setup.lhs, I'm annoyed that it's not always the same name, can't rely on shell history :( Same here; my solution is to

[Haskell-cafe] Re: question concerning ANSI void *

2008-02-08 Thread Ben Franksen
Galchin Vasili wrote: Let's take a concrete but made up case .. suppose we want to call through to pthread_create and pass the (void *) argument to pthread_create which in turn gets interpreted by the pthread that is launched. How would one populate the C struct that is passed to the launched

Re: question about expected and inferred types in error messages

2007-03-13 Thread Ian Lynagh
On Sun, Mar 11, 2007 at 08:43:51PM +, Frederik Eaton wrote: I am looking at version 6.6. (is there a newer one in Debian?) (no) Thanks for the bug report and testcase; I've filed a trac bug for it: http://hackage.haskell.org/trac/ghc/ticket/1221 I hope that this isn't again something

Re: question about expected and inferred types in error messages

2007-03-13 Thread Frederik Eaton
Couldn't match expected type `Bool - [a]' against inferred type `()' In the first argument of `a', namely `()' In the expression: a () In the definition of `d': d = a () Also, I don't know what other people will think, but something bothers me about the In on the

Re: question about expected and inferred types in error messages

2007-03-12 Thread Frederik Eaton
Hi Simon, I've attached a program which exhibits the error. Here is what I get when compiling with ghc 6.6: $ ghc6 --version The Glorious Glasgow Haskell Compilation System, version 6.6 $ ghc6 bar.hs bar.hs:7:6: Couldn't match expected type `[a]' against inferred type `()' In the first

[Haskell-cafe] Re: question about database interfaces

2007-01-09 Thread Thomas David Baker
Eric wrote: So I'm wondering -- in practice, what do people actually use? Is there a more-or-less generally accepted standard database library for Haskell? In practice I am using HDBC for a PostgreSQL database and it is very easy to use and works great. http://gopher.quux.org:70/devel/hdbc

[Haskell-cafe] Re: question - which monad to use?

2006-10-02 Thread apfelmus
Tamas K Papp wrote: Hi, I have a computation where a function is always applied to the previous result. However, this function may not return a value (it involves finding a root numerically, and there may be no zero on the interval). The whole problem has a parameter c0, and the function

[Haskell-cafe] Re: Question regarding let clauses

2006-03-09 Thread Christian Maeder
Martin Percossi wrote: matMul a b = do { let foo = 2*5; return a } probably { let {foo = 2*5}; return a } will work (untested) your ; indicates a further let-equation, but the possibility to use ; without { and } is a bit pathologic (and haddock used to reject it) Christian

Re: [Haskell-cafe] Re: Question regarding let clauses

2006-03-09 Thread Brian Hulley
Christian Maeder wrote: Martin Percossi wrote: matMul a b = do { let foo = 2*5; return a } probably { let {foo = 2*5}; return a } will work (untested) your ; indicates a further let-equation, but the possibility to use ; without { and } is a bit pathologic (and haddock used to reject

Re: [Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-21 Thread Malcolm Wallace
John Meacham [EMAIL PROTECTED] wrote: I generalized this primitive to drop__ :: a - b - b Also known in the Prelude as const... The difference is that you propose it be primitive, with the intention that a clever compiler should not be able to bypass it by inlining its definition and

Re: [Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-21 Thread John Meacham
On Tue, Feb 21, 2006 at 10:15:59AM +, Malcolm Wallace wrote: John Meacham [EMAIL PROTECTED] wrote: I generalized this primitive to drop__ :: a - b - b Also known in the Prelude as const... well, 'flip const' but yes. The difference is that you propose it be primitive, with the

[Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-21 Thread Simon Marlow
John Meacham wrote: On Tue, Feb 21, 2006 at 10:15:59AM +, Malcolm Wallace wrote: John Meacham [EMAIL PROTECTED] wrote: I generalized this primitive to drop__ :: a - b - b Also known in the Prelude as const... well, 'flip const' but yes. The difference is that you propose it be

[Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-21 Thread John Meacham
On Tue, Feb 21, 2006 at 11:04:40PM +, Simon Marlow wrote: Your drop__ reminds me of GHC's touch#, which is like drop__ in the IO monad. We use it to control lifetimes, eg. inside withForeignPtr. You could implement drop in terms of touch#: drop__ a b = case touch# a realworld# of

[Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-20 Thread Simon Marlow
John Meacham wrote: So, I finally decided that jhc needs real arrays, but am running into an issue and was wondering how other compilers solve it, or if there is a general accepted way to do so. here is what I have so far -- The opaque internal array type data Array__ a -- the array

Re: [Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-20 Thread John Meacham
After reading all the interesting responses I decided to go with a slight generalization of my original idea, and it surprisingly turns out to have other generally useful unintended uses, which is the point that a 'hack' becomes a 'feature'. :) before I had a primitive: newWorld__ :: a - World__

[Haskell] Re: Question for the haskell implementors: Arrays, unsafePerformIO, runST

2006-02-16 Thread Ben Rudiak-Gould
Data.Array.ST has runSTArray :: Ix i = (forall s . ST s (STArray s i e)) - Array i e I think if you can implement that, then all your problems will be solved. -- Ben ___ Haskell mailing list Haskell@haskell.org

RE: Question about ghc case analysis

2005-08-09 Thread Simon Marlow
On 09 August 2005 12:25, Adrian Hey wrote: Well this is actually a couple of questions.. First question is how does ghc do case analysis on algebraic data type constructors. I always assumed it was by using some kind of jump table on a tag field, but I don't know really (I'm not even sure

RE: Question about how GUM works

2003-11-12 Thread Simon Peyton-Jones
I think you'll maximise your chances by sending mail about GUM and Glasgow Parallel Haskell to the GpH mailing list http://www.macs.hw.ac.uk/~dsg/gph/ Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yang, Qing | Sent: 12 November 2003

RE: Question about profiling in GHC...

2003-11-03 Thread Simon Marlow
Yes, it's probably garbage collection. To be sure, you can run your program with the -t RTS option, which will create a file in the current working directory named foo.stat if the executable is named foo. The resulting file will contain the total amount of time spent, the mutator

Re: Question about profiling in GHC...

2003-10-28 Thread Kirsten Chevalier
On Mon, Oct 27, 2003 at 12:00:04PM -0500, [EMAIL PROTECTED] wrote: When I compile my program without -prof -auto-all option (no profiling support), its execution time is about 140s (compiled with -O2). When compiled with profiling support, the time spent by the

Re: Question abt Num

2003-10-22 Thread Artie Gold
Pratik Bhadra wrote: Hi I have a data type Expr for handling Expressions data Expr = Lit1 Int | Lit2 Bool | Var String | BinOp Op Expr Expr As you can see, I am trying to have an Expression have both Int and Bool values so that I can work with both arithmetic (+,-,*,/) and logical(and,or,,=,,=)

Re: Question abt Num

2003-10-22 Thread Hamilton Richards
At 9:20 PM -0500 10/22/03, Pratik Bhadra wrote: Hi I have a data type Expr for handling Expressions data Expr = Lit1 Int | Lit2 Bool | Var String | BinOp Op Expr Expr As you can see, I am trying to have an Expression have both Int and Bool values so that I can work with both arithmetic

Re: Question abt num

2003-10-22 Thread Pratik Bhadra
Thanks, Artie and thanks to Dr Richards! I figured it out. I was not correlating the Exprs properly. Now that I broke it up into Lit1 and Lit2 and am returning a Lit1 or a Lit2 which will return an Expr, it works! :) Pratik Pratik Bhadra Undergraduate Section

Re: Question about implementation of an information-passnig arrow

2003-09-16 Thread Brandon Michael Moore
On Mon, 15 Sep 2003, Yu Di wrote: data MyArrow a b = MyArrow ((String, a) - (String, b)) i.e. there is an information asscioated with each piece of data (represented by the string), and I want to pass it around. And often the arrow's processing logic will depend on the input information,

Re: Question regarding arrows...

2003-07-07 Thread Ross Paterson
On Sun, Jul 06, 2003 at 05:31:59PM +0100, MR K P SCHUPKE wrote: I am trying to define the left operator for a CPS arrow of type: newtype CPSFunctor ans a b c = CPS ((a c ans) - (a b ans)) [...] So I try and apply this to left and get: left (CPS f) = CPS $ \k - arr (\z - case z of

RE: Question about Haskell lexer and parser.

2003-05-28 Thread Simon Marlow
Question is really about layout rules. If the first lexeme of a module is not a module keyword, we insert {n}, where n is the indentation of first lexeme. Then we apply function L to the list of lexemes and stack of layouts: L ({n}:lexemes) [] One of first case definitions of L

Re: Question about scope of 'let' and 'where'

2003-03-17 Thread Matt Hellige
[Hal Daume III [EMAIL PROTECTED]] It is not. Lets are expressions. Wheres are part of declarations. In a grammar sense, you have something like: funcdef ::= name = expr (where decls)? expr::= let decls in expr so the declarations inside a let are internal to the expression and

Re: Question about scope of 'let' and 'where'

2003-03-17 Thread Hal Daume III
No, that's not legal. You'll get an unbound variable error on the use of 'a' in the definition of 'b'. This doesn't really have anything to do with layout. Consider the following definition: f x = case x of Nothing - ... Just (y,z) - let Just q = z in b

Re: Question about scope of 'let' and 'where'

2003-03-17 Thread Matt Hellige
[Hal Daume III [EMAIL PROTECTED]] No, that's not legal. You'll get an unbound variable error on the use of 'a' in the definition of 'b'. This doesn't really have anything to do with layout. Consider the following definition: f x = case x of Nothing - ... Just (y,z) -

Re: Question about scope of 'let' and 'where'

2003-03-17 Thread Hal Daume III
Hi, f x = let ... in ... where ... Assuming that all the ...s are legal, is this OK? Should it be? It really makes the 'where' clause look like it's inside the 'let', when in fact it can't be. Ah, sorry. Yes, this is legal. However, if you

Re: Question about scope of 'let' and 'where'

2003-03-17 Thread Graham Klyne
At 22:00 16/03/2003 -0800, Hal Daume III wrote: It is not. Lets are expressions. Wheres are part of declarations. In a grammar sense, you have something like: funcdef ::= name = expr (where decls)? expr::= let decls in expr so the declarations inside a let are internal to the expression and

Re: Question about scope of 'let' and 'where'

2003-03-16 Thread Hal Daume III
It is not. Lets are expressions. Wheres are part of declarations. In a grammar sense, you have something like: funcdef ::= name = expr (where decls)? expr::= let decls in expr so the declarations inside a let are internal to the expression and can't go outside into the where clause. --

Re: Question about How use the ports in haskell

2003-02-26 Thread Nick Name
On Wed, 26 Feb 2003 00:54:13 + Cesar Augusto Acosta Minoli [EMAIL PROTECTED] wrote: ¿There's a way to input/output data from the computers' port in Haskell? ¿What about LPT1 or Com? I guess the fastest way is to create a C library and use the FFI. If you are on linux, you can as

RE: Question about compiling CGIs with Ghc

2003-02-18 Thread Simon Marlow
http://www.haskell.org/ghc/docs/latest/html/network/Network.CGI.html This make me curious, and the following just made me curiouser... Forbidden You don't have permission to access /ghc/docs/latest/html/network/Network.CGI.html on this server. *Sigh* That's because Apache thinks it's a

Re: Question about compiling CGIs with Ghc

2003-02-17 Thread Alex Ferguson
On Mon, Feb 17, 2003 at 11:00:13AM -, Simon Marlow wrote: I have some CGI programs running with Hugs and I want to use GHC instead. What changes must I do to the .hs file? Is it an easy job? Depends on lots of things really. The CGI library that comes with GHC is

Re: Question about a Function getTime

2003-01-22 Thread Hal Daume III
System.Time.getClockTime, IIRC. A quick browse through the libraries confirms this. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Wed, 22 Jan 2003, Cesar Augusto Acosta Minoli wrote:

Re: Question about lists

2003-01-19 Thread jefu
cris cris wrote: We can represent a matrix as a list of lists... which means that 1 2 3 4 7 6 2 5 1 could be written as follows: [[1,2,3],[4,7,6],[2,5,1]] The question is how can I reverse the matrix (each row becomes a column) Sounds like homework time again. At the risk of being

RE: Question about literals in the core-language

2003-01-14 Thread Simon Marlow
I'm working at comparing the ghc-core-language with another lambda-calculus. This calculus has no unboxed values, but normal constructors are available. My problem is now: How can I represent the unboxed values in my calculus. More precisely: Can I represent the unboxed values by a

Re: Question About lists

2003-01-02 Thread Alastair Reid
1. Haskell 98 does not explicitly mandate tail recursion optimisation. However, in practice Haskell compilers must provide this since it is impossible to write a loop without using recursion and if your loops don't use constant stack space, you're not going to run for very long. (In

Re: Question About lists

2003-01-02 Thread Andrew J Bromage
G'day all. On Thu, Jan 02, 2003 at 08:39:18AM +, Alastair Reid wrote: Please note that this is NOT TRUE! Whoops, you're right. Sorry, my mistake. Cheers, Andrew Bromage ___ Haskell mailing list [EMAIL PROTECTED]

Re: Question About lists

2003-01-01 Thread Shlomi Fish
On Wed, 1 Jan 2003, Andrew J Bromage wrote: G'day all. On Mon, Dec 30, 2002 at 01:47:37PM -0600, Artie Gold wrote: One suggestion, though is that you're working too hard; there's really no reason to define a locally defined function. The much simpler: long [] = 0 long (x:xs) = 1 +

Re: Question About lists

2003-01-01 Thread Andrew J Bromage
G'day all. On Wed, 1 Jan 2003, Andrew J Bromage wrote: It has quite different performance characteristics, though. In particular, this uses O(n) stack space whereas the accumulator one uses O(1) stack space. On Wed, Jan 01, 2003 at 12:17:10PM +0200, Shlomi Fish wrote: This is assuming

Re: Question About lists

2002-12-31 Thread Andrew J Bromage
G'day all. On Mon, Dec 30, 2002 at 01:47:37PM -0600, Artie Gold wrote: One suggestion, though is that you're working too hard; there's really no reason to define a locally defined function. The much simpler: long [] = 0 long (x:xs) = 1 + long xs will do quite nicely. It has quite

Re: Question About lists

2002-12-30 Thread gilesb
Hi Cesar If you check the prelude, you will find the definition (something like): length::[a]-Int length= foldl' (\n _ - n + 1) 0 and the definition of foldl' foldl' :: (a - b - a) - a - [b] - a foldl' f a [] = a foldl' f a (x:xs) = (foldl' f $! f a x) xs Which also

Re: Question About lists

2002-12-30 Thread Mark Carroll
On Mon, 30 Dec 2002, Cesar Augusto Acosta Minoli wrote: Hello! I'm Working with Lists in Haskell, I´m a Beginner in Functional Programming and I would like to know if there is a way to write a more efficient function that return the length of a list, I wrote this one: long    ::  [a]-Int

Re: Question About lists

2002-12-30 Thread Artie Gold
Cesar Augusto Acosta Minoli wrote: Hello! I'm Working with Lists in Haskell, I´m a Beginner in Functional Programming and I would like to know if there is a way to write a more efficient function that return the length of a list, I wrote this one: long:: [a]-Int long p =

Re: Question About lists

2002-12-30 Thread William Lee Irwin III
On Mon, Dec 30, 2002 at 01:47:37PM -0600, Artie Gold wrote: One suggestion, though is that you're working too hard; there's really no reason to define a locally defined function. The much simpler: long [] = 0 long (x:xs) = 1 + long xs will do quite nicely. HTH, --ag There is already a

RE: Question About lists

2002-12-30 Thread Jong Keun Na
long = sum . map (const 1) How's this? /JongKeun -Original Message- From: William Lee Irwin III [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 31, 2002 5:18 AM To: Artie Gold Cc: Cesar Augusto Acosta Minoli; [EMAIL PROTECTED] Subject: Re: Question About lists On Mon, Dec 30, 2002

Re: Question About Random Module

2002-12-25 Thread Glynn Clements
Cesar Augusto Acosta Minoli wrote: PHello! I just Wanna Know, What should I do, to build a List of random Numbers, withoutnbsp; IO type, just Float or Int/P Use randoms or randomRs in conjunction with either mkStdGen or your own instance of RandomGen, all from the Random module. You only get

Re: Question About Random Module

2002-12-24 Thread Zdenek Dvorak
Hello, Hello! I just Wanna Know, What should I do, to build a List of random Numbers, without IO type, just Float or Int the answer for this is either you can't, read something about IO and monads (good starting places are http://haskell.org/wiki/wiki?UsingIo and

RE: question about haskell report terminology

2002-11-28 Thread David Bergman
Bernard James wrote: In section 4.4.3 Function and Pattern Bindings of the Haskell 98 Report, it gives the following translation: [ the pattern lambda construction to case expression conversion from the Report] What does it mean by semantically equivalent. A rough approximation is has the

Re: question about haskell report terminology

2002-11-28 Thread Bernard James POPE
For example: foo x = show x versus foo = \x - show x And, why not the simplest version: foo = show... If we call these three versions foo1, foo2 and foo3, then they are semantically equivalent because, besides having the same type, one can substitute one with anyone of

Re: Question about the notation of (# ... #)

2002-10-04 Thread Hal Daume III
This means its an unboxed tuple. See recent thread about boxed vs. unboxed. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Fri, 4 Oct 2002, David Sabel wrote: Hi, can somebody

Re: question about 'sort' algorithm

2002-10-02 Thread Ross Paterson
On Wed, Oct 02, 2002 at 07:01:50AM -0400, David Roundy wrote: I was wondering if anyone knows what sort of algorithm the 'sort' function in the List module actually uses? In The Haskell 98 Library Report, they give an insertion sort implementation, but I find it hard to believe that the

Re: Question aboutthe use of an inner forall

2002-08-30 Thread Scott J.
List [EMAIL PROTECTED] Sent: Thursday, August 29, 2002 4:10 PM Subject: RE: Question aboutthe use of an inner forall Now fixed in the 5.04 branch. The fix will get into the HEAD when I merge in the Template Haskell stuff. Thanks for the report Simon | -Original Message- | From

RE: Question aboutthe use of an inner forall

2002-08-28 Thread Simon Peyton-Jones
No, this is a bug, thank you. Will fix. Simon | -Original Message- | From: Ashley Yakeley [mailto:[EMAIL PROTECTED]] | Sent: 19 August 2002 11:31 | To: Jay Cox; Haskell Cafe List | Subject: Re: Question aboutthe use of an inner forall | | | At 2002-08-18 20:19, Jay Cox wrote

Re: Question about use of | in a class declaration

2002-08-21 Thread Hal Daume III
find reference to this in any of my standard Haskell tutorials, nor the Haskell 98 report. Any references? cheers, Simon -Original Message- From: Andrew J Bromage [mailto:[EMAIL PROTECTED]] Sent: 21 August 2002 04:19 To: [EMAIL PROTECTED] Subject: Re: Question about sets

Re: Question about use of | in a class declaration

2002-08-21 Thread Jerzy Karczmarczuk
Hal Daume III wrote: This is a functional dependency. You can probably find informationin the GHC docs. It's a way of telling the compiler how to derive type information on multiparameter classes. Oh, can you? Here what the User's Guide says: Functional dependencies are implemented as

RE: Question about use of | in a class declaration

2002-08-21 Thread Simon Marlow
Here what the User's Guide says: Functional dependencies are implemented as described by Mark Jones in Type Classes with Functional Dependencies, Mark P. Jones, In Proceedings of the 9th European Symposium on Programming, ESOP 2000, Berlin, Germany, March 2000,

Re: Question about use of | in a class declaration

2002-08-21 Thread Christian Sievers
Simon Guest asked: Please could someone explain the meaning of | in this class declaration (from Andrew's example): class (Ord k) = Map m k v | m - k v where lookupM :: m - k - Maybe v I couldn't find reference to this in any of my standard Haskell tutorials, nor the

Re: Question about use of | in a class declaration

2002-08-21 Thread Mark Carroll
On Wed, 21 Aug 2002, Christian Sievers wrote: (snip) It might not have become clear from the previous answers: this construction is not Haskell 98, but an extension. That's why it's not in the report. (snip) One issue we have here is that any Haskell we write is stuff we'll probably want to

Re: Question about use of | in a class declaration

2002-08-21 Thread Andrew J Bromage
G'day all. On Wed, Aug 21, 2002 at 02:46:16PM -0400, Mark Carroll wrote: One issue we have here is that any Haskell we write is stuff we'll probably want to keep using for a while so, although we've only just got most of the bugs out of the H98 report, I'll certainly watch with interest as

  1   2   >