Re: [Haskell-cafe] GHCi Loop Detection

2012-06-11 Thread John Van Enk
Thanks.

On Sat, Jun 2, 2012 at 12:57 PM, Michal Terepeta
michal.terep...@gmail.comwrote:

 On 01.06 11:06, John Van Enk wrote:
  Hi Cafe,
 
  Is there a reason that the GHCi interpreter doesn't detect and report
  infinite loops in statements like this (like compiled programs do) even
  though no CPU time appears to be used? My (admittedly weak) searching for
  an answer didn't turn much up.
 
  let s | not $ null s = [] in s
 
  GHCi v7.0.4 on OSX
 
  Thanks,
  John

 Hi John,

 I think this is a known problem in GHCi:
 http://hackage.haskell.org/trac/ghc/ticket/2786

 Regards,
 Michal

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] GHCi Loop Detection

2012-06-01 Thread John Van Enk
Hi Cafe,

Is there a reason that the GHCi interpreter doesn't detect and report
infinite loops in statements like this (like compiled programs do) even
though no CPU time appears to be used? My (admittedly weak) searching for
an answer didn't turn much up.

let s | not $ null s = [] in s

GHCi v7.0.4 on OSX

Thanks,
John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: hspec-0.1.0 (Behavior Driven Development for Haskell)

2011-02-15 Thread John Van Enk
I second the request to publish this to hackage.

On Tue, Feb 15, 2011 at 1:02 PM, Simon Michael si...@joyful.com wrote:
 On 2/11/11 8:42 PM, trysta...@comcast.net wrote:

 Any advice, comments, or questions are welcome.

 Hi Trystan.. it looks great. I like the rubyish brevity and readability.
 Please do publish on hackage.

 What should we read to find out more about this style of tests,
 http://rspec.info ?

 When you get a chance, some examples using quickcheck properties would be
 interesting.

 I suppose it could also be made to accept hunit tests ?

 I currently use test-framework partly for it's nice concurrent test runner.
 I assume hspec tests currently run in sequence ?

 Any thoughts on how this fits in with the existing haskell test tools, when
 to use it ?

 Thanks for working on it.
 -Simon

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskelldb-users] ANNOUNCE: HaskellDB 2.0: Scrap your SQL strings

2010-10-11 Thread John Van Enk
Hooray for collaboration! I think this emphasizes the need for some sort of
social aspect on Hackage...

On Mon, Oct 11, 2010 at 10:58 AM, Justin Bailey jgbai...@gmail.com wrote:

 On Mon, Oct 11, 2010 at 7:56 AM, Christopher Done
 chrisd...@googlemail.com wrote:
  Hey that's cool, I hadn't seen that. This'll reduce my code
  significantly, especially mkFieldWithName. Cheers!
 

 I'm not sure if it supports the parameterization of records that you
 detailed in your post - let me know how it works for you. Patches
 always welcome as well :)

 Justin
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC), version 1.1.0

2010-09-24 Thread John Van Enk
Can UHC self-host yet? How does the runtime compare to GHC's? I suppose I
could just go look... :)

On Wed, Sep 22, 2010 at 10:30 AM, Atze Dijkstra a...@cs.uu.nl wrote:

Utrecht Haskell Compiler -- second release 1.1.0



 The UHC team is happy to announce the second public release of the
 Utrecht Haskell Compiler (UHC). UHC supports almost allmost all
 Haskell98 and Haskell2010 features plus some experimental extensions. The
 compiler runs on MacOSX, Windows (cygwin), and various Unix flavors.

 This second release has the following highlights relative to the
 previous first release:

  * Supports most of the Haskell2010 features.

  * Generic deriving [1].

  * UHC knows about packages, and Cabal version 1.9.3 and later have
basic support for UHC, so that Cabal can be used to build UHC packages.

  * For the default backend libraries are provided until including
package haskell98.

  * The runtime system is no longer dependent on Boehm garbage
collector, but uses UHCs own, a swap space collector allowing
parameterization with backend specifics.

  * More programs from the nofib test suite compile and run.

  * Many smaller and larger problems fixed.

 For more info see http://www.cs.uu.nl/wiki/UHC


 Getting started  Download
 --

 UHC is available for download as source distribution via the UHC home
 page:

http://www.cs.uu.nl/wiki/UHC

 Here you will also find instructions to get started and the specifics
 of what UHC can and cannot do.


 Status of the implementation
 

 Over the past year much effort by many people has been put into
 improving UHC, in particular to make it compile and run more library
 modules and test programs. Although the UHC project is very much work in
 progress overall reliability has improved, bugs have been fixed, and
 some Hackage packages compile.


 Warning
 ---

 Although we think that the compiler is stable enough to compile
 substantial Haskell programs, we do not recommend yet to use it for any
 serious development work in Haskell. We ourselves use the GHC as a
 development platform! We think however that it provides a great platform
 for experimenting with language implementations, language extensions,
 etc.


 Mailing lists
 -

 For UHC users and developers respectively:

http://mail.cs.uu.nl/mailman/listinfo/uhc-users
http://mail.cs.uu.nl/mailman/listinfo/uhc-developers


 Bug reporting
 -

 Please report bugs at:

http://code.google.com/p/uhc/issues/list


 The UHC Team



 [1] Jose Pedro Magalhaes, Atze Dijkstra, Johan Jeuring, and Andres Loeh.
 A generic deriving mechanism for Haskell.
 http://dreixel.net/research/pdf/gdmh_draft.pdf (see Section 7.1 for the
 discussion on constrained datatypes)




- Atze -

 Atze Dijkstra, Department of Information and Computing Sciences. /|\
 Utrecht University, PO Box 80089, 3508 TB Utrecht, Netherlands. / | \
 Tel.: +31-30-2534118/1454 | WWW  : http://www.cs.uu.nl/~atze . /--|  \
 Fax : +31-30-2513971  | Email: a...@cs.uu.nl  /   |___\



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Changing my Profile

2010-08-23 Thread John Van Enk
On the bottom of this page, enter your e-mail address:

http://www.haskell.org/mailman/listinfo/haskell-cafe

http://www.haskell.org/mailman/listinfo/haskell-cafeThis is also provided
in the footer of these list e-mails.

On Mon, Aug 23, 2010 at 1:35 PM, David Webster dwwebste...@gmail.comwrote:

 Is there any way to change my profile or signup options so that I don't get
 CC'ed on every posting to Haskell-Cafe?

 David

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread John Van Enk
I happened to download them all (i think all) a while ago to torment my
coworkers:

http://sw17ch.com/dump/lambdacats.zip

Enjoy.

On Fri, Aug 6, 2010 at 12:12 AM, Tony Morris tonymor...@gmail.com wrote:

 Hello, does anyone happen to have the lambdacats page cached? The domain (
 arcanux.org) and server have disappeared and the wayback machine doesn't
 have the images.

 --
 Tony Morris
 http://tmorris.net/

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] real-time audio processing [Was: can Haskell do everyting as we want?]

2010-08-06 Thread John Van Enk
It's not an EDSL (though I'm a huge fan of the concept) because we wan't to
pitch the language to programmers who currently use C/Ada.

As much as I love EDSL's, they are particularly hard to sell to entrenched
engineers without substantial effort or mandate.

Dangling a few neat features on top of a comfortable tool set hopefully will
stimulate some curiosity and help sell Haskell/EDSL's in the future...

On Fri, Aug 6, 2010 at 11:34 AM, C K Kashyap ckkash...@gmail.com wrote:

 Hey John,
 The language you are working on - is it a EDSL in Haskell? If not, had you
 considered such an option?

 On Thu, Aug 5, 2010 at 8:11 PM, Job Vranish job.vran...@gmail.com wrote:

 Yeah Atom is pretty slick, though unfortunately it's not quite powerful
 enough for much of the stuff that we do.

 John Van Enk and I are actually working on a language that's similar to C
 (and compiles to C), but has polymorphism, type inference and other goodies.
 The goal is to make working on embedded systems a bit less painful, while
 still being able to do anything that C can do (like run on an 8 bit micro).
 Hopfully, if things go as planned, we'll have a working beta out by the
 end of the month :)

 - Job


 On Wed, Aug 4, 2010 at 5:58 PM, Don Stewart d...@galois.com wrote:

 job.vranish:
  + 1
 
 
  This is probably the biggest obstacle to using Haskell where I work.
 (Aviation
  industry, software for flight management systems for airplanes)
 
  We often need to perform some computations with hard deadlines, say
 every 20ms,
  with very little jitter.
  Major GC's spoil the fun; It's quite easy to have a major GC take
 longer than
  20ms, and currently they are not pauseable (nor is it trivial to make
 them
  so).
 
  It would be very nice to have some annotation/DSL/compiler-flag that
 would let
  me run a small block of mostly regular haskell code under hard,
 real-time
  constraints.
 
  Hmm, it looks like the HASP project is working on some of this, though
 I'm not
  sure how portable their work is back to GHC: http://hasp.cs.pdx.edu/
 

 Or look at EDSLs, like Atom:

http://hackage.haskell.org/package/atom



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




 --
 Regards,
 Kashyap

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] finding out which gcc is hard-coded into a ghc?

2010-08-06 Thread John Van Enk
If you're on Windows, I believe you can find the gcc.exe at the following
location:

C:\Program Files\Haskell Platform\2009.2.0.2\gcc.exe

See this link for how to pick which C compiler to use:

http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/options-phases.html#replacing-phases

2010/8/6 Günther Schmidt gue.schm...@web.de

 Hello,

 how can I find out which gcc a ghc is hard-coded to use and is it possible
 to override it?

 Günther

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] lambdacats

2010-08-06 Thread John Van Enk
I apologize if I missed any. :(

On Fri, Aug 6, 2010 at 3:03 PM, Henning Thielemann 
schlepp...@henning-thielemann.de wrote:

 Sean Leather schrieb:
 
  On Fri, Aug 6, 2010 at 12:12 AM, Tony Morris wrote:
 
  Hello, does anyone happen to have the lambdacats page cached?
  The domain (arcanux.org http://arcanux.org) and server have
  disappeared and the wayback machine doesn't have the images.
 
 
  On Fri, Aug 6, 2010 at 18:43, John Van Enk wrote:
 
  I happened to download them all (i think all) a while ago to torment
  my coworkers:
 
 
  http://sw17ch.com/dump/lambdacats.zip
 
 
  And from that to this:
 
  http://spl.smugmug.com/Humor/Lambdacats/13227630_eKt46


 I remember the first lambdacat said something like why can't u curry
 this funkshun. I don't see it in this list. :-(

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: DSTM 0.1.1

2010-08-04 Thread John Van Enk
Is there a Git/Darcs dev repo hiding anywhere we could submit patches to?

On Tue, Aug 3, 2010 at 4:35 AM, Frank Kupke f...@informatik.uni-kiel.dewrote:

 Hi,

 DSTM is an implementation of a robust distributed Software Transactional 
 Memory (STM) library for Haskell. Many real-life applications are distributed 
 by nature. Concurrent applications may profit from robustness added by 
 re-implementation as distributed applications. DSTM extends the STM 
 abstraction to distributed systems and presents an implementation efficient 
 enough to be used in soft real-time applications. Further, the implemented 
 library is robust in itself, offering the application developer a high 
 abstraction level to realize robustness, hence, significantly simplifying 
 this, in general, complex task.

 The DSTM package consists of the DSTM library, a name server application, and 
 three sample distributed programs using the library. Provided are a simple 
 Dining Philosophers, a Chat, and a soft real-time Bomberman game application. 
 Distributed communication is transparent to the application programmer. The 
 application designer uses a very simple name server mechanism to set up the 
 system. The DSTM library includes the management of unavailable process nodes 
 and provides the application with abstract error information thus 
 facilitating the implementation of robust distributed application programs.

 For usage please look into the documentation file: DSTMManual.pdf.

 The package including the documentation can be found 
 on:http://hackage.haskell.org/package/DSTM-0.1.1


 Best regards,
 Frank Kupke



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Mining Twitter data in Haskell and Clojure

2010-06-14 Thread John Van Enk
Would it be possible to use an IntMap instead of your OrdMap? Perhaps zip
your users with [0..] and key off the integer?

As a side note, I threw this package onto Hackage a while ago and may suit
your needs if you decide to move to something like IntMap:
http://hackage.haskell.org/package/EnumMap

It does have a performance hit over an IntMap, but I'm not entirely sure how
large it is.

/jve

On Mon, Jun 14, 2010 at 10:27 AM, braver delivera...@gmail.com wrote:

 I've supplied a profile report there.  Since I load the graphs in
 memory and then walk them a lot, the time seems expected.  It
 allocates a lot, though.  The main graph type is


 type Graph = M.Map User AdjList
 type AdjList = M.Map Day Reps
 type User = B.ByteString
 type Day = Int
 type Reps = M.Map User Int

 and I walk it with M.foldWithKey.  Folks said it's not strict enough,
 hence I tried to seq the step function, but to no avail so far.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread John Van Enk
Hot.

On Wed, Apr 7, 2010 at 2:35 PM, Thomas Schilling nomin...@googlemail.comwrote:

 http://i.imgur.com/kFqP3.png   Didn't know about CSS's rgba to
 describe transparency.  Very useful.

 On 7 April 2010 18:19, Gregory Crosswhite gcr...@phys.washington.edu
 wrote:
  Ooo, I really like this revision;  it is a major improvement in your
 design!  I particularly like the picture you chose for the top, and the new
 way that you have laid out all of the boxes and made the bottom right box a
 different shade so that it is easier to distinguish it as a different
 column.  Also, I concur with your use of the inverted pyramid model, even
 if it comes at the expense of a little redundancy.
 
  My only quibble is that I don't like the fact that the summary text at
 the top has a font background color, so that there are in essence several
 boxes around the text of different sizes and with space in between the
 lines.  I recognize that the purpose of the font background was to help the
 text contrast with the picture behind it, but it would be nicer if there
 were a better solution, such as by putting a box around all of the text and
 then filling that with color (so there aren't boxes of different sizes
 containing the text and empty spaces between the lines), or by putting a
 translucent box around the text so that we can still see the background but
 it's faded a bit so that the text still shows up.
 
  Cheers,
  Greg
 
  On Apr 7, 2010, at 9:53 AM, Thomas Schilling wrote:
 
  Yup, I have to agree.  The Ruby web site certainly is the best web
  site for a programming language that I've come across, but it's
  certainly not amazing.  I like the python documentation design, but
  their home page is a bit dull.  Anyway, here's another variation, this
  time with more colour:
 
  http://i.imgur.com/Lj3xM.png
 
  The image is about 80k (while the website alone is  10k) so I hope
  there won't be any bandwidth issues.  Regarding the particular
  contents:
 
   (a) I won't post another version for every tiny wibble.  You know,
  you can actually post text via email (yes, really!) so if anyone has
  improvements for how the sections should look like, post the suggested
  alternative contents on this list.
 
   (b) A little redundancy is no problem at all.  I try to follow the
  inverted pyramid model: put all the important information at the top,
  and add more details below.  If that leads to a small amount of
  duplication so be it.
 
   (c) As mentioned before, we don't want a perfect home page, we
  simply want a better one.  Incremental improvements can be made later
  on.
 
   (d) Who actually *can* update the homepage?  Ian, Ross, Malcolm, Simon
 M?
 
   (e) I don't have an iPhone, *Droid, or iPad, so I'd need some help
  testing on any of those.
 
   (f) The design is not fixed width, and most sizes are specified in
  terms of font size or percentages.  I merely added a max-width
  restriction so that it still looks decent on maximised screens.  I
  tried to remove it, but that just doesn't look good anymore.
 
  On 7 April 2010 14:19, Daniel Fischer daniel.is.fisc...@web.de wrote:
  Am Mittwoch 07 April 2010 04:09:17 schrieb Gregory Crosswhite:
  While I think that (d) is a valid concern, it is also important not to
  let the perfect be the enemy of the good.  If we agree that the
 proposed
  web site layout is sufficiently better than the current one and is
 good
  enough aesthetically, then I think we should go ahead and switch to
 the
  new layout and *then* start thinking about how we could make it
 
  Good plan.
 
  *completely amazing* like the Ruby web site,
 
  www.ruby-lang.org ?
 
  Sure, that looks pretty good, but completely amazing?
 
  because if we demand
  completely amazing for our *first* try then I fear that all that will
  happen is that nothing will change because the bar will have been set
  too high.
 
  Cheers,
  Greg
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 
  --
  Push the envelope.  Watch it bend.
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 



 --
 Push the envelope.  Watch it bend.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why does Haskell not infer most general type?

2010-04-06 Thread John Van Enk
I don't believe that the monomorphism restriction has anything to do with
this. Removing it does not generalize the type.

On Tue, Apr 6, 2010 at 4:46 PM, Brandon S. Allbery KF8NH 
allb...@ece.cmu.edu wrote:

 On Apr 6, 2010, at 15:56 , Job Vranish wrote:

 Is haskell supposed to always infer the most general type (barring
 extensions)?


 Look up the monomorphism restriction.

 --
 brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
 system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
 electrical and computer engineering, carnegie mellon universityKF8NH



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are there any female Haskellers?

2010-03-27 Thread John Van Enk
http://en.wikipedia.org/wiki/Grace_Hopper

http://en.wikipedia.org/wiki/Grace_HopperA heck of a lady.

On Sat, Mar 27, 2010 at 12:51 PM, Andrew Coppin andrewcop...@btinternet.com
 wrote:

 Ozgur Akgun wrote:

 Nevertheless, I guess you're right. There are very few females in most of
 the CS topics, and haskell is no different.


 This is my experience too. Although note that apparently the world's very
 first computer programmer was apparently a woman...


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: powerpc-0.0.1

2010-03-11 Thread John Van Enk
Serguey,

I'm working on a similar project. What's the chance you have your source
code in the open?

/jve

On Thu, Mar 11, 2010 at 7:30 AM, Serguey Zefirov sergu...@gmail.com wrote:

 2010/3/10 Tom Hawkins tomahawk...@gmail.com:
  On Wed, Mar 10, 2010 at 8:07 AM, Warren Henning
  warren.henn...@gmail.com wrote:
  Wow. Quite ambitious.
 
  Was this inspired by work at your current employer like with Atom and
  some of the other stuff you've released?
 
  Yes, we had an immediate need to debug some machine code.  I looked
  around, but all the emulators I found (PSIM, et al.) were too
  complicated.
 
  I'm also intrigued by the emphasis on software verification at the
  object code level for aerospace (DO-178).  I figure better tools in
  this area may open the door to using advanced design methods like Atom
  for avionics.  Of course it's unlikely this project will reach that
  level of maturity, but you never know.

 We wrote the debugger and simulator for AVR line of microcontroller cores.

 We used a DSEL to describe inner workings of commands and now try to
 apply it to ARM ISA.

 The Haskell code is heavy on the use of type-level computations and,
 especially, assiciated types.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: powerpc-0.0.1

2010-03-11 Thread John Van Enk
Serguey,

The system I'm writing has a type in place for the AVR instruction set. I'm
working on writing an assembler/disassembler for it as well. It might make
sense, if your employer deems it worthwhile to release the code, to
collaborate.

/jve

On Thu, Mar 11, 2010 at 11:35 AM, Serguey Zefirov sergu...@gmail.comwrote:

 2010/3/11 John Van Enk vane...@gmail.com:
  Serguey,
  I'm working on a similar project. What's the chance you have your source
  code in the open?
  /jve

 I'll ask.

 But chances are pretty small.

 I'll think about reimplementing command description from scratch.

  On Thu, Mar 11, 2010 at 7:30 AM, Serguey Zefirov sergu...@gmail.com
 wrote:
 
  2010/3/10 Tom Hawkins tomahawk...@gmail.com:
   On Wed, Mar 10, 2010 at 8:07 AM, Warren Henning
   warren.henn...@gmail.com wrote:
   Wow. Quite ambitious.
  
   Was this inspired by work at your current employer like with Atom and
   some of the other stuff you've released?
  
   Yes, we had an immediate need to debug some machine code.  I looked
   around, but all the emulators I found (PSIM, et al.) were too
   complicated.
  
   I'm also intrigued by the emphasis on software verification at the
   object code level for aerospace (DO-178).  I figure better tools in
   this area may open the door to using advanced design methods like Atom
   for avionics.  Of course it's unlikely this project will reach that
   level of maturity, but you never know.
 
  We wrote the debugger and simulator for AVR line of microcontroller
 cores.
 
  We used a DSEL to describe inner workings of commands and now try to
  apply it to ARM ISA.
 
  The Haskell code is heavy on the use of type-level computations and,
  especially, assiciated types.
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to break strings and put to a tuple

2010-03-04 Thread John Van Enk
These are beginning to look like homework questions...

On Thu, Mar 4, 2010 at 11:38 AM, Pradeep Wickramanayake prad...@talk.lkwrote:

  Hi,



 sortList2 :: String - String
 sortList2 (x:xs)
 | x == ',' = 
 | otherwise = [x] ++ sortList2 xs



 im breaking a one specific string and putting them to each word. But I need
 to put them to a tuple.

 Can someone help me with the code



 Please.


 __ Information from ESET NOD32 Antivirus, version of virus
 signature database 4915 (20100304) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Evolving Faster Haskell Programs (now with LLVM!)

2010-03-01 Thread John Van Enk
What's the chance you have generational graphs for the rest of your examples
like you do with the first? I'd be interested to see those.

On Mon, Mar 1, 2010 at 3:02 AM, Don Stewart d...@galois.com wrote:



 http://donsbot.wordpress.com/2010/03/01/evolving-faster-haskell-programs-now-with-llvm/

 … In which I use genetic algorithms to search for optimal LLVM optimizer
 passes to make Haskell programs faster …

 LLVM + GHC is a lot of fun.

 -- Don
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Real-time garbage collection for Haskell

2010-03-01 Thread John Van Enk
 The whole concept of lazy evaluation seems to run counter to the idea of
real-time systems.

Hi Thomas,

Lazy evaluation is okay since it has deterministic characteristics. We can
predict what will happen quite accurately (heck, we can model it in simpler
cases). It might take a while to get people comfortable with the concept,
but it wouldn't be a show stopper (actually, some people would benefit
greatly from lazy evaluation and referential transparency).

The GC throws a wrench in a system which would otherwise make it past
certification with enough effort. If we can write a GC that can be modeled,
we'd have an excellent case for using Haskell in aerospace.

/jve

On Mon, Mar 1, 2010 at 2:37 PM, Thomas Schilling nomin...@googlemail.comwrote:

 On 1 March 2010 16:27, Job Vranish job.vran...@gmail.com wrote:
  My current area of work is on realtime embedded software programming for
  avionics systems. We do most of our coding in Ada but I've been dreaming
 of
  using haskell instaed.

 Do you really think this is realistic?  Garbage collector aside,
 Haskell's execution model is very difficult to predict, which I would
 suspect is crucial for even soft real-time systems.  The whole concept
 of lazy evaluation seems to run counter to the idea of real-time
 systems.  Lazy evaluation essentially says do as little as possible
 *now* at the expense of having to do it all later.  For a real-time
 system you want almost the opposite; you want to make sure that you
 complete all the required work in the current time slice.

 A possible workaround would be to sprinkle lots of 'rnf's around your
 code to make sure you don't build up a thunk or two that will delay
 you later.  And if you do this, aren't you essentially programming in
 a strict functional language (like SML or O'Caml)?  By careful
 profiling you and auditing you can probably rule out most of the
 potential bad cases, so it can be acceptable for a soft real-time
 system (Galois did something like this, I believe).  But for avionics
 systems you probably want to more assurances than that, don't you?

 --
 Push the envelope.  Watch it bend.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Real-time garbage collection for Haskell

2010-03-01 Thread John Van Enk
Simon,

Would a more predictable GC or a faster GC be better in your case? (Of
course, both would be nice.)

/jve

On Mon, Mar 1, 2010 at 9:33 PM, Simon Cranshaw simon.crans...@gmail.comwrote:

 On Sun, Feb 28, 2010 at 6:06 PM, Pavel Perikov peri...@gmail.com wrote:

 Did you really seen 100ms pauses?! I never did extensive research on this
 but my numbers are rather in microseconds range (below 1ms). What causes
 such a long garbage collection? Lots of allocated and long-living objects?


 I am using an automated options trading system written in Haskell.  I'm
 more on the business side than the technical side of the issues so I'm not
 clear on all the details.  I can confirm that without tweaking the RTS
 settings we were seeing over 100ms GC pauses.  I've mainly been trying to
 minimise our overall response time and we were able to improve this by
 increasing the allocation area with -A.  I think this brought GC well under
 100ms.  We are still working on analysis of this.

 I can also confirm, as others seem to have found, that under 6.12 the
 parallel GC seemed to make things much worse. I am always turning it off
 with -qg.  If there is a project to improve performance of the GC I could be
 interested to contribute.

 Simon Cranshaw

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: atom-1.0.0

2010-02-13 Thread John Van Enk
Hmm... that's my outdated blog post. I've been meaning to add an updated
version. I'll try and get to that soon.

On Sat, Feb 13, 2010 at 7:30 PM, Yves Parès limestr...@gmail.com wrote:


 I've been interested in using Atom since I saw this:
 http://blog.sw17ch.com/wordpress/?p=84
 However those samples are very outdated, do you have newer ones?



 Tom Hawkins-2 wrote:
 
  Atom is a Haskell DSL for designing hard realtime embedded software.
  The 1.0 release is meant to indicate some level of stability; most of
  the core has been unchanged for quite some time.
 
  That said, there are a few interesting changes in 1.0.  First the var'
  family of variable declarations (bool', word8', double', etc.) are no
  longer part of the Atom monad.  For example:
 
  bool' :: Name - V Bool
 
  This cleaned up quite a bit of code in our production design.  This
  also made the randomization in Atom's unit testing framework monadless
  as well.
 
  The other significant change with 1.0 is all state variables are now
  packed into a hierarchical C structure that matches the hierarchy of
  the Atom design.  Not only does this make the generated C a bit more
  legible, it is now possible to interface external C code directly to
  Atom's state variables and arrays.  Prior to this change, all
  interfacing had to be done through var' declarations and action calls
  -- too often a messy process.  To further aid interfacing to external
  code, Atom now generates a header file that exposes both the iterative
  function and the hierarchical state structure.
 
  -Tom
 
  http://hackage.haskell.org/package/atom
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


 -
 Yves Parès

 Live long and prosper
 --
 View this message in context:
 http://old.nabble.com/ANN%3A-atom-1.0.0-tp27574165p27579930.html
 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: How many Haskell Engineer I/II/IIIs are there?

2010-02-12 Thread John Van Enk
I _think_ that the abstract points out that reference-counted garbage
collection can be done deterministically. Haskell could some day be an
excellent replacement for C/Ada in safety critical markets, but some serious
changes to the RTS (most having to do with memory allocation, garbage
collection, and multi-threading) would have to be made.

If the GC becomes deterministic, then a much better case can be made for
using the language on a plane or in medical devices.

/jve

On Fri, Feb 12, 2010 at 10:29 AM, Simon Marlow marlo...@gmail.com wrote:

 On 11/02/2010 17:01, John Van Enk wrote:

 Here's the paper:
 http://comjnl.oxfordjournals.org/cgi/content/abstract/33/5/466


 Can you say a bit about why that GC fits your needs?  Must it be that
 particular algorithm?  I don't seem to be able to find the paper online.

 Replacing GHC's RTS is no mean feat, as you're probably aware.  There are a
 large number of dependencies between the compiler, the RTS, and the
 low-level libraries.  I expect rather than thinking about replacing the RTS
 it would be more profitable to look at what kinds of things you need the RTS
 to do that it currently does not.

 I'm aware that some people need a GC with shorter pause times.  We'll
 probably put that on the roadmap at some point.

 Cheers,
Simon

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How many Haskell Engineer I/II/IIIs are there?

2010-02-11 Thread John Van Enk
I need to be able to swap out the RTS. The place I want to stick Haskell
absolutely needs its own custom RTS, and currently, I don't think it's all
that easy or clean to do that.

Am I wrong? Are there resources describing how to do this already?

/jve

On Thu, Feb 11, 2010 at 10:12 AM, Michael Lesniak mlesn...@uni-kassel.dewrote:

 Hello,


  elegance of Haskell. Whether Haskell becomes an easy choice for
  commercial work or remains a boutique language depends on how easy it
  is to build today's applications.

 Do you (or anyone reading this thread) know of some kind of wishlist
 of missing features and/or libraries? Would be nice to see what's
 still missing.

 - Michael
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How many Haskell Engineer I/II/IIIs are there?

2010-02-11 Thread John Van Enk
I'm not specifically interested in raw hardware, but I am interested in,
say, making the garbage collection deterministic and altering the scheduler
to fit some other needs. I'll try and find a link to the paper describing
the GC i want to implement

On Thu, Feb 11, 2010 at 11:10 AM, Ivan Panachev ivan.panac...@gmail.comwrote:

 On Thu, Feb 11, 2010 at 6:30 PM, John Van Enk vane...@gmail.com wrote:

 I need to be able to swap out the RTS. The place I want to stick Haskell
 absolutely needs its own custom RTS, and currently, I don't think it's all
 that easy or clean to do that.

 Am I wrong? Are there resources describing how to do this already?


 Could you be a bit more precise about your RTS needs? For example, if you
 want to run Haskell on raw hardware you might be interested with House
 project, http://programatica.cs.pdx.edu/House/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How many Haskell Engineer I/II/IIIs are there?

2010-02-11 Thread John Van Enk
Here's the paper:
http://comjnl.oxfordjournals.org/cgi/content/abstract/33/5/466

On Thu, Feb 11, 2010 at 11:45 AM, John Van Enk vane...@gmail.com wrote:

 I'm not specifically interested in raw hardware, but I am interested in,
 say, making the garbage collection deterministic and altering the scheduler
 to fit some other needs. I'll try and find a link to the paper describing
 the GC i want to implement

 On Thu, Feb 11, 2010 at 11:10 AM, Ivan Panachev 
 ivan.panac...@gmail.comwrote:

 On Thu, Feb 11, 2010 at 6:30 PM, John Van Enk vane...@gmail.com wrote:

 I need to be able to swap out the RTS. The place I want to stick Haskell
 absolutely needs its own custom RTS, and currently, I don't think it's all
 that easy or clean to do that.

 Am I wrong? Are there resources describing how to do this already?


 Could you be a bit more precise about your RTS needs? For example, if you
 want to run Haskell on raw hardware you might be interested with House
 project, http://programatica.cs.pdx.edu/House/



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How many Haskell Engineer I/II/IIIs are there?

2010-02-11 Thread John Van Enk
Well, my point here is that if we want to see GHC branch into other fields
(mine being safety critical), and actually see the code generated by GHC be
what's really running (rather than once-removed in the form of an EDSL),
some changes will have to be made.

Being able to experiment with GHC's RTS and possibly being able to write
your own (should the project require it) would go a long way to helping me
make the case for GHC in safety critical.

Perhaps I'd be better off looking at UHC/LHC/JHC as a starting place.

/jve

On Thu, Feb 11, 2010 at 12:13 PM, Jason Dusek jason.du...@gmail.com wrote:

  Is JHC not suitable in this case? It won't compile all of
  Haskell but it does some to be doing the right things as
  regards a pluggable RTS.

  I think it's fair to say at this point that GHC can compile
  all the Haskell we want and that new Haskell pieces will come
  to GHC before anything else gets them. So going with a totally
  new system, front-to-back, is not really desirable when all
  you want is a new RTS; however, I don't think GHC was designed
  to be a Haskell compiler superserver.

 --
 Jason Dusek

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How many Haskell Engineer I/II/IIIs are there?

2010-02-11 Thread John Van Enk
I'd suggested this in an earlier SoC thread.

2010/2/11 Matthias Görgens matthias.goerg...@googlemail.com

 Implementing an alternative RTS for GHC seems like a viable Google
 Summer of Code project to me.  What do you think?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How many Haskell Engineer I/II/IIIs are there?

2010-02-11 Thread John Van Enk
I'll definitely take a closer look.

On Thu, Feb 11, 2010 at 1:09 PM, John Meacham j...@repetae.net wrote:

 On Thu, Feb 11, 2010 at 06:57:48PM +0100, Henning Thielemann wrote:
  John Van Enk schrieb:
   I need to be able to swap out the RTS. The place I want to stick
 Haskell
   absolutely needs its own custom RTS, and currently, I don't think it's
   all that easy or clean to do that.
  
   Am I wrong? Are there resources describing how to do this already?
 
  As far as I know JHC is intended to work without an RTS.

 It is more that the RTS is generated as a part of the normal code
 generation process, this is done by implementing as much as possible in
 haskell itself, jhc has a very rich set of unboxed primitives, making it
 as expressible as c-- for the most part, for the bits of C I do need, I
 try to make them conditionally compilable, so parts that arn't used will
 not be included. all in all, the overhead is ~= 1k or so. A side effect
 is that jhc is very lightly coupled to any particular RTS, so
 experimenting with alternate ones is pretty straigtforward.

John

 --
 John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How many Haskell Engineer I/II/IIIs are there?

2010-02-11 Thread John Van Enk
Perhaps just defining the interface and demonstrating that different RTS's
are swappable would be enough?

2010/2/11 Alp Mestanogullari a...@mestan.fr

 It seems quite big for a 3 months project made by a student, though.

 2010/2/11 Matthias Görgens matthias.goerg...@googlemail.com

 Implementing an alternative RTS for GHC seems like a viable Google

 Summer of Code project to me.  What do you think?




 --
 Alp Mestanogullari
 http://alpmestan.wordpress.com/
 http://alp.developpez.com/

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How many Haskell Engineer I/II/IIIs are there?

2010-02-10 Thread John Van Enk
Not using it yet, but there's been a large amount of interest and
willingness to work with it from management. We're contractors, so it
depends on us finding some one who will allow us to use the language or asks
for it explicitly.

On Wed, Feb 10, 2010 at 10:59 AM, Jason Dusek jason.du...@gmail.com wrote:

  Although I'm fond of Haskell, in practice I am not a
  Haskell programmer -- I'm paid for Ruby and Bourne shell
  programming.

  Many of the jobs posted on this list end up being jobs
  for people who appreciate Haskell but will work in C# or
  O'Caml or some-such.

  I wonder how many people actually write Haskell,
  principally or exclusively, at work?

 --
 Jason Dusek
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How many Haskell Engineer I/II/IIIs are there?

2010-02-10 Thread John Van Enk
 consider presenting at CUFP this year

Any word on when this will be?

On Wed, Feb 10, 2010 at 3:50 PM, Don Stewart d...@galois.com wrote:

 v.dijk.bas:
  On Wed, Feb 10, 2010 at 4:59 PM, Jason Dusek jason.du...@gmail.com
 wrote:
I wonder how many people actually write Haskell,
principally or exclusively, at work?
 
  Roel and I use Haskell at work.
 
  We develop embedded software in Haskell (not real-time) that controls
  a scientific instrument.
 
  We will probably write something more detailed about this project some
  time from now.
 

 This is a great thread. Perhaps more users could add their details to

http://haskell.org/haskellwiki/Haskell_in_industry

 and consider presenting at CUFP this year. http://cufp.galois.com
 (new website to be launched soon!)

 -- Don
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Anyone up for Google SoC 2010?

2010-02-08 Thread John Van Enk
I'll just toss this idea out there:

I want to be able to pick a runtime to compile against. Some Ada compilers
allow me to specify a runtime to use with a --RTS flag. This, of course,
also means we'd need to write more runtime variants.

I dropped this on the haskell_proposals reddit for safe keeping/evaluation:
http://www.reddit.com/r/haskell_proposals/comments/azjah/pluggable_rts_for_ghc_pickyourownruntime/

/jve

On Sun, Jan 31, 2010 at 6:04 AM, Malcolm Wallace 
malcolm.wall...@cs.york.ac.uk wrote:

 Google has announced that the Summer of Code programme will be running
 again this year.  If haskell.org people would like to take part again this
 year, then we need volunteers:

 First,
* suggestions for suitable projects
  (in the past this was organised using a reddit)
* an administrator to co-ordinate the application to Google
  (I have done it for the last three years but am very willing
   to hand on to someone else)

 Google will accept applications from organisations in the period 8th - 12th
 March 2010, approx 1900UTC.

 If haskell.org is accepted again, students can apply between 29th March -
 9th April.
 More volunteers will be required:

* to review student applications and choose which to accept
* to supervise the accepted students

 Both of these roles are called mentor in the Google system.  Putting
 together a good team of mentors before applying as an organisation is
 helpful towards us being accepted into the programme.

 Regards,
Malcolm

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell on Ideone!

2010-01-21 Thread John Van Enk
Seems a little dangerous:

http://ideone.com/XL6uLnLo

On Thu, Jan 21, 2010 at 8:25 PM, Gwern Branwen gwe...@gmail.com wrote:

 On Thu, Jan 21, 2010 at 8:02 PM, Sphere Research Labs
 cont...@sphere-research.com wrote:
  Hi,
 
  test Haskell on ideone.com,
 
  see the example: http://ideone.com/bbloQ9r0
 
  regards,
 
  Ideone Team

 Besides specifying standard in, what does Ideone do beyond
 codepad.org? (eg. http://codepad.org/Guukn3Ho)

 How are you guys doing the sandboxing - just the usual chroot with rlimits?

 Also, the site's visual appearance is somewhat broken under firefox
 3.5.7; see screenshot.

 --
 gwern

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Force -threaded from a library

2010-01-14 Thread John Van Enk
Hi List,

Is it possible to prevent a library from being used unless -threaded is
enabled? I have a specific case where lots-of-nasty shows up if the library
is linked against an executable built without -threaded.

I suppose this is GHC specific.

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] what is *hack*?

2010-01-13 Thread John Van Enk
http://hackage.haskell.org/package/hack

2010/1/13 Günther Schmidt gue.schm...@web.de

 Hi,

 References to a Hack. module came in the responses to my posts on
 HTML-GUIs.

 What is Hack then?


 Günther


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] what is *hack*?

2010-01-13 Thread John Van Enk
This may help more: http://wiki.github.com/nfjinjing/hack

The Hack project is based off of a project known as Rack for ruby. I'm
fairly sure the documentation you can find on Rack will help you understand
what Hack does.

2010/1/13 Günther Schmidt gue.schm...@web.de

  Hi John,

 thanks, I should have mentioned that I had found it on hackage, I just
 don't understand what it *is* or what it's supposed to be for.

 Günther


 Am 13.01.10 14:46, schrieb John Van Enk:

 http://hackage.haskell.org/package/hack

 2010/1/13 Günther Schmidt gue.schm...@web.de

 Hi,

 References to a Hack. module came in the responses to my posts on
 HTML-GUIs.

 What is Hack then?


 Günther


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: tuntap-0.0.1

2010-01-06 Thread John Van Enk
Hi All,

As some of you have requested, I've extracted the code from my (under work)
VPN which talks to the TUN/TAP device under Linux (/dev/net/tun).

Some things to note:
1) I've only tested this under Linux.
2) The help-win.c file under cbits HAS allowed similar code to talk to the
TUN/TAP driver used by the OpenVPN project, but I haven't implemented this
functionality yet.
3) The help-bsd.c file under cbits HAS allowed Mac/BSD flavors to talk to a
TUN/TAP driver, but I've never tested this and haven't implemented this
functionality yet.

I don't have a whole lot there right now, but keep a lookout for more
releases with some examples and better docs (as I get around to it).

For a very verbose example, you can look at how I use the Network.TUNTAP
module in this project: http://github.com/sw17ch/Scurry, specifically
http://github.com/sw17ch/Scurry/blob/master/src/Scurry/TAPTask.hs.

Hackage: http://hackage.haskell.org/package/tuntap
GitHub: http://github.com/sw17ch/tuntap

John Van Enk

PS: Thanks to Matthew Isleb and Job Vranish for their help on the C code
used.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Re: Data.Ring -- Pre-announce

2010-01-05 Thread John Van Enk
For those interested, the version of data-clist without Empty is here:

http://github.com/sw17ch/data-clist/tree/noEmpty

http://github.com/sw17ch/data-clist/tree/noEmpty

On Tue, Jan 5, 2010 at 2:53 AM, Luke Palmer lrpal...@gmail.com wrote:

 On Mon, Jan 4, 2010 at 1:13 PM, Maciej Piechotka uzytkown...@gmail.com
 wrote:
  However then we lost the monoid (ok. I haven't send patch but please
  accept[1]) along with alternative/monad plus - which is much more
  popular, standard and useful then Copointed/Comonad.

 This point is a self-fulfilling prophecy.  We don't have very much
 experience working with copointeds and comonads, but I don't think
 that makes them useless, just unfamiliar.

 One must never confuse what is natural with what is habitual.  --
 Mahatma Gandhi

 Luke
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Data.Ring -- Pre-announce

2010-01-04 Thread John Van Enk
I've heard this a few times and am slowly becoming convinced of it. I'll try
my current use without the Empty and see how it goes.

Given that I've heard this from several places, I'll probably drop Empty.

On Mon, Jan 4, 2010 at 9:17 AM, Luke Palmer lrpal...@gmail.com wrote:

 On Mon, Jan 4, 2010 at 6:51 AM, Maciej Piechotka uzytkown...@gmail.com
 wrote:
  About comonad - not exactly as every comonad is copointed and the only
  possible way is extract Empty = _|_

 I think this module could be cleaned up by disallowing empty lists.
 You have this nice semantic property that every clist has a focus,
 but when you add empty you have to add unless it's empty.  focus
 returns a Maybe, isEmpty is necessary.

 I mean, it could be that your use case requires empty clists and would
 be uglier without empty, but think about it.  I find in Haskell that
 simplicity breeds simplicity; i.e. I'm willing to wager that whatever
 algorithm you are using clist for will actually be cleaner if you got
 rid of empty and modify the algorithm accordingly.  We shall see
 though...

 Luke
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A question on DSL's

2010-01-04 Thread John Van Enk
To start with, can you clarify that you are looking for an Embedded DSL
(sometimes called Light Weight DSL)?

A _proper_ DSL has its own interpreter/compiler where an EDSL/LwDSL
leverages the compiler of a host language (in this case, Haskell).

Assuming you're referring to an EDSL, I'll respond. :)

I don't think the second option is ever used. Modifying the compiler backend
doesn't seem to make a lot of sense to me. I'm not aware of any circumstance
where this has been done.

Your first option is closer. Generally, when emitting some sort of target
code from a large EDSL, you'll have two stages. Your first takes the
embedded syntax of your EDSL and converts it to an Abstract Syntax Tree.
Your second stage accepts the AST as input and emits target code.

Take Tom Hawkins' Atom EDSL as an example. When we write Atom code, we're
building up an AST. After the AST is built up, the compile function
converts the AST to C code.

For smaller EDSLs, it's more than possible to have the functions themselves
emit the code we're after (rather than relying on an AST and compile
function).

Is this what you're looking for?

/jve

On Mon, Jan 4, 2010 at 12:14 PM, CK Kashyap ck_kash...@yahoo.com wrote:

 Hi,
 I am not sure if I'm using DSL in the right context here but I am referring
 to those solutions that allow us to write code in Haskell and generate a
 target code source code of another language or even object code for that
 matter. I am aware of two ways of achieving this -
 1. Implement functions that emit the target code - that is, when the
 Haskell code is compiled and run, the target code is emitted
 2. Modify the Haskell compiler's back end to emit the code - that is when
 the Haskell code is compiled the target code is emitted

 I am not sure if there are more ways (hybrid perhaps) ...

 My question is,  when would I chose one approach over the other?

 Regards,
 Kashyap





 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Timing in atom -- how consistent?

2010-01-01 Thread John Van Enk
Hi Jason,

Regarding timing, the version of blink_atom.c below does not contain this,
but my later versions used the hardware timers to control the blink rate.

One can setup the interrupt vector for a hardware timer to call your
outermost atom function at whatever resolution you want. As long as the
timer allows enough time between expirations for any of the task groups to
finish, it will run in hard real time.

Hope this helps.

John Van Enk

On Thu, Dec 31, 2009 at 10:43 PM, Jason Dusek jason.du...@gmail.com wrote:

  I'm working with Atom to program an ATtiny25. I am curious
  about how consistent the timings actually are.

  Consider John Van Enk' example of blinking a LED on an
  Arduino:

http://code.sw17ch.com/blog/atom/blink_atom.c

  We see that sometimes `setLED' is executed and sometimes not.
  When `__clock' is incremented, it will be incremented
  sometimes sooner, sometimes later.

  Also, I am a little puzzled by the `__coverage` variable. What
  does it do?

  As for my project/motivation -- I'm just trying to blink a
  little LED on much less robust/rich kit -- the Trippy RGB
  Waves kit from Lady Ada. I am (gratuitously) exploring ways to
  program it with Haskell.

 --
 Jason Dusek
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Timing in atom -- how consistent?

2010-01-01 Thread John Van Enk
I remembered that I have some of this stuff on github. Here's the example C
file that sets up the timers on an Ardunio board.

http://github.com/sw17ch/atom-arduino-experiments/blob/master/Blink/blink.c

Notice that the main function does nothing. All the work is done by
blink_atom() which is called out of the ISR (Interrupt Service Routine).

On Fri, Jan 1, 2010 at 10:48 AM, John Van Enk vane...@gmail.com wrote:

 Hi Jason,

 Regarding timing, the version of blink_atom.c below does not contain this,
 but my later versions used the hardware timers to control the blink rate.

 One can setup the interrupt vector for a hardware timer to call your
 outermost atom function at whatever resolution you want. As long as the
 timer allows enough time between expirations for any of the task groups to
 finish, it will run in hard real time.

 Hope this helps.

 John Van Enk


 On Thu, Dec 31, 2009 at 10:43 PM, Jason Dusek jason.du...@gmail.comwrote:

  I'm working with Atom to program an ATtiny25. I am curious
  about how consistent the timings actually are.

  Consider John Van Enk' example of blinking a LED on an
  Arduino:

http://code.sw17ch.com/blog/atom/blink_atom.c

  We see that sometimes `setLED' is executed and sometimes not.
  When `__clock' is incremented, it will be incremented
  sometimes sooner, sometimes later.

  Also, I am a little puzzled by the `__coverage` variable. What
  does it do?

  As for my project/motivation -- I'm just trying to blink a
  little LED on much less robust/rich kit -- the Trippy RGB
  Waves kit from Lady Ada. I am (gratuitously) exploring ways to
  program it with Haskell.

 --
 Jason Dusek
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Timing in atom -- how consistent?

2010-01-01 Thread John Van Enk
Yes, exactly.

On Fri, Jan 1, 2010 at 3:02 PM, Jason Dusek jason.du...@gmail.com wrote:

  Wait, no -- I missed something. As long as the outermost Atom
  routine is run every `n' µs by a hardware clock, the counter
  (`__global_clock') will contain an accurate count of how many
  `n' µs intervals have passed in our application.

 --
 Jason Dusek
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Data.Ring -- Pre-announce

2009-12-31 Thread John Van Enk
Hi List,

I recently needed a ring structure (circular list with bi-directional
access) and didn't see anything obvious on Hackage. I threw something
together fairly quickly and would like some feedback before tossing it on
Hackage.

I'd really appreciate if some one would:

   1. make sure the code looks goodish (127 lines with full docs)
   2. make sure my tests look saneish

If I hear nothing, I'll assume wild support and push to Hackage.

Code: http://github.com/sw17ch/data-ring/blob/master/src/Data/Ring.hs
Tests: http://github.com/sw17ch/data-ring/blob/master/tests/quickcheck.hs
Package Root: http://github.com/sw17ch/data-ring

Thanks ahead of time,
John Van Enk
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Data.Ring -- Pre-announce

2009-12-31 Thread John Van Enk
Hi Luke,

Thanks for the feedback. I had some follow up comments.

On Thu, Dec 31, 2009 at 5:50 AM, Luke Palmer lrpal...@gmail.com wrote:

 Code looks okay.  It suffers from the same persistence/amortization
 problem as the classical functional queue; if you happen to shift from
 one of the edge cases (eg. prev when the left is empty), you will get
 degenerate time complexity, reversing that right list over and over.
 See discussion at Simple and efficient purely functional queues and
 deques, by Chris Okasaki; probably can adapt that solution to yours.
 More of an academic interest, I doubt anyone will care about those
 cases.


Yes. I agree and did see it. I'm reading the paper and may implement some of
the stuff he talks about.


 Ring is a comonad, so you can make it an instance of one if you want
 to have some fun :-P


I plan on adding as many instances as I know and make sense to me. :)


 It seems weird that you would put the focus in the middle in fromList.
  Overly strict.  Why not just put it at the first element?  (Also
 easier to reason about)


It actually uses the first element as the focus, not the middle.


 I would consider considering a ring where *both* left and right were
 infinite to be valid, but not when only one of them is infinite (when
 they both are infinite, you will never get to reverse).


This would be neat, perhaps someday. I don't think this works well with my
current API. :(

Thanks again. :)

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Data.Ring -- Pre-announce

2009-12-31 Thread John Van Enk
Hi Daniel,

Some follow up on your comments:

On Thu, Dec 31, 2009 at 5:54 AM, Daniel Fischer daniel.is.fisc...@web.dewrote:

  Am Donnerstag 31 Dezember 2009 10:59:54 schrieb John Van Enk:

  Hi List,

 

  I recently needed a ring structure (circular list with bi-directional

  access) and didn't see anything obvious on Hackage. I threw something

  together fairly quickly and would like some feedback before tossing it on

  Hackage.

 

  I'd really appreciate if some one would:

 

  1. make sure the code looks goodish (127 lines with full docs)

 I think 'left' and 'right' aren't the optimal names. But I can't think of
 something clearly better either. The same applies to 'remove'.

 Please, flip the arguments in 'insert'. While ring `insert` el or insert
 ring el may seem more natural (or not) and that argument order is nicer for
 foldl', consistency with the argument order of Data.List.insert,
 Data.Set.insert and Data.Map.insert seems far more important to me.


Done.


   2. make sure my tests look saneish

 Sort of. The code is so short and clear that testing it at all may hint at
 paranoia.

 Jokes aside, prop_balance is a consequence of prop_list

 (toList . balance . fromList === toList . fromList . toList . fromList;

 toList . fromList === id == toList . fromList . toList . fromList === id).

 prop_isEmpty :: [Int] - Bool

 prop_isEmpty [] = True == (isEmpty . fromList $ [])

 prop_isEmpty l  = False == (isEmpty . fromList $ l)

  prop_isEmpty [] = isEmpty . fromList $ []

 prop_isEmpty l  = not . isEmpty . fromList $ l

  or

  prop_isEmpty l = null l == isEmpty (fromList l)



Agreed. I actually dislike all the tests... this is actually the first
package I've used QuickCheck to test with. I'm most likely going to redo the
test set shortly. I'll take this advice.

Thanks again.

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Data.Ring -- Pre-announce

2009-12-31 Thread John Van Enk
Hi Heinrich,

Some comments:

On Thu, Dec 31, 2009 at 6:27 AM, Heinrich Apfelmus 
apfel...@quantentunnel.de wrote:

 Since the name  Ring  is already taken by an ubiquitous mathematical
 structure, and thus already in hackage for example as  Algebra.Ring  in
 the  numeric-prelude , I suggest to call the data structure  Necklace
 instead.


I think I like Ring more than Necklace or Tom's suggestion of Circular. I
chose Ring simply because that's what I was searching for when I wanted the
data structure. The package will be named data-ring, so that should
hopefully be enough to clue in the user that it's not dealing with the
mathematical concept.


 While we're at it, I'd also perform the following name changes:

   -- new focus = element to the left of the current focus
   prev -  left
   -- new focus = element to the right of the current focus
   next  - right

   left  - elementsLeft
   right - elementsRight

 The problem with  prev  and  next  is that they are relative to a
 default direction and everybody would have to remember whether that was
 to the left or right. Since a necklace is inherently symmetric, I
 suggest to avoid imposing such a default direction.


Done. I actually had it this way first, but had the hard problem of
conceptualizing left/prev right/next. I added some comments to the
documentation describing the metaphor using a rotating table so that
left/right make sense.




 Furthermore, I think the documentation is lacking a few key points,
 first and foremost the explanation of what exactly a  Ring  (Necklace)
 is. While you can assume that people should know what a stack or queue
 is, this cannot be said for this little known data structure.


I hope I've addressed this in the extended documentation.


 Second, there is the off by one issue. Does  insert  put elements left
 or right of the focus?


I've replaced insert/remove with insertL/R and removeL/R. The docs better
explain their behavior.

Third, I think the quickcheck tests are not very effective; instead of
 always converting to and from lists and testing how the operations
 behave, I suggest to focus on intrinsic laws, like for example

  (prev . next) x == x
   focus . insert a x == Just a

 and so on. (You do need one or two tests involving  toList  and
 fromList , but no more.)


Yes. The tests are junk. I'm replacing them. :)

Also, you should make an  instance Arbitrary a = Arbitrary (Necklace a)
 to replace the  [Int]  arguments that are just a proxy for an actual
 necklace. (Not to mention that thanks to parametric polymorphism, it is
 sufficient to test everything on the lists [1..n])


Working on this now.


 Last but not least, what about asymptotic complexity? While your
 operations are usually O(1), sometimes they are O(n). You provide a
 function  balance  to deal with the latter case, but the API is much
 more usable if you guarantee O(1) no matter what; please dispense with
 balance  and friends.


I'll see what I can do. I'm addressing complexity after everything else
looks okay. I don't like balance or pack and am hoping to drop all of them
from the API.

You can implement O(1) operations by using two queues instead of two
 lists as left and right part. Alternatively, you can adapt the rotation
 scheme for purely functional queues to your data structure and
 internally balance whenever one of the lists becomes for example 3x
 larger than the other one. See also chapter 3.4.2 of

  Chris Okasaki. Purely Functional Data Structures. (thesis)
  
 http://www.cs.cmu.edu/~rwh/theses/okasaki.pdfhttp://www.cs.cmu.edu/%7Erwh/theses/okasaki.pdf

 (Not sure if 3 is a good size factor; this can be determined with the
 amortized cost/step graph  c(a) = let b = a/(1+a)-1/2 in (b+1)/b  where
 a is the size factor.)


This bothers me only because checking the length means I need to run down
the spine of the list. Perhaps I can convince my self to keep a memo of the
respective lengths.

Thanks for your feedback!

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Data.Ring -- Pre-announce

2009-12-31 Thread John Van Enk
I've decided to settle on Data.CircularList. The renamed git repository is
here:

http://github.com/sw17ch/data-clist

On Thu, Dec 31, 2009 at 3:29 PM, Twan van Laarhoven twa...@gmail.comwrote:

 John Van Enk wrote:

 Hi Heinrich,


 I think I like Ring more than Necklace or Tom's suggestion of Circular. I
 chose Ring simply because that's what I was searching for when I wanted the
 data structure. The package will be named data-ring, so that should
 hopefully be enough to clue in the user that it's not dealing with the
 mathematical concept.


 The mathematical concept would likely also go in Data, unfortunately. See
 for example Data.Monoid. If someone does at a Ring class sometime, it is
 very likely to go into Data.Ring, which would lead to conflicts. In fact it
 already exists, see the monoids package [1]

 I would prefer the name RingList or CircularList. As long as you put the
 word ring in the package description users will still find it when
 searching on hackage.


 [1]
 http://hackage.haskell.org/packages/archive/monoids/0.1.25/doc/html/Data-Ring.html

 Twan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Announce: data-clist-0.0.3 -- A RingBuffer/CircularList/Ring data type

2009-12-31 Thread John Van Enk
Hi all,

data-clist-0.0.3 is up on hackage:
http://hackage.haskell.org/package/data-clist-0.0.3

Any feedback is appreciated. The docs are getting there, but not quite
complete.

Enjoy!

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Memory-aware Haskell?

2009-12-24 Thread John Van Enk
This is a problem with partitioned operating systems used in avionics. The
airplane computers require certain partitions to exist between programs in
both time and space. The space guarantees are most easily enforced by
eliminating any dynamic memory allocation once the operating system enters a
'normal mode'. This means that all memory needs to be allocated on the stack
and ahead of time.

This reduces the calculation of the upper memory bound to checking what the
largest possible stack a process could grow to is. Of course, calculating
this maximum stack is difficult in its own right.

Unfortunately, nothing I've just discussed seems to port well to Haskell (I
could be wrong!). Given this, I think you're looking at a very hard problem
(but one I'd be incredibly interested in discovering a solution for!).

/jve

On Thu, Dec 24, 2009 at 5:38 PM, Roman Cheplyaka r...@ro-che.info wrote:

 Imagine some system with hard memory bound (e.g. 64M of physical memory,
 no swap). I don't want some accidental laziness (maybe even not in my
 code, but in some used package) to crash my program.

 So, let's think what we can do at runtime. Suppose RTS takes the parameter
 --
 upper limit of consumed memory. When it sees that memory consumption is
 close to upper bound, it can:

 1. force garbage collection

 2. apply some heuristics to find and reduce some chunks which will
   benefit from reduction in terms of size

 3. if nothing helps, throw an exeption. It can be caught in IO and
   memory-aware program can make apropriate decision -- e.g. abort
   opening a large file and gracefully warn the user.

 (And there still is a problem of foreign code whose memory consumption
 we know nothing about...)

 What do you think?

 --
 Roman I. Cheplyaka :: http://ro-che.info/
 Don't let school get in the way of your education. - Mark Twain
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Hemkay, the 100% Haskell MOD player

2009-12-14 Thread John Van Enk
It's been well over a year. I'll see what I can do when I get some free(er)
time.

2009/12/14 Patai Gergely patai_gerg...@fastmail.fm

  The more of these I see, the more guilt I feel over the condition of the
  portaudio module. There's a good chance that the performance issue you're
  seeing is a bad implementation of the portaudio library. Do you have any
  specific problems you ran into with portaudio? I'd love to revisit at
  some point...
 Well, when I tried to push whole blocks instead of individual samples,
 it seemed to miss some of these writes. It might do the same even now,
 but it wouldn't be noticeable with a sample missing here and there
 anyway.

 The interface for writeStream is not very fortunate. It forces me to
 pack samples into lists no matter what, even if the interleaved list is
 actually easier to produce. So it should probably provide alternative
 interfaces for interleaved lists (which would actually be possible right
 away if writeStream didn't ignore its third argument altogether), and
 maybe an array interface as well. I don't know if the callback interface
 works better, maybe that's also worth a shot.

 Ultimately, it would be probably best if it gave the programmer a higher
 abstraction, where it is passed a potentially infinite list of samples,
 and takes care of all the buffering duties. Also, this could be made to
 play nice with stream fusion in order to get the maximum performance out
 of it.

 Gergely

 --
 http://www.fastmail.fm - One of many happy users:
  http://www.fastmail.fm/docs/quotes.html

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Why?

2009-12-10 Thread John Van Enk
If anything, I'd flip those two...

On the backend, things are anything but pure but it helps us reason about
the program on the front end.

Laziness also isn't nearly as prevalent on the backend as it is on the front
end.

Even though we can reason about things using purity and laziness on the
front, the compiler often times makes an identical situation that runs a lot
faster using strictness and mutation on the back.

/jve

On Thu, Dec 10, 2009 at 11:09 AM, John D. Earle johndea...@cox.net wrote:

  Laziness is on the logic front end and purity is on the execution back
 end.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Rebox Package or To Hackage or not to Hackage

2009-12-08 Thread John Van Enk
Hi List,

I've recently had a situation where I used the same pattern quite a bit
 while reducing and evaluating an AST. I quickly wrapped the operation in a
package and stuck it on github.

http://github.com/sw17ch/rebox/blob/master/src/Data/Rebox.hs

I'm wondering two things:
1) Does any one recognize the pattern I'm using here as something with a
different name?
2) Is this worth sticking on Hackage? It's trivial, but we have plenty of
trivial concepts on Hackage (and it's not a bad thing).

Any feedback would be great.

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: PortAudio Windows Tutorial and Binaries

2009-12-07 Thread John Van Enk
Very cool.

On Sun, Dec 6, 2009 at 7:29 PM, M Xyz functionallyharmoni...@yahoo.comwrote:


 I got a lot of great help this weekend from Haskell-Cafe, thanks.
 Now that I have portaudio up and running I put up a tutorial and a 103 kb
 download
 of all the windows binaries and files. I hope this helps people exploring
 digital audio with Haskell.

 http://www.subreddits.org/misc/haskell/portaudio.html



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?

2009-12-04 Thread John Van Enk
Hi,

portaudio is my embarrassing fault, but it does work most of the time.
(Community, some one remind me to revisit this package after Christmas.)

Are you running in Windows? Linux? If Linux, which flavor?

/jve

On Fri, Dec 4, 2009 at 1:51 PM, M Xyz functionallyharmoni...@yahoo.comwrote:


 What is the most minimal (preferably platform independent) library
 available for writing bytes to the sound card? I see 60 wonderful libraries
 on Hackage, but I really just need the Haskell equivalent of an
 audio.write(byte[]) method. What sound api are these 60 libraries using?

 I think the portaudio library is the only contender but when I try to
 install it I get:

 cabal install portaudio
 Resolving dependencies...
 Downloading portaudio-0.0.1...
 Configuring portaudio-0.0.1...
 cabal: Missing dependency on a foreign library:
 * Missing C library: portaudio
 This problem can usually be solved by installing the system package that
 provides this library (you may need the -dev version). If the library is
 already installed but in a non-standard location then you can use the flags
 --extra-include-dirs= and --extra-lib-dirs= to specify where it is.
 cabal: Error: some packages failed to install:
 portaudio-0.0.1 failed during the configure step. The exception was:
 exit: ExitFailure 1




 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?

2009-12-04 Thread John Van Enk
You'll have to install the portaudio C libraries and header files before
continuing. I never actually tested the package on XP, if you get it to
work, I'd love to hear your experience.

/jve

On Fri, Dec 4, 2009 at 2:20 PM, M Xyz functionallyharmoni...@yahoo.comwrote:



 Hi,

 portaudio is my embarrassing fault, but it does work most of the time.
 (Community, some one remind me to revisit this package after Christmas.)

 Are you running in Windows? Linux? If Linux, which flavor?

 /jve


 I'm using Haskell on XP but I dual boot with Ubuntu 9 and I'd prefer not to
 break compatibility. I'm new to this, was I supposed to install portaudio
 for my OS before downloading the Haskell package? Are there other similar
 simple sound apis?




 On Fri, Dec 4, 2009 at 1:51 PM, M Xyz 
 functionallyharmoni...@yahoo.comhttp://mc/compose?to=functionallyharmoni...@yahoo.com
  wrote:


 What is the most minimal (preferably platform independent) library
 available for writing bytes to the sound card? I see 60 wonderful libraries
 on Hackage, but I really just need the Haskell equivalent of an
 audio.write(byte[]) method. What sound api are these 60 libraries using?

 I think the portaudio library is the only contender but when I try to
 install it I get:

 cabal install portaudio
 Resolving dependencies...
 Downloading portaudio-0.0.1...
 Configuring portaudio-0.0.1...
 cabal: Missing dependency on a foreign library:
 * Missing C library: portaudio
 This problem can usually be solved by installing the system package that
 provides this library (you may need the -dev version). If the library is
 already installed but in a non-standard location then you can use the
 flags
 --extra-include-dirs= and --extra-lib-dirs= to specify where it is.
 cabal: Error: some packages failed to install:
 portaudio-0.0.1 failed during the configure step. The exception was:
 exit: ExitFailure 1




 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org http://mc/compose?to=haskell-c...@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Finding HP

2009-12-03 Thread John Van Enk
I'm all for making HP the default as long as we find a way to make some of
the larger packages (I'm thinking gtk2hs) either ship with HP in Windows or
install correctly with HP.

On Thu, Dec 3, 2009 at 11:46 AM, Joe Fredette jfred...@gmail.com wrote:

 I think it makes sense, the HP is supposed to set up the entire environment
 needed for typical haskell development (at least, that is my understanding).
 As such, what's the point in making downloading haskell mean downloading a
 single _peice_ of haskell (GHC) only to have to download _everything else
 anyway_ (cabal-et-al, various standard libraries, etc).

 Perhaps we could put it to some kind of community vote.

 /Joe


 On Dec 3, 2009, at 11:43 AM, Don Stewart wrote:

  vandijk.roel:

 On Wed, Dec 2, 2009 at 11:44 PM, Gregory Crosswhite
 gcr...@phys.washington.edu wrote:

 On a more serious note, Download Haskell /= Download Haskell
 Platform, so if I were glancing down the sidebar looking for a link to
 download the Haskell Platform then the first link wouldn't have 
 registered
 for me.  And putting a X has been released link! in the news does not
 count as a prominent download link.


 If I wanted to know something *about* the *Haskell Platform* I would
 click the link The Haskell Platform under the section About. So it is
 actually mentioned 3 times on the front page. What could be improved
 are the 2 download links: Download Haskell and Download GHC. It
 would perhaps be better to have one nice big Download button that
 takes you to a separate download page.


 Having a single download link that only points to the Haskell Platform
 would be a bit of a policy shift. Is the community ready to accept that
 users looking for Haskell should be given the HP binaries?

 If so, I can change it to have a single Download button. Though it
 might be preferable to do that after the next release (the first
 non-beta release).

 -- Don
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is Haskell a Fanatic?

2009-12-03 Thread John Van Enk
The burden of proof is on you to demonstrate that it _is_.

On Thu, Dec 3, 2009 at 12:09 PM, John D. Earle johndea...@cox.net wrote:

 See [Haskell-cafe] Optimization with Strings ? for background.

 Don Stewart wrote, the guarantees of purity the type system provides are
 extremely
 useful for verification purposes. My response to this is in theory. This
 is what caught my attention initially, but the language lacks polish and
 does not appear to be going in a direction where it shows signs where it
 will self-correct. It may even be beyond repair. I care about others and I
 don't want people to be misled.

 I am already well aware of the numbers. They do not impress me. I have
 written on this already. I have given Haskell the benefit of the doubt and
 said, What's wrong with being uncompromising? There is something wrong with
 it, if it has taken you off the path of truth. This is not uncompromising.
 This is something else. It is called fanaticism and this is the opinion that
 I have come to after due consideration.

 If you are going to argue your case, be constructive. Tell me how the type
 system is not flawed and how the Haskell language is rigorous. What proof do
 you have of this? Explain to me how Haskell has been merely uncompromising
 in its pursuit of perfection and did not manage to step over the threshold
 into fanaticism. Please remain on topic and on point.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is Haskell a Fanatic?

2009-12-03 Thread John Van Enk
*flawed, that is

On Thu, Dec 3, 2009 at 12:13 PM, John Van Enk vane...@gmail.com wrote:

 The burden of proof is on you to demonstrate that it _is_.

 On Thu, Dec 3, 2009 at 12:09 PM, John D. Earle johndea...@cox.net wrote:

 See [Haskell-cafe] Optimization with Strings ? for background.

 Don Stewart wrote, the guarantees of purity the type system provides are
 extremely
 useful for verification purposes. My response to this is in theory. This
 is what caught my attention initially, but the language lacks polish and
 does not appear to be going in a direction where it shows signs where it
 will self-correct. It may even be beyond repair. I care about others and I
 don't want people to be misled.

 I am already well aware of the numbers. They do not impress me. I have
 written on this already. I have given Haskell the benefit of the doubt and
 said, What's wrong with being uncompromising? There is something wrong with
 it, if it has taken you off the path of truth. This is not uncompromising.
 This is something else. It is called fanaticism and this is the opinion that
 I have come to after due consideration.

 If you are going to argue your case, be constructive. Tell me how the type
 system is not flawed and how the Haskell language is rigorous. What proof do
 you have of this? Explain to me how Haskell has been merely uncompromising
 in its pursuit of perfection and did not manage to step over the threshold
 into fanaticism. Please remain on topic and on point.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IORefs and weak pointers

2009-11-02 Thread John Van Enk
Is the IORef or the value in the IORef your key?

2009/11/2 Patai Gergely patai_gerg...@fastmail.fm

 Hello all,

 I wanted to create a weak pointer with an IORef as the key and something
 else as the value, but I saw no way to do it through the API provided.
 After some experimentation I came up with the following abomination for
 a solution:

 myWeakRef (IORef (STRef r)) v f =
  IO $ \s - case mkWeak# r v f s of (# s', w #) - (# s', Weak w #)

 This works perfectly when the code is compiled both with and without
 optimisations, but ghci chokes on it with an internal error. So my
 question is if I can expect this to work at least this much in the long
 run, or is it a hopelessly fragile hack?

 Gergely

 --
 http://www.fastmail.fm - Same, same, but different...

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: mecha-0.0.0

2009-10-22 Thread John Van Enk
Is this on hackage yet, or should we just consult the mecha link on your
home page?

On Wed, Oct 21, 2009 at 11:42 PM, Tom Hawkins tomahawk...@gmail.com wrote:

 A few months ago, I started toying with a few alternative pump designs
 to power our hydraulic hybrids.  After not being able to secure a ProE
 license, I searched for a free solid modeler to sketch out a few
 ideas.  To my surprise, their are practically no open source 3D CAD
 packages available.  So I created Mecha, DSL for constructive solid
 modeling.

 Mecha's geometry is based on octrees, which makes it easy to perform
 set operations on solids, as well as volumetric calculations such as
 center-of-mass, moments of inertia, and of course, total volume.
 Drawbacks of octrees include consuming a lot of memory and the loss of
 some surface information.  To address the later, Mecha carries forward
 surface points and normals to the leaf nodes of the octree to assist
 in rendering, such that solids don't look like they're made from a
 bunch of LEGOS.

 Note this is a very early release.  The only thing Mecha can do at the
 moment is draw a pretty blue ball -- well it can also zoom and pan on
 a pretty blue ball (mouse wheel).  Establishing a primitive API and
 building a primitive library must be finished before Mecha an do
 anything useful.

 Any comments and suggestions are welcome.

 http://tomahawkins.org/
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Make two windows work together

2009-10-20 Thread John Van Enk
Are you using GTK? OpenGL? Haskell? There's absolutely no context here...

On Tue, Oct 20, 2009 at 11:02 AM, xu zhang douy...@gmail.com wrote:

 Hi there,

 I am trying to make a sub-window of one window and make them work
 together. I mean, if I zoom or transform some content in one of the window,
 the other one works in the same way.
 What I have done so far is just open a new window which have the same
 drawing view as the original one, but when I try to change some content in
 one window, the other one does not work at the same time. They are separate.
 Can anyone give me some hint on how to make them work at the same time not
 separate anymore?

 Thank you so much!

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Need help with ghc static compile for cgi using mysql

2009-10-15 Thread John Van Enk
I've run Haskell stuff on VPS hosts like Linode or SliceHost. $20/month is a
lot better than $60.

On Thu, Oct 15, 2009 at 12:32 PM, Austin King sh...@ozten.com wrote:

 For now, I've given up on cheap hosting (via statically compiled CGI).

 I've created a GHC 6.10.4, cabal-install, Ubuntu 9.04 ec2 instance +
 MySQL and it works well.

 Running this plus EBS and Elastic IP will run a little over $60 a month.
 Ouch.

 The work going into Haskell Platform is amazing, but...
 Haskell needs a better commodity hosting story, to allow for casual,
 fun web hacking.

 For the record, I tried nearlyfreespeech.net and dreamhost. I wasn't
 able to install ghc and cabal due to:
 * FreeBSD GHC support (old version)
 * FreeBSD library support (no HDBC)
 * Linux - Missing 'dev' libraries like zlib and not having root access
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] On DSLs - one last time

2009-10-08 Thread John Van Enk
To me, the D and S come in when I'm deciding what to support. The
domain represents the set of primitive operations I want to support. The
specific says that I don't support anything other than those operations.

Consider a language for laying out boolean logic circuits: we want to
implement only AND, OR, and XOR, and NOT. The domain is boolean logic. We
can't reason directly about trees or rainbows with this language, so it's
specific.

Our set of primitive operations would probably consist of:

1) Create input
2) Perform one of AND, OR, or XOR on two inputs (or proceeding inputs from
previous operations)
3) Apply a NOT to an operation.

With this basic set of operations, one can build up a graph of gates which
can then be executed directly, converted to some other intermediate form, or
plotted in graphical form. This is actually the focus domain of a small EDSL
I'm working on for demonstrative purposes. The following is a link to the
github repository and a direct link to one of the examples.

http://github.com/sw17ch/gator
http://github.com/sw17ch/gator/blob/master/examples/4bitAdder.hs

The example linked is a 4 bit adder (8 inputs, 4 outputs) that will dump
GraphViz 'dot' code.

This simple EDSL currently only allows you to construct graphviz, but the
intermediate Logic type could be transformed to just about anything having
to do with boolean logic or executed in place.

I hope some of this made sense.

/jve

2009/10/8 Günther Schmidt gue.schm...@web.de

 Hi all,

 I'd like to summarize my impressions on the DSL issue, gathered from the
 responses to my posts.

 It is absolutely amazing, various people have shown here that it is
 possible to design languages within haskell that are almost or just as
 powerful and safe as haskell itself. It is probably even possible to create
 an EDSL within an EDSL within haskell.

 Amazing!


 Uhm...

 ... but in that case I really wonder why I should not use Haskell directly
 then.

 Because out of the EDSL I can clearly see the E and I can see the L but
 having slight problems figuring out where the D and the S come in.

 In short, yes it's great that you can create a language within Haskell so
 powerful that it's gone full circle and is general purpose again, but what
 good is that?

 The efforts I've seen here where efforts to create a rich and powerful
 syntax, but aren't we supposed to focus on expressing semantics specific to
 a problem in a DSL rather?

 I'm not trying to put the efforts and achievements of the people who have
 done such amazing work down, but what exactly is it that I missed?

 Günther

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: What *is* a DSL?

2009-10-07 Thread John Van Enk
On Wed, Oct 7, 2009 at 2:52 PM, Ben Franksen


 But isn't one of the advantages of an _E_DSL that we can use the host
 language (Haskell) as a meta or macro language for the DSL?


Substantially so. I've used brief examples where the EDSL syntax is
basically the data declaration (perhaps with some operators overloading
constructors) to demonstrate Haskell's fitness as a host language for EDSLs.

This is also a credit to the expressiveness of Haskell's data declarations.

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal - how do I remove a package?

2009-10-06 Thread John Van Enk
you want:

ghc-pkg unregister [package name]

and

ghc-pkg list

/jve

On Tue, Oct 6, 2009 at 3:52 PM, Paul Moore p.f.mo...@gmail.com wrote:

 As it says in the subject, how do I remove a package that I installed
 (with the --user flag) via cabal?

 Come to that, how do I list the packages I've installed via cabal?
 cabal list --installed includes all the GHC standard library (which I
 didn't install) and it doesn't seem to support a --user flag to list
 per-user installed packages.

 FWIW, I'm on Windows 7.

 Thanks,
 Paul.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal - how do I remove a package?

2009-10-06 Thread John Van Enk
Are you actually trying to remove the bits from the hard drive, or is that
something to fix a different problem you're having. If it's a different
problem, perhaps you could ask that as well?

On Tue, Oct 6, 2009 at 4:04 PM, Paul Moore p.f.mo...@gmail.com wrote:

 2009/10/6 John Van Enk vane...@gmail.com:
  you want:
 
  ghc-pkg unregister [package name]
 
  and
 
  ghc-pkg list

 Thanks. I wouldn't have found that by myself.

 Unfortunately, having issued

 ghc-pkg unregister mersenne-random-1.0

 I still see the code present:

 dir C:\Users\Gustav\AppData\Roaming\cabal\mersenne-random-1.0\ghc-6.10.4

  Volume in drive C is OS Serial number is 8442:99ea
  Directory of
  C:\Users\Gustav\AppData\Roaming\cabal\mersenne-random-1.0\ghc-6.10.4\*

 05/10/2009  21:06 DIR.
 05/10/2009  21:06 DIR..
 05/10/2009  21:06 DIRinclude
 05/10/2009  21:06 DIRSystem
 05/10/2009  21:06  44,350  HSmersenne-random-1.0.o
 05/10/2009  21:06  66,762  libHSmersenne-random-1.0.a

 Looks like ghc-pkg unregister just does precisely that - unregisters
 the package but doesn't remove it. Can I even persuage cabal/ghc-pkg
 to list all the files and directories created by the install so I can
 remove them by hand?

 Paul.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Market Place for Haskell development teams?

2009-10-02 Thread John Van Enk
 Sorry boss, but we're just not going to be able to meet that deadline,
 because, well, a language extension we were using was dropped from the
 language, and the syntax for some core operators was changed. Not only is
 our code broken, but many of the libraries we were using are broken. Don't
 worry, though, we're 'agile', so our unit tests will tell us when our code
 is working again.

 Big business demands stability.


And yet they use IE... how many projects have I had to spend substantial
time fixing because Microsoft releases a new IE...
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] c2hs, size_t, and CSize -- argh!

2009-10-01 Thread John Van Enk
Hello List,

I'm running into a problem with c2hs and how it parses the C typedef
'size_t'. On 32bit systems, this ends up being parsed as a CUInt. On 64bit
systems, this ends up as a CULong. This gets especially sticky with function
pointers.

In order to make bindings with c2hs that work across the different word
sizes, I have to write an indirection layer in C that defines wrappers for
functions or re-defines typedef's for function pointers to include 'unsigned
long' instead of 'size_t'.

I see there is a ticket open for this:
http://hackage.haskell.org/trac/c2hs/ticket/20

Has any one else run into this issue? Is there a good workaround that
doesn't involve writing a C function/typedef for each collision?

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] c2hs, size_t, and CSize -- argh!

2009-10-01 Thread John Van Enk
Hi Duncan,

Yes, I forgot to leave out that I'd like to see 'size_t' mapped to CSize.

As a (dirty) workaround, one can use 'castPtr' as the marshaler when dealing
with pointers to 'size_t'. I'm a little more concerned about FunPtr's
(though 'castPtr' still makes the issue go away).

Here's my specific case dealing with function pointers:

In 64bit world, it looks like this:
type ReadableCallback = Ptr () - Ptr CUChar - *Ptr CULong* - IO CUInt
{#fun gcry_ac_io_init_readable_callback {
id `ACIO',
id `FunPtr ReadableCallback',
id `Ptr ()'
} - `()'#}

In 32bit world, it looks like this:
type ReadableCallback = Ptr () - Ptr CUChar - *Ptr CUInt* - IO CUInt
{#fun gcry_ac_io_init_readable_callback {
id `ACIO',
id `FunPtr ReadableCallback',
id `Ptr ()'
} - `()'#}

I'd really like it if I could use 'Ptr CSize' (which corresponds to the
'size_t * ptr' in the C code).

My current workaround (which doesn't use a cast in Haskell) is to redefine
the function pointer type in a C header file to use 'unsigned long' instead
of 'size_t', but this gets cludgy in a hurry. If c2hs could translate to
CSize directly, I could pass a pointer to CSize.

Is it really such a problem to make the conversion? My assumption is that
CSize would match 'size_t' for the specific architecture.

Thanks for your comment.

/jve


On Thu, Oct 1, 2009 at 12:37 PM, Duncan Coutts duncan.cou...@googlemail.com
 wrote:

 On Thu, 2009-10-01 at 10:20 -0400, John Van Enk wrote:
  Hello List,
 
  I'm running into a problem with c2hs and how it parses the C typedef
  'size_t'. On 32bit systems, this ends up being parsed as a CUInt. On
  64bit systems, this ends up as a CULong. This gets especially sticky
  with function pointers.

 Right. Of course that's because on those different platforms size_t
 really is a typedef for unsigned int or unsigned long.

  I see there is a ticket open for this:
  http://hackage.haskell.org/trac/c2hs/ticket/20
 
  Has any one else run into this issue? Is there a good workaround that
  doesn't involve writing a C function/typedef for each collision?

 So what you would want, presumably, is to map the size_t typedef to
 the Haskell type Foreign.C.Types.CSize, rather than what c2hs discovers
 as the actual raw type of size_t. Then you're making the promise that
 unsigned long, or unsigned int really really does match
 Foreign.C.Types.CSize.

 Currently c2hs has no support for remapping basic types like that.

 As for a workaround, just use fromIntegral to convert to CSize. You know
 this is always possible because you know CSize matches CUInt or CULong
 on the appropriate platforms.

 $ cat foo.h
 #include stddef.h
 size_t foo(void);

 $ cat foo.c
 #include foo.h
 size_t foo(void) { return 42; }

 $ cat foo.chs

 import Foreign.C.Types
 foo :: IO CSize
 foo = fmap fromIntegral {# call foo as bar #}

 $ gcc -c foo.c
 $ c2hs foo.h foo.chs
 $ ghci foo.hs -fffi foo.o
 Main foo
 42


 Duncan


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] c2hs, size_t, and CSize -- argh!

2009-10-01 Thread John Van Enk

 Ohhh, if you're dealing with pointers to CSize then it's easy, c2hs
 supports that directly. See the c2hs user guide section on the pointer
 hook.

 {# pointer *size_t as CSizePtr - CSize #}


I seriously should have thought of that. I have #pointer's everywhere, but I
didn't think to do it with that. Thanks.

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Status of GHC as a Cross Compiler

2009-09-24 Thread John Van Enk
Thanks. I'd heard rumors about a year ago that 6.12 might have a cross
compiler. I just wanted to check. :)

On Wed, Sep 23, 2009 at 4:41 PM, Duncan Coutts
duncan.cou...@worc.ox.ac.ukwrote:

 On Wed, 2009-09-23 at 14:50 -0400, John Van Enk wrote:
  Hi,
 
  This may be more appropriate for a different list, but I'm having a
  hard time figuring out whether or not we're getting a cross compiler
  in 6.12 or not. Can some one point me to the correct place in Traq to
  find this information?

 We're getting slightly closer but it's not even nearly there yet.

 You might have read about the changes in the native code generator
 towards building all backends on each platform. However there are a lot
 of other changes needed especially in the build system to make a full
 cross-compiler. I know some people have worked on this for ARM but
 there's nothing integrated yet.

 Duncan


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Status of GHC as a Cross Compiler

2009-09-23 Thread John Van Enk
Hi,

This may be more appropriate for a different list, but I'm having a hard
time figuring out whether or not we're getting a cross compiler in 6.12 or
not. Can some one point me to the correct place in Traq to find this
information?

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: hssqlppp, sql parser and type checker, pre-alpha

2009-09-14 Thread John Van Enk
Second the hackage suggestion.

`cabal unpack [package name]` is a really nice way to grab sources.

On Mon, Sep 14, 2009 at 1:59 PM, Don Stewart d...@galois.com wrote:

 jakewheatmail:
  Hello all,
 
  I've started on a SQL parser and type checker, which I'm currently
  planning on evolving into a lint-type program for PL/pgSQL, called
  HsSqlPpp.
 
  It currently parses a subset of PostGreSQL SQL and PL/pgSQL, can type
  check some select, insert, update, delete and create statements, and
  is pretty rough all round at the moment.
 
  It uses Parsec and UUAGC, comes with a small HUnit test suite, and has
  a Cabal file.
 
  The code is on Launchpad here:
  https://launchpad.net/hssqlppp
 
  You can get a snapshot here:
 
 http://launchpad.net/hssqlppp/prealpha/secondtypechecking/+download/hssqlppp-140909-rev276.zip
 
  More information in the readme:
 
 http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/READMEhttp://bazaar.launchpad.net/%7Ejakewheat/hssqlppp/trunk/annotate/head%3A/README
  and brief the usage guide gives you an idea of what you can do with it
  right now:
 
 http://bazaar.launchpad.net/~jakewheat/hssqlppp/trunk/annotate/head%3A/usagehttp://bazaar.launchpad.net/%7Ejakewheat/hssqlppp/trunk/annotate/head%3A/usage
 
  I'm pretty new to Haskell, parsing, attribute grammars and type
  checking - any comments, advice, criticism welcome.

 Will you be releasing it on Hackage?

 Bonus: if you do, it can be cabal-installed :)

 -- Don
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-09-14 Thread John Van Enk
I'll hunt down those changes and push something new to hackage. :)

On Mon, Sep 14, 2009 at 12:27 PM, Felipe Lessa felipe.le...@gmail.comwrote:

 On Wed, Aug 12, 2009 at 01:03:55PM -0400, John Van Enk wrote:
   EnumMap silently passes this responsibility to the user, without even a
 note in the documentation.
 
  Like I've said, I made no modifications to the documentation other
  than replacing IntMap with EnumMap. Should the community show more
  interest in the EnumMap, such a change will show up in the docs.

 I'm showing interest in EnumMap :).  I have some IntMap's that
 provide no type safety about what is inserted and EnumMap solves
 that problem as nicely as possible.

 Right now I don't really care about the doumentation problems,
 but I would like to see the SPECIALIZE and INLINE improvements,
 when will there be a new version?

 Thanks a lot!

 --
 Felipe.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-09-14 Thread John Van Enk
http://hackage.haskell.org/package/EnumMap

Changes pushed. Job Vranish added the SPECIALIZE pragmas, and I believe he
has more data concerning how much this helps.

Note, the git repo is here: http://github.com/sw17ch/EnumMap

/jve

On Mon, Sep 14, 2009 at 12:27 PM, Felipe Lessa felipe.le...@gmail.comwrote:

 On Wed, Aug 12, 2009 at 01:03:55PM -0400, John Van Enk wrote:
   EnumMap silently passes this responsibility to the user, without even a
 note in the documentation.
 
  Like I've said, I made no modifications to the documentation other
  than replacing IntMap with EnumMap. Should the community show more
  interest in the EnumMap, such a change will show up in the docs.

 I'm showing interest in EnumMap :).  I have some IntMap's that
 provide no type safety about what is inserted and EnumMap solves
 that problem as nicely as possible.

 Right now I don't really care about the doumentation problems,
 but I would like to see the SPECIALIZE and INLINE improvements,
 when will there be a new version?

 Thanks a lot!

 --
 Felipe.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal install on Windows 7

2009-09-08 Thread John Van Enk
Might it make sense to try and get the concept of global and user
working in Windows? (It may already, but I noticed that the default seems to
be global.)

I don't know what technical challenges there are, but the ApplicationData
directory (or AppData, or whatever) seems like a good place to stick user
cabal packages.

/jve

On Tue, Sep 8, 2009 at 9:31 AM, Peter Verswyvelen bugf...@gmail.com wrote:

 I tried the cabal install command on Windows 7, and I had to run it
 with administrative privileges, otherwise I got access denied (it
 failed to create the Haskell folder in C:\Program Files)

 Not sure if this is also the case on Vista.

 Is this the intended behavior?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: jail-0.0.1 - Jailed IO monad

2009-08-27 Thread John Van Enk
Neat!

On Thu, Aug 27, 2009 at 10:09 AM, Sebastiaan Visser sfvis...@cs.uu.nlwrote:

 Hi all,

 I am very pleased to announce the first release of the jail[1,2] package. A
 jailed IO monad that can restrict filesystem access for your code. This
 package will soon be an integral part of the Salvia web server. (a new and
 improved Salvia will be released soon)

 Basic documentation of the jail package is included below.

 Any comments, suggestions, audits, etc. are welcome!

 Gr,

 --
 Sebastiaan Visser

 [1] Source repo: http://github.com/sebastiaanvisser/jail/

 [2] Hackage: http://hackage.haskell.org/package/jail



 

 Like all of us know, the IO monad from the System.IO module is a wild beast
 allowing all forms of insecure computations that can read, or even worse,
 alter the real world. Writing to sockets, deleting files or even launching
 missiles, its possibilities are endless. This library provides a special IO
 module that wraps all file and handle based IO operations from the System.IO
 module, but provides a possibility to run them in an restricted environment.
 When running a jailed IO computation a file path can be specified all IO
 operations will be checked against. Accessing files outside this directory
 is not allowed and results in a runtime error. Additionally, when running a
 jailed IO computation a whitelist of file handles can be specified that are
 accessible as well.

 For example, running some code with the permission to access all files
 within (and only within) my home directory and allowing to access the
 standard output and standard error can be enforced like this:

  Jail.run (Just /home/sebas) [stdout, stderr]
 yourUntrustworthyComputation
 Only allowing the code to access the standard input and nothing else can be
 enforced like this:

  Jail.run Nothing [stdin] yourEvenMoreUntrustworthyComputation
 Because the jailed IO environment keeps track of all file handles and
 checks that are opened by its own operations, smuggling in evil file handles
 from the fierce and dangerous outside world will be punished by border
 patrol. Only handles from the whitelist or handles securely opened by
 functions like openFile will be accepted. Because of the opaque IO
 constructor and the restricted set of exported operations this module is not
 easily fooled.

 I would almost dare to say this module is conceptually safe and code with
 the jailed IO type can blindly be trusted. Except, yes unfortunately except,
 unsafePerformIO ruins it all. I would almost suggest adding a flag to the
 compiler to enforce the absence ofunsafeRuinMyTypeSafety-alike functions in
 order to be able to create systems in which code can be trusted by its type
 alone.

 Nonetheless, this module is one step forward in trusting your own programs.
 Some real http://tinyurl.com/paranoidpeople prefer writing there software
 in one of the most insecure programming languages and perform security
 audits by hand, I'd rather have my compiler do the job. (Anyone who wants to
 audit this library is more than welcome!)


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Killing a thread blocking on a foreign call

2009-08-27 Thread John Van Enk
Hi List,

I'm trying to kill a thread (during program cleanup) that is almost always
going to be perma-blocking on a foreign call (read).

It seems that there's no facility to do this built into Haskell at this
point, or is there?

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-12 Thread John Van Enk
On Wed, Aug 12, 2009 at 2:09 AM, Ketil Maldeke...@malde.org wrote:
 Felipe Lessa felipe.le...@gmail.com writes:

 There are some funky Enum instances around:

 IMO it's implicit that keys overwrite eachother whenever their
 'fromEnum' is equal, however that may be spoken in the docs.

 I couldn't find anything explicit in the documentation.  I'd suggest a
 clear note at the top, dismissing the (IMO natural) notion that
 EnumMap k v behaves like Map k v (which was true for IntMap and
 Map Int, I believe).

I haven't updated any of the documentation from IntMap over s/IntMap/EnumMap/g.


 And perhaps also note that you will get exceptions for values outside
 the Enum range.


I'd think that part is obvious.

 It strikes me that using Bits instead of Enum might be more likely to
 be what people want in many cases - but perhaps that would be too slow?
 Also that Enum really should map to Integer, but again, that's a speed
 issue.¹


I think Enum is a little more natural--perhaps I'm wrong.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-12 Thread John Van Enk
On Wed, Aug 12, 2009 at 11:34 AM, David Menendezd...@zednenem.com wrote:
 On Wed, Aug 12, 2009 at 9:16 AM, John Van Enkvane...@gmail.com wrote:
 On Wed, Aug 12, 2009 at 2:09 AM, Ketil Maldeke...@malde.org wrote:

 And perhaps also note that you will get exceptions for values outside
 the Enum range.


 I'd think that part is obvious.

 That depends on what outside the Enum range means. You'll get an
 exception if you somehow get an Int key in the map which doesn't
 correspond to any value in the enum...

We should be protected by the type system against unmatched Int's in
the map as long as you have sane Enum instances.

 ... but you don't get an exception if
 you try to pass in, say, a large Integer.
 Prelude fromEnum (2^32)
 0

 In essence, you're using Enum as a hash function, but not making any
 provision for hash collisions.


Unless I'm mistaken, the Enum typeclass _is_ a hash function who's
keyspace is the range of Int that doesn't make any provisions for
collisions.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-12 Thread John Van Enk
 EnumMap silently passes this responsibility to the user, without even a note 
 in the documentation.

Like I've said, I made no modifications to the documentation other
than replacing IntMap with EnumMap. Should the community show more
interest in the EnumMap, such a change will show up in the docs.

On Wed, Aug 12, 2009 at 12:58 PM, David Menendezd...@zednenem.com wrote:
 On Wed, Aug 12, 2009 at 12:07 PM, John Van Enkvane...@gmail.com wrote:
 On Wed, Aug 12, 2009 at 11:34 AM, David Menendezd...@zednenem.com wrote:
 On Wed, Aug 12, 2009 at 9:16 AM, John Van Enkvane...@gmail.com wrote:
 On Wed, Aug 12, 2009 at 2:09 AM, Ketil Maldeke...@malde.org wrote:

 And perhaps also note that you will get exceptions for values outside
 the Enum range.


 I'd think that part is obvious.

 That depends on what outside the Enum range means. You'll get an
 exception if you somehow get an Int key in the map which doesn't
 correspond to any value in the enum...

 We should be protected by the type system against unmatched Int's in
 the map as long as you have sane Enum instances.

 One would hope so.

 ... but you don't get an exception if
 you try to pass in, say, a large Integer.
 Prelude fromEnum (2^32)
 0

 In essence, you're using Enum as a hash function, but not making any
 provision for hash collisions.


 Unless I'm mistaken, the Enum typeclass _is_ a hash function who's
 keyspace is the range of Int that doesn't make any provisions for
 collisions.

 Hash functions traditionally map integers to integers, so I would
 describe fromEnum as like a hash function, but that's not important.

 And yes, hash functions collide, which is why hash tables employ
 various methods for distinguishing keys that hash to the same values.
 EnumMap silently passes this responsibility to the user, without even
 a note in the documentation.

 --
 Dave Menendez d...@zednenem.com
 http://www.eyrie.org/~zednenem/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-12 Thread John Van Enk
 It strikes me that using Bits instead of Enum might be more likely to be what 
 people want in many cases

It wouldn't hurt for you (or someone) to implement this. I'm sure it
would be useful.

On Wed, Aug 12, 2009 at 2:09 AM, Ketil Maldeke...@malde.org wrote:
 Felipe Lessa felipe.le...@gmail.com writes:

 There are some funky Enum instances around:

 IMO it's implicit that keys overwrite eachother whenever their
 'fromEnum' is equal, however that may be spoken in the docs.

 I couldn't find anything explicit in the documentation.  I'd suggest a
 clear note at the top, dismissing the (IMO natural) notion that
 EnumMap k v behaves like Map k v (which was true for IntMap and
 Map Int, I believe).

 And perhaps also note that you will get exceptions for values outside
 the Enum range.

 It strikes me that using Bits instead of Enum might be more likely to
 be what people want in many cases - but perhaps that would be too slow?
 Also that Enum really should map to Integer, but again, that's a speed
 issue.¹

 One could also question the sanity of using e.g. floating point values
 as keys, but Map supports this, so who am I to judge.

 (Also, a minor documentation niggle is that Haskell only guarantees 30
 bits for an Int, it's GHC that uses Ints of 32 and 64 bits.  One could
 argue that it is the report that should be fixed here, unless one can
 imagine a program that depends on correct modulo arithmetic with an
 unknown quotient.)

 -k

 ¹ This of course migth give the careless reader of the Report the
 impression that the Haskell community values speed over correctness,
 and thus that we actually are aiming for popularity and mainstream
 recognition after all.
 --
 If I haven't seen further, it is by standing in the footprints of giants
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] unsafeDestructiveAssign?

2009-08-11 Thread John Van Enk
 unsafeHorribleThings

I think we have a name for this new feature.

I can see how something like this would be useful to some areas. There
are many cases (graphs!) where it's just easier to build up structures
destructively, seal them, and return them to happyPureFunTimesLand.

Even if GHC does do just as good of a job as performing the unsafe
button pushing our selves, it would be an interesting exercise.

On Tue, Aug 11, 2009 at 12:14 PM, Max
Desyatovexplicitc...@googlemail.com wrote:
 Job Vranish jvran...@gmail.com writes:

 Does anybody know if there is some unsafe IO function that would let me do 
 destructive assignment?
 Something like:

 a = 5
 main = do
   veryUnsafeAndYouShouldNeverEveryCallThisFunction_DestructiveAssign a 8
   print a
 8

 Aren't StateT or IORefs the exact thing you are looking for?

 I'm also looking for a way to make actual copies of data.
 so I could do something like this:

 a = Node 5 [Node 2 [], Node 5 [a]]
 main = do
   b - makeCopy a
   veryUnsafeAndYouShouldNeverEveryCallThisFunction_DestructiveAssign b (Node 
 0 [])
   -- 'a' is unchanged

 It would be even more fantastic, if the copy function was lazy.
 I think the traverse function might actually make a copy, but I would be 
 happier with something more general (doesn't
 require membership in traversable), and more explicit (was actually designed 
 for making real copies).

 Same thing, IORefs could help you.  Anyway, I can't imagine any case
 where veryUnsafeAndYouShouldNeverEveryCallThisFunction_DestructiveAssign
 could be useful with its imperative semantics as you've described.  The
 point is that Haskell is pure language and I use it because of this
 feature (not only because of this, to be exact).  I don't want to use
 any library code that brokes pure semantics and launches nuclear bombs
 behind the IO monad.  GHC is smart enough these days to do all optimised
 destructive assignments, copies and all that imperative stuff and there
 are plenty of other ways to get a performance boost without
 unsafeHorribleThings.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-11 Thread John Van Enk
For the sake of testing both options, here's a branch with the wrapper
code instead of the replacement/integrated code:

http://github.com/sw17ch/EnumMap/tree/wrapper

On Sat, Aug 8, 2009 at 4:41 PM, Henning
Thielemannlemm...@henning-thielemann.de wrote:

 On Sat, 8 Aug 2009, John Van Enk wrote:

 Hi List,

 I've uploaded a first version of EnumMap to hackage.

 EnumMap is a generalization of IntMap that constrains the key to Enum
 rather than forcing it to be Int. I have no idea what impact this has
 on performance, but it still passes all the tests that ship with
 IntMap. (My guess is that performance will be similar/identical unless
 I've missed something.)

 Could that be implemented as wrapper around IntMap?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-10 Thread John Van Enk
I've been trying to implement EnumMap as a wrapper for IntMap. Here's
the first problem I ran into:

 IntMap.insertWithKey :: (Key - a - a - a) - Key - a - IntMap a - 
 IntMap a

I'd like to translate this to something like:

 EnumMap.insertWithKey :: Enum k = (Key k - a - a - a) - Key k - a - 
 EnumMap k a - EnumMap k a

My initial thought was just to make it a normal wrapper:

 EnumMap.insertWithKey f k v m = IntMap.insertWithKey f (unKey k) v (unEnumMap 
 m)

The obvious problem here is the type of `f' expected by the wrapper
function and the internal function. Either we force the wrapper to
take a function that takes an Int as the first parameter, or we
rewrite the logic of insertWithKey to allow us to use the proper (Key
k) type.

I don't see an obvious way around this--am I missing something?

On Sat, Aug 8, 2009 at 4:41 PM, Henning
Thielemannlemm...@henning-thielemann.de wrote:

 On Sat, 8 Aug 2009, John Van Enk wrote:

 Hi List,

 I've uploaded a first version of EnumMap to hackage.

 EnumMap is a generalization of IntMap that constrains the key to Enum
 rather than forcing it to be Int. I have no idea what impact this has
 on performance, but it still passes all the tests that ship with
 IntMap. (My guess is that performance will be similar/identical unless
 I've missed something.)

 Could that be implemented as wrapper around IntMap?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-10 Thread John Van Enk
Allow me to answer my own question:

 EnumMap.insertWithKey f k v m = IntMap.insertWithKey (f . Key . toEnum) 
 (unKey k) v (unEnumMap m)


On Mon, Aug 10, 2009 at 2:32 PM, John Van Enkvane...@gmail.com wrote:
 I've been trying to implement EnumMap as a wrapper for IntMap. Here's
 the first problem I ran into:

 IntMap.insertWithKey :: (Key - a - a - a) - Key - a - IntMap a - 
 IntMap a

 I'd like to translate this to something like:

 EnumMap.insertWithKey :: Enum k = (Key k - a - a - a) - Key k - a - 
 EnumMap k a - EnumMap k a

 My initial thought was just to make it a normal wrapper:

 EnumMap.insertWithKey f k v m = IntMap.insertWithKey f (unKey k) v 
 (unEnumMap m)

 The obvious problem here is the type of `f' expected by the wrapper
 function and the internal function. Either we force the wrapper to
 take a function that takes an Int as the first parameter, or we
 rewrite the logic of insertWithKey to allow us to use the proper (Key
 k) type.

 I don't see an obvious way around this--am I missing something?

 On Sat, Aug 8, 2009 at 4:41 PM, Henning
 Thielemannlemm...@henning-thielemann.de wrote:

 On Sat, 8 Aug 2009, John Van Enk wrote:

 Hi List,

 I've uploaded a first version of EnumMap to hackage.

 EnumMap is a generalization of IntMap that constrains the key to Enum
 rather than forcing it to be Int. I have no idea what impact this has
 on performance, but it still passes all the tests that ship with
 IntMap. (My guess is that performance will be similar/identical unless
 I've missed something.)

 Could that be implemented as wrapper around IntMap?


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-09 Thread John Van Enk
http://github.com/sw17ch/EnumMap/tree/master

Perhaps you could patch what I have? :)

On Sun, Aug 9, 2009 at 12:08 AM, Thomas
DuBuissonthomas.dubuis...@gmail.com wrote:
 Inflating the number of elements in the test, I see:

 IntMap
 inserts: 5.3 seconds
 lookups: 2.0 seconds

 EnumMap
 inserts: 6.1 sec (15% slower)
 lookups: 2.5 sec (25% slower)

 EnumMap with SPECIALIZE of:
 {-# SPECIALIZE join :: Prefix - EnumMap Int a - Prefix - EnumMap
 Int a - EnumMap Int a #-}
 {-# SPECIALIZE lookup :: Int - EnumMap Int a - Maybe a #-}
 {-# SPECIALIZE lookupN :: Nat - EnumMap Int a - Maybe a #-}
 {-# SPECIALIZE insert :: Int - a - EnumMap Int a - EnumMap Int a #-}
 inserts: 5.3 seconds (dead on)
 lookups: 2.6 seconds (owch!)

 Additionally specializing the functions used in lookup{,N} doesn't
 help.  I tried inlining (via INLINE) a couple things but that only
 made performance notably worse.


 Thomas

 On Sat, Aug 8, 2009 at 8:29 PM, John Van Enkvane...@gmail.com wrote:
 How bad is the lookup compared to normal?

 On Sat, Aug 8, 2009 at 9:02 PM, Thomas
 DuBuissonthomas.dubuis...@gmail.com wrote:
 On Sat, Aug 8, 2009 at 5:30 PM, Felipe Lessafelipe.le...@gmail.com wrote:
 On Sat, Aug 08, 2009 at 04:14:15PM -0700, Thomas DuBuisson wrote:
 There exists a small but measurable performance hit for at least one
 test case (using Int as keys, obviously).  Perhaps the bias would be
 the other way if we were comparing EnumMap to an IntMap wrapped with
 to/from Enum.

 Perhaps some SPECIALIZE pragmas would help here.


 Actually I tried that by adding SPECIALIZE to insert, insertN and
 lookup.  it seemed to make the insert benchmark competitive but not
 lookup.

 Thomas
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-08 Thread John Van Enk
Hi List,

I've uploaded a first version of EnumMap to hackage.

EnumMap is a generalization of IntMap that constrains the key to Enum
rather than forcing it to be Int. I have no idea what impact this has
on performance, but it still passes all the tests that ship with
IntMap. (My guess is that performance will be similar/identical unless
I've missed something.)

If this package competes in speed (especially with an Int key) with
IntMap, I'd expect this could be merged into the containers package as
an IntMap replacement.

The source comments/copyright/license hasn't been changed since this
is a derivative work of the original IntMap package.

http://hackage.haskell.org/package/EnumMap

Comments/benchmarks/criticism is appreciated. Merging this in with
containers eventually would be more appreciated. :)

John Van Enk
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-08 Thread John Van Enk
That's originally how I was thinking about doing it, but I think that
requires one to re-implement all the functions available in
Data.IntMap as simple wrappers that do the toEnum/fromEnum conversion.
I think making it into its own module is a little cleaner. The
conversion from EnumMap to IntMap is substantially cleaner than from
IntMap to EnumMap:

 type IntMap v = EnumMap Int v

/jve

On Sat, Aug 8, 2009 at 4:41 PM, Henning
Thielemannlemm...@henning-thielemann.de wrote:

 On Sat, 8 Aug 2009, John Van Enk wrote:

 Hi List,

 I've uploaded a first version of EnumMap to hackage.

 EnumMap is a generalization of IntMap that constrains the key to Enum
 rather than forcing it to be Int. I have no idea what impact this has
 on performance, but it still passes all the tests that ship with
 IntMap. (My guess is that performance will be similar/identical unless
 I've missed something.)

 Could that be implemented as wrapper around IntMap?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-08 Thread John Van Enk
What if we say that Enum a generalization, rather than a wrapper, of Int?

If the benchmarks are even, is there a reason to use the more specific
structure rather than the general one? I don't know if Enum being
more complex outweighs the benefits of it being more general (if
the EnumMap matches IntMap for speed).

Thoughts?

On Sat, Aug 8, 2009 at 6:11 PM, Henning
Thielemannlemm...@henning-thielemann.de wrote:

 On Sat, 8 Aug 2009, John Van Enk wrote:

 That's originally how I was thinking about doing it, but I think that
 requires one to re-implement all the functions available in
 Data.IntMap as simple wrappers that do the toEnum/fromEnum conversion.
 I think making it into its own module is a little cleaner. The
 conversion from EnumMap to IntMap is substantially cleaner than from
 IntMap to EnumMap:

 type IntMap v = EnumMap Int v

 Can you implement EnumMap in terms of the Enum methods, without many
 conversions to Int? I mean, if you often convert to Int and back then you
 could achieve the same on top of IntMap. Generally I prefer the strategy
 from simple to complex. I consider Enum to be a wrapper around Int.
  http://haskell.org/haskellwiki/Simple_to_complex

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Announce: EnumMap-0.0.1

2009-08-08 Thread John Van Enk
How bad is the lookup compared to normal?

On Sat, Aug 8, 2009 at 9:02 PM, Thomas
DuBuissonthomas.dubuis...@gmail.com wrote:
 On Sat, Aug 8, 2009 at 5:30 PM, Felipe Lessafelipe.le...@gmail.com wrote:
 On Sat, Aug 08, 2009 at 04:14:15PM -0700, Thomas DuBuisson wrote:
 There exists a small but measurable performance hit for at least one
 test case (using Int as keys, obviously).  Perhaps the bias would be
 the other way if we were comparing EnumMap to an IntMap wrapped with
 to/from Enum.

 Perhaps some SPECIALIZE pragmas would help here.


 Actually I tried that by adding SPECIALIZE to insert, insertN and
 lookup.  it seemed to make the insert benchmark competitive but not
 lookup.

 Thomas
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Haskell on a VPS

2009-07-23 Thread John Van Enk
Has any one used a service similar to (or equivelant to) Slicehost or
Linode to run Haskell network applications?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell on a VPS

2009-07-23 Thread John Van Enk
No, I just want to know if there are any gotchas in the typical VPS
setups that for some strange reason wouldn't like Haskell binaries. I
couldn't think of any, but I miss details some times.

Thanks.

On Thu, Jul 23, 2009 at 11:08 AM, Jeremy Shawjer...@n-heptane.com wrote:
 At Thu, 23 Jul 2009 10:53:40 -0400,
 John Van Enk wrote:

 Has any one used a service similar to (or equivelant to) Slicehost or
 Linode to run Haskell network applications?

 I have run happstack applications on vpslink and rimuhosting VPSes. (I
 build everything as .debs and then just install the .debs on the
 server. But that has nothing to do with the fact that I am using
 Haskell or a VPS, it's just how I roll...)

 Is there some reason you think running a Haskell network application
 would be different than any other network application when it comes to
 a VPS?

 - jeremy

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell on a VPS

2009-07-23 Thread John Van Enk
Yeah, it crossed my mind, but since my application only uses 3MB of
memory in Linux, I think I'll be ok. :)

On Thu, Jul 23, 2009 at 11:38 AM, Anton van
Straatenan...@appsolutions.com wrote:
 John Van Enk wrote:

 No, I just want to know if there are any gotchas in the typical VPS
 setups that for some strange reason wouldn't like Haskell binaries. I
 couldn't think of any, but I miss details some times.

 One detail you should check is that the VPS has enough memory for the
 Haskell applications you intend to run.  RAM tends to be the most
 constraining factor on cheaper VPSes, and Haskell apps aren't always the
 most lightweight users of RAM.  (At least, mine aren't.)

 Anton
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell on a VPS

2009-07-23 Thread John Van Enk
It's a synchronization node for my VPN application written in Haskell.
All it has to do is catch UDP packets, and keep a teeny tiny amount of
state. I just don't have the resources to host that my self in a
reliable way.

On Thu, Jul 23, 2009 at 11:44 AM, Anton van
Straatenan...@appsolutions.com wrote:
 3MB?  You're going to host Hello World on a VPS?  ;)


 John Van Enk wrote:

 Yeah, it crossed my mind, but since my application only uses 3MB of
 memory in Linux, I think I'll be ok. :)

 On Thu, Jul 23, 2009 at 11:38 AM, Anton van
 Straatenan...@appsolutions.com wrote:

 John Van Enk wrote:

 No, I just want to know if there are any gotchas in the typical VPS
 setups that for some strange reason wouldn't like Haskell binaries. I
 couldn't think of any, but I miss details some times.

 One detail you should check is that the VPS has enough memory for the
 Haskell applications you intend to run.  RAM tends to be the most
 constraining factor on cheaper VPSes, and Haskell apps aren't always the
 most lightweight users of RAM.  (At least, mine aren't.)

 Anton
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] FFI to double constants, printf

2009-07-17 Thread John Van Enk
You probably want something like printf(%.10Lg,d);. Here's a shot C
example and its output:

#include stdio.h

int main(int argc, char * argv[])
{
long double d = 0.123456789;

printf(%.30Lf\n, d);
printf(%.20Lg\n, d);
printf(%.20Le\n, d);
}

/*
0.1234567887336054491370
0.123456788734
1.234567887336e-01
*/

On Fri, Jul 17, 2009 at 6:41 PM, Maurí­ciobriqueabra...@yahoo.com wrote:
 When we printf doubles from C (like when using hsc2hs to bind to a
 constant) we can get something that's not valid Haskell. See these
 2 examples:

 3.40282347e+38F

 inf

 Do you know some way to printf a double using printf (or any other
 standard function) that's always going to give me valid Haskell
 text, even in special cases?

 Thanks,
 Maurício

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Atom resources

2009-07-16 Thread John Van Enk
Are you starting a new Wiki? I'd absolutely love to have that resource.

On Thu, Jul 16, 2009 at 8:14 PM, Thomas
DuBuissonthomas.dubuis...@gmail.com wrote:
 The wiki [1] where Atom [2] once lived has been gone for some time
 now.  The only resources I know for Atom are a couple blog posts, the
 haddock docs, and the Atom source on patchtag.  Is anyone aware of
 other resources?

 Tom

 [1] http://funhdl.org/wiki/doku.php
 [2] http://hackage.haskell.org/package/atom
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Haskell Platform + gtk2hs

2009-06-28 Thread John Van Enk
List,

Has any one managed to install gtk2hs on a Windows box running the
Haskell Platform? I've had no luck; it seems the gtk2hs installer is
unable to find the GHC installation.

/jve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


  1   2   3   >