Re: [Haskell-cafe] Why Either = Left | Right instead of something like Result = Success | Failure

2010-06-01 Thread Patrick LeBoutillier
On Thu, May 27, 2010 at 3:17 PM, Mike Dillon m...@embody.org wrote:
 begin C. McCann quotation:
 Personally, I advocate instead using Sinister and Dexter. Nice and
 catchy, don't you think?

 Has anyone done a translation of the Prelude into Latin?

 modulus PraeLudus ubi

 data Uter a b = Sinister a
               | Dexter b
               derivare (Aequo, Ordinaro, Lego, Monstro)

 Ha.

Not Haskell, but check this one out:

http://search.cpan.org/~dconway/Lingua-Romana-Perligata-0.50/lib/Lingua/Romana/Perligata.pm

Patrick


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




-- 
=
Patrick LeBoutillier
Rosemère, Québec, Canada
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Language Shootout reverse-complement benchmark

2010-06-01 Thread Louis Wasserman
Hey,

I was looking at the reverse-complement benchmark on the Language Shootout,
and among other things, I noticed that the Haskell implementation was using
(filter (/= '\n')) on ByteStrings, and also using lists as queues.

I had a few improvements which using -fasm seem to yield about a 19%
improvement in speed, and a 35% reduction in allocation, on my computer.
 (If both programs are compiled with -fllvm -- I'm not sure whether or not
that's fair game on the Shootout -- my implementation is 35% faster, and
does 10% less allocation.)  I've checked my code on the Shootout's test
input, as well.

Mostly, the improvement comes from a tightly specialized version of (filter
(/= '\n')), although eliminating an intermediate list entirely (and one used
in a queuelike fashion) didn't seem to hurt.  I managed to cut the program
to a point where the program size is about the same as before.

The code is at http://hpaste.org/fastcgi/hpaste.fcgi/view?id=25865; the
previous implementation is at
http://shootout.alioth.debian.org/u32/program.php?test=revcomplang=ghcid=2
.

Let the arguing begin?

Louis Wasserman
wasserman.lo...@gmail.com
http://profiles.google.com/wasserman.louis
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell + CouchDB, anyone?

2010-06-01 Thread Лев Никитин
I hav not run your examples. But

1. May be you have put to couchdb only *object* (braked by {}) but not array?
2. Why not to define data (data Mydata = Mydata {...}) and
   declare it as instance of JSON
   you can find example of using couchDB via google.com/codesearch
(lang:haskell couchDB)


-- 
Никитин Лев.
n...@lab321.ru, leon.v.niki...@gmail.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [web-devel] Google Summer of Code: BlazeHTML RFC

2010-06-01 Thread Jeremy Shaw
A (hopefully) non-cropped version of the chart, http://tinyurl.com/2cl42js
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Parselib sample

2010-06-01 Thread C K Kashyap
Hi,
Is there a not-so-trivial parser implementation with Parselib? Parser for a
C like language would be good.
I searched and found Haskell++ -
http://www.cs.chalmers.se/~rjmh/Software/h++.html
However, I'd prefer to look at a parser for a C like language.

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


[Haskell-cafe] The state of Hackage: what are we doing about it?

2010-06-01 Thread Don Stewart
I see fairly regular complaints about too many Haskell libraries,
bewildering choice of difficult-to-determine quality.

I've tried to summarize the state of Hackage, and what projects are
active to make it easier to find high quality libraries:

http://tinyurl.com/2cqw9sb

Thoughts?

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


[Haskell-cafe] Re: LLVM - Haskell

2010-06-01 Thread Aaron Tomb

On May 31, 2010, at 3:02 PM, Tom Hawkins wrote:

 For instance, the LLVM.FFI.BitReader module has some functions that'll get 
 you a ModuleRef from some bitcode.
 
 getBitcodeModuleInContext :: ContextRef  - MemoryBufferRef  - Ptr
 ModuleRef  - Ptr  CString  - IO  Bool
 type ModuleRef = Ptr  Module
 data Module
 
 I'm confused how this works.  How does one get a Ptr ModuleRef to call
 this function?  Module is not Storable, so you can't use alloca or
 malloc.  And I don't see any functions in the library that returns a
 Ptr ModuleRef.  What am I missing?  (Sorry, I lack experience with
 Foreign.Ptr.)

That's a good question, and I'm not sure of the answer. I based my previous 
email  purely on a quick scan the documentation. I've never actually tried to 
use it. :)

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


[Haskell-cafe] How to build an Indicator Type for a type class?

2010-06-01 Thread Steffen Schuldenzucker
Dear Cafe,

let:

 data True
 data False

 class C a

(arbitrary instances for C may follow)

Now, how to obtain an Indicator Type for C, i.e. a type IndC that is defined
via a type family / fundep / ... , so that

IndC a = True   forall a which are instances of C
IndC a = False  for all other a.

I've collected some failed approaches here[1]. My key problem is that if I
define (in the 3rd try):

 instance (C a) = IndC3 a True

, it does *not* mean Define this instance for all a which are an instance of
C, but Define the instance IndC3 a True for all types a, but it's not gonna
work if a is not an instance of C.

Does anyone have another idea?

Background:

After having implemented type-level lists[2] and a quicksort on them[3], I'd
like to have type-level sets. In their most simple implementation, sets are
just (unsorted) lists like this:

 data Nil
 data Cons a b
 class Elem x l
(instances for Elem so that Elem x l iff x is an element of the list l)

Now I want:

 type family Insert x s :: *

Insert x s = s  forall (x, s) with (Elem x s)
Insert x s = Cons x s   for all other (x, s).


Thanks a lot!

Steffen


[1] http://hpaste.org/fastcgi/hpaste.fcgi/view?id=25832#a25832
[2] Kiselyov, Peyton-Jones, Shan: Fun with type functions

http://research.microsoft.com/en-us/um/people/simonpj/papers/assoc-types/fun-with-type-funs/typefun.pdf
[3] I rewrote this algorithm using type families instead of fundeps:

http://www.haskell.org/haskellwiki/Type_arithmetic#An_Advanced_Example_:_Type-Level_Quicksort
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Language Shootout reverse-complement benchmark

2010-06-01 Thread David Leimbach
I'm still trying to figure out what the point of the shootout really is.  If
there's no dedicated folks working with a language there, trying to make
things run faster, a language will come out looking inefficient potentially.
 There's a lot of compile flags and optimizations that can make a difference
in probably all of the languages listed on that page.

I guess all you can get from the shootout is a sense of what a particular
language or set of tools is capable of in the hands of the programmers who
submit implementations.  It doesn't really give you a concrete idea as to
how to evaluate a programming language.

It does still seem kind of fun for some reason though :-)

Dave

On Mon, May 31, 2010 at 5:47 PM, Louis Wasserman
wasserman.lo...@gmail.comwrote:

 Hey,

 I was looking at the reverse-complement benchmark on the Language Shootout,
 and among other things, I noticed that the Haskell implementation was using
 (filter (/= '\n')) on ByteStrings, and also using lists as queues.

 I had a few improvements which using -fasm seem to yield about a 19%
 improvement in speed, and a 35% reduction in allocation, on my computer.
  (If both programs are compiled with -fllvm -- I'm not sure whether or not
 that's fair game on the Shootout -- my implementation is 35% faster, and
 does 10% less allocation.)  I've checked my code on the Shootout's test
 input, as well.

 Mostly, the improvement comes from a tightly specialized version of (filter
 (/= '\n')), although eliminating an intermediate list entirely (and one used
 in a queuelike fashion) didn't seem to hurt.  I managed to cut the program
 to a point where the program size is about the same as before.

 The code is at http://hpaste.org/fastcgi/hpaste.fcgi/view?id=25865; the
 previous implementation is at
 http://shootout.alioth.debian.org/u32/program.php?test=revcomplang=ghcid=2
 .

 Let the arguing begin?

 Louis Wasserman
 wasserman.lo...@gmail.com
 http://profiles.google.com/wasserman.louis

 ___
 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] name of this monadic combinator?

2010-06-01 Thread Mike Dillon
begin Brent Yorgey quotation:
 On Sun, May 30, 2010 at 11:15:40AM -0700, Mike Dillon wrote:
  begin Michael Snoyman quotation:
   http://hackage.haskell.org/packages/archive/base/4.2.0.1/doc/html/Control-Monad.html#v%3AliftM2
   
   file:///usr/share/doc/ghc6-doc/html/libraries/base-4.2.0.0/Control-Monad.html#v%3AliftM2Strangely,
   Hayoo didn't turn this one up... anyone know why?
  
  Hoogle finds it. I didn't think Hayoo was expected to do this sort of
  abstract type signature search:
  
  
  http://haskell.org/hoogle/?hoogle=Monad+m+%3D%3E+%28a+-%3E+a+-%3E+a%29+-%3E+m+a+-%3E+m+a+-%3E+m+a
  
  It comes up as the second hit on that search or the first hit on this
  one:
  
  
  http://haskell.org/hoogle/?hoogle=Monad+m+%3D%3E+%28a+-%3E+b+-%3E+c%29+-%3E+m+a+-%3E+m+b+-%3E+m+c
  
  That second search also shows zipWith in there; I never really thought
  about zipWith being like liftM2 for the list Monad. I don't believe
  that's actually true for the normal list Monad, but it should be true of
  an alternate list Monad along the lines of the Functor and Applicative
  instances for the ZipList newtype in Control.Applicative.
 
 As Max noted, ZipList is not a monad.  However, you have the right
 idea: zipWith is exactly liftA2 (the equivalent of liftM2 for
 Applicatives) for ZipList.

Thanks to both you and Max. After you guys responded, I went back and
found an interesting haskell-cafe discussion about how ZipList cannot be
made into a Monad from August 2009.

I should have realized that there was a reason there is no Monad
instance defined along with ZipList.

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


Re: [Haskell-cafe] Parselib sample

2010-06-01 Thread Stephen Tetley
Hello

For non-trivial parsing Parsec or UU-Parse are much better candidates.

If you have Parsec installed from Hackage, I'd still recommend you get
the manual and source distribution from:

http://legacy.cs.uu.nl/daan/parsec.html

The source distribution has some examples - Tiger, Mondrian, Henk -
full, if small languages.
C is quite a large language and its grammar is usually presented for
LR parsing so you are unlikely to find a parser for C or even a subset
of C with a combinator library, as parser combinators are LL. To
convert LR to LL needs a lot of left factoring and wouldn't be fun,
though I believe there is a C parser for the ANTLR system which is
LL(k).

Best wishes

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


[Haskell-cafe] design question/font metrics

2010-06-01 Thread Gery Debongnie
Dear Haskell-Cafe list,

Since I am learning Haskell, I decided to try to do a real program, to
practice and give me some experience.  I choose to do a basic
typesetting program (like TeX/LaTeX).  Now, obviously, such a program
needs to manipulate font objects, and in particular, font metrics.
Basically, I would like some function like this :

stringWidth :: Font - String - Double
charWidth :: Font - Char - Double

which take some appropriate font type, string or char, and gives me a
width (also height) in some given unit.  I'd like it to take into
account appropriate kerning.

Question 1 :
Now, I may be missing something, but a quick search on Google/Hackage
didn't yield anything. Is there an existing package, or any nice and
simple way to deal with that problem?

Question 2 :
In case the answer to the previous question is negative, I guess I
will need to do it myself, the old-fashioned way.  Now, this is where
I have a design question.  The thing is that font metrics information
are encoded into some file (either .tfm or .pl files, for TeX fonts),
so my function stringWidth will need to read a file, which is, gasp,
an IO operation. Therefore, its type will be something like

stringWidth :: Font - String - IO Double

and it will infect pretty much everything else.  It doesn't sound
really appealing, so I'd like your opinions on this subject.  To start
the conversation, here are the solutions that I have in mind, so far :

1. well, do nothing, and let IO infect everything.

2. use unsafePerformIO  to get rid of IO.  (I am weary to do this,
since I am a newbie, and I don't really want to start using that
function everywhere...  However, in this case, it looks kinda
legitimate...)

3. Perform a reading of the font metrics file in the main program, put
the results into some FontMetrics object, and give that to stringWidth
:: FontMetrics - Font - String - Double.  Pros : allow me to avoid
problems of solution 1 and 2, cons : it doesn't sound right for the
main program to have to do this, it should be confined into a Font
module.

Any other ideas, suggestions?

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


Re: [Haskell-cafe] ANNOUNCE: MonadCatchIO-foreign

2010-06-01 Thread Bas van Dijk
Thanks for writing this package.

I used those functions myself in my usb package:
http://hackage.haskell.org/packages/archive/usb/0.3.1/doc/html/src/System-USB-IO-Synchronous-Enumerator.html#genAlloca
(set you browser to UTF-8 encoding to correctly view the Unicode symbols)

I've now patched usb to work with your package:
http://code.haskell.org/~basvandijk/code/usb/System/USB/IO/Synchronous/Enumerator.hs

The next release will include it.

Regards,

Bas

On Mon, May 31, 2010 at 2:10 AM, Antoine Latter aslat...@gmail.com wrote:
 Hello Haskell,

 I'd like to announce a very small library in two flavors.

 The problem I'm trying to solve is that we have some capabilities for
 writing functions which are polymorphic over monad but still use IO
 capabilities - liftIO :: (IO a - m a) from the packages transformers
 and mtl. The packages[1,2] MonadCatchIO offer similar polymorphism for
 the exception capabilities of the IO monad.

 The package MonadCatchIO-foreign offers similar polymorphism for the
 following functions:

  alloca, allocaBytes, allocaArray, allocaArray0 and withForeignPtr.

 It's a small thing, but I don't see why it should be written twice.

 Links on hackage:

 http://hackage.haskell.org/package/MonadCatchIO-mtl-foreign
 http://hackage.haskell.org/package/MonadCatchIO-transformers-foreign

 GitHub link:

 http://github.com/aslatter/MonadCatchIO-foreign

 Feedback, praise and adulation welcome.

 Antoine
 ___
 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: The state of Hackage: what are we doing about it?

2010-06-01 Thread Marc Weber
Excerpts from Don Stewart's message of Tue Jun 01 01:13:20 +0200 2010:
 I see fairly regular complaints about too many Haskell libraries,
 bewildering choice of difficult-to-determine quality.

I want to send a small reminder that there was the idea adding a public
wiki for each project which can react upon wishes of users faster than
everything else:
http://haskell.org/haskellwiki/Hackage_wiki_page_per_project_discussion

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


[Haskell-cafe] ANN: list-extras 0.4.0

2010-06-01 Thread wren ng thornton


-- list-extras 0.4.0


A minor (but interface-changing) release for common not-so-common 
functions for lists.




-- Changes (since 0.3.0)


* (by Tom Lokhorst) Added Data.List.Extras.list: a function for 
non-recursive case matching on lists. In the spirit of `maybe` and 
`either` (if we don't interpret them as catamorphisms).


* Changed the type of Data.List.Extras.Pair.zipBy to be correct. I have 
no idea where the old more restrictive type came from.




-- Links


Homepage:
http://code.haskell.org/~wren/

Hackage:
http://hackage.haskell.org/package/list-extras

Darcs:
http://code.haskell.org/~wren/list-extras/

Haddock (Darcs version):
http://code.haskell.org/~wren/list-extras/dist/doc/html/list-extras/

--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: The state of Hackage: what are we doing about it?

2010-06-01 Thread Henning Thielemann
Marc Weber schrieb:
 Excerpts from Don Stewart's message of Tue Jun 01 01:13:20 +0200 2010:
 I see fairly regular complaints about too many Haskell libraries,
 bewildering choice of difficult-to-determine quality.
 
 I want to send a small reminder that there was the idea adding a public
 wiki for each project which can react upon wishes of users faster than
 everything else:
 http://haskell.org/haskellwiki/Hackage_wiki_page_per_project_discussion

This seems to be part of current efforts. Quoting

http://donsbot.wordpress.com/2010/05/31/there-are-a-hell-of-a-lot-of-haskell-libraries-now-what-are-we-going-to-do-about-it/

2. Google Summer of Code: Hackage 2.0 – we have Matt Gruen working this
summer to finish the implementation of Hackage 2.0 – an improved Hackage
that will allow for many new features to help sort out the wheat from
the chaff in Haskell packages: build reports, wiki commenting, and
social voting.

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


Re: [Haskell-cafe] design question/font metrics

2010-06-01 Thread Anthony Cowley
On Tue, Jun 1, 2010 at 10:30 AM, Gery Debongnie
gery.debong...@gmail.com wrote:
 3. Perform a reading of the font metrics file in the main program, put
 the results into some FontMetrics object, and give that to stringWidth
 :: FontMetrics - Font - String - Double.  Pros : allow me to avoid
 problems of solution 1 and 2, cons : it doesn't sound right for the
 main program to have to do this, it should be confined into a Font
 module.

Ultimately all your IO is driven from main, so don't be afraid to add
more IO dependencies to it. You can let IO infect a module for
dealing with font files (e.g. a FontMetrics module with a function
getMetrics :: [String] - Map String Double), then drive that module
from main and feed its results into your pure code.

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


Re: [Haskell-cafe] design question/font metrics

2010-06-01 Thread Stephen Tetley
Hi Gery

There probably isn't a library to help - I've looked at extracting
TrueType font metrics myself but abandoned it - TrueType fonts have a
very complicated file format, and the spec is inadequate to code an
implementation. TeX font metrics are probably simpler but obviously
tied to TeX.

Reading from file and being in IO is probably not so bad for a TeX
like program - as TeX is essentially a 'compiler' a function from Tex
to Dvi, i.e. compileFile :: TeX - Dvi.

For any significant compiler you are likely to have the work inside a
monad made of a stack of monad transformers, so you can cleanly and
fairly trivially add IO as the bottom layer of the monad stack -
CompilerM - e.g. compileFile :: TeX - CompilerM Dvi.


Best wishes

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


[Haskell-cafe] Announce: berp, an implementation of Python 3, in Haskell

2010-06-01 Thread Bernie Pope
I'm pleased to announce the first public release of berp, version 0.0.2.

Berp is (the beginnings of) an implementation of Python 3, written in
Haskell. It provides a compiler and an interpreter. In both cases the
input Python program is translated into Haskell code. The compiler
turns the Haskell code into machine code. The interpreter runs the
Haskell code immediately via the GHCi interpreter. The user interface
of the interpreter imitates the one provided by CPython.

A cabal package is available:

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

The source code is hosted on github:

  http://github.com/bjpop/berp

Documentation is available on a github wiki:

  http://wiki.github.com/bjpop/berp/

Note: berp is known to work with GHC 6.10.4, but it may not work with
6.12.x, due to issues with GHC's memory usage when compiling the
language-python package (ticket #3972 on the GHC trac).

As you can see by the very low version number (0.0.2), berp is still
young; there is lots of room for improvement. However, it does support
a fairly wide variety of Python's features, and some extensions such
as callCC and tail call optimisation. Read more about it on the github
wiki mentioned above.

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


[Haskell-cafe] Pugs with GHC 6.12

2010-06-01 Thread Simon Thompson

Has anyone successfully compiled Pugs with GHC 6.12? The Pugs page suggests 
that it compiles, but it falls to link (and therefore build) when I try it.

Thanks!

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


[Haskell-cafe] Improving Haskell on Windows by adding it to TakeoffGW

2010-06-01 Thread MH
That's a great idea and I would love to help but I have no idea where and
how to start. I would love to work on making Haskell installer work on
TakeofGW. Would it be possible to write down some notes describing what
needs to be done?

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


Re: [Haskell-cafe] Pugs with GHC 6.12

2010-06-01 Thread Daniel Fischer
On Tuesday 01 June 2010 16:58:53, Simon Thompson wrote:
 Has anyone successfully compiled Pugs with GHC 6.12?

$ pugs +RTS --info
 [(GHC RTS, YES)
 ,(GHC version, 6.12.1)
 ,(RTS way, rts_v)
 ,(Host platform, i386-unknown-linux)
 ,(Host architecture, i386)
 ,(Host OS, linux)
 ,(Host vendor, unknown)
 ,(Build platform, i386-unknown-linux)
 ,(Build architecture, i386)
 ,(Build OS, linux)
 ,(Build vendor, unknown)
 ,(Target platform, i386-unknown-linux)
 ,(Target architecture, i386)
 ,(Target OS, linux)
 ,(Target vendor, unknown)
 ,(Word size, 32)
 ,(Compiler unregisterised, NO)
 ,(Tables next to code, YES)
 ]

 The Pugs page
 suggests that it compiles, but it falls to link (and therefore build)
 when I try it.

 Thanks!

 Simon T.

Cheers,
Daniel

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


[Haskell-cafe] Third Ghent Functional Programming Group Meeting: Tuesday, June 29 at 19h

2010-06-01 Thread Jeroen Janssen
(apologies if you receive multiple copies)

Dear all,

We would like to announce that the third Ghent Functional Programming Group 
Meeting will take place on Tuesday, June 29, in the Technicum Building 
(Sint-Pietersnieuwstraat 41, 9000 Gent) of Ghent University at 19h. If you are 
interested in giving a talk, please do not hesitate to drop us a note! The 
final program will be announced shortly.

For more information you can follow us at twitter (@ghentfpg) or sign up for 
our google group (http://groups.google.com/group/ghent-fpg).

Hope to see you all then,

Bart Coppens (bart.copp...@elis.ugent.be; Twitter: @bartcopp)
Jasper Van der Jeugt (jasper...@gmail.com; Twitter: @jaspervdj)
Jeroen Janssen (jejan...@gmail.com; Twitter: @jejansse)

Note: if you do not want to receive any more e-mails from Ghent FPG, just send 
an e-mail to Jeroen Janssen (jejan...@gmail.com) and we will remove you from 
our mailinglist.___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Language Shootout reverse-complement benchmark

2010-06-01 Thread Gwern Branwen
On Tue, Jun 1, 2010 at 10:25 AM, David Leimbach leim...@gmail.com wrote:
 I'm still trying to figure out what the point of the shootout really is.  If
 there's no dedicated folks working with a language there, trying to make
 things run faster, a language will come out looking inefficient potentially.
  There's a lot of compile flags and optimizations that can make a difference
 in probably all of the languages listed on that page.

'Out of the crooked timber of humanity, no straight thing was ever made.'

 I guess all you can get from the shootout is a sense of what a particular
 language or set of tools is capable of in the hands of the programmers who
 submit implementations.  It doesn't really give you a concrete idea as to
 how to evaluate a programming language.
 It does still seem kind of fun for some reason though :-)
 Dave

The Shootout has a number of valuable purposes:

1) Concrete evidence that language X *can*, somehow, be as fast as language Y
2) Public examples of techniques to do #1, again concrete
3) Exposes where libraries/compilers can do better (this has happened
many times with GHC and Haskell libraries)
4) Motivates people to work on creating/fixing #2 and #3

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


[Haskell-cafe] Re: Pugs with GHC 6.12

2010-06-01 Thread Christian Maeder
Simon Thompson schrieb:
 Has anyone successfully compiled Pugs with GHC 6.12? The Pugs page suggests 
 that it compiles, but it falls to link (and therefore build) when I try it.

Your error message would help.

I was able to compile and link pugs (Version: 6.2.13.15)
using ghc-6.12.2.20100521 by:

  cabal install pugs

The libraries displayed by ldd on the binary are:

linux-gate.so.1 =  (0xe000)
libperl.so =
/usr/lib/perl5/5.10.0/i586-linux-thread-multi/CORE/libperl.so (0xb756)
libnsl.so.1 = /lib/libnsl.so.1 (0xb751a000)
libdl.so.2 = /lib/libdl.so.2 (0xb7515000)
libm.so.6 = /lib/libm.so.6 (0xb74ec000)
libcrypt.so.1 = /lib/libcrypt.so.1 (0xb74b4000)
libutil.so.1 = /lib/libutil.so.1 (0xb74b)
libpthread.so.0 = /lib/libpthread.so.0 (0xb7496000)
libc.so.6 = /lib/libc.so.6 (0xb733a000)
libncursesw.so.5 = /lib/libncursesw.so.5 (0xb72f)
librt.so.1 = /lib/librt.so.1 (0xb72e6000)
libgmp.so.3 = /usr/lib/libgmp.so.3 (0xb72a8000)
/lib/ld-linux.so.2 (0xb77d5000)

HTH Christian

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


Re: [Haskell-cafe] The state of Hackage: what are we doing about it?

2010-06-01 Thread Stephen Tetley
Forked to the Cafe...

Hi all

What's the procedure for marking one's own package(s) as deprecated on Hackage?

Best wishes

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


Re: [Haskell-cafe] yet another functional reactive programming tutorial :)

2010-06-01 Thread Thomas Hartman
cabal installable would be nice. for that matter, throw it on hackage!

2010/5/26 Jinjing Wang nfjinj...@gmail.com:
 Dear list,

 As I'm learning frp and reading the wonderful tutorial at

 http://www.formicite.com/dopage.php?frp/frp.html

 , I'm putting up some more basic cheatsheet style tutorial for myself.

 http://github.com/nfjinjing/frp-guide

 Feel free to take advantage of it.

 --
 jinjing
 ___
 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] PDF generation?

2010-06-01 Thread Jim Tittsler
What is the easiest way to create PDF files from Haskell?  Is gtk2hs's
PDF output the preferred way?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] PDF generation?

2010-06-01 Thread Henning Thielemann


On Tue, 1 Jun 2010, Jim Tittsler wrote:


What is the easiest way to create PDF files from Haskell?  Is gtk2hs's
PDF output the preferred way?


I have successfully used HPDF for
   http://hackage.haskell.org/package/internetmarke
 Certainly there could be some improvements to HPDF's API interface, but 
it works as it is.

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


Re: [Haskell-cafe] The state of Hackage: what are we doing about it?

2010-06-01 Thread Brandon S. Allbery KF8NH

On May 31, 2010, at 19:13 , Don Stewart wrote:

I see fairly regular complaints about too many Haskell libraries,
bewildering choice of difficult-to-determine quality.


One thing that might help is just a less cluttered/better organized  
interface.  I always have to use browser find on the package list page.


--
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




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: LLVM - Haskell

2010-06-01 Thread Tom Hawkins
 For instance, the LLVM.FFI.BitReader module has some functions that'll get 
 you a ModuleRef from some bitcode.

getBitcodeModuleInContext :: ContextRef  - MemoryBufferRef  - Ptr
ModuleRef  - Ptr  CString  - IO  Bool
type ModuleRef = Ptr  Module
data Module

I'm confused how this works.  How does one get a Ptr ModuleRef to call
this function?  Module is not Storable, so you can't use alloca or
malloc.  And I don't see any functions in the library that returns a
Ptr ModuleRef.  What am I missing?  (Sorry, I lack experience with
Foreign.Ptr.)

To get started, I want to make a function that reads an llvm object
file and returns a ModuleRef:

readObj :: FilePath - IO ModuleRef

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


Re: [Haskell-cafe] PDF generation?

2010-06-01 Thread Pierre-Etienne Meunier
Read the PDF manual from adobe, it is not that hard. Fonts are a little harder, 
but not too much.

El 01/06/2010, a las 12:14, Henning Thielemann escribió:

 
 On Tue, 1 Jun 2010, Jim Tittsler wrote:
 
 What is the easiest way to create PDF files from Haskell?  Is gtk2hs's
 PDF output the preferred way?
 
 I have successfully used HPDF for
   http://hackage.haskell.org/package/internetmarke
 Certainly there could be some improvements to HPDF's API interface, but it 
 works as it is.
 ___
 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: [web-devel] Google Summer of Code: BlazeHTML RFC

2010-06-01 Thread Jeremy Shaw
Hello,

HSP does not use xhtml or any other library internally.

The trhsx pre-processor turns this:

bigTable :: [[Int]] - String
bigTable t = renderAsHTML $ evalIdentity $
   table
% mapM (\r - tr% mapM (\d - td% show d %/td) r %/tr) t %
   /table

into:

bigTable :: [[Int]] - String
{-# LINE 38 hsp-blaze.hs #-}
bigTable t
  = L.unpack $
  B.renderHtml $
evalBlaze $
  (genElement (Nothing, table) []
 [asChild
((asChild
(mapM
   (\ r -
  (genElement (Nothing, tr) []
 [asChild
((asChild
(mapM
   (\ d -
  (genElement (Nothing, td) []
 [asChild ((asChild (show
d)))]))
   r)))]))
   t)))])

Basically, it just calls genElement to create the elements, and asChild is a
class to turn things into things that can be children on an element.

The question remains, though, what is the type that genElement is producing?
The type is monad specific. genElement comes from this class,

-- | Generate XML values in some XMLGenerator monad.
class Monad m = XMLGen m where
 type XML m
 data Child m
 data Attribute m
 genElement  :: Name - [XMLGenT m [Attribute m]] - [XMLGenT m [Child m]]
- XMLGenT m (XML m)
 genEElement :: Name - [XMLGenT m [Attribute m]]
 - XMLGenT m (XML m)
 genEElement n ats = genElement n ats []
 xmlToChild :: XML m - Child m
 pcdataToChild :: String - Child m

Most of the stuff in the HSX/HSP family now produces values of the type:

data XML = Element Name Attributes Children
 | CDATA Bool String

and you can use renderXML or renderAsHTML to convert that to a String
depending on what rendering rules you want in effect.

Anyway, on to the exciting stuff! The benchmarks:

As I test I have implemented the big-table benchmark for four cases:

1. the existing html test in benchmarkes/bigtable
2. plain-old blaze
3. hsp using the identity monad, the XML type, and String
4. hsp using blaze

html: mean: 15.86650 ms, lb 15.68054 ms, ub 16.22545 ms, ci 0.950
blaze:  mean: 28.86730 ms, lb 28.45495 ms, ub 29.63139 ms, ci 0.950
hsp+identity: mean: 50.05748 ms, lb 49.45395 ms, ub 50.97315 ms, ci 0.950
hsp+blaze: mean: 166.4717 ms, lb 161.7957 ms, ub 174.1437 ms, ci 0.950

As a chart:

http://chart.apis.google.com/chart?cht=bvgchs=200x250chd=t:29,50,166.5chds=0,180chdl=blaze|hsp+identity|hsp+blazechco=ff|00ff00|ffchxt=ychxr=0,0,180,25

I am not entirely sure I did these tests correctly. So, we should not really
trust these numbers at all for the moment.

Also, the 'nf' thing did not have a lazy ByteString instance, so for the
blaze stuff, I used L.unpack to turn the output back into a String -- which
is not really 'fair'. (And would also be bad if the tests actually contained
utf-8, and not just an ascii subset of it).

That said, my first attempts at using blaze to speed up HSP do not seem to
have worked :p

I think that 'speeding up' HSX is going to be somewhat dependent on what you
are trying to do with it. If you are just writing templates by hand, and the
data you are adding in is String data, then I think the current HSX stuff is
probably doing a descent job. Everything starts as String, and ends as a
String. Then if you want you can convert that String to a ByteString, etc.

The default instances for HSX would probably not perform as well if you had
a lot of data you wanted to splice in that was already pre-encoded utf-8
bytestrings. If that is your case, though, you could just implement an
alternative XML data type and matching monad, and use those with hsx
instead. Though, you still have to be careful. It is not enough to have just
utf-8 encoded bytestrings, they would also need to already have any special
html characters escaped (such as ). You can't just read utf-8 values out of
database and stick them straight into the html output.

Another option might be to implement a instance of XMLGen that does not have
an intermediate type -- it just goes directly to String, Text, ByteString,
or whatever you want. I am not sure how much overhead the intermediate type
is really causing though. One thing that slows the hsx html rendering down
is that it has to check each tag and see if it is one of the special tags
that has no close tag. (Such as meta, input, img, etc). Or if it is one of
the tags where the content is rendered as as CDATA instead of PCDATA, such
as script and style. And the only way to do that is to pattern match on the
tag name.

I have attached all three files I used to benchmark to this message.

Certainly making hsx/hsp faster would be nice (though it doesn't seem
especially slow to start with). And it would also be nice if you could use
use a mixture of hsx+blaze combinators.

- jeremy

ps. I also added, 

Re: [Haskell-cafe] design question/font metrics

2010-06-01 Thread Brandon S. Allbery KF8NH

On Jun 1, 2010, at 10:53 , Stephen Tetley wrote:

There probably isn't a library to help - I've looked at extracting
TrueType font metrics myself but abandoned it - TrueType fonts have a
very complicated file format, and the spec is inadequate to code an


The saner way to do this is to write a binding to freetype2.

--
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




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The state of Hackage: what are we doing about it?

2010-06-01 Thread Vo Minh Thu
2010/6/1 Brandon S. Allbery KF8NH allb...@ece.cmu.edu:
 On May 31, 2010, at 19:13 , Don Stewart wrote:

 I see fairly regular complaints about too many Haskell libraries,
 bewildering choice of difficult-to-determine quality.

 One thing that might help is just a less cluttered/better organized
 interface.  I always have to use browser find on the package list page.

The browser find can be quite effective when the descriptions are
good. It could also be less boring to use if each package was in a
single category.

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


[Haskell-cafe] www.haskell.org web server down?

2010-06-01 Thread Sean Leather
It responds to pings but not http.

http://downforeveryoneorjustme.com/www.haskell.org

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


Re: [Haskell-cafe] design question/font metrics

2010-06-01 Thread Stephen Tetley
Hi Brandon

Even that's not simple - freetype is essentially a framework for
writing font processors rather than a conventional C library[*]. Saner
perhaps is to write a C program using freetype to do the exact job you
have in mind, then bind to your C program.

Best wishes

Stephen

[*} Probably why several people Including me have attempted a binding,
but no-one has delivered one.

On 1 June 2010 17:18, Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote:

 The saner way to do this is to write a binding to freetype2.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The state of Hackage: what are we doing about it?

2010-06-01 Thread Bas van Dijk
On Tue, Jun 1, 2010 at 5:55 PM, Stephen Tetley stephen.tet...@gmail.com wrote:
 What's the procedure for marking one's own package(s) as deprecated on 
 Hackage?

Ask Ross Paterson to deprecate your package.

Once a package is deprecated it won't show up in the package list
anymore but will still be available from the package URL.

Regards,

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


Re: [Haskell-cafe] The state of Hackage: what are we doing about it?

2010-06-01 Thread Stephen Tetley
Thanks Bas

I've just emailed Ross, so that should be one zombie down when he
has the chance to update Hackage.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] PDF generation?

2010-06-01 Thread Robert Wills
Last year, I was playing around with using the Hieroglyph library for pdf
creation via it's Cairo backend (which I guess amounts to the same thing as
using gtk2hs' pdf output).

http://wrwills.webfactional.com/docs/pandocHieroglyph/

You should be able to use Diagrams as well as it also has a cairo backend.
http://hackage.haskell.org/package/diagrams

-Rob

On Tue, Jun 1, 2010 at 5:15 PM, Pierre-Etienne Meunier 
pierreetienne.meun...@gmail.com wrote:

  On Tue, 1 Jun 2010, Jim Tittsler wrote:
 
  What is the easiest way to create PDF files from Haskell?  Is gtk2hs's
  PDF output the preferred way?

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


[Haskell-cafe] Installing Curl on Windows 7 - permissions problem

2010-06-01 Thread Ralph Hodgson
Don,

 

More angst with Windows 7 permissions.  I hope this is a simple thing for
you or someone else to help me with.

 

I have successfully installed other packages into my private cabal area.   

 

When it came to the Haskell curl package, I got permission errors.

 

Just to prove that things go to the right places, here is a successful run
with the Parseargs Package.

 

C:\Users\Ralphcabal install parseargs

Resolving dependencies...

Downloading parseargs-0.1.3...

Configuring parseargs-0.1.3...

Preprocessing library parseargs-0.1.3...

Preprocessing executables for parseargs-0.1.3...

Building parseargs-0.1.3...

[1 of 1] Compiling System.Console.ParseArgs ( System\Console\ParseArgs.hs,
dist\

build\System\Console\ParseArgs.o )

Registering parseargs-0.1.3...

[1 of 2] Compiling System.Console.ParseArgs ( System\Console\ParseArgs.hs,
dist\

build\parseargs-example\parseargs-example-tmp\System\Console\ParseArgs.o )

[2 of 2] Compiling Main ( parseargs-example.hs,
dist\build\parseargs

-example\parseargs-example-tmp\Main.o )

Linking dist\build\parseargs-example\parseargs-example.exe ...

Installing library in

C:\Users\Ralph\AppData\Roaming\cabal\parseargs-0.1.3\ghc-6.10.4

Installing executable(s) in C:\Users\Ralph\AppData\Roaming\cabal\bin

Registering parseargs-0.1.3...

 

Parseargs installed fine and the package list shows it in my cabal
directory.

 

C:\Users\Ralphghc-pkg list

C:/Program Files (x86)/Haskell Platform/2009.2.0.2\package.conf:

Cabal-1.6.0.3, GLUT-2.1.1.2, HTTP-4000.0.6, HUnit-1.2.0.3,

OpenGL-2.2.1.1, QuickCheck-1.2.0.0, Win32-2.2.0.0, array-0.2.0.0,

base-3.0.3.1, base-4.1.0.0, bytestring-0.9.1.4, cgi-3001.1.7.1,

containers-0.2.0.1, directory-1.0.0.3, (dph-base-0.3),

(dph-par-0.3), (dph-prim-interface-0.3), (dph-prim-par-0.3),

(dph-prim-seq-0.3), (dph-seq-0.3), extensible-exceptions-0.1.1.0,

fgl-5.4.2.2, filepath-1.1.0.2, (ghc-6.10.4), ghc-prim-0.1.0.0,

haddock-2.4.2, haskell-src-1.0.1.3, haskell98-1.0.1.0, hpc-0.5.0.3,

html-1.0.1.2, integer-0.1.0.1, mtl-1.1.0.2, network-2.2.1.4,

old-locale-1.0.0.1, old-time-1.0.0.2, packedstring-0.1.0.1,

parallel-1.1.0.1, parsec-2.1.0.1, pretty-1.0.1.0, process-1.0.1.1,

random-1.0.0.1, regex-base-0.72.0.2, regex-compat-0.71.0.1,

regex-posix-0.72.0.3, rts-1.0, stm-2.1.1.2, syb-0.1.0.1,

template-haskell-2.3.0.1, time-1.1.2.4, xhtml-3000.2.0.1,

zlib-0.5.0.0

C:\Users\Ralph\AppData\Roaming\ghc\i386-mingw32-6.10.4\package.conf:

Cabal-1.8.0.4, ListZipper-1.1.1.0, QuickCheck-2.1.0.3,

bytestring-0.9.1.6, deepseq-1.1.0.0, parseargs-0.1.3, tagsoup-0.9

 

C:\Users\Ralph

 

Now for curl. 

 

I installed Mingw32 (following the advice at
http://old.nabble.com/cURL-under-Windows-again-td21789068.html#a21789068)

 

This is what happened when I went to my windows shell:

 

C:\Users\Ralph\AppData\Roaming\cabal\curl-1.3.5runhaskell setup build

Preprocessing library curl-1.3.5...

Building curl-1.3.5...

Registering curl-1.3.5...

 

C:\Users\Ralph\AppData\Roaming\cabal\curl-1.3.5runhaskell setup install

setup: permission denied

 

I am wondering if the curl package is trying to put things in system
folders?

 

Help much appreciated - tight deadlines

 

Ralph

 

 

-Original Message-
From: haskell-cafe-boun...@haskell.org
[mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Don Stewart
Sent: Wednesday, May 19, 2010 1:37 PM
To: Henning Thielemann
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] TagSoup 0.9

 

schlepptop:

 Don Stewart schrieb:

  Or use things from the download-curl package, which provides a nice

  openURL function.

 

 The openURL function from TagSoup is lazy, which the proposed

 replacement 'getResponseBody = simpleHTTP (getRequest x)' is not. Is

 the openURL function from download-curl lazy?

 

 

Yes, see:

 

Network.Curl.Download.Lazy.openLazyURI

 

though I think it is possible that I strictified the code. Have a play

around with it if it doesn't meet your needs -- should be /trivial/ to

ensure it is chunk-wise lazy.

___

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] Installing Curl on Windows 7 - permissions problem

2010-06-01 Thread Stephen Tetley
On 31 May 2010 22:50, Ralph Hodgson rhodg...@topquadrant.com wrote:


 This is what happened when I went to my windows shell:



 C:\Users\Ralph\AppData\Roaming\cabal\curl-1.3.5runhaskell setup build

 Preprocessing library curl-1.3.5...

 Building curl-1.3.5...

 Registering curl-1.3.5...



 C:\Users\Ralph\AppData\Roaming\cabal\curl-1.3.5runhaskell setup install

 setup: permission denied




Don't you want to be installing the curl binding through MinGW's shell
rather than going back to the Windows shell?

Best wishes

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


Re: [Haskell-cafe] Installing Curl on Windows 7 - permissions problem

2010-06-01 Thread Stephen Tetley

 Don't you want to be installing the curl binding through MinGW's shell
 rather than going back to the Windows shell?

By that I mean the Bash shell provided by MSys, which you should have
installed along with MinGW...
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Why Either = Left | Right instead of something like Result = Success | Failure

2010-06-01 Thread Aaron Denney
On 2010-05-27, aditya siram aditya.si...@gmail.com wrote:
 Monstro
 I'm going to call it that from now on. Stay out of the IO Monstro.

Monstro is Show (think demonstrate), not Monad.

-- 
Aaron Denney
--

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


[Haskell-cafe] Difference between div and /

2010-06-01 Thread Maciej Piechotka
I started to wonder what is the difference between div and / so they are
2 separate symbols.

div:
  Take a Integral divide and round (down)

(/):
  Take a Fractional divide and usually round

In some applications I would like to use any of those but it is not
possible. Is this unification taken into account while reworking numeric
classes?

I.e. why not:

class Num a = Divisable a where
(/) :: a - a - a

class (Real a, Enum a, Divisable a) = Integral a where
quot :: a - a - a
rem :: a - a - a
div = (/)
mod :: a - a - a
x `quotRem` y = (x `quot` y, x `rem y)
x `divMod` y = (x `div` y, x `mod` y)
toInteger :: a - Integer

class Divisable a = Fractional a where
recip = (1/) :: a - a
fromRational :: Rational - a

(Example does not take into account other refactoring)

Regards

PS. Why is Fd/cPid etc. Integral or even Num?
What does (stdin + stderr) `mod` stdout mean (result will be stdin).


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Problems with Haskell Platform

2010-06-01 Thread Pete Chown

Dominic Steintiz wrote:


I seem to be in some sort package dependency hell (which I thought the
Haskell Platform did away with).

I install ghc using my package manager (I'm on opensuse).


I was just thinking, interactions between Cabal and the distribution 
package manager could get worse, as shared Haskell libraries become more 
common.  Suppose a distribution ships a package 'foo', but not a package 
'bar' which depends on it.  The 'foo' package includes shared libraries. 
 The user now installs 'bar' using Cabal.  This causes Cabal to install 
'foo' (because it is a dependency) and it won't use the distribution's 
package manager.


If 'foo' is built as a shared library, programs built by the user will 
not work for anyone else.  Other users will have the distribution's 
build of 'foo' rather than Cabal's build.  If 'foo' is built statically, 
it's not quite so bad, but the user will not get the benefits that could 
come from using shared libraries.


Pete

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


Re: [Haskell-cafe] Installing Curl on Windows 7 - permissions problem

2010-06-01 Thread Daniel Fischer
On Monday 31 May 2010 23:50:58, Ralph Hodgson wrote:
 Don,



 More angst with Windows 7 permissions.  I hope this is a simple thing
 for you or someone else to help me with.



 I have successfully installed other packages into my private cabal area.



 When it came to the Haskell curl package, I got permission errors.



 Just to prove that things go to the right places, here is a successful
 run with the Parseargs Package.



 C:\Users\Ralphcabal install parseargs

snip

 Now for curl.

 This is what happened when I went to my windows shell:

 C:\Users\Ralph\AppData\Roaming\cabal\curl-1.3.5runhaskell setup build

 Preprocessing library curl-1.3.5...

 Building curl-1.3.5...

 Registering curl-1.3.5...



 C:\Users\Ralph\AppData\Roaming\cabal\curl-1.3.5runhaskell setup install

 setup: permission denied



 I am wondering if the curl package is trying to put things in system
 folders?

It's not the library, it's

runhaskell ./Setup.hs ...

versus

cabal install

The previous defaults to global installs, the latter to user installs.

So you can either

- run cabal install in the package directory (if you don't give a package 
name to install, it installs [tries to install] the package from the 
current directory)

- pass the --user flag to runhaskell ./Setup.hs,

runhaskell ./Setup.hs configure --user --prefix=C:\Users\Ralph\...

Getting into the habit of always using cabal install prevents such 
predicaments.


 Help much appreciated - tight deadlines

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


Re: [Haskell-cafe] Parselib sample

2010-06-01 Thread C K Kashyap
Thanks Stephan,

In Haskell, what would be the right thing to parse C like languages.
Parsec literature seems to indicate that they can pretty much parse
anything.

The reason I had asked for a sample in Parselib was for me to understand the
monadic parser in action. The last time I tried looking at Parsec from RWH,
I could not follow it too well.

Regards,
Kashyap

On Tue, Jun 1, 2010 at 7:59 PM, Stephen Tetley stephen.tet...@gmail.comwrote:

 Hello

 For non-trivial parsing Parsec or UU-Parse are much better candidates.

 If you have Parsec installed from Hackage, I'd still recommend you get
 the manual and source distribution from:

 http://legacy.cs.uu.nl/daan/parsec.html

 The source distribution has some examples - Tiger, Mondrian, Henk -
 full, if small languages.
 C is quite a large language and its grammar is usually presented for
 LR parsing so you are unlikely to find a parser for C or even a subset
 of C with a combinator library, as parser combinators are LL. To
 convert LR to LL needs a lot of left factoring and wouldn't be fun,
 though I believe there is a C parser for the ANTLR system which is
 LL(k).

 Best wishes

 Stephen
 ___
 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


Re: [Haskell-cafe] PDF generation?

2010-06-01 Thread Yitzchak Gale
Jim Tittsler wrote:
 What is the easiest way to create PDF files from Haskell?

Pierre-Etienne Meunier wrote:
 Read the PDF manual from adobe, it is not that hard.
 Fonts are a little harder, but not too much.

I have often generated PostScript from Haskell, which is
much easier. PostScript is a nice little concatenative
programming language. The basics are easy to learn,
and you can copy things like the page setup and fonts
from the output of OpenOffice.Org, which is quite
readable.

Then you convert the PS to PDF using any of the nice
utilities around for that, like the ones that come with
xpdf, poppler, ghostscript, etc.

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


RE: [Haskell-cafe] Installing Curl on Windows 7 - no longer a permissions problem - due to dependency conflicts

2010-06-01 Thread Ralph Hodgson
Permissions issue was straight-forward to resolve.

 

Yesterday I tracked this down to a conflict with versions of bytestring.

 

ghc.6.10.4 needs bytestring-0.9.1.4 

 

 

ghc-pkg: unregistering bytestring-0.9.1.4 would break the following
packages: ha

ddock-2.4.2 ghc-6.10.4 Win32-2.2.0.0 regex-base-0.72.0.2
regex-posix-0.72.0.3 re

gex-compat-0.71.0.1 zlib-0.5.0.0 HTTP-4000.0.6 cgi-3001.1.7.1 curl-1.3.5
QuickCh

eck-2.1.0.3 tagsoup-0.9 feed-0.3.7 tagsoup-0.10 utf8-string-0.3.6 xml-1.3.7
(use

 --force to override)

 

other libraries need bytestring-09.1.6

 

ghc-pkg: unregistering bytestring-0.9.1.6 would break the following
packages: Wi

n32-2.2.0.0 Win32-2.2.0.2 HTTP-4000.0.9 (use --force to override)

 

Yesterday I could not  access haskell.org  to see if I can install a newer
version of GHC - network or server is done.

 

Today I am upgrading everything to ghc-6.12.2

 

There must be a tool somewhere that can assess potential conflicts :

 

A needs B (2)

A needs C (1) but 

C needs B (2)

 

I will look once I get passed these install issues

 

From: haskell-cafe-boun...@haskell.org
[mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Ralph Hodgson
Sent: Monday, May 31, 2010 2:51 PM
To: 'Don Stewart'
Cc: 'Henning Thielemann'; haskell-cafe@haskell.org
Subject: [Haskell-cafe] Installing Curl on Windows 7 - permissions problem

 

Don,

 

More angst with Windows 7 permissions.  I hope this is a simple thing for
you or someone else to help me with.

 

I have successfully installed other packages into my private cabal area.   

 

When it came to the Haskell curl package, I got permission errors.

 

Just to prove that things go to the right places, here is a successful run
with the Parseargs Package.

 

C:\Users\Ralphcabal install parseargs

Resolving dependencies...

Downloading parseargs-0.1.3...

Configuring parseargs-0.1.3...

Preprocessing library parseargs-0.1.3...

Preprocessing executables for parseargs-0.1.3...

Building parseargs-0.1.3...

[1 of 1] Compiling System.Console.ParseArgs ( System\Console\ParseArgs.hs,
dist\

build\System\Console\ParseArgs.o )

Registering parseargs-0.1.3...

[1 of 2] Compiling System.Console.ParseArgs ( System\Console\ParseArgs.hs,
dist\

build\parseargs-example\parseargs-example-tmp\System\Console\ParseArgs.o )

[2 of 2] Compiling Main ( parseargs-example.hs,
dist\build\parseargs

-example\parseargs-example-tmp\Main.o )

Linking dist\build\parseargs-example\parseargs-example.exe ...

Installing library in

C:\Users\Ralph\AppData\Roaming\cabal\parseargs-0.1.3\ghc-6.10.4

Installing executable(s) in C:\Users\Ralph\AppData\Roaming\cabal\bin

Registering parseargs-0.1.3...

 

Parseargs installed fine and the package list shows it in my cabal
directory.

 

C:\Users\Ralphghc-pkg list

C:/Program Files (x86)/Haskell Platform/2009.2.0.2\package.conf:

Cabal-1.6.0.3, GLUT-2.1.1.2, HTTP-4000.0.6, HUnit-1.2.0.3,

OpenGL-2.2.1.1, QuickCheck-1.2.0.0, Win32-2.2.0.0, array-0.2.0.0,

base-3.0.3.1, base-4.1.0.0, bytestring-0.9.1.4, cgi-3001.1.7.1,

containers-0.2.0.1, directory-1.0.0.3, (dph-base-0.3),

(dph-par-0.3), (dph-prim-interface-0.3), (dph-prim-par-0.3),

(dph-prim-seq-0.3), (dph-seq-0.3), extensible-exceptions-0.1.1.0,

fgl-5.4.2.2, filepath-1.1.0.2, (ghc-6.10.4), ghc-prim-0.1.0.0,

haddock-2.4.2, haskell-src-1.0.1.3, haskell98-1.0.1.0, hpc-0.5.0.3,

html-1.0.1.2, integer-0.1.0.1, mtl-1.1.0.2, network-2.2.1.4,

old-locale-1.0.0.1, old-time-1.0.0.2, packedstring-0.1.0.1,

parallel-1.1.0.1, parsec-2.1.0.1, pretty-1.0.1.0, process-1.0.1.1,

random-1.0.0.1, regex-base-0.72.0.2, regex-compat-0.71.0.1,

regex-posix-0.72.0.3, rts-1.0, stm-2.1.1.2, syb-0.1.0.1,

template-haskell-2.3.0.1, time-1.1.2.4, xhtml-3000.2.0.1,

zlib-0.5.0.0

C:\Users\Ralph\AppData\Roaming\ghc\i386-mingw32-6.10.4\package.conf:

Cabal-1.8.0.4, ListZipper-1.1.1.0, QuickCheck-2.1.0.3,

bytestring-0.9.1.6, deepseq-1.1.0.0, parseargs-0.1.3, tagsoup-0.9

 

C:\Users\Ralph

 

Now for curl. 

 

I installed Mingw32 (following the advice at
http://old.nabble.com/cURL-under-Windows-again-td21789068.html#a21789068)

 

This is what happened when I went to my windows shell:

 

C:\Users\Ralph\AppData\Roaming\cabal\curl-1.3.5runhaskell setup build

Preprocessing library curl-1.3.5...

Building curl-1.3.5...

Registering curl-1.3.5...

 

C:\Users\Ralph\AppData\Roaming\cabal\curl-1.3.5runhaskell setup install

setup: permission denied

 

I am wondering if the curl package is trying to put things in system
folders?

 

Help much appreciated - tight deadlines

 

Ralph

 

 

-Original Message-
From: haskell-cafe-boun...@haskell.org
[mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Don Stewart
Sent: Wednesday, May 19, 2010 1:37 PM
To: Henning Thielemann
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] TagSoup 0.9

 

schlepptop:

 Don Stewart schrieb:

  Or use things from the download-curl package, 

Re: [Haskell-cafe] PDF generation?

2010-06-01 Thread Pierre-Etienne Meunier
Isn't there a problem with non-type 1 vectorial fonts being rasterized during 
this conversion ?


El 01/06/2010, a las 14:07, Yitzchak Gale escribió:

 Jim Tittsler wrote:
 What is the easiest way to create PDF files from Haskell?
 
 Pierre-Etienne Meunier wrote:
 Read the PDF manual from adobe, it is not that hard.
 Fonts are a little harder, but not too much.
 
 I have often generated PostScript from Haskell, which is
 much easier. PostScript is a nice little concatenative
 programming language. The basics are easy to learn,
 and you can copy things like the page setup and fonts
 from the output of OpenOffice.Org, which is quite
 readable.
 
 Then you convert the PS to PDF using any of the nice
 utilities around for that, like the ones that come with
 xpdf, poppler, ghostscript, etc.
 
 Regards,
 Yitz

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


[Haskell-cafe] Re: Language Shootout reverse-complement benchmark

2010-06-01 Thread Isaac Gouy
On Tue, Jun 1, 2010 at 10:25 AM, David Leimbach leimy2k at gmail.com wrote:
 I'm still trying to figure out what the point of the shootout really is. 

From one point of view - http://shootout.alioth.debian.org/help.php#why


 If there's no dedicated folks working with a language there, trying to
 make things run faster, a language will come out looking inefficient
 potentially.

If there isn't even one effective programmer willing to contribute tiny 
programs ...


 There's a lot of compile flags and optimizations that can make a
 difference in probably all of the languages listed on that page.

The compile flags and optimizations used are shown below the program source 
code.



  

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


Re: [Haskell-cafe] Difference between div and /

2010-06-01 Thread Jonas Almström Duregård
One might expect a == (a/b)*b and other common arithmetic formulas to
hold for division?

/Jonas

On 31 May 2010 14:32, Maciej Piechotka uzytkown...@gmail.com wrote:
 I started to wonder what is the difference between div and / so they are
 2 separate symbols.

 div:
  Take a Integral divide and round (down)

 (/):
  Take a Fractional divide and usually round

 In some applications I would like to use any of those but it is not
 possible. Is this unification taken into account while reworking numeric
 classes?

 I.e. why not:

 class Num a = Divisable a where
    (/) :: a - a - a

 class (Real a, Enum a, Divisable a) = Integral a where
    quot :: a - a - a
    rem :: a - a - a
    div = (/)
    mod :: a - a - a
    x `quotRem` y = (x `quot` y, x `rem y)
    x `divMod` y = (x `div` y, x `mod` y)
    toInteger :: a - Integer

 class Divisable a = Fractional a where
    recip = (1/) :: a - a
    fromRational :: Rational - a

 (Example does not take into account other refactoring)

 Regards

 PS. Why is Fd/cPid etc. Integral or even Num?
 What does (stdin + stderr) `mod` stdout mean (result will be stdin).

 ___
 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] Resource module

2010-06-01 Thread Arie Peterson
Dear list,


For some time, I have maintained a small private module centred around the
following type of resource:

 newtype Resource cap m = Resource { with :: forall a. (cap - m a) - m
a }

Interpretation: @Resource cap m@ is a resource, providing a capability
of type @cap@, which does administration (like opening and closing handles)
in the monad @m...@.

I would like to use a standard module instead of this howe-grown one, so I
can publish things that depend on it. Does anyone know a package that
provides this?


Things I tried:

- The type is suspiciously similar to the continuation monad transformer;
in fact @Resource cap m@ is isomorphic to @forall t. ContT t m c...@.
However, I can't use this latter type directly, because I would like
functions on Resources like the instance

 instance (Monoid cap) = Monoid (Resource cap m)

, which is not possible without a newtype wrapper.

- I tried using the regions package, since it has a very similar
purpose, but this seems impossible: some resources I could not express in
the form required for its class 'Resource' (methods 'open' and 'close').


If something like this is not yet around, I'll upload my version, but I'd
like to reuse, if possible.


Regards,

Arie

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


Re: [Haskell-cafe] Parselib sample

2010-06-01 Thread Stephen Tetley
Hi Kashyap

There's a C parser for Happy (LR) - I long while ago I converted this
to Frown (also LR) - both Happy and Frown are parser generators that
take a grammar description and generate a Haskell module that
implements the Parser. Personally I prefer Frown, I find the input
syntax a bit nicer than Happy but unfortunately Frown has disappeared
since its author Ralf Hinze moved to Oxford.

As I said, the C grammar is generally presented in LR form (e.g. in
the KR book, in Harbison  Steele and in the ISO spec). Other C like
languages e.g. the GLSL shading language tend to be in LR form as well
- I've an untested Happy parser for GLSL in my source repository.
Using an LR grammar with Parsec or ParseLib would be fatal - your
program would go into an infinite loop on all but the most trivial
input. You would have to rewrite the grammar into LL form - Parsec
(and ParseLib) have some helpers to do this, and quite often you can
write a Parsec grammar quite close to the LR one by using the - many,
many1 - combinators for repetition, plus sometimes the - chain -
combinators. Unfortunately its still quite a bit of effort to convert
to LL - it took me about a days work to write a Parsec parser for
GHC-core from the LR Happy grammar and GHC-core is much simpler than
GLSL or C. Also the Parsec parser was much slower.


Parsec is very powerful - it can handle large lookahead - other LL
parsers tend to be LL(1) where 1 is one token lookahead. But while
Parsec has the power, lookahead is costly and large lookahead will
make the parser slow and use a lot of memory. Parsec can handle
context-sensitive parsing - this is often very useful when writing
parsers where you are writing a parser for an ad-hoc file format
rather than a grammar. You can often do some tricks with
context-sensitive parsing that would take a lot of extra work to do
with context-free parsing. Finally, its commonly used as a
scanner-less parser - where you can use all the features to parse at
the character level rather than delegate to a separate scanner.

I've thought about writing an article for The Monad Reader - moving
from Graham Hutton's parsers to Parsec, if there's any interest I'll
look into doing it. For the time being the main difference is probably
that Parsec parsers generally use the TokenParser module for some of
the combinators that Parselib provides directly. Using the TokenParser
module requires a couple of tricks - import it qualified and re-define
unqualified versions of the parsers you need - int, symbol, identifier
- etc.


Best wishes

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


Re: [Haskell-cafe] PDF generation?

2010-06-01 Thread Yitzchak Gale
I wrote:
 I have often generated PostScript from Haskell...
 Then you convert the PS to PDF using any of the nice
 utilities around for that

Pierre-Etienne Meunier wrote:
 Isn't there a problem with non-type 1 vectorial fonts being
 rasterized during this conversion ?

No.

PDF is just a simplified, compressed encoding of PostScript.
Unless there is some special reason to do so, why would
a conversion utility go to the trouble of rasterizing fonts
instead of just copying them in?

Perhaps something like ImageMagick might do that; its
internal format is a raster.

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


[Haskell-cafe] Re: The state of Hackage: what are we doing about it?

2010-06-01 Thread Bas van Dijk
On Tue, Jun 1, 2010 at 7:09 PM, Matthias Kilian k...@outback.escape.de wrote:
 - Liveness of a library, that is: does it still get updates? Does it
  build with recent versions of GHC?

Note that Hackage already shows the upload date and for which versions
of GHC the package does and doesn't build.

 - Reverse dependencies -- how many other libraries and/or programs are
  using this library (Maybe something for Hackage-2.0)?

My brother Roel created a patch for this. See ticket #576:
http://hackage.haskell.org/trac/hackage/ticket/576
Also see our mirror Hackage that implements that patch:
http://bifunctor.homelinux.net/~roel/hackage/packages/hackage.html
The server automatically synchronizes with Hackage daily.

It would be great to have this in the regular Hackage however!

Regards,

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


Re: [Haskell-cafe] Difference between div and /

2010-06-01 Thread Daniel Fischer
On Tuesday 01 June 2010 20:26:55, Jonas Almström Duregård wrote:
 One might expect a == (a/b)*b and other common arithmetic formulas to
 hold for division?

 /Jonas

Better not if one's using Float or Double.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Resource module

2010-06-01 Thread Bas van Dijk
On Mon, May 31, 2010 at 12:08 PM, Arie Peterson ar...@xs4all.nl wrote:
 - I tried using the regions package, since it has a very similar
 purpose, but this seems impossible: some resources I could not express in
 the form required for its class 'Resource' (methods 'open' and 'close').

Hi Arie, I would love to see some examples of these resources for
which you can't define a Resource[1] instance.

Regards,

Bas

[1] 
http://hackage.haskell.org/packages/archive/regions/0.5/doc/html/Control-Resource.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Difference between div and /

2010-06-01 Thread Aaron D. Ball
 What does (stdin + stderr) `mod` stdout mean (result will be stdin).

In my GHCi (6.12.1) with System.IO, this fails because Handle is not a
numeric type.  What implementation are you using?

The underlying object here is a Unix file descriptor, which is just a
number.  In that sense, stdin is 0, stdout is 1, and stderr is 2, so
this would be (0 + 2) (mod 1) = 0.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread Cory Knapp
Thanks! That was exactly the sort of response I was looking for.

This explains why you need to double up for your current definitions. To
 choose between two booleans (which will in turn allow you to choose between
 'a's), you need a CB (CB a). You can eliminate the asymmetric type, though,
 like so:

  cand :: CB a - CB a - CB a
   cand p q t f = p (q t f) f

 Right. When he was working on it, I thought of that, and seemed to have
completely forgotten when I reworked it.


 You can probably always do this, but it will become more tedious the more
 complex your functions get.

  type CB a = forall a . a - a - a

 Note: this is universal quantification, not existential.

 As I would assume. But I always see the forall keyword used when
discussing existential quantification. I don't know if I've ever seen an
exists keyword. Is there one? How would it be used?


 In the new type, the parameter 'a' is misleading. It has no connection to
 the
 'a's on the right of the equals sign. You might as well write:

  type CB = forall a. a - a - a

 Ah! That makes sense. Which raises a new question: Is this type too
general? Are there functiosn which are semantically non-boolean which fit
in that type, and would this still be the case with your other suggestion
(i.e. cand p q = p (q t f) f )?

I guess it wouldn't much matter, since Church encodings are for untyped
lambda calculus, but I'm just asking questions that come to mind here. :)


 And now, hopefully, a key difference can be seen: we no longer have the
 result
 type for case analysis as a parameter of the type. Rather, they must work
 'for
 all' result types, and we can choose which result type to use when we need
 to
 eliminate them (and you can choose multiple times when using the same
 boolean
 value in multiple places).

 One may think about explicit typing and type abstraction. Suppose we have
 your
 first type of boolean at a particular type T. We'll call said type CBT.
 Then
 you have:

  CBT = T - T - T

 and values look like:

  \(t :: T) (f :: T) - ...

 By contrast, values of the second CB type look like this:

  \(a :: *) (t :: a) (f :: a) - ...

 *snip*

cand (T :: *) (p :: CB T) (q :: CB T) = ...

 cand gets told what T is; it doesn't get to choose.


I'm guessing that * has something to do with kinds, right? This is probably
a silly question, but why couldn't we have (T :: *-*) ?

Hopefully I didn't make that too over-complicated, and you can glean
 something
 useful from it. It turned out a bit longer than I expected.

 It was very helpful, thanks!

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


Re: [Haskell-cafe] Difference between div and /

2010-06-01 Thread Alexander Solla


On Jun 1, 2010, at 12:20 PM, Aaron D. Ball wrote:


The underlying object here is a Unix file descriptor, which is just a
number.  In that sense, stdin is 0, stdout is 1, and stderr is 2, so
this would be (0 + 2) (mod 1) = 0


Every integer is 0 (mod 1).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Dependency issues with GHC 6.12.2 installing parsec and others

2010-06-01 Thread Ralph Hodgson
base-3.0.3.2-b2241f4c659fe250ebb821a4173f40c9 doesn't exist (use --force
to override)

 

Having installed GHC 6.12.2, I am hitting these problems with every package
I tried to install:

 

C:\Users\Ralphcabal install parsec

Resolving dependencies...

Configuring parsec-2.1.0.1...

Preprocessing library parsec-2.1.0.1...

Building parsec-2.1.0.1...

[ 1 of 10] Compiling Text.ParserCombinators.Parsec.Pos (
Text\ParserCombinators\

Parsec\Pos.hs, dist\build\Text\ParserCombinators\Parsec\Pos.o )

 

[snip]

 

[ 9 of 10] Compiling Text.ParserCombinators.Parsec.Perm (
Text\ParserCombinators

\Parsec\Perm.hs, dist\build\Text\ParserCombinators\Parsec\Perm.o )

 

Text\ParserCombinators\Parsec\Perm.hs:1:0:

Warning: Module `Prelude' is deprecated:

   You are using the old package `base' version 3.x.

   Future GHC versions will not support base version 3.x. You

   should update your code to use the new base version 4.x.

[10 of 10] Compiling Text.ParserCombinators.Parsec.Language (
Text\ParserCombina

tors\Parsec\Language.hs, dist\build\Text\ParserCombinators\Parsec\Language.o
)

 

Text\ParserCombinators\Parsec\Language.hs:1:0:

Warning: Module `Prelude' is deprecated:

   You are using the old package `base' version 3.x.

   Future GHC versions will not support base version 3.x. You

   should update your code to use the new base version 4.x.

Registering parsec-2.1.0.1...

Installing library in

C:\Users\Ralph\AppData\Roaming\cabal\parsec-2.1.0.1\ghc-6.12.2

Registering parsec-2.1.0.1...

cabal: parsec-2.1.0.1: dependency

base-3.0.3.2-b2241f4c659fe250ebb821a4173f40c9 doesn't exist (use --force
to

override)

cabal: Error: some packages failed to install:

parsec-2.1.0.1 failed during the final install step. The exception was:

exit: ExitFailure 1

 

I wonder what to do next?

 

 

From: Ralph Hodgson [mailto:rhodg...@topquadrant.com] 
Sent: Tuesday, June 01, 2010 11:19 AM
To: rhodg...@topquadrant.com; 'Don Stewart'
Cc: 'Henning Thielemann'; haskell-cafe@haskell.org
Subject: RE: [Haskell-cafe] Installing Curl on Windows 7 - no longer a
permissions problem - due to dependency conflicts

 

Permissions issue was straight-forward to resolve.

 

Yesterday I tracked this down to a conflict with versions of bytestring.

 

ghc.6.10.4 needs bytestring-0.9.1.4 

 

 

ghc-pkg: unregistering bytestring-0.9.1.4 would break the following
packages: ha

ddock-2.4.2 ghc-6.10.4 Win32-2.2.0.0 regex-base-0.72.0.2
regex-posix-0.72.0.3 re

gex-compat-0.71.0.1 zlib-0.5.0.0 HTTP-4000.0.6 cgi-3001.1.7.1 curl-1.3.5
QuickCh

eck-2.1.0.3 tagsoup-0.9 feed-0.3.7 tagsoup-0.10 utf8-string-0.3.6 xml-1.3.7
(use

 --force to override)

 

other libraries need bytestring-09.1.6

 

ghc-pkg: unregistering bytestring-0.9.1.6 would break the following
packages: Wi

n32-2.2.0.0 Win32-2.2.0.2 HTTP-4000.0.9 (use --force to override)

 

Yesterday I could not  access haskell.org  to see if I can install a newer
version of GHC - network or server is done.

 

Today I am upgrading everything to ghc-6.12.2

 

There must be a tool somewhere that can assess potential conflicts :

 

A needs B (2)

A needs C (1) but 

C needs B (2)

 

I will look once I get passed these install issues

 

From: haskell-cafe-boun...@haskell.org
[mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Ralph Hodgson
Sent: Monday, May 31, 2010 2:51 PM
To: 'Don Stewart'
Cc: 'Henning Thielemann'; haskell-cafe@haskell.org
Subject: [Haskell-cafe] Installing Curl on Windows 7 - permissions problem

 

Don,

 

More angst with Windows 7 permissions.  I hope this is a simple thing for
you or someone else to help me with.

 

I have successfully installed other packages into my private cabal area.   

 

When it came to the Haskell curl package, I got permission errors.

 

Just to prove that things go to the right places, here is a successful run
with the Parseargs Package.

 

C:\Users\Ralphcabal install parseargs

Resolving dependencies...

Downloading parseargs-0.1.3...

Configuring parseargs-0.1.3...

Preprocessing library parseargs-0.1.3...

Preprocessing executables for parseargs-0.1.3...

Building parseargs-0.1.3...

[1 of 1] Compiling System.Console.ParseArgs ( System\Console\ParseArgs.hs,
dist\

build\System\Console\ParseArgs.o )

Registering parseargs-0.1.3...

[1 of 2] Compiling System.Console.ParseArgs ( System\Console\ParseArgs.hs,
dist\

build\parseargs-example\parseargs-example-tmp\System\Console\ParseArgs.o )

[2 of 2] Compiling Main ( parseargs-example.hs,
dist\build\parseargs

-example\parseargs-example-tmp\Main.o )

Linking dist\build\parseargs-example\parseargs-example.exe ...

Installing library in

C:\Users\Ralph\AppData\Roaming\cabal\parseargs-0.1.3\ghc-6.10.4

Installing executable(s) in C:\Users\Ralph\AppData\Roaming\cabal\bin

Registering parseargs-0.1.3...

 

Parseargs installed fine and the package list shows it in my cabal
directory.

 


Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread Jason Dagit
On Tue, Jun 1, 2010 at 12:40 PM, Cory Knapp cory.m.kn...@gmail.com wrote:

 Thanks! That was exactly the sort of response I was looking for.

 This explains why you need to double up for your current definitions. To
 choose between two booleans (which will in turn allow you to choose
 between
 'a's), you need a CB (CB a). You can eliminate the asymmetric type,
 though,
 like so:

  cand :: CB a - CB a - CB a
   cand p q t f = p (q t f) f

 Right. When he was working on it, I thought of that, and seemed to have
 completely forgotten when I reworked it.


 You can probably always do this, but it will become more tedious the more
 complex your functions get.

  type CB a = forall a . a - a - a

 Note: this is universal quantification, not existential.

 As I would assume. But I always see the forall keyword used when
 discussing existential quantification. I don't know if I've ever seen an
 exists keyword. Is there one? How would it be used?


There is no exists keyword, in GHC at least.  See for example this page:
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/data-type-extensions.html

When the forall appears in certain places it behaves differently.  For
example:
  * In a function signature it is universal, but where it appears matters.
Putting it on the left side of function arrows increases the rank of the
type.  This leads to Rank N types.
  * In the case of data constructors it can behave as existential
quantification when it introduces a type variable on the right-hand side of
the equal sign in the data declaration.

At least, that's my understanding.

Also, haskell prime has a proposal for an exists keyword:
http://hackage.haskell.org/trac/haskell-prime/wiki/ExistentialQuantification

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


Re: [Haskell-cafe] Difference between div and /

2010-06-01 Thread Jonas Almström Duregård
 One might expect a == (a/b)*b and other common arithmetic formulas to
 hold for division?

 Better not if one's using Float or Double.

I figured someone would say that :)

What about this one:
round (a/b/c) == round (a/(b*c))

Of course this doesn't work on Integers...

/J

On 1 June 2010 21:08, Daniel Fischer daniel.is.fisc...@web.de wrote:
 On Tuesday 01 June 2010 20:26:55, Jonas Almström Duregård wrote:
 One might expect a == (a/b)*b and other common arithmetic formulas to
 hold for division?

 /Jonas

 Better not if one's using Float or Double.

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


Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread C. McCann
On Tue, Jun 1, 2010 at 3:40 PM, Cory Knapp cory.m.kn...@gmail.com wrote:
 In the new type, the parameter 'a' is misleading. It has no connection to
 the
 'a's on the right of the equals sign. You might as well write:

  type CB = forall a. a - a - a

 Ah! That makes sense. Which raises a new question: Is this type too
 general? Are there functiosn which are semantically non-boolean which fit
 in that type, and would this still be the case with your other suggestion
 (i.e. cand p q = p (q t f) f )?

Because the type is universally quantified, any function with that
signature can only manipulate the values it's given, having no way of
creating new values of that type, or inspecting them in any way. It
receives two values and returns one, so (ignoring _|_) only two
implementations are possible: (\x _ - x) and (\_ x - x), which are
the Church booleans. Intuitively, observe that the function must, and
may only, make a decision between two options--thus providing exactly
one bit of information, no more and no less.

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


Re: [Haskell-cafe] Dependency issues with GHC 6.12.2 installing parsec and others

2010-06-01 Thread Daniel Fischer
On Tuesday 01 June 2010 22:31:21, Ralph Hodgson wrote:
 base-3.0.3.2-b2241f4c659fe250ebb821a4173f40c9 doesn't exist (use
 --force to override)


You probably have a package.conf from the previous GHC still lying around.
If your new GHC is in the system space, it'll probably be enough to remove 
all package.conf files from the user space, if your new GHC lives in user 
space, remove all package.conf files from the user space *except the one 
ghc-6.12.2 created* (that's the one containing the package ghc-6.12.2).



 Having installed GHC 6.12.2, I am hitting these problems with every
 package I tried to install:



 C:\Users\Ralphcabal install parsec

 Resolving dependencies...

 Configuring parsec-2.1.0.1...

 Preprocessing library parsec-2.1.0.1...

 Building parsec-2.1.0.1...

 [ 1 of 10] Compiling Text.ParserCombinators.Parsec.Pos (
 Text\ParserCombinators\

 Parsec\Pos.hs, dist\build\Text\ParserCombinators\Parsec\Pos.o )



 [snip]



 [ 9 of 10] Compiling Text.ParserCombinators.Parsec.Perm (
 Text\ParserCombinators

 \Parsec\Perm.hs, dist\build\Text\ParserCombinators\Parsec\Perm.o )



 Text\ParserCombinators\Parsec\Perm.hs:1:0:

 Warning: Module `Prelude' is deprecated:

You are using the old package `base' version 3.x.

Future GHC versions will not support base version 3.x.
 You

should update your code to use the new base version 4.x.

 [10 of 10] Compiling Text.ParserCombinators.Parsec.Language (
 Text\ParserCombina

 tors\Parsec\Language.hs,
 dist\build\Text\ParserCombinators\Parsec\Language.o )



 Text\ParserCombinators\Parsec\Language.hs:1:0:

 Warning: Module `Prelude' is deprecated:

You are using the old package `base' version 3.x.

Future GHC versions will not support base version 3.x.
 You

should update your code to use the new base version 4.x.

 Registering parsec-2.1.0.1...

 Installing library in

 C:\Users\Ralph\AppData\Roaming\cabal\parsec-2.1.0.1\ghc-6.12.2

 Registering parsec-2.1.0.1...

 cabal: parsec-2.1.0.1: dependency

 base-3.0.3.2-b2241f4c659fe250ebb821a4173f40c9 doesn't exist (use
 --force to

 override)

 cabal: Error: some packages failed to install:

 parsec-2.1.0.1 failed during the final install step. The exception was:

 exit: ExitFailure 1



 I wonder what to do next?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Difference between div and /

2010-06-01 Thread Daniel Fischer
On Tuesday 01 June 2010 22:40:51, Jonas Almström Duregård wrote:
  One might expect a == (a/b)*b and other common arithmetic formulas to
  hold for division?
 
  Better not if one's using Float or Double.

 I figured someone would say that :)

*g*


 What about this one:
 round (a/b/c) == round (a/(b*c))

Don't know, we have
(a `quot` b) `quot` c == a `quot` (b*c)
for Integers (overflow may or may not break that for Int), so if (/) were 
truncating division for Integral types, we'd have that.

I like the distinction between (/) and div (and quot), but I have no 
problem using (/) for integer division in Python, C, Java or C#.


 Of course this doesn't work on Integers...

 /J

 On 1 June 2010 21:08, Daniel Fischer daniel.is.fisc...@web.de wrote:
  On Tuesday 01 June 2010 20:26:55, Jonas Almström Duregård wrote:
  One might expect a == (a/b)*b and other common arithmetic formulas to
  hold for division?
 
  /Jonas
 
  Better not if one's using Float or Double.

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


Re: [Haskell-cafe] Difference between div and /

2010-06-01 Thread Maciej Piechotka
On Tue, 2010-06-01 at 22:40 +0200, Jonas Almström Duregård wrote:
  One might expect a == (a/b)*b and other common arithmetic formulas to
  hold for division?
 
  Better not if one's using Float or Double.
 
 I figured someone would say that :)
 
 What about this one:
 round (a/b/c) == round (a/(b*c))
 
 Of course this doesn't work on Integers...
 

Hmm. C, Java  co.[1] seems to not have this problem. Also having common
division operator is well - useful.

I don't think it would create much confusion. At least no more than IEEE
standard.

[1] By co I mean Ruby, Python, Perl and others. There are no so many
languages that do recognize the difference.


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread Dan Doel
On Tuesday 01 June 2010 3:40:41 pm Cory Knapp wrote:
  Note: this is universal quantification, not existential.
  
 As I would assume. But I always see the forall keyword used when
 discussing existential quantification. I don't know if I've ever seen an
 exists keyword. Is there one? How would it be used?

There is no first-class exists in GHC. If there were, it would work about the 
same as forall, like:

  foo :: (exists a. P a) - T

or what have you. There's potentially a little more of interest with how you 
make and take apart things with existential types, but that's about it.

There are papers out there on type systems with this, and the UHC Haskell 
compiler has it, although it doesn't let you use it in conjunction with type 
classes, but I think SPJ is on record as saying it would add a lot of 
complexity to the current GHC type system, and I'm inclined to believe him.

So, instead, GHC allows you to do existential quantification around data 
constructors, and somewhat confusingly, it uses the forall keyword. The idea 
behind this is that the type of such a constructor would be:

  C :: (exists a. ...) - T

which is isomorphic to:

  C :: forall a. ... - T

So, if you're using GADT syntax, that's exactly what you write:

  data T where
C :: forall a. ... - T

but, if you're using normal-ish data syntax, instead of writing:

  data T = C (exists a. ...)

you write:

  data T = forall a. C (...)

which is supposed to suggest that C has the isomorphic type in question, but I 
think it just tends to confuse people who are new to this, especially since 
holding a universal inside a datatype looks like:

  data U = C (forall a. ...)

and removing the constructors to attempt to make it a type alias makes them 
look identical:

  type T = forall a. ...
  type U = forall a. ...

But the alias T here is not the same as the data type T above. To make them 
(roughly) the same, you'd need:

  type T = exists a. ...

But I digress.

 Ah! That makes sense. Which raises a new question: Is this type too
 general? Are there functiosn which are semantically non-boolean which fit
 in that type, and would this still be the case with your other suggestion
 (i.e. cand p q = p (q t f) f )?

(forall a. a - a - a) should type only booleans, with some caveats. The 
forall enforces parametricity, which means the only normal lambda terms you 
can write with that type are:

  \x y - x
  \x y - y

In Haskell, you can also write stuff like:

  \x - undefined
  \x y - x `seq` y

The first of which is arguably a boolean, if you consider _|_ to be one in 
Haskell (although the Church encoding contains several distinguishable 
bottoms, due to seq), but the second is weird. It's false, except it blows up 
if the true case is undefined. But if you ignore these weird corner cases (or 
have a language that doesn't allow them), then you get exactly the booleans.

 I guess it wouldn't much matter, since Church encodings are for untyped
 lambda calculus, but I'm just asking questions that come to mind here. :)

By contrast to the above, I said that 'CB a' is a boolean that can be used to 
choose between 'a' values. However, you can construct non-booleans for special 
cases of this type. For instance:

  add :: CB Int
  add x y = x + y

This is clearly not a boolean, but it inhabits CB Int. So, the only way you 
can be (reasonably) sure that v :: CB T is a boolean choice between Ts is if 
you got it by specializing something with the type (forall a. CB a), since 
that is exactly the type above that contains only boolean expressions (and the 
weird corner cases).

  cand (T :: *) (p :: CB T) (q :: CB T) = ...
 
  cand gets told what T is; it doesn't get to choose.
 
 I'm guessing that * has something to do with kinds, right? This is probably
 a silly question, but why couldn't we have (T :: *-*) ?

* is the kind of types. So, for instance:

  Int:: *
  [Int]  :: *
  Int - Int :: *

* - * is the kind of functions from types to types, and so on, so:

  Maybe  :: * - *
  Either :: * - * - *
  (-)   :: * - * - *

So, in particular, if T :: * - *, then T - T is ill-kinded, because each 
side of (-) expects a *, but you're trying to give it a * - *. Hence, CB T 
won't work if T :: * - *.

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


Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread Daniel Fischer
On Tuesday 01 June 2010 23:21:35, Dan Doel wrote:
  I think SPJ is on record as saying it would add a lot of
 complexity to the current GHC type system,

 and I'm inclined to believe him.

In matters concerning the GHC type system, that's a fairly natural stance, 
I think.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Difference between div and /

2010-06-01 Thread Maciej Piechotka
On Tue, 2010-06-01 at 15:20 -0400, Aaron D. Ball wrote:
 
  What does (stdin + stderr) `mod` stdout mean (result will be stdin).
 
 In my GHCi (6.12.1) with System.IO, this fails because Handle is not a
 numeric type.  What implementation are you using? 

Ups. I missed the Handle with Fd. Which does not change point
significantly. 

Regards


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Parselib sample

2010-06-01 Thread Sean Leather
 I've thought about writing an article for The Monad Reader - moving
 from Graham Hutton's parsers to Parsec, if there's any interest I'll
 look into doing it. For the time being the main difference is probably
 that Parsec parsers generally use the TokenParser module for some of
 the combinators that Parselib provides directly. Using the TokenParser
 module requires a couple of tricks - import it qualified and re-define
 unqualified versions of the parsers you need - int, symbol, identifier
 - etc.


I'd like a comparison of how to do similar things in Parsec and
uu-parsinglib and polyparse and whatever other parser combinator library you
want to throw in. I imagine a sort of cookbook, so that once you have become
comfortable with one, you can reference this cookbook to figure out the
similarities/differences with another.

Also, here's something to add to the thread: I wrote a wrapper module for
uu-parsinglib for the functional programming course at Utrecht. The goal was
threefold:
1. Support the nice functionality of uu-parsinglib (e.g. error handling,
efficiency) while simplifying the interface for beginner programmers,
2. Provide an interface very similar to Parselib which was covered in the
course, and
3. Add documentation which was sorely missing from uu-parsinglib.

The file (licensed to the public domain) is attached.

Regards,
Sean


UUParsingSimple.hs
Description: Binary data
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Difference between div and /

2010-06-01 Thread Evan Laforge
 [1] By co I mean Ruby, Python, Perl and others. There are no so many
 languages that do recognize the difference.

% python -Q new
Python 2.4.6 (#1, Aug  3 2009, 17:05:16)
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type help, copyright, credits or license for more information.
10 / 3
#- 3.3335
10 // 3
#- 3


The python guys decided that int/int - int was a mistake, but because
it's an incompatible change, the removal process has been long (hence
the -Q flag, or a from __future__ import).  In fact, I think they gave
up on making it the default before python 3.

I appreciate that haskell has differentiated from the beginning.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Difference between div and /

2010-06-01 Thread Maciej Piechotka
On Tue, 2010-06-01 at 15:29 -0700, Evan Laforge wrote:
  [1] By co I mean Ruby, Python, Perl and others. There are no so many
  languages that do recognize the difference.
 
 % python -Q new
 Python 2.4.6 (#1, Aug  3 2009, 17:05:16)
 [GCC 4.0.1 (Apple Inc. build 5490)] on darwin
 Type help, copyright, credits or license for more information.
 10 / 3
 #- 3.3335
 10 // 3
 #- 3
 
 
 The python guys decided that int/int - int was a mistake, but because
 it's an incompatible change, the removal process has been long (hence
 the -Q flag, or a from __future__ import).  In fact, I think they gave
 up on making it the default before python 3.
 
 I appreciate that haskell has differentiated from the beginning.

Well - i tried to write some package dealing with distributions etc. 

If you have something like that:

instance ... = Distribution (Linear a) a where
rand (Linear f s) g =
let (gf, gt) = genRange g
(v, g') = next g
in (g', f + (fromIntegral v * s) / fromIntegral (gt - gf))

(I haven't check it but IMHO it is right implementation)

Now I have following options:

 - Implement per Int/Int8/...
 - Implement IntegerLinear and FractionalLinear separatly

Neither of choices are IMHO not ideal.

Regards


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Resource module

2010-06-01 Thread Arie Peterson
On Tue, 1 Jun 2010 21:10:40 +0200, Bas van Dijk v.dijk@gmail.com
wrote:
| [...]
| Hi Arie, I would love to see some examples of these resources for
| which you can't define a Resource[1] instance.
| [...]
| 
| [1]
|
http://hackage.haskell.org/packages/archive/regions/0.5/doc/html/Control-Resource.html


I had this involved example of a function that takes a resource, and
returns a similar resource, which performs the relevant IO actions in a
separate thread, receiving its instructions over a concurrent channel.
However, in the course of explaining why it doesn't fit in the simple
open/Handle/close framework, I actually helped myself to see that it is
possible (and not difficult) :-).


A different scenario where the open/Handle/close framework may actually
not suffice is the following: 

 fallback :: Resource cap IO - Resource cap IO - Resource cap IO
 fallback (Resource primary) (Resource backup) = Resource l where
   l c = primary c `catch` (\ ProblemWithMainResource - backup c)

; the fact that @c@, the continuation (which describes how the
capability is used), is mentioned twice in the body of @l@ makes this a
weird case.


By the way, Bas, I'm not quite sure how to properly use your Resource
class. Should one create different datatypes for different resources, if
they have different handle types or open/close functions, even though they
provide the same capability? I would like to avoid this, if possible, to
make life easier for users of these resources (they just want a resource
providing a certain capability, and don't care about its internal state). I
suppose one can create a class of resources giving a certain capability
instead.


Kind regards,

Arie

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


Re: [Haskell-cafe] Re: Difference between div and /

2010-06-01 Thread Daniel Fischer
On Wednesday 02 June 2010 00:55:08, Maciej Piechotka wrote:
 On Tue, 2010-06-01 at 15:29 -0700, Evan Laforge wrote:
   [1] By co I mean Ruby, Python, Perl and others. There are no so many
   languages that do recognize the difference.
 
  % python -Q new
  Python 2.4.6 (#1, Aug  3 2009, 17:05:16)
  [GCC 4.0.1 (Apple Inc. build 5490)] on darwin
  Type help, copyright, credits or license for more information.
  10 / 3
  #- 3.3335
  10 // 3
  #- 3
 
 
  The python guys decided that int/int - int was a mistake, but because
  it's an incompatible change, the removal process has been long (hence
  the -Q flag, or a from __future__ import).  In fact, I think they gave
  up on making it the default before python 3.
 
  I appreciate that haskell has differentiated from the beginning.

 Well - i tried to write some package dealing with distributions etc.

 If you have something like that:

 instance ... = Distribution (Linear a) a where
 rand (Linear f s) g =
 let (gf, gt) = genRange g
 (v, g') = next g
 in (g', f + (fromIntegral v * s) / fromIntegral (gt - gf))

 (I haven't check it but IMHO it is right implementation)

 Now I have following options:

  - Implement per Int/Int8/...
  - Implement IntegerLinear and FractionalLinear separatly

- use realToFrac instead of fromIntegral
(using the logfloat package is probably not a bad idea then)


 Neither of choices are IMHO not ideal.

Methinks that is not what you wanted to say ;)


 Regards

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


RE: [Haskell-cafe] Dependency issues with GHC 6.12.2 installing parsec and others

2010-06-01 Thread Ralph Hodgson
Thanks Daniel, I will give it a try

I just did some work on the MAC to verify that everything worked there. And all 
is well with MAC GHC 6.12.1

-Original Message-
From: daniel.is.fisc...@web.de [mailto:daniel.is.fisc...@web.de] 
Sent: Tuesday, June 01, 2010 2:03 PM
To: haskell-cafe@haskell.org; rhodg...@topquadrant.com
Subject: Re: [Haskell-cafe] Dependency issues with GHC 6.12.2 installing parsec 
and others

On Tuesday 01 June 2010 22:31:21, Ralph Hodgson wrote:
 base-3.0.3.2-b2241f4c659fe250ebb821a4173f40c9 doesn't exist (use
 --force to override)


You probably have a package.conf from the previous GHC still lying around.
If your new GHC is in the system space, it'll probably be enough to remove 
all package.conf files from the user space, if your new GHC lives in user 
space, remove all package.conf files from the user space *except the one 
ghc-6.12.2 created* (that's the one containing the package ghc-6.12.2).



 Having installed GHC 6.12.2, I am hitting these problems with every
 package I tried to install:



 C:\Users\Ralphcabal install parsec

 Resolving dependencies...

 Configuring parsec-2.1.0.1...

 Preprocessing library parsec-2.1.0.1...

 Building parsec-2.1.0.1...

 [ 1 of 10] Compiling Text.ParserCombinators.Parsec.Pos (
 Text\ParserCombinators\

 Parsec\Pos.hs, dist\build\Text\ParserCombinators\Parsec\Pos.o )



 [snip]



 [ 9 of 10] Compiling Text.ParserCombinators.Parsec.Perm (
 Text\ParserCombinators

 \Parsec\Perm.hs, dist\build\Text\ParserCombinators\Parsec\Perm.o )



 Text\ParserCombinators\Parsec\Perm.hs:1:0:

 Warning: Module `Prelude' is deprecated:

You are using the old package `base' version 3.x.

Future GHC versions will not support base version 3.x.
 You

should update your code to use the new base version 4.x.

 [10 of 10] Compiling Text.ParserCombinators.Parsec.Language (
 Text\ParserCombina

 tors\Parsec\Language.hs,
 dist\build\Text\ParserCombinators\Parsec\Language.o )



 Text\ParserCombinators\Parsec\Language.hs:1:0:

 Warning: Module `Prelude' is deprecated:

You are using the old package `base' version 3.x.

Future GHC versions will not support base version 3.x.
 You

should update your code to use the new base version 4.x.

 Registering parsec-2.1.0.1...

 Installing library in

 C:\Users\Ralph\AppData\Roaming\cabal\parsec-2.1.0.1\ghc-6.12.2

 Registering parsec-2.1.0.1...

 cabal: parsec-2.1.0.1: dependency

 base-3.0.3.2-b2241f4c659fe250ebb821a4173f40c9 doesn't exist (use
 --force to

 override)

 cabal: Error: some packages failed to install:

 parsec-2.1.0.1 failed during the final install step. The exception was:

 exit: ExitFailure 1



 I wonder what to do next?

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


Re: [Haskell-cafe] Re: Difference between div and /

2010-06-01 Thread Maciej Piechotka
On Wed, 2010-06-02 at 01:13 +0200, Daniel Fischer wrote:
 On Wednesday 02 June 2010 00:55:08, Maciej Piechotka wrote:
  On Tue, 2010-06-01 at 15:29 -0700, Evan Laforge wrote:
[1] By co I mean Ruby, Python, Perl and others. There are no so many
languages that do recognize the difference.
  
   % python -Q new
   Python 2.4.6 (#1, Aug  3 2009, 17:05:16)
   [GCC 4.0.1 (Apple Inc. build 5490)] on darwin
   Type help, copyright, credits or license for more information.
   10 / 3
   #- 3.3335
   10 // 3
   #- 3
  
  
   The python guys decided that int/int - int was a mistake, but because
   it's an incompatible change, the removal process has been long (hence
   the -Q flag, or a from __future__ import).  In fact, I think they gave
   up on making it the default before python 3.
  
   I appreciate that haskell has differentiated from the beginning.
 
  Well - i tried to write some package dealing with distributions etc.
 
  If you have something like that:
 
  instance ... = Distribution (Linear a) a where
  rand (Linear f s) g =
  let (gf, gt) = genRange g
  (v, g') = next g
  in (g', f + (fromIntegral v * s) / fromIntegral (gt - gf))
 
  (I haven't check it but IMHO it is right implementation)
 
  Now I have following options:
 
   - Implement per Int/Int8/...
   - Implement IntegerLinear and FractionalLinear separatly
 
 - use realToFrac instead of fromIntegral
 (using the logfloat package is probably not a bad idea then)
 

I'm not quire sure how to use it. I would have to either use floor/...
which would make result Integral or left it as it is and having
(Fractional a, Real a) constraint.

 
  Neither of choices are IMHO not ideal.
 
 Methinks that is not what you wanted to say ;)
 

Ups. Sorry - it's rather late and I'm not native speaker (and my native
language do use double negation). Neither of the choices are ideal
IMHO.

 
  Regards
 

Regards


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe