[Haskell-cafe] ANN: The Monad.Reader - Issue 14

2009-07-29 Thread Wouter Swierstra
Dear all, I am pleased to announce that a new issue of The Monad.Reader is now available: http://themonadreader.wordpress.com/ Issue 14 consists of the following three articles: * Fun with Morse Code by Heinrich Apfelmus * Hieroglyph 2: Purely Functional Information Graphics

[Haskell-cafe] Re: Need feedback on my Haskell code

2009-07-29 Thread Jon Fairbairn
CK Kashyap ck_kash...@yahoo.com writes: line' (x1, y1) (x2, y2) deltax deltay ystep isSteep error | x1 == x2 = if isSteep then [(y1, x1)] else [(x1, y1)] | isSteep = (y1, x1) : line' (newX, newY) (x2, y2) deltax deltay ystep isSteep newError | otherwise = (x1, y1) :

[Haskell-cafe] Re: Adding a field to a data record

2009-07-29 Thread Jon Fairbairn
Henry Laxen nadine.and.he...@pobox.com writes: It seems to me this should be easy, but I can't quite figure out how to do it without a lot of typing. Here is the question: Suppose you have a data type like: Data Foo = Foo { a :: Int, b :: Int, ... many other fields ... y :: Int }

Re: [Haskell-cafe] Adding a field to a data record

2009-07-29 Thread José Pedro Magalhães
Hello Henry, The paper A Lightweight Approach To Datatype-Generic Rewriting [1] describes a way to generically add a constructor to any regular datatype using type-indexed datatypes [2]. A similar technique could be used to add a new field to each constructor. Then you get something like: data

Re: [Haskell-cafe] Need feedback on my Haskell code

2009-07-29 Thread CK Kashyap
It worked like a charm!!! I'd need more time to get my head around unfoldr I'd appreciate it very much if you could explain this line map maySwitch . unfoldr go $ (x1,y1,0) I did not fully understand the $ in that line - I tried putting parenthesis in various places to get rid of $ but did not

Re: [Haskell-cafe] Re: Adding a field to a data record

2009-07-29 Thread Lennart Augustsson
With the RecordWildCard extension you should be able to write newFoo Old.Foo{..} = New.Foo { .., z=1 } On Tue, Jul 28, 2009 at 3:47 PM, Henry Laxennadine.and.he...@pobox.com wrote: Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk writes: and perhaps use emacs to query-replace all the

Re: [Haskell-cafe] Proposal: TypeDirectedNameResolution

2009-07-29 Thread Ben Lippmeier
On 28/07/2009, at 6:41 AM, John Dorsey wrote: I'm assuming that name resolution is currently independent of type inference, and will happen before type inference. With the proposal this is no longer true, and in general some partial type inference will have to happen before conflicting

Re: [Haskell-cafe] Need feedback on my Haskell code

2009-07-29 Thread Johan Tibell
On Wed, Jul 29, 2009 at 12:04 PM, CK Kashyap ck_kash...@yahoo.com wrote: It worked like a charm!!! I'd need more time to get my head around unfoldr I'd appreciate it very much if you could explain this line map maySwitch . unfoldr go $ (x1,y1,0) I did not fully understand the $ in that line

Re: [Haskell-cafe] Need feedback on my Haskell code

2009-07-29 Thread david48
On Wed, Jul 29, 2009 at 12:04 PM, CK Kashyapck_kash...@yahoo.com wrote: map maySwitch . unfoldr go $ (x1,y1,0) I'm not an expert and I might say things the wrong way or without the required rigor, so with this disclaimer here's my explanation : go calculates a step of the line, given the

[Haskell-cafe] RFC: Unicode support in Alex

2009-07-29 Thread Jean-Philippe Bernardy
Hello, I have modified the Alex lexer generator to support unicode. The general idea is that the state-machine works on the UTF8 representation of the text. I submit my work here for review in order to off-load the maintainer (Simon Marlow) as far as possible. The prototype is available on

[Haskell-cafe] Re: Re: Proposal: TypeDirectedNameResolution

2009-07-29 Thread Johannes Waldmann
While the discussion centers around overload resolution let me re-iterate a point that (e.g.,) Java does nicely: for their x.f, if x :: T, then you write .f (unqualified) instead of .T.f (qualified), even if you needed qualification to declare the type of x, as in foo.bar.T x; This requires

[Haskell-cafe] [Haskell Cafe] Data construction: how to avoid boilerplate code?

2009-07-29 Thread Paul Sujkov
Hi haskellers, I have a datatype of this sort: data Type = Status | Message | Warning | Error | StepIn | StepOut deriving (Eq, Show) and (at this moment) two fabric-like functions: makeType :: String - Type makeType c = case c of

[Haskell-cafe] Re: [Haskell] ANNOUNCE: OpenGL 2.3.0.0

2009-07-29 Thread Felipe Lessa
On Wed, Jul 29, 2009 at 06:26:30PM +0200, Sven Panne wrote: Apart from that, a bug in vertexAttribPointer has been fixed. ...and the new ObjectName, StateVar and Tensor packages are being used, and this is great! Thanks for the release. -- Felipe.

Re: [Haskell-cafe] [Haskell Cafe] Data construction: how to avoid boilerplate code?

2009-07-29 Thread Luke Palmer
On Wed, Jul 29, 2009 at 6:27 AM, Paul Sujkovpsuj...@gmail.com wrote: Hi haskellers, I have a datatype of this sort: data Type = Status   | Message   | Warning   | Error   | StepIn   | StepOut deriving (Eq, Show) and (at this moment) two

Re: [Haskell-cafe] [Haskell Cafe] Data construction: how to avoid boilerplate code?

2009-07-29 Thread Luke Palmer
On Wed, Jul 29, 2009 at 10:15 AM, Paul Sujkovpsuj...@gmail.com wrote: Hi Luke, I'm not pretty sure. The thing I don't like is the need to copy-and-paste all the code with enumeration constructors. So, now I have two types to make Type data from, but they could be many, so I'll have many

Re: [Haskell-cafe] Re: cabal: : openFile: does not exist (No such file or directory)

2009-07-29 Thread Job Vranish
lol, yep you're right. I'd assumed the haskell platform shipped with the latest parsec, when in fact it does not :) my bad... However, I fixed the cabal issue by installing ghc 6.10.3 and rebuilding the haskell platform. Apparently there is either a compiler issue or incompatibility with 6.10.4

Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: OpenGL 2.3.0.0

2009-07-29 Thread Rafael Gustavo da Cunha Pereira Pinto
Just a heads up: I did a cabal install Tensor on my Ubuntu box, and got the following message: src/Data/Tensor.hs:333:18: Not in scope: `mapAccumL' I will investigate a little more and let you know. On Wed, Jul 29, 2009 at 13:55, Felipe Lessa felipe.le...@gmail.com wrote: On Wed, Jul 29,

Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: OpenGL 2.3.0.0

2009-07-29 Thread Rafael Gustavo da Cunha Pereira Pinto
That was quick! mapAccumL was added to Data.Traversable in package base-4. GHC 6.8.2 uses base-3... I think I will be forced to upgrade my GHC by hand... I just can't stand 6.8.2 anymore... On Wed, Jul 29, 2009 at 22:17, Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com wrote:

Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: OpenGL 2.3.0.0

2009-07-29 Thread Felipe Lessa
On Wed, Jul 29, 2009 at 10:24:23PM -0300, Rafael Gustavo da Cunha Pereira Pinto wrote: mapAccumL was added to Data.Traversable in package base-4. GHC 6.8.2 uses base-3... But this means that Tensor's dependencies should be on base = 4, not 3. -- Felipe.