[Haskell-cafe] [ANNOUNCE] First Public Release of the Snap Framework

2010-05-21 Thread Gregory Collins
Hello all, To coincide with Hac Phi 2010 (http://www.haskell.org/haskellwiki/Hac_%CF%86), the Snap team is happy to announce the first public release of the Snap Framework, a simple and fast Haskell web programming server and library for unix systems. For installation instructions, documentation,

Re: [Haskell-cafe] Enum instantiation

2010-05-21 Thread Antoine Latter
On Fri, May 21, 2010 at 8:59 PM, R J wrote: > If I type "toEnum 5," the error I get is: > :1:0: >     Ambiguous type variable `a' in the constraint: >       `Enum a' arising from a use of `toEnum' at :1:0-7 >     Probable fix: add a type signature that fixes these type variable(s) > *Main> Here t

Re: [Haskell-cafe] Proof question -- (==) over Bool

2010-05-21 Thread Luke Palmer
2010/5/21 R J : > I'm trying to prove that (==) is reflexive, symmetric, and transitive over > the Bools, given this definition: > (==)                       :: Bool -> Bool -> Bool > x == y                     =  (x && y) || (not x && not y) > My question is:  are the proofs below for reflexivity

Re: [Haskell-cafe] Enum instantiation

2010-05-21 Thread Gregory Collins
R J writes: > I'd like to make "Day" an instance of class "Enum," but the definition > of toEnum below seems to be completely wrong, because integers seem > not permit pattern matching. How is toEnum defined? Thanks. You could try using guards: > toEnum x | x == 0= Sunday >

Re: [Haskell-cafe] Enum instantiation

2010-05-21 Thread Antoine Latter
2010/5/21 R J : > I'd like to make "Day" an instance of class "Enum," but the definition of > toEnum below seems to be completely wrong, because integers seem not permit > pattern matching.  How is toEnum defined?  Thanks. Hi, What error are you getting when you try your class instance? Thanks,

[Haskell-cafe] Enum instantiation

2010-05-21 Thread R J
I'd like to make "Day" an instance of class "Enum," but the definition of toEnum below seems to be completely wrong, because integers seem not permit pattern matching. How is toEnum defined? Thanks. data Day = Sunday | Monday

Re: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-21 Thread Daniel Peebles
Have you tried freopen on stderr? On Fri, May 21, 2010 at 8:43 AM, Phyx wrote: > Hi, > I tried that, setting it to (\_ _ _ _ -> return ()) and it still did the > same, also tried setting it to undefined to see whether the code that's > printing the error is using it, and it didn't crash > So I a

[Haskell-cafe] Proof question -- (==) over Bool

2010-05-21 Thread R J
I'm trying to prove that (==) is reflexive, symmetric, and transitive over the Bools, given this definition: (==) :: Bool -> Bool -> Boolx == y = (x && y) || (not x && not y) My question is: are the proofs below for reflexivity and symmetricity rigoro

Re: [Haskell-cafe] double2Float is faster than (fromRational . toRational)

2010-05-21 Thread Pierre-Etienne Meunier
By the way, speaking of floating-point precision, is there a real reason why haskell forces us to write : foreign import ccall unsafe "math.h frexp" c_frexp::CDouble->(Ptr CInt)->IO () foreign import ccall unsafe "math.h ldexp" c_ldexp::CDouble->CInt->IO CDouble ulp::Double->Double ulp x=unsafeP

Re: [Haskell-cafe] double2Float is faster than (fromRational . toRational)

2010-05-21 Thread Don Stewart
dvde: > Dear Haskellers, > > I just want to share an observation. I had to convert a Double to a > Float value in an inner loop of an application, and I used somethin like > this: > > xf = (fromRational $ toRational xd) :: Float > > The program works on windows but it did not on OSX - it was to

Re: [Haskell-cafe] double2Float is faster than (fromRational . toRational)

2010-05-21 Thread Daniel Fischer
On Friday 21 May 2010 22:06:43, Henning Thielemann wrote: > On Fri, 21 May 2010, Daniel van den Eijkel wrote: > > Dear Haskellers, > > > > I just want to share an observation. I had to convert a Double to a > > Float value in an inner loop of an application, and I used somethin > > like this: > > >

Re: [Haskell-cafe] double2Float is faster than (fromRational . toRational)

2010-05-21 Thread Daniel van den Eijkel
I see. And I changed the code, it works well. Thanks for that! Daniel Henning Thielemann schrieb: On Fri, 21 May 2010, Daniel van den Eijkel wrote: Dear Haskellers, I just want to share an observation. I had to convert a Double to a Float value in an inner loop of an application, and I use

Re: [Haskell-cafe] double2Float is faster than (fromRational . toRational)

2010-05-21 Thread Henning Thielemann
On Fri, 21 May 2010, Daniel van den Eijkel wrote: Dear Haskellers, I just want to share an observation. I had to convert a Double to a Float value in an inner loop of an application, and I used somethin like this: xf = (fromRational $ toRational xd) :: Float I think realToFrac is the func

[Haskell-cafe] double2Float is faster than (fromRational . toRational)

2010-05-21 Thread Daniel van den Eijkel
Dear Haskellers, I just want to share an observation. I had to convert a Double to a Float value in an inner loop of an application, and I used somethin like this: xf = (fromRational $ toRational xd) :: Float The program works on windows but it did not on OSX - it was too slow. Now, after b

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

2010-05-21 Thread Daniel Fischer
On Friday 21 May 2010 20:50:39, Anatoly Yakovenko wrote: > anyone else seeing this behavior? > > anato...@anatolyy-linux ~ $ ghci > GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help > Loading package ghc-prim ... linking ... done. > Loading package integer-gmp ... linking ... done. > L

[Haskell-cafe] Exception: : changeWorkingDirectory: does not exist (No such file or directory)

2010-05-21 Thread Anatoly Yakovenko
anyone else seeing this behavior? anato...@anatolyy-linux ~ $ ghci GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ...

Re: [Haskell-cafe] ambiguous type variable problem when using forall, multiparameter type classes, and constraints on polymorphic values (and syb-with-class)

2010-05-21 Thread C. McCann
On Fri, May 21, 2010 at 12:30 PM, Jeremy Shaw wrote: > Adding all the scoped type variable stuff does not seem to help. Alas, > I can not figure out if this is a limitation of the type-checker, or > something that is fundamentally impossible. Nor can I figure out how > to work around the issue. I

Re: [Haskell-cafe] FW: Why does this Ord-class instance crash?

2010-05-21 Thread Daniel Fischer
On Friday 21 May 2010 19:06:51, R J wrote: > Why does the following, trivial code snippet below hang GHCi when I > type"Scalene > Failure", and what's the fix? For an Ord instance, you need to define at least one of compare and (<=) or the other functions from the class won't work. All methods h

Re: [Haskell-cafe] FW: Why does this Ord-class instance crash?

2010-05-21 Thread Miguel Mitrofanov
From Prelude.hs: class (Eq a) => Ord a where compare :: a -> a -> Ordering (<), (<=), (>), (>=) :: a -> a -> Bool max, min :: a -> a -> a compare x y = if x == y then EQ -- NB: must be '<=' not '<' to validate the --

Re: [Haskell-cafe] FW: Why does this Ord-class instance crash?

2010-05-21 Thread David Menendez
2010/5/21 R J : > Why does the following, trivial  code snippet below hang GHCi when I type > "Scalene > Failure", and what's the fix? An instance of Ord must declare compare or (<=). You only defined (<), so (>) is using the default definition. Here are the defaults: compare x y = if x == y

Re: [Haskell-cafe] Proposal to solve Haskell's MPTC dilemma

2010-05-21 Thread David Menendez
On Fri, May 21, 2010 at 3:56 AM, Max Bolingbroke wrote: > On 21 May 2010 01:58, Carlos Camarao wrote: >> But this type-correct program would become not typeable if >> instances such as the ones referred to before (by Daniel Fischer) > > I was thinking this through, and the situation is more compl

[Haskell-cafe] FW: Why does this Ord-class instance crash?

2010-05-21 Thread R J
Why does the following, trivial code snippet below hang GHCi when I type"Scalene > Failure", and what's the fix? data Triangle = Failure | Equilateral | Isosceles | Scalene

[Haskell-cafe] ambiguous type variable problem when using forall, multiparameter type classes, and constraints on polymorphic values (and syb-with-class)

2010-05-21 Thread Jeremy Shaw
Hello, I am trying to understand why I am getting an ambigious type variable error, and what I can do to work around it. The problem is occurring while trying to use syb-with-class, but I have stripped it down to it's bare essentials, so the following code is self-contained, and does not require a

[Haskell-cafe] Tools to make tidy HTML

2010-05-21 Thread Dmitri O.Kondratiev
Hello! Please advise haskell libraries similar to convert real-world HTML to well-formed XML. I need something similat to "HTML Tidy" library: http://tidy.sourceforge.net/ Thanks! Dmitri ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.h

[Haskell-cafe] Register now for: Haskell in Leipzig (Germany), June 4.

2010-05-21 Thread Johannes Waldmann
Schedule and registration for the "Haskell in Leipzig" meeting on June 4 are now on-line: http://www.iba-cg.de/hal5.html It's our fifth meeting, and here are five good reasons to go: * learn Haskell: attend tutorials for beginners * get first-hand information: authors of Leksah, HXT, Ha

Re: [Haskell-cafe] Proposal to solve Haskell's MPTC dilemma

2010-05-21 Thread Marco Túlio Gontijo e Silva
Hi Max. Excerpts from Max Bolingbroke's message of Sex Mai 21 04:56:51 -0300 2010: (...) > (Incidentally, the link to your paper is broken, so I haven't actually > been able to read it, sorry!) It was easy to find it on google. http://www.dcc.ufmg.br/~camarao/CT/solution-to-mptc-dilemma.pdf Gre

RE: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-21 Thread Phyx
Hi, I tried that, setting it to (\_ _ _ _ -> return ()) and it still did the same, also tried setting it to undefined to see whether the code that's printing the error is using it, and it didn't crash So I assume it's not. --- *VsxParser> getModInfo True "C:\\Users\\Phyx\\AppData\\Local\\T

Re: [Haskell-cafe] Type families vs. functional dependencies -- how to express something

2010-05-21 Thread Tomáš Janoušek
Hello, On Tue, May 18, 2010 at 04:47:50PM -0700, Dan Weston wrote: > > Unifying those two types by hand, I get: > > > > P (A t -> B a) > > ~> P (B a) > > Maybe the problem is that type families (and associated types, their > class cousins) are not injective: P x ~ P y does not imply that x

Re: [Haskell-cafe] making the GHC Api not write to stderr

2010-05-21 Thread Thomas Schilling
You could try changing the log_action[1] member of the DynFlags. A while ago I turned most printed errors into some form of error message, but I wouldn't be surprised if I missed some places. All output should go through log_action, though, so try changing that to intercept any output. [1]: htt

Re: [Haskell-cafe] Недвижимость во Ф ранции, аренда и продажа вилл

2010-05-21 Thread Roel van Dijk
Google translation: > The office of our company is located in Nice - the heart of the > Riviera, that gives us an immediate opportunity to offer villas > for rent and sale in all their diversity, as well as guidance to > our clients on the most interesting and important events in the > rich cultura

[Haskell-cafe] Недвижимость во Франции, ар енда и продажа вилл

2010-05-21 Thread moreletto
Офис нашей компании находится в Ницце - в самом сердце Французской Ривьеры, что дает нам непосредственную возможность предложить виллы для аренды и продажи во всем их многообразии, а также сориентировать наших клиентов на самые интересные и значимые мероприятия в богатой культурной и светской жизни

Re: [Haskell-cafe] String rewriting

2010-05-21 Thread Uwe Schmidt
Hi Roly, > I'm looking for a simple way to rewrite strings according to simple > composable rules like: > > replace "_" by "\\(\\hole\\)" > replace "-n" where n matches an integer by "^{n}" > > so that I can import some pretty-printed output into a LaTeX alltt > environment. I'm guessing that this

[Haskell-cafe] Re: String rewriting

2010-05-21 Thread Johannes Waldmann
> ... to rewrite strings according to simple composable rules like ... more often than not, regexp/replace is a hack to avoid the "real thing" (parse -> AST -> transform -> AST' -> print). such hacks tend to grow into something that is definitely not composable. but, you can be a hero ... http:

Re: [Haskell-cafe] Proposal to solve Haskell's MPTC dilemma

2010-05-21 Thread Max Bolingbroke
On 21 May 2010 01:58, Carlos Camarao wrote: > But this type-correct program would become not typeable if > instances such as the ones referred to before (by Daniel Fischer) I was thinking this through, and the situation is more complex than I had thought. It seems that single param type classes

Re: [Haskell-cafe] Proposal to solve Haskell's MPTC dilemma

2010-05-21 Thread Stephen Tetley
Hi Evan EHC - Essential Haskell Compiler - is the 'family of compilers' that UHC - Utrecht Haskell Compiler - is instance one of. The EHC family starts with a simple Haskell subset and adds features building up to (almost) Haskell98 for UHC and extended Haskell for some of the EHC variations. This