Re: [Haskell-cafe] DFAs and self-referential data

2010-12-28 Thread oleg
Maxime Henrion wrote: I've been playing with some code to work with DFAs, but I'm now faced with an implementation problem. In order to have states that can transition to themselves, it seems I would need self-referential data; otherwise I would need to separate those transitions from the

Re: [Haskell-cafe] DFAs and self-referential data

2010-12-28 Thread Jason Dagit
On Tue, Dec 28, 2010 at 3:09 AM, o...@okmij.org wrote: Maxime Henrion wrote: I've been playing with some code to work with DFAs, but I'm now faced with an implementation problem. In order to have states that can transition to themselves, it seems I would need self-referential data;

[Haskell-cafe] Incrementially updating an array

2010-12-28 Thread Robert Clausecker
Hi folks! I have the following problem. As code is most time easier to understand, let give an example what I try to do in C: unsigned int i,j; unsigned int r[100]; for (i = 0; i 100; i++) { j = makeResult(); //j is known to be smaller than 100. r[j] = r[j] + 1; } (My C is poor, so

Re: [Haskell-cafe] Incrementially updating an array

2010-12-28 Thread Henning Thielemann
On Tue, 28 Dec 2010, Robert Clausecker wrote: Hi folks! I have the following problem. As code is most time easier to understand, let give an example what I try to do in C: unsigned int i,j; unsigned int r[100]; for (i = 0; i 100; i++) { j = makeResult(); //j is known to be smaller than

Re: [Haskell-cafe] Incrementially updating an array

2010-12-28 Thread Ross Paterson
On Tue, Dec 28, 2010 at 08:46:24PM +0800, Robert Clausecker wrote: I have the following problem. As code is most time easier to understand, let give an example what I try to do in C: unsigned int i,j; unsigned int r[100]; for (i = 0; i 100; i++) { j = makeResult(); //j is known to

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2010-12-28 Thread Tillmann Rendel
Hi, Jonathan Geddes wrote: For TH use #1, compile-time parsing of arbitrary strings, I think it would be nice for quasiquote semantics to be modified so that code like json :: String - JsonObject json = ... data = [ json | { name : Jonathan , favorite language: Haskell } |]

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2010-12-28 Thread Jonathan Geddes
On Tue, Dec 28, 2010 at 8:17 AM, Tillmann Rendel ren...@mathematik.uni-marburg.de wrote: This seems simple enough to me, so it looks as if your use case is already supported as a library on top of the more general API. This is exactly what I was looking for, and much simpler than my previous

[Haskell-cafe] Polymorphic function over pairs of maybes.

2010-12-28 Thread Edward Amsden
Hello all: I'd like to right a function that could take a structure with type (random example): (Int, (String, (Int, Int))) and another where each individual value is a Maybe of the corresponding type, for example: (Maybe Int, (Maybe String, (Maybe Int, Maybe Int))) and perform a fromMaybe

[Haskell-cafe] Haskell for Gingerbread

2010-12-28 Thread Chris Kuklewicz
Hi folks, I have been looking at developing for my Android phone which is running Gingerbread (Android version 2.3). The important thing about the official development kit is this: The new native development kit (C/C++ cross compiler for ARM) is that the you can create android applications

Re: [Haskell-cafe] Polymorphic function over pairs of maybes.

2010-12-28 Thread Jake McArthur
Maybe something like this would work for you (requires the TypeFamilies extension). class FromMaybe a where type Maybe' a fromMaybe :: a - Maybe' a - a instance FromMaybe Int where type Maybe' Int = Maybe Int fromMaybe = Data.Maybe.fromMaybe instance

[Haskell-cafe] ghc +RTS -M and -A behaving strange

2010-12-28 Thread Johannes Waldmann
Hello. When I run a program compiled with ghc-6.12.3 like this: ... +RTS -A2G -M8G -s I get as an answer: Heap exhausted; Current maximum heap size is 0 bytes (0 MB); use `+RTS -Msize' to increase it. and when I put the options ... +RTS -A2000M -M8000M -s I get Heap exhausted; Current

Re: [Haskell-cafe] what is the status of haskell's mail libraries?

2010-12-28 Thread Robert Wills
I've finally gotten around to doing an update to HaskellNet which provides along with some cleanups integration with mime-mail. There is an example of its usage at: example/smtpMimeMail.hs in http://hackage.haskell.org/package/HaskellNet -Rob On Wed, Oct 27, 2010 at 11:05 AM, Michael Snoyman

Re: [Haskell-cafe] Haskell for Gingerbread

2010-12-28 Thread austin seipp
There was work ongoing for an ARM port of GHC. See here: http://tommd.wordpress.com/2010/01/19/ghc-on-arm/ Also see: http://alpheccar.org/en/posts/show/94 Alpheccar's build uses the work of Stephen Blackheath to cross compile, which originated in the GHC-iPhone project, based on ghc 6.10.2 I

Re: [Haskell-cafe] Haskell for Gingerbread

2010-12-28 Thread John Meacham
jhc generated C works on the android/ARM just fine. Android specific libraries arn't available, so you would have to bind to what you want with the FFI. John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Polymorphic function over pairs of maybes.

2010-12-28 Thread Stephen Tetley
On 28 December 2010 19:23, Edward Amsden eca7...@cs.rit.edu wrote: Hello all: I'd like to right a function that could take a structure with type (random example): (Int, (String, (Int, Int))) and another where each individual value is a Maybe of the corresponding type, for example: (Maybe

Re: [Haskell-cafe] Polymorphic function over pairs of maybes.

2010-12-28 Thread aditya siram
Although I don't understand it myself Oleg's deepest functor [1] seems to be what you're looking for. -deech [1] http://okmij.org/ftp/Haskell/deepest-functor.lhs On Tue, Dec 28, 2010 at 1:23 PM, Edward Amsden eca7...@cs.rit.edu wrote: Hello all: I'd like to right a function that could take a

Re: [Haskell-cafe] Polymorphic function over pairs of maybes.

2010-12-28 Thread Max Rabkin
On Tue, Dec 28, 2010 at 21:23, Edward Amsden eca7...@cs.rit.edu wrote: (Int, (String, (Int, Int))) and another where each individual value is a Maybe of the corresponding type, for example: (Maybe Int, (Maybe String, (Maybe Int, Maybe Int))) This example demonstrates exactly why you might

Re: [Haskell-cafe] Polymorphic function over pairs of maybes.

2010-12-28 Thread Edward Amsden
Aditya: Not quite, because I'm actually looking to extract values from a functor (Maybe) with a default. Stephen: Thanks, I'll take a look at those. I do have a need for it. I'm writing a very similar library to Yampa. (I would be patching Yampa, but the code is a mess, so I decided to try

[Haskell-cafe] multi type addition

2010-12-28 Thread william murphy
We were trying to make an addition function that, unlike the library one, could add numbers of different types from the typeclass 'Num.' We originally ran into a problem when trying to add (5 :: Integer) + 4.8, and were trying to define a new function that would be able to get that: (+') :: (Num

Re: [Haskell-cafe] Polymorphic function over pairs of maybes.

2010-12-28 Thread Sterling Clover
Basically, I have a signal processing loop, where values are passed updated with a Maybe, representing whether there is or is not a change to the value. I could use a single Maybe around the whole thing, but that would require then re-updating a potentially large structure entirely. I want to

Re: [Haskell-cafe] Polymorphic function over pairs of maybes.

2010-12-28 Thread Stephen Tetley
On 28 December 2010 21:44, Edward Amsden eca7...@cs.rit.edu wrote: [SNIP] I'm writing a very similar library to Yampa. (I would be patching Yampa, but the code is a mess, so I decided to try starting from scratch.) Basically, I have a signal processing loop, where values are passed updated

Re: [Haskell-cafe] multi type addition

2010-12-28 Thread aditya siram
The problem here is that unfortunately the Haskell type system cannot do coercion. There is however a toRational method Real typeclass that converts instances of Num and Ord to Rational data type and a fromRational method that converts back. So your code could be: myplus :: (Real a, Real b) = a

[Haskell-cafe] What's the motivation for η rul es?

2010-12-28 Thread David Sankel
TIA, David -- David Sankel Sankel Software www.sankelsoftware.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] What's the motivation for η rul es?

2010-12-28 Thread Luke Palmer
Eta conversion corresponds to extensionality; i.e. there is nothing more to a function than what it does to its argument. Suppose f x = g x for all x. Then using eta conversion: f = (\x. f x) = (\x. g x) = g Without eta this is not possible to prove. It would be possible for two functions to

Re: [Haskell-cafe] What's the motivation for η rules?

2010-12-28 Thread Stefan Monnier
One way to look at it is that β rules are the application of an eliminator (e.g. function application) to its corresponding constructor (the lambda expression), whereas η rules correspond to the application of a constructor to its corresponding eliminator. E.g. λ y . (x y)= x

Re: [Haskell-cafe] what is the status of haskell's mail libraries?

2010-12-28 Thread Michael Snoyman
This looks very good, thank you! One comment: do you think it would be possible to add a function for sending a mime-mail Mail datatype directly? I see that you provide a wrapper around simpleMail in your sendMimeMail function, but that won't always be sufficient. Michael On Tue, Dec 28, 2010 at

[Haskell-cafe] Having trouble with ftphs module

2010-12-28 Thread aXqd
Hi all: I'm new to Haskell, and I ran into this problem recently while I am using ftphs module downloaded from hackage. Prelude :m Network.FTP.Client Prelude Network.FTP.Client h - easyConnectFTP xxx.xxx.xxx.xxx *** Exception: FTP: (unknown) (line 2, column