Re: carriage returns on Windows from quasi-quotes

2013-10-05 Thread Christopher Done
They're on Windows? On 5 October 2013 01:36, Greg Weber g...@gregweber.info wrote: A Windows user rerported using Data.Text.IO.writeFile to write out quasi-quoted text. writeFile automatically translates '\r' to \r\n, so the user ended up writing out \r\r\n to a file. Haskell seems to be

Re: How to fix DatatypeContexts?

2013-07-18 Thread Christopher Done
Why not this? data Pair = forall a. Eq a = Pair {x::a, y::a} equal :: Pair - Bool equal (Pair x y) = x == y ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: How to fix DatatypeContexts?

2013-07-18 Thread Christopher Done
Hm, also, with equality constraints you can make the type parametrized, too: data Pair a' = forall a. (a ~ a', Eq a) = Pair {x::a, y::a} equal :: Pair a - Bool equal (Pair x y) = x == y On 18 July 2013 13:00, Christopher Done chrisd...@gmail.com wrote: Why not this? data Pair = forall a. Eq

Re: How to fix DatatypeContexts?

2013-07-18 Thread Christopher Done
Good point, classic use-case for GADTs. On 18 July 2013 13:11, Sjoerd Visscher sjo...@w3future.com wrote: I'd use GADT syntax for this: {-# LANGUAGE GADTs #-} data Pair a where Pair :: Eq a = {x::a, y::a} - Pair a Sjoerd On Jul 18, 2013, at 1:05 PM, Christopher Done chrisd...@gmail.com

Re: Why is GHC so much worse than JHC when computing the Ackermann function?

2013-04-20 Thread Christopher Done
JHC compiles to C and last time I tried this it looked very much like the original C version: http://www.reddit.com/r/haskell/comments/1bcru7/damn_lies_and_haskell_performance/c9689a3 This is the same thing. Compile with --tdir=/tmp/ajhc and then cat /tmp/ajhc/main_code.c. Output should be like

Re: How to get started with a new backend?

2013-01-27 Thread Christopher Done
The trac claims that ghc can compile itself to C so that only standard gnu C tools are needed to build an unregistered compiler. Wait, it can? Where's that? On 28 January 2013 02:15, Jason Dagit dag...@gmail.com wrote: I would like to explore making a backend for .NET. I've done a lot of

Re: UHC-like JavaScript backend in GHC

2012-11-13 Thread Christopher Done
On 13 November 2012 16:33, J. Stutterheim j.stutterh...@me.com wrote: Yes, I did check out other work that's been done in this area, albeit only briefly. Unless I've overlooked it (which is very much possible), none of the other solutions (except Fay) support an FFI that bridges the gap

Re: UHC-like JavaScript backend in GHC

2012-11-13 Thread Christopher Done
You also need an accomplice web server to host the JS file containing the JavaScript for the web worker to run. I don't see how you can fork threads without such support. On 13 November 2012 20:53, Luite Stegeman stege...@gmail.com wrote: Does/can cabal-install support GHCJS? I suppose that's a

Re: GADTs in the wild

2012-08-18 Thread Christopher Done
On 18 August 2012 20:57, Bertram Felgenhauer bertram.felgenha...@googlemail.com wrote: The natural encoding as a GADT would be as follows: data Command result where GetFoo :: Double - Command Foo PutFoo :: String - Command Double Right, that's exactly what I wrote at the

Re: GADTs in the wild

2012-08-17 Thread Christopher Done
Funny, I just solved a problem with GADTs that I couldn't really see how to do another way. The context === In a fat-client web app (like GMail) you have the need to send requests back to the server to notify the server or get information back, this is normally transported in JSON

Re: GADTs in the wild

2012-08-17 Thread Christopher Done
Oh, I went for a walk and realised that while I started with a GADT, I ended up with a normal Haskell data type in a fancy GADT dress. I'll get back to you if I get the GADT approach to work. On 17 August 2012 15:14, Christopher Done chrisd...@gmail.com wrote: Funny, I just solved a problem

Re: Why GHC doesn't warn about LHS nullary-constructor pattern bindings?

2012-07-19 Thread Christopher Done
In your case the Nothing is unused so will never be a problem. Perhaps more worrying: foo :: Int - Int foo n = x + 1 where Just x = Nothing This gives no warnings. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org

Re: How to describe this bug?

2012-07-10 Thread Christopher Done
Depends what the real offending code is. For example, if it contains unsafePerformIO then it's not a bug. On 10 July 2012 12:42, Sönke Hahn sh...@cs.tu-berlin.de wrote: Hi! I've discovered a strange bug that violates simple equational reasoning. Basically, something similar to this: let a =

Re: [Haskell-cafe] Call to arms: lambda-case is stuck and needs your help

2012-07-05 Thread Christopher Done
I like \case as is proposed. It seems the least controversial one and there's curry (\case ) for two-args, but even that seems a rare case. For what it's worth, I like the idea of omission being partiality, as in case of and if then. It seems perfectly natural to me, I don't need a \ to tell me

Re: Explicit calls to the garbage collector.

2012-05-07 Thread Christopher Done
I would also be interested to know this. A web server is an example of a Haskell program that could force garbage collection at the end of every request reply, especially a multi-threaded server where the memory use is localized to threads. For long-running applications, a GC at this point would

Re: default instance for IsString

2012-04-21 Thread Christopher Done
Pretty sure it does default to String, anyway: {-# LANGUAGE OverloadedStrings #-} main = print (show Hello!) ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Re: [Haskell-cafe] A Modest Records Proposal

2012-04-02 Thread Christopher Done
On 2 April 2012 14:41, Michael Snoyman mich...@snoyman.com wrote: import Data.Time main = do    now - getCurrentTime    let (_, month, day) = toGregorian $ utctDay now    putStrLn $        if month == 4 day == 1            then It's a joke            else It's real import Data.Time main

Re: [Haskell-cafe] A Modest Records Proposal

2012-04-01 Thread Christopher Done
I actually read the first couple paragraphs and thought “sounds interesting I'll read it later”. After reading it properly, I lol'd. After some initial feedback, I'm going to create a page for the Homotopy Extensional Records Proposal (HERP) on trac. There are really only a few remaining

Re: GHCi and line numbers (with ghc-7.4.1)

2012-03-22 Thread Christopher Done
On 22 March 2012 12:13, Simon Marlow marlo...@gmail.com wrote: On 20/03/2012 20:12, Simon Hengel wrote: They are now incremented with each evaluated expression. Why *are* they incremented with each evaluation? Surely the only use for line numbers would be in multi-line statements: :{ Prelude|

Re: How to work around GHC bug

2012-03-14 Thread Christopher Done
On 14 March 2012 15:08, Ozgur Akgun ozgurak...@gmail.com wrote: On 14 March 2012 13:51, Volker Wysk p...@volker-wysk.de wrote: import System main = do [a] - getArgs putStrLn (show a) a here is already of type String. If you don't call show on it, it'll do the expected thing. He

Re: Records in Haskell

2011-09-15 Thread Christopher Done
I added my evaluation of the module-based approach to existing records, but on second thoughts it's maybe inappropriate, so I'll post it here. I saw that some people commented on the reddit discussion that the solution is to put your types in separate modules but it doesn't seem that anyone has

Re: Records in Haskell

2011-09-15 Thread Christopher Done
TRex is already mentioned on the wiki as coming at a too high implementation cost. 2011/9/15 J. Garrett Morris jgmor...@cs.pdx.edu: On Thu, Sep 15, 2011 at 6:03 AM, Barney Hilken b.hil...@ntlworld.com wrote: The right way to deal with records is first to agree a mechanism for writing a context

Re: Records in Haskell

2011-09-15 Thread Christopher Done
I personally really like the proposal here: http://research.microsoft.com/en-us/um/people/simonpj/Haskell/records.html The wiki doesn't show any opposition to this system. If Haskell had that record system now I would be very happy and would be fine with leaving other record systems as purely

Re: Records in Haskell

2011-09-15 Thread Christopher Done
2011/9/15 Greg Weber g...@gregweber.info: Chris, Thank you for the real word experience report. I had assumed (because everyone else told me) that importing qualified would be much, much better than prefixing. I had thought that in your case since you are big on model separation that you would

Re: Records in Haskell

2011-09-15 Thread Christopher Done
2011/9/15 Greg Weber g...@gregweber.info: I should be clear that in my counter point I am using Ruby, not Haskell on those projects. In Ruby one can use a string for the name of a class (which will be evaluated later) and other general dynamic typing tricks to avoid cyclical dependencies. Ah,