Re: [Haskell-cafe] building a regular polygon

2007-08-19 Thread Radosław Grzanka
2007/8/19, Daniel C. Bastos [EMAIL PROTECTED]: Any help is appreciated. I also had problem with this exercise. However this was more Haskell newbie problem :) If you're feeling lost you can always try google and come up with this blog with solutions to exercises from this book. You should find

RE: [Haskell-cafe] building a regular polygon

2007-08-19 Thread Frank Buss
(*) Exercise 2.2 Define a function regularPolygon :: Int - Side - Shape such that regularPolygon n s is a regular polygon with n sides, each of length s. (Hint: consider using some of Haskell's trigonometric functions, such as sin :: Float - Float, cos :: Float - Float, and tan :: Float

[Haskell-cafe] List comprehension desugaring

2007-08-19 Thread Neil Mitchell
Hi, The Haskell desugaring for list comprehensions is given in: http://haskell.org/onlinereport/exps.html#list-comprehensions All the rules seem to be left to right rewrites, apart from the second one, which seems to be right to left. Is there some deep reason for this, or is this accidental.

[Haskell-cafe] Re: List comprehension desugaring

2007-08-19 Thread Neil Mitchell
Hi Sorry for the noise, I've now realised they are a left to right rewrite system, the second rule is required to set up the base case. Thanks Neil On 8/19/07, Neil Mitchell [EMAIL PROTECTED] wrote: Hi, The Haskell desugaring for list comprehensions is given in:

Re: [Haskell-cafe] Re: Error building takusen with Cabal-1.1.6.2

2007-08-19 Thread Alistair Bayley
Setup.hs:13:7: Could not find module `Distribution.Compat.FilePath': it is hidden (in package Cabal-1.1.6.2) This is what I did to make takusen build with ghc-6.6.1: [EMAIL PROTECTED]: .../haskell/takusen_0 darcs whatsnew { hunk ./Setup.hs 13 -import

[Haskell-cafe] GHC optimisations

2007-08-19 Thread Andrew Coppin
Does GHC do stuff like converting (2*) into (shift 1) or converting x + x into 2*x? If I do x * sin 12, is GHC likely to compute sin 12 at compile-time? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Using Apple Spotlight to search for .hs and .lhs files

2007-08-19 Thread alpheccar
Since it is not really Haskell related, I have answered by email. If anyone is interested, don't hesitate to email me. alpheccar. This isn't really a Haskell question but I'm guessing some Haskell hackers have a solution. MacOS X's Spotlight doesn't seem to be able to search for text in .lhs

[Haskell-cafe] Re: List comprehension desugaring

2007-08-19 Thread apfelmus
Neil Mitchell wrote: The Haskell desugaring for list comprehensions is given in: http://haskell.org/onlinereport/exps.html#list-comprehensions All the rules seem to be left to right rewrites, apart from the second one, which seems to be right to left. Is there some deep reason for this, or is

Re: [Haskell-cafe] Re: How do I simulate dependent types using phantom types?

2007-08-19 Thread Bertram Felgenhauer
DavidA wrote: Twan van Laarhoven twanvl at gmail.com writes: The solution is to use a dummy parameter: class IntegerType a where value :: a - Integer Thanks to all respondents for this suggestion. That works great. I prefer a slightly elaborate way, newtype Mark n t = Mark t

[Haskell-cafe] Using Collections: ElemsView and KeysView

2007-08-19 Thread Benjamin Franksen
Hi I am using collections-0.3 and need to perform some operations on keys resp. values of a map. In the concrete implementations there are functions like 'elems' and 'keys' but there is no such thing in Data.Collections. Instead there are the types 'ElemsView' and 'KeysView' and functions

Re: [Haskell-cafe] Parsing binary data.

2007-08-19 Thread Adam Langley
On 8/18/07, Matthew Sackman [EMAIL PROTECTED] wrote: Also, one thing to watch out for is the fact the existing Get and Put instances may not do anything like what you expect. For example, for some reason I expected that the instances of Get and Put for Float and Double would send across the

Re: [Haskell-cafe] GHC optimisations

2007-08-19 Thread Tim Chevalier
On 8/19/07, Andrew Coppin [EMAIL PROTECTED] wrote: Does GHC do stuff like converting (2*) into (shift 1) or converting x + x into 2*x? Hmm, that's an interesting architecture where multiplication is cheaper than addition :-) If I do x * sin 12, is GHC likely to compute sin 12 at

Re: [Haskell-cafe] GHC optimisations

2007-08-19 Thread Stefan O'Rear
On Sun, Aug 19, 2007 at 12:53:07PM +0100, Andrew Coppin wrote: Does GHC do stuff like converting (2*) into (shift 1) or converting x + x into 2*x? For a good time, compile some code which uses even or odd :: Int - Bool using -O2 -fasm -ddump-asm... The compiler *really* shouldn't be using

RE: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-19 Thread Peter Verswyvelen
Thanks. I got confused because the StackOverflow link on http://www.haskell.org/haskellwiki/HaWiki_migration is dead. -Original Message- From: Derek Elkins [mailto:[EMAIL PROTECTED] Sent: Saturday, August 18, 2007 8:54 PM To: Peter Verswyvelen Cc: haskell-cafe@haskell.org Subject: Re:

[Haskell-cafe] Re: Interval Arithmetics

2007-08-19 Thread Henning Thielemann
The page http://www.haskell.org/haskellwiki/Applications_and_libraries/Mathematics#Number_representations lists several implementations of several flavours of computable reals, which may be useful for you. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] building a regular polygon

2007-08-19 Thread Rafael Almeida
On 8/19/07, Frank Buss [EMAIL PROTECTED] wrote: (*) Exercise 2.2 Define a function regularPolygon :: Int - Side - Shape such that regularPolygon n s is a regular polygon with n sides, each of length s. (Hint: consider using some of Haskell's trigonometric functions, such as sin ::

[Haskell-cafe] IO in HApps handler ?

2007-08-19 Thread Luc TAESCH
Subject: IO in HApps handler ? I am trying to add a handler that would run an external command in HApps 0.8.8, and I got a type issue I do not know how to get around.. can we have IO in a handler ? testcmdpost.hs:52:8: Couldn't match expected type `Ev st Request' against inferred

[Haskell-cafe] ghc 6.7 /6.8

2007-08-19 Thread Luc TAESCH
Date: Sun, 19 Aug 2007 12:39:50 +0200 Subject: Fwd: ghc 6.7 /6.8 hello. will 6.7 be released, or will only 6.8 be ? ( i.e do you use an even/uneven relesing number convention) -in that case, does the 6.8 branch means the freeze is on, and what would be the target for 6.8 ? Q3/2007 ? Q4 ? (

Re: [Haskell-cafe] ghc 6.7 /6.8

2007-08-19 Thread Neil Mitchell
Hi will 6.7 be released, or will only 6.8 be ? 6.7 is the HEAD branch, 6.8 will be released. -in that case, does the 6.8 branch means the freeze is on, and what would be the target for 6.8 ? Q3/2007 ? Q4 ? Soon, in the next month - according to latest targets/estimates. ( context: I am

[Haskell-cafe] Re: trouble compiling import GHC.Prim(MutableByteArray#, ..... (building regex-tdfa from darcs) -- what's that # sign doing?

2007-08-19 Thread ChrisK
Stefan O'Rear wrote: On Fri, Aug 17, 2007 at 04:27:29PM -0400, Thomas Hartman wrote: trying to compile regex-tdfa, I ran into another issue. (earlier I had a cabal problem but that's resolved.) there's a line that won't compile, neither for ghc 6.6.1 nor 6.7 import

Re: [Haskell-cafe] Re: trouble compiling import GHC.Prim(MutableByteArray#, ..... (building regex-tdfa from darcs) -- what's that # sign doing?

2007-08-19 Thread Stefan O'Rear
On Sun, Aug 19, 2007 at 11:25:49PM +0100, ChrisK wrote: #ifdef __GLASGOW_HASKELL__ foreign import ccall unsafe memcpy memcpy :: MutableByteArray# RealWorld - MutableByteArray# RealWorld - Int# - IO () {-# INLINE copySTU #-} copySTU :: (Show i,Ix i,MArray (STUArray s) e (ST s))

[Haskell-cafe] Bi-directional Maps

2007-08-19 Thread Andrew Wagner
Hi folks! So, in writing my chess engine, I've been trying to maintain 2 Map objects. One maps squares on the board to Ints, the other maps Ints to actual Pieces. It occurred to me that it would be useful to explicitly have a Bi-directional Map, which does the maintenance of keeping the Maps

RE: [Haskell-cafe] building a regular polygon

2007-08-19 Thread Frank Buss
From: Rafael Almeida [mailto:[EMAIL PROTECTED] I used the cosine law in order to calculate r. After all, s is actually the size of the side of the polygon and not the distance of its vertices from the origin. You are right, my solution was wrong. If you don't mind rounding errors, this is

Re: [Haskell-cafe] IO in HApps handler ?

2007-08-19 Thread Marc Weber
Hi TAESCH, THat's what haskell is good for. It prevents you from doing unsafe things by accident. You must get the source and have a look at the definition of the Ev type: (module HAppS.MACID.Types where:) (Not sure wether this code is most recent or not (Version: 0.8.8)) =

Re: [Haskell-cafe] IO in HApps handler ?

2007-08-19 Thread Tim Newsham
Subject: IO in HApps handler ? I am trying to add a handler that would run an external command in HApps 0.8.8, and I got a type issue I do not know how to get around.. can we have IO in a handler ? http://www.haskell.org/haskellwiki/HAppS_tutorial#Application The MACID monad lets you update