[Haskell-cafe] Rewrite thunk action rule?

2008-12-21 Thread Peter Todd
I have a program with this data structure:

data Element = Element {
elementOrigin :: V,
elementSubs :: [Element]
} 

and this important bit of code that operates on it:

transform :: T - Element - Element
transform t e = Element {
elementOrigin = tmulv t (elementOrigin e),
elementSubs = map (transform t) (elementSubs e)
}
Where V is a vertex and T is a matrix transformation. The following is true:

transform a (transform b e) == transform (a * b) e


I have read about rewrite rules, such would efficiently rewrite the obvious
transformations. However, given that the program will be applying *many*
transformations to very deep and wide Element trees, and applying those
transformations at many levels, I don't see how the optimizer would be able to
handle all cases, for instance a thunk getting left over from perhaps
evaluation prior to some IO function.  

FWIW here's an example tree-builder I'm using to test with:

mkElems 0 _ = Element {
elementOrigin = V 0 0,
elementSubs = []
}
mkElems depth width = Element {
elementOrigin = V 0 0,
elementSubs = replicate width $ transform (rotation (pi / 
(fromIntegral width))) $ transform (translation $ V 1 1) $ mkElems (depth - 1) 
width
}

with depth = width = 5


If I could somehow arrange for the transform function to detect when it
is being applied to a unevaluated thunk, and then modify the thunk in
place, that would basically be the behavior I need. Any suggestions?

-- 
http://petertodd.org 'peter'[:-...@petertodd.org 


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


Re: [Haskell-cafe] Trouble with FFI on Windows2000...

2008-12-21 Thread kyra

Serge LE HUITOUZE wrote:

I do the following:
  

dlltool -d cproj1.def -l libcproj1.a
ghc --make testFFI_2.hs -optl-lcproj1 -optl-L.



This seems fine, since it produces a testFFI_2.exe.
However, executing it, I get a MSWindows error box with a message
that looks like (approximate translation): 
DLL (null) not found on specified path


At first, I didn't have the LIBRARY directive in the .def file,
so I thought that was the reason for the (null) appearing in the
message. But adding said directive didn't change anything...

  

dlltool -d cproj1.def -l libcproj1.a -D cproj1.dll
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Line noise

2008-12-21 Thread Jon Harrop
On Tuesday 23 September 2008 02:27:17 Brian Hurt wrote:
 On Sun, 21 Sep 2008, wren ng thornton wrote:
  Even with functionalists ---of the OCaml and SML ilk---
  this use of spaces can be confusing if noone explains that function
  application binds tighter than all operators.

 Bwuh?  Ocaml programmers certainly know that application binds tighter
 than operators.  And as:

   let f x y = ... in
   f a b

 is more efficient (in Ocaml) than:

   let f (x, y) = ... in
   f (a, b)

 (Ocaml doesn't optimize away the tuple allocation)...

That is incorrect. OCaml does optimize away that tuple: both forms compile to 
the same 2-argument function.

OCaml does not optimize away this tuple:

  let a, b = 1, 2

So, when efficiency is important, you write:

  let a = 1 and b = 2

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal Install Links to Source from Haddock Docs

2008-12-21 Thread Thomas Hartman
the answer: not cabal install, just cabal.

thart...@thartman-laptop:~/haskellInstalls/smallInstalls/pureMD5-0.2.3
thart...@thartman-laptop:~/haskellInstalls/smallInstalls/pureMD5-0.2.3cabal
--help | grep -i doc
 haddock  Generate Haddock HTML documentation.
thart...@thartman-laptop:~/haskellInstalls/smallInstalls/pureMD5-0.2.3cabal
haddock --help | grep -i link
   --hyperlink-source Hyperlink the documentation to the source code
thart...@thartman-laptop:~/haskellInstalls/smallInstalls/pureMD5-0.2.3cabal
haddock --hyperlink-source

2008/12/21 R Hayes rfha...@reillyhayes.com:

 Is there a way I can get Haddock Docs WITH links to source (local) from
 modules installed with cabal install xxx?

 Getting the docs themselves is pretty easy by changing either
 ~/.cabal/config or using --enable-documentation.

 Automatically generating the source (colourised or not) and integrated links
 eludes me.

 -r
 ___
 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] Rewrite thunk action rule?

2008-12-21 Thread Luke Palmer
2008/12/21 Peter Todd p...@petertodd.org

 If I could somehow arrange for the transform function to detect when it
 is being applied to a unevaluated thunk, and then modify the thunk in
 place, that would basically be the behavior I need. Any suggestions?


That is exactly what is already happening.  Perhaps you want what you think
is happening: if a value *is* evaluated, you want to apply the
transformation right then instead of making a thunk.

By the way, this is very operational thinking for Haskell.  Haskell tries
quite hard to abstract away operational thinking, so thinking on this level
will be difficult and more work than you should be doing to write a program.

May I ask why you want this behavior?  Have you just tested it and observed
that it is running too slowly and you are trying to speed it up?

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


Re: [Haskell-cafe] Re: Windows vs. Linux x64

2008-12-21 Thread Jon Harrop
On Friday 12 December 2008 13:57:44 Simon Marlow wrote:
   - it means recompiling *everything*.  It's a complete new way, so you
 have to make the decision to do this once and for all, or build all
 your libraries + RTS twice.  In JITed languages they can make the
 choice at runtime, which makes it much easier.

Is anyone developing a JIT Haskell compiler? The approach has many important 
practical benefits and tools like LLVM are a joy to use...

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: [Haskell] ANN: Hoogle with more libraries

2008-12-21 Thread Neil Mitchell
Hi Bob,

 1. Searching using a package name that isn't all lower case results in
 nothing (e.g. (a - b) - f a - f b +InfixApplicative gives no results,
 while (a - b) - f a - f b +infixapplicative gives 2).

Yes, if you do +InfixApplicative it assumes you mean only in the
module InfixApplicative, not the package. Module is upper case,
package starts with lowercase.

 2. Searching with the +package syntax seems to remove all other possible
 results.  Perhaps it would be nice to show results from the default library
 set below.

Add +default to search the default too.

 If you get the package name wrong (i.e. specify a package that hoogle can't
 see), it would be nice for it to report something like google does -- maybe
 you meant xyz.

Definately! The whole area needs an overhall.

Thanks

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


Re: [Haskell-cafe] Yampa vs. Reactive

2008-12-21 Thread Henrik Nilsson

Hi Tom,

 In reactive, one doesn't.  All behaviors and events have the same
 absolute 0 value for time.

Right. I believe the possibility of starting behaviors later
is quite important.

And from what Conal wrote in a related mail, I take it that this
is recognized, and that this capability is something that is
being considered for reactive?

Best,

/Henrik

--
Henrik Nilsson
School of Computer Science
The University of Nottingham
n...@cs.nott.ac.uk

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

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


Re: [Haskell-cafe] Logos of Other Languages

2008-12-21 Thread Paul Johnson

Paulo Tanimoto wrote:

Another idea: something in the form of an Ouroboros.  Is that already
taken for a programming language?

http://en.wikipedia.org/wiki/Ouroboros
  

Something like this?

http://www.haskell.org/sitewiki/images/f/fd/Ouroborous-oval.png

Paul

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


[Haskell-cafe] Comparing on multiple criteria

2008-12-21 Thread Martijn van Steenbergen

Hello all,

Data.Ord has a handy function called comparing, and its documentation 
shows an example of its use.


But what if you want to sort a list of values based on multiple 
criteria? It turns out there is a neat way to do this:


compareTuple = mconcat [comparing fst, comparing snd]

The default Monoid instances for Ordering and functions work exactly as 
required here. (Thanks to vixey in #haskell for the hint to look at 
monoids!)


To reverse the order of a criterion or a set of criteria, flip can be used:

compareTuple' = mconcat [comparing fst, flip $ comparing snd]

I think it would be really neat if these two use cases were also 
described in comparing's documentation. Who is the right person to ask 
this of?


Thanks in advance,

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


RE: [Haskell-cafe] forkIO on multicore

2008-12-21 Thread Paul Keir
 So this benchmark is primarily a stress test of the parallel garbage
 collector since it is GC that is taking 75-80% of the time. Note that
 the mutator elapsed time goes down slightly with 2 cores compared to 1
 however the GC elapsed time goes up slightly.

Thanks Duncan, Jake et al. I'm more familiar with MPI and OpenMP for
parallelism; it seems I've got a lot more thinking to do when it comes
to Haskell. I'll look at some more tutorials, and then most likely
Data Parallel Haskell.

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


Re: [Haskell-cafe] Comparing on multiple criteria

2008-12-21 Thread Jan-Willem Maessen

On Dec 21, 2008, at 8:52 AM, Martijn van Steenbergen wrote:


Hello all,

Data.Ord has a handy function called comparing, and its  
documentation shows an example of its use.


But what if you want to sort a list of values based on multiple  
criteria? It turns out there is a neat way to do this:


compareTuple = mconcat [comparing fst, comparing snd]

The default Monoid instances for Ordering and functions work exactly  
as required here. (Thanks to vixey in #haskell for the hint to look  
at monoids!)


Indeed, this is great to know.  I can't help but notice that there is  
no documentation of any kind at all for the Monoid instance of  
Ordering; how were we supposed to know this behavior existed in the  
first place, except by hunting down the source code for the instance  
declaration?


-Jan-Willem Maessen

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


Re: [Haskell-cafe] Comparing on multiple criteria

2008-12-21 Thread Luke Palmer
On Sun, Dec 21, 2008 at 9:20 AM, Jan-Willem Maessen
jmaes...@alum.mit.eduwrote:

 Indeed, this is great to know.  I can't help but notice that there is no
 documentation of any kind at all for the Monoid instance of Ordering; how
 were we supposed to know this behavior existed in the first place, except by
 hunting down the source code for the instance declaration?


It seems we have no good way to associate documentation with instances.

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


[Haskell-cafe] Re: Is this related to monomorphism restriction?

2008-12-21 Thread Maurí­cio

Why isn't the last line of this code allowed?
f :: (TestClass a) = a - Integer
f = const 1
a = (f,f)
g = fst a
The only thing I can think about is monomorphism
restriction, but it's allowed (...)



(...) The reason is that a has type
a :: (TestClass a, TestClass b) = (a,b)
and then when we take 'fst' of this value (as in g) we get



g :: (TestClass a, TestClass b) = a
which is an ambiguous type, (...)


Is there some version (i.e., set of extensions) of
Haskell where this would be allowed?

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


Re: [Haskell-cafe] Rewrite thunk action rule?

2008-12-21 Thread Peter Todd
On Sun, Dec 21, 2008 at 02:56:06AM -0700, Luke Palmer wrote:
 2008/12/21 Peter Todd p...@petertodd.org
 
  If I could somehow arrange for the transform function to detect when it
  is being applied to a unevaluated thunk, and then modify the thunk in
  place, that would basically be the behavior I need. Any suggestions?
 
 
 That is exactly what is already happening.  Perhaps you want what you think
 is happening: if a value *is* evaluated, you want to apply the
 transformation right then instead of making a thunk.

Not quite. If I have a thunk, at the low level somewhere it must refer
to the transform function, the transform matrix, and the element that is
to be transformed. If I apply another transform to that unevaluated
thunk, my understanding is that haskell will represent it as such:

thunk transform Ta (thunk transform Tb e)

When I want the following:

thunk transform (Ta * Tb) e


This alternate definition of the Element structure might make more
sense:

data Element = Element {
elementOrigin :: V,
elementSubs :: [Element]
} 
| ElementThunk T Element

transform :: T - Element - Element
transform t (ElementThunk t2 e) = ElementThunk (tmul t t2) e
transform t e = ElementThunk t e
transform t e = Element {
elementOrigin = tmulv t (elementOrigin e),
elementSubs = map (transform t) (elementSubs e)
}

This gives a behavior close to what I want, applying a transform to an
element results in a thunk, and subsequent transforms simply modify
the thunk, the problem is that I don't see a way to implicitly coerce an
ElementThunk into an Element on demand for all the other code in the
program that expects elements. (such as the elementOrigin function)

 By the way, this is very operational thinking for Haskell.  Haskell tries
 quite hard to abstract away operational thinking, so thinking on this level
 will be difficult and more work than you should be doing to write a program.

Yes, but this part of the program is library code, that will be used by
a whole pile of other stuff, so if I can get the right behavior
magically the rest of the program will be a lot easier to write.

FWIW this is EDA software, those elements refer to elements of a
printed circuit board layout, and the transform operations correspond to
stuff like moving a chip on the board. The representation of a simple IC
would consist of something like an element, with a bunch of sub-elements
for each pin, all of which have geometry data.

 May I ask why you want this behavior?  Have you just tested it and observed
 that it is running too slowly and you are trying to speed it up?

I've written a previous version of this program in Python actually,
where I explicitly modeled the lazy evaluation behavior that I wanted.
It all worked great, but the overall speed was still quite slow.  I was
hoping that Haskell, built around lazy evaluation already, would be a
better fit.


That, and in any case, other aspects of the program that I've re-written
in Haskell saw about a 5-1 redunction in code length... :)

-- 
http://petertodd.org 'peter'[:-...@petertodd.org 


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


Re: [Haskell-cafe] Rewrite thunk action rule?

2008-12-21 Thread Luke Palmer
On Sun, Dec 21, 2008 at 10:27 AM, Peter Todd p...@petertodd.org wrote:


 data Element = Element {
elementOrigin :: V,
elementSubs :: [Element]
}
 | ElementThunk T Element

 transform :: T - Element - Element
 transform t (ElementThunk t2 e) = ElementThunk (tmul t t2) e
 transform t e = ElementThunk t e
 transform t e = Element {
elementOrigin = tmulv t (elementOrigin e),
elementSubs = map (transform t) (elementSubs e)
}

 This gives a behavior close to what I want, applying a transform to an
 element results in a thunk, and subsequent transforms simply modify
 the thunk, the problem is that I don't see a way to implicitly coerce an
 ElementThunk into an Element on demand for all the other code in the
 program that expects elements. (such as the elementOrigin function)


Oh!  Okay, studying your code a bit, I think I finally understand what
you're trying to do.  Tell me if I'm wrong.  You have a list of elements es
and a composition of transforms t1,t2,t3, and instead of applying t1, t2,
and t3 to each element, you want to collapse them together into a single
matrix and apply that matrix to each element.

This is definitely a modeling level thing to do; you don't need to go
anywhere near rewrite rules or thinking about internal representations or
anything like that.  A bit of old fashioned abstraction should do the trick.

Your Thunk representation is not that bad.  I can't really weigh the
trade-offs for you.  Keep the data type abstract and only allow access
through functions (like elementOrigin).  Then I don't see the problem with
redefining elementOrigin as:

elementOrigin (Element v subs) = v
elementOrigin (ElementThunk t e) = tmulv t (elementOrigin e)

Keep the number of operations which need to know the representation
(constructors) of Element as small as you can.

Another possibility is this:

data Element = Element
  { elementOrigin :: V
  , elementSubs :: [(T,Element)]
  }

Where, of course, the transform for each sub-element is relative.

Overall I think your thunk solution is a very nice trade-off.  (Minor
rhetorical note: I would probably name your ElementThunk constructor
Transform or ElementTransform instead)

Hmm, you have an invariant that the pattern ElementThunk t (ElementThunk t
e) never occurs.  It would be good style to encode this:

data PrimElement = PrimElement { elementOrigin :: V, elementSubs ::
[Element] }
data Element = Element (Maybe T) PrimElement

That Maybe bugs me.  You could factor that out into the T type with a
special optimization for the identity transform.  Hmm, then the
[(T,Element)] encoding and this one are identical.  Fun. :-)

Short answer:  *abstract data type!*

Luke



  By the way, this is very operational thinking for Haskell.  Haskell tries
  quite hard to abstract away operational thinking, so thinking on this
 level
  will be difficult and more work than you should be doing to write a
 program.

 Yes, but this part of the program is library code, that will be used by
 a whole pile of other stuff, so if I can get the right behavior
 magically the rest of the program will be a lot easier to write.

 FWIW this is EDA software, those elements refer to elements of a
 printed circuit board layout, and the transform operations correspond to
 stuff like moving a chip on the board. The representation of a simple IC
 would consist of something like an element, with a bunch of sub-elements
 for each pin, all of which have geometry data.

  May I ask why you want this behavior?  Have you just tested it and
 observed
  that it is running too slowly and you are trying to speed it up?

 I've written a previous version of this program in Python actually,
 where I explicitly modeled the lazy evaluation behavior that I wanted.
 It all worked great, but the overall speed was still quite slow.  I was
 hoping that Haskell, built around lazy evaluation already, would be a
 better fit.


 That, and in any case, other aspects of the program that I've re-written
 in Haskell saw about a 5-1 redunction in code length... :)

 --
 http://petertodd.org 'peter'[:-...@petertodd.org

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.6 (GNU/Linux)

 iD8DBQFJTnx03bMhDbI9xWQRAhWvAJoD8JeQg/3Q3Oy5FNEAaVjbNDbg3QCfe5jJ
 Ob2IGxR4YDfiVpoTeOFcnBM=
 =RS6B
 -END PGP SIGNATURE-


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


[Haskell-cafe] Removing/Uninstalling cabal packages ?

2008-12-21 Thread Laurent Giroud

Hi,

I have been doing a few experiments with cabal packages lately and I  
wish to uninstall these to return to a cleaner package base. However,  
there doesn't seem to be a cabal uninstall command and reading the  
documentation at http://www.haskell.org/ghc/docs/latest/html/Cabal/index.html 
 does not tell much about how to do that manually.


Note that what I wish to do is both delete the installed files and the  
cabal database so that the uninstalled packages does not show anymore  
when running cabal list --installed.


Would anyone know how to do that ?
Thanks in advance.

Regards,
Laurent
--
Laurent Giroud
m...@niaow.com

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


Re: [Haskell-cafe] ANN: bytestring-trie 0.1.0

2008-12-21 Thread Sterling Clover
Thanks for working on this! A nice efficient bytestring-trie is the  
sort of data structure we should have had in Haskell for some time  
now, and I'm sure I'll be giving it a great deal of use.


Regards,
Sterl.

On Dec 20, 2008, at 1:06 AM, wren ng thornton wrote:



-- Announcing: bytestring-trie 0.1.0 (beta)


An efficient finite map from (byte)strings to values.

The implementation is based on big-endian patricia trees, like  
Data.IntMap. We first trie on the Word8 elements of a  
Data.ByteString, sharing string prefixes where possible, and then  
trie on the big-endian bit representation of those elements.  
Patricia trees have efficient algorithms for union and other  
merging operations, but they're also quick for lookups and insertions.




-- Future Extensions


* I've done spot checking to make sure it works, but haven't  
constructed an extensive test suite. Does anyone know of a good  
data set already out there for testing corner cases? I'm sure other  
dictionary writers have come up with one.


* A Word8 is much smaller than the architecture's natural Word  
size. Therefore it'd be more efficient for the trie on bits to read  
off a whole Word at a time. This work is in progress, but I need  
help from people with 64-bit and big-endian machines in order to  
verify the code works on those architectures.


* Using ByteStrings allows for trieing on any packed byte  
representation of a value, but they're not Strings. Integration  
with Data.ByteString.Char8, utf8-string, and utf8-light should happen.


* The current implementation also only accepts strict ByteStrings.  
When chopping up strings to share prefixes we share the smaller  
string. For very long strings when many deletions are expected,  
this can still hold onto more memory than necessary. Accepting lazy  
ByteStrings or adding heuristics for when to copy prefixes instead  
of sharing will fix this.




-- Links


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

Hackage:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ 
bytestring-trie


Darcs:
http://code.haskell.org/~wren/bytestring-trie/

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


--
Live well,
~wren

___
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: Time for a new logo?

2008-12-21 Thread Brandon S. Allbery KF8NH

On 2008 Dec 17, at 8:42, Darrin Thompson wrote:

X monad could have a variant of this logo too. X= (That's how I
originally thought of it, just was too lazy to post it anywhere. Sorry
about that.)



Or just a lambda with an extra contrasting stroke to make an X (λ'  
very roughly, if you have the right font).


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


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


Re: [Haskell-cafe] Logos of Other Languages

2008-12-21 Thread Daniel van den Eijkel
what about such a variation? something between an ouroborob, a lambda 
and a mermaid...


By the way: I mixed up something: My note, that the orouboros was used 
as a logo for Heinz von Försters second order cybernetics, was not 
correct. The correct note should have been: Heinz von Förster, the later 
founder of the second order cybernetics, invented the ouroboros as a 
logo for the american society for cybernetics.

http://www.asc-cybernetics.org/

daniel


Paulo Tanimoto wrote:

Another idea: something in the form of an Ouroboros.  Is that already
taken for a programming language?

http://en.wikipedia.org/wiki/Ouroboros
  

Something like this?

http://www.haskell.org/sitewiki/images/f/fd/Ouroborous-oval.png

Paul

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

inline: lambda-ouroboros.JPG___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Is this related to monomorphism restriction?

2008-12-21 Thread Ryan Ingram
You have a few options.

In Haskell98 (no extensions):

a () = (f,f)
g () = fst (a ())
-- alternatively
g x = fst (a ()) x

Here you make it explicit that a and g are functions; the
monomorphism restriction is there to stop things that look like values
(and therefore you expect to only get evaluated once) from being
functions (which get evaluated every time they are used).

Alternatively, you are allowed to tell the compiler This value should
be polymorphic with a type signature:

a :: TestClass a = (a - Integer, a - Integer)
a = (f,f)
g :: TestClass a = a - Integer
g = fst a

The non-haskell98 solution:

{-# LANGUAGE NoMonomorphismRestriction #-}

But beware that it is really there to protect you; code that uses g
will compile to something very similar to the first operation I
showed, re-evaluating fst a and doing dictionary selection at every
use of g.

  -- ryan

On Sun, Dec 21, 2008 at 9:21 AM, Maurí­cio briqueabra...@yahoo.com wrote:
 Why isn't the last line of this code allowed?
 f :: (TestClass a) = a - Integer
 f = const 1
 a = (f,f)
 g = fst a
 The only thing I can think about is monomorphism
 restriction, but it's allowed (...)

 (...) The reason is that a has type
 a :: (TestClass a, TestClass b) = (a,b)
 and then when we take 'fst' of this value (as in g) we get

 g :: (TestClass a, TestClass b) = a
 which is an ambiguous type, (...)

 Is there some version (i.e., set of extensions) of
 Haskell where this would be allowed?

 ___
 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: Time for a new logo?

2008-12-21 Thread Miguel Mitrofanov
BTW, in Russian the character X (pronounced a bit like English H)  
is the first letter in Haskell.


On 21 Dec 2008, at 21:48, Brandon S. Allbery KF8NH wrote:


On 2008 Dec 17, at 8:42, Darrin Thompson wrote:

X monad could have a variant of this logo too. X= (That's how I
originally thought of it, just was too lazy to post it anywhere.  
Sorry

about that.)



Or just a lambda with an extra contrasting stroke to make an X (λ'  
very roughly, if you have the right font).


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



___
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] ANN: Data.List.Split

2008-12-21 Thread Brent Yorgey
I am pleased to announce the release of Data.List.Split, which
provides a wide range of strategies and a unified combinator framework
for splitting lists with respect to some sort of delimiter.  It
strives to be flexible yet simple.  If you've ever wished there was a
simple 'split' function you could grab from Data.List, this is the
package for you---no matter which of the seventeen* slightly different
ways to split a list you actually need!  Just use one of the
prepackaged splitting strategies, or build your own with the
combinator library.

Get it from Hackage:

  cabal install split

  http://hackage.haskell.org/cgi-bin/hackage-scripts/package/split

Get the source:

  darcs get http://code.haskell.org/~byorgey/code/split

Get excited:

  http://byorgey.wordpress.com/2008/12/21/datalistsplit/


-Brent

* Actual number may vary.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Is this related to monomorphism restriction?

2008-12-21 Thread Iavor Diatchki
Hello,
You can work around the monomorphism restriction with extensions but
to fix the ambiguity in your program that Reiner pointed out you'll
have to change the program to specify how you'd like to instantiate
a.
here are all the types once again:
f :: (TestClass a) = a - Integer
f = const 1

a :: (TestClass a, TestClass b) = (a - Integer, b - Integer)
a = (f,f)

g :: (TestClass a, TestClass b) = a - Integer  -- ambiguous
g = fst a

Note that the type of 'g' to the right of '=' does not mention 'b'.
This means that the type of 'g' is ambiguos because the type checker
does not know how to pick a type for 'b'.  To fix that, you could:
  1. Give 'a' a less general type, for example:  a :: (TestClass a) =
(a - Integer, a - Integer)
  2. Write a type signature on the use of 'a':

g :: TestClass a = a - Integer
g = fst (a :: (a - Integer, a - Integer))

Here we are using another GHC extension called scoped type variables
to associate the a in the type signature of g with the a in the
type annotation for the value a.

Hope that this helps,
Iavor




On Sun, Dec 21, 2008 at 9:21 AM, Maurí­cio briqueabra...@yahoo.com wrote:
 Why isn't the last line of this code allowed?
 f :: (TestClass a) = a - Integer
 f = const 1
 a = (f,f)
 g = fst a
 The only thing I can think about is monomorphism
 restriction, but it's allowed (...)

 (...) The reason is that a has type
 a :: (TestClass a, TestClass b) = (a,b)
 and then when we take 'fst' of this value (as in g) we get

 g :: (TestClass a, TestClass b) = a
 which is an ambiguous type, (...)

 Is there some version (i.e., set of extensions) of
 Haskell where this would be allowed?

 ___
 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] Removing/Uninstalling cabal packages ?

2008-12-21 Thread brian
On Sun, Dec 21, 2008 at 12:12 PM, Laurent Giroud m...@niaow.com wrote:
 I have been doing a few experiments with cabal packages lately and I wish to
 uninstall these to return to a cleaner package base. However, there doesn't
 seem to be a cabal uninstall command and reading the documentation at
 http://www.haskell.org/ghc/docs/latest/html/Cabal/index.html does not tell
 much about how to do that manually.

I think you want 'ghc-pkg list' and 'ghc-pkg unregister'.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Is this related to monomorphism restriction?

2008-12-21 Thread Luke Palmer
2008/12/21 Iavor Diatchki iavor.diatc...@gmail.com



 g :: TestClass a = a - Integer
 g = fst (a :: (a - Integer, a - Integer))


Which I believe needs to be written:

g :: forall a. TestClass a = a - Integer
g = fst (a :: (a - Integer, a - Integer))




 Here we are using another GHC extension called scoped type variables
 to associate the a in the type signature of g with the a in the
 type annotation for the value a.

 Hope that this helps,
 Iavor




 On Sun, Dec 21, 2008 at 9:21 AM, Maurí­cio briqueabra...@yahoo.com
 wrote:
  Why isn't the last line of this code allowed?
  f :: (TestClass a) = a - Integer
  f = const 1
  a = (f,f)
  g = fst a
  The only thing I can think about is monomorphism
  restriction, but it's allowed (...)
 
  (...) The reason is that a has type
  a :: (TestClass a, TestClass b) = (a,b)
  and then when we take 'fst' of this value (as in g) we get
 
  g :: (TestClass a, TestClass b) = a
  which is an ambiguous type, (...)
 
  Is there some version (i.e., set of extensions) of
  Haskell where this would be allowed?
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 

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


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


[Haskell-cafe] The Haskell re-branding exercise

2008-12-21 Thread Paul Johnson




A call
has gone out for a new logo for Haskell. Candidates (including a couple
of mine)
are accumulating here.
There has also been a long thread on the Haskell Cafe mailing list.

I've lived through a couple of corporate rebranding exercises in my
time, and I've read about some others. They follow a pattern:

  Management decide that the organisation needs a makeover to
change public perception. A new corporate "look and feel" is part of
this, and a new logo is therefore required. The rest of the makeover
may be deep or shallow; that doesn't affect the rest of this story.
  The new branding is released with as much fanfare as possible.
Press releases are released. Staff are given briefings about the
significance of the whole exercise and the bold new future that it
symbolises.
  The staff universally agree that the new logo is not a patch on
the old one. The old one was a much loved friend; it stood for
something; people have spent years working for it. The new one is
obviously a piece of cheap gimcrackery munged up by an overpaid
consultancy hired by senior managers who mistake image for substance.
A ten year-old with an Etch-a-Sketch could have done better.
  Over time the new logo blends in and becomes part of the
scenery. Years pass. Go to stage 1 and repeat.

This suggests that the current effort to find a new logo for Haskell
needs to go back to the basics. Its no good expecting consensus on one
of the suggestions because there are too many options and everyone has
their favourite. Nothing will attract a majority of the community. 

Furthermore I think that (just like programmers everywhere) we have
dived into development before deciding what the requirements are. This
is reflected in the mailing list discussion, where two broad positions
seem to be emerging.

  On one side we have what I think of as the "Vulcans". This group
sees Haskell as abstract and difficult, and believes that the logo
should reflect these qualities. They want mathematical symbols to
dominate the design.
  On the other side we have the "Warm Fuzzies". They want Haskell
to be perceived as accessible and welcoming, and so want a logo
featuring something warm and friendly.

A paradox of the Haskell world is that, while the language is Vulcan,
the community around it is dominated by Warm Fuzziness. Clearly the
two are not mutually exclusive.

A rebranding exercise needs to start with a short list of adjectives
that the brand is to represent, and I think that the Haskell community
needs to decide this before it fires up Inkscape. To that end, here
are a sample of adjectives in alphabetical order:

abstract, academic, accessible, accurate,
adventurous, business-like, communal, complicated, dangerous,
different, easy, exciting, familiar, friendly, fun, fuzzy, hard,
interesting, inventive, precise, productive, profitable, reliable,
revolutionary, safe, simple, strange, supportive, warm, welcoming.

What are the top three adjectives we want to project? Once we have
decided that, we can write a brief for the Haskell logo.

Note that the selected adjectives need not be related. In fact they
may be partly contradictory. I've
already noted that the language is Vulcan whereas the community is Warm
and Friendly. So they might reasonably be the three adjectives (though
I wouldn't take "Vulcan" too literally). The challenge will then be
for the graphical work to project these qualities, even if they seem
incompatible.



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


Re: intimidating terminology (was: Re: [Haskell-cafe] Time for a new logo?)

2008-12-21 Thread Brandon S. Allbery KF8NH

On 2008 Dec 19, at 4:13, Lennart Augustsson wrote:

When accurate names for Haskell concepts already exist we should use
them (as we have tried in the past).  There has been too much
invention of misleading terminology in computing already.  If some
people can't handle things having the right names, well, maybe they
should try another language.  (What would happen if we used the new
name principle, e.g., in cooking?  Oh, cinnamon is a difficult name,
I'll call it tangy spice instead.)



Cinnamon's already got an accuracy problem anyway:  what most people  
in the US call cinnamon is actually cassia.


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


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


Re: [Haskell-cafe] The Haskell re-branding exercise

2008-12-21 Thread Don Stewart
Wonderful, Paul. Could you add your list of adjectives to the wiki page.

Note that the initial deadline was Dec 31, after which time we can
filter out dupes and narrow down the logos to about 5 or so different
directions to have a vote on. Anything you can do to help direct or
improve quality is welcome!

-- Don

paul:
A [1]call has gone out for a new logo for Haskell.  Candidates (including
a [2]couple of [3]mine) are accumulating [4]here.  There has also been a
long thread on the Haskell Cafe mailing list.
 
I've lived through a couple of corporate rebranding exercises in my time,
and I've read about some others.  They follow a pattern:
 
 1. Management decide that the organisation needs a makeover to change
public perception.  A new corporate look and feel is part of this,
and a new logo is therefore required.  The rest of the makeover may be
deep or shallow; that doesn't affect the rest of this story.
 2. The new branding is released with as much fanfare as possible.  Press
releases are released.  Staff are given briefings about the
significance of the whole exercise and the bold new future that it
symbolises.
 3. The staff universally agree that the new logo is not a patch on the
old one.  The old one was a much loved friend; it stood for something;
people have spent years working for it.  The new one is obviously a
piece of cheap gimcrackery munged up by an overpaid consultancy hired
by senior managers who mistake image for substance.  A ten year-old
with an Etch-a-Sketch could have done better.
 4. Over time the new logo blends in and becomes part of the scenery. 
Years pass.  Go to stage 1 and repeat.
 
This suggests that the current effort to find a new logo for Haskell needs
to go back to the basics.  Its no good expecting consensus on one of the
suggestions because there are too many options and everyone has their
favourite.  Nothing will attract a majority of the community. 
 
Furthermore I think that (just like programmers everywhere) we have dived
into development before deciding what the requirements are.  This is
reflected in the mailing list discussion, where two broad positions seem
to be emerging.
 
  * On one side we have what I think of as the Vulcans.  This group sees
Haskell as abstract and difficult, and believes that the logo should
reflect these qualities.  They want mathematical symbols to dominate
the design.
  * On the other side we have the Warm Fuzzies.  They want Haskell to be
perceived as accessible and welcoming, and so want a logo featuring
something warm and friendly.
 
A paradox of the Haskell world is that, while the language is Vulcan, the
community around it is dominated by Warm Fuzziness.  Clearly the two are
not mutually exclusive.
 
A rebranding exercise needs to start with a short list of adjectives that
the brand is to represent, and I think that the Haskell community needs to
decide this before it fires up Inkscape.  To that end, here are a sample
of adjectives in alphabetical order:
 
abstract, academic, accessible, accurate, adventurous, business-like,
communal, complicated, dangerous, different, easy, exciting, familiar,
friendly, fun, fuzzy, hard, interesting, inventive, precise, productive,
profitable, reliable, revolutionary, safe, simple, strange, supportive,
warm, welcoming.
 
What are the top three adjectives we want to project?  Once we have
decided that, we can write a brief for the Haskell logo.
 
Note that the selected adjectives need not be related.  In fact they may
be partly contradictory.  I've already noted that the language is Vulcan
whereas the community is Warm and Friendly.  So they might reasonably be
the three adjectives (though I wouldn't take Vulcan too literally).  The
challenge will then be for the graphical work to project these qualities,
even if they seem incompatible.
 
 References
 
Visible links
1. http://www.haskell.org/pipermail/haskell-cafe/2008-December/051836.html
2. http://www.haskell.org/haskellwiki/Image:Haskell-logo-revolution.png
3. http://www.haskell.org/sitewiki/images/f/fd/Ouroborous-oval.png
4. http://www.haskell.org/haskellwiki/Haskell_logos/New_logo_ideas

 ___
 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] GHC libraries documentation and links to source files

2008-12-21 Thread Manlio Perillo

Hi.

I have noted that recent versions of the GHC libraries documentation, no 
longer have links to the source code.


What is the reason?
I find it very useful.



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


Re: [Haskell-cafe] The Haskell re-branding exercise

2008-12-21 Thread Sebastian Sylvan
2008/12/21 Paul Johnson p...@cogito.org.uk




 This suggests that the current effort to find a new logo for Haskell needs
 to go back to the basics.  Its no good expecting consensus on one of the
 suggestions because there are too many options and everyone has their
 favourite.  Nothing will attract a majority of the community.


I agree with this, which I why I would propose using Condorcet-voting.
Personally I find the current logo horrendous. I think it's ugly and
intimidating at the same time. I don't really care too much which one of the
proposals should win, just so long as I can weed out some of the ones I
really hate.
Condorcet voting will pick a good compromise, where someone like me could
just put all the acceptable ones at shared #1, and all the ones I dislike at
#2., and someone with stronger opinions could flesh it out some more. The
point being that the least disliked logo wins out. Maybe nobody will be
happy, but hopefully most people won't be deeply unhappy with it.

It would be a shame if there's lots of votes that are spread out over a
large group of fairly similar logos that are good, and then a crappy one
wins out with 6% of the vote because there weren't any others like it so the
votes for that style weren't spread out over multiple entries.


Wikipedia:
http://en.wikipedia.org/wiki/Condorcet_voting

-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Haskell re-branding exercise

2008-12-21 Thread Don Stewart
Would you be willing to set up a little online voting system (or do you
know of one) so we can implement this?

Assume there'll be  10 candidates.

-- Don

sylvan:
2008/12/21 Paul Johnson [1]p...@cogito.org.uk
 
  This suggests that the current effort to find a new logo for Haskell
  needs to go back to the basics.  Its no good expecting consensus on one
  of the suggestions because there are too many options and everyone has
  their favourite.  Nothing will attract a majority of the community. 
 
I agree with this, which I why I would propose using Condorcet-voting.
Personally I find the current logo horrendous. I think it's ugly and
intimidating at the same time. I don't really care too much which one of
the proposals should win, just so long as I can weed out some of the ones
I really hate.
Condorcet voting will pick a good compromise, where someone like me could
just put all the acceptable ones at shared #1, and all the ones I dislike
at #2., and someone with stronger opinions could flesh it out some more.
The point being that the least disliked logo wins out. Maybe nobody will
be happy, but hopefully most people won't be deeply unhappy with it.
It would be a shame if there's lots of votes that are spread out over a
large group of fairly similar logos that are good, and then a crappy one
wins out with 6% of the vote because there weren't any others like it so
the votes for that style weren't spread out over multiple entries.
Wikipedia:
[2]http://en.wikipedia.org/wiki/Condorcet_voting
 
--
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
 
 References
 
Visible links
1. mailto:p...@cogito.org.uk
2. http://en.wikipedia.org/wiki/Condorcet_voting

 ___
 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] The Haskell re-branding exercise

2008-12-21 Thread Sebastian Sylvan
I am very shortly travelling abroad for several weeks and will not have
(reliable access to) a computer, but isn't this a task for one of the
haskell web-apps people (HSP, HAppS, Turbinado, etc.) to show us once and
for all why *their* library is better than the competition? :-)
On Sun, Dec 21, 2008 at 9:23 PM, Don Stewart d...@galois.com wrote:

 Would you be willing to set up a little online voting system (or do you
 know of one) so we can implement this?

 Assume there'll be  10 candidates.

 -- Don

 sylvan:
 2008/12/21 Paul Johnson [1]p...@cogito.org.uk
 
   This suggests that the current effort to find a new logo for Haskell
   needs to go back to the basics.  Its no good expecting consensus on
 one
   of the suggestions because there are too many options and everyone
 has
   their favourite.  Nothing will attract a majority of the community.
 
 I agree with this, which I why I would propose using Condorcet-voting.
 Personally I find the current logo horrendous. I think it's ugly and
 intimidating at the same time. I don't really care too much which one
 of
 the proposals should win, just so long as I can weed out some of the
 ones
 I really hate.
 Condorcet voting will pick a good compromise, where someone like me
 could
 just put all the acceptable ones at shared #1, and all the ones I
 dislike
 at #2., and someone with stronger opinions could flesh it out some
 more.
 The point being that the least disliked logo wins out. Maybe nobody
 will
 be happy, but hopefully most people won't be deeply unhappy with it.
 It would be a shame if there's lots of votes that are spread out over
 a
 large group of fairly similar logos that are good, and then a crappy
 one
 wins out with 6% of the vote because there weren't any others like it
 so
 the votes for that style weren't spread out over multiple entries.
 Wikipedia:
 [2]http://en.wikipedia.org/wiki/Condorcet_voting
 
 --
 Sebastian Sylvan
 +44(0)7857-300802
 UIN: 44640862
 
  References
 
 Visible links
 1. mailto:p...@cogito.org.uk
 2. http://en.wikipedia.org/wiki/Condorcet_voting

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




-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Haskell re-branding exercise

2008-12-21 Thread Matthias Kilian
On Sun, Dec 21, 2008 at 01:23:33PM -0800, Don Stewart wrote:
 Would you be willing to set up a little online voting system (or do you
 know of one) so we can implement this?
 
 Assume there'll be  10 candidates.

What about www.doodle.com?

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


Re: [Haskell-cafe] The Haskell re-branding exercise

2008-12-21 Thread Don Stewart
kili:
 On Sun, Dec 21, 2008 at 01:23:33PM -0800, Don Stewart wrote:
  Would you be willing to set up a little online voting system (or do you
  know of one) so we can implement this?
  
  Assume there'll be  10 candidates.
 
 What about www.doodle.com?

That looks like it might be an option, embedded in a page with the 10
candidates.

Thanks!

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


[Haskell-cafe] Threads with high CPU usage

2008-12-21 Thread Günther Schmidt

Hi,

in an application of mine I start a long-running operation in a thread via  
forkIO so that the UI process doesn't get blocked.
It just so happens, that the long-running process also takes the CPU to  
nearly 100% while it runs.


During that time the run-time system does *not* switch back and forth  
between the UI-process and the long-running task, it seems that the UI  
process only gets woken up *after* the high CPU thread finishes completely.


To the effect of course that it makes no difference at all to the UIs  
responsiveness whether I use forkIO or not.


The long running process is pretty atomic, it's a single query to the  
database which takes up to a minute to complete so I don't see a chance to  
squeeze a mainIteration in there.


What can I do?

Günther

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


Re: [Haskell-cafe] Threads with high CPU usage

2008-12-21 Thread Brandon S. Allbery KF8NH

On 2008 Dec 21, at 16:47, Don Stewart wrote:

redcom:

The long running process is pretty atomic, it's a single query to the
database which takes up to a minute to complete so I don't see a  
chance to

squeeze a mainIteration in there.



How are you compiling this code (-O -threaded ?) and what does the
forkIO'd thread do? Does it allocate?



Sounds to me like it's making FFI calls to a database library.  I  
smell bound threads, especially if the UI also makes FFI calls.


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


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


Re: [Haskell-cafe] GHC libraries documentation and links to source files

2008-12-21 Thread Donnie Jones
Hello Manilo and Haskell-cafe,

On Sun, Dec 21, 2008 at 4:07 PM, Manlio Perillo manlio_peri...@libero.itwrote:

 Hi.

 I have noted that recent versions of the GHC libraries documentation, no
 longer have links to the source code.

 What is the reason?
 I find it very useful.


I would like to suggest that all Haskell libraries generate documentation
with view source links.  Like Manilo, I also find it very useful.

Thank you.
__
Donnie Jones
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Threads with high CPU usage

2008-12-21 Thread Mads Lindstrøm
Hi Günter

Günther Schmidt wrote:
 Hi,
 
 in an application of mine I start a long-running operation in a thread via  
 forkIO so that the UI process doesn't get blocked.
 It just so happens, that the long-running process also takes the CPU to  
 nearly 100% while it runs.
 
 During that time the run-time system does *not* switch back and forth  
 between the UI-process and the long-running task, it seems that the UI  
 process only gets woken up *after* the high CPU thread finishes completely.
 
 To the effect of course that it makes no difference at all to the UIs  
 responsiveness whether I use forkIO or not.
 
 The long running process is pretty atomic, it's a single query to the  
 database which takes up to a minute to complete so I don't see a chance to  
 squeeze a mainIteration in there.

It could be the database library, as it may use unsafe foreign calls.
Unsafe foreign calls blocks all other threads, even if you compile with
the -threaded option. See
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent.html#4
 .

I cannot claim to know how all Haskell database libraries are
implemented, but at least some of them use unsafe foreign calls. So
which database library is you using?

 
 What can I do?

If the problem has to do with unsafe foreign calls, then you can
implement the database calls in a separate process. Not the easiest
options, but I can think of no other.

 
 Günther
 

/Mads Lindstrøm



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


[Haskell-cafe] Re: Threads with high CPU usage

2008-12-21 Thread Günther Schmidt

Hi Mads,

I'm using HDBC with sqlite3

Günther

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


Re: [Haskell-cafe] Threads with high CPU usage

2008-12-21 Thread Peter Verswyvelen
Would forkOS instead of forkIO help in this case?
On Sun, Dec 21, 2008 at 11:16 PM, Mads Lindstrøm
mads_lindstr...@yahoo.dkwrote:

 Hi Günter

 Günther Schmidt wrote:
  Hi,
 
  in an application of mine I start a long-running operation in a thread
 via
  forkIO so that the UI process doesn't get blocked.
  It just so happens, that the long-running process also takes the CPU to
  nearly 100% while it runs.
 
  During that time the run-time system does *not* switch back and forth
  between the UI-process and the long-running task, it seems that the UI
  process only gets woken up *after* the high CPU thread finishes
 completely.
 
  To the effect of course that it makes no difference at all to the UIs
  responsiveness whether I use forkIO or not.
 
  The long running process is pretty atomic, it's a single query to the
  database which takes up to a minute to complete so I don't see a chance
 to
  squeeze a mainIteration in there.

 It could be the database library, as it may use unsafe foreign calls.
 Unsafe foreign calls blocks all other threads, even if you compile with
 the -threaded option. See

 http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent.html#4.

 I cannot claim to know how all Haskell database libraries are
 implemented, but at least some of them use unsafe foreign calls. So
 which database library is you using?

 
  What can I do?

 If the problem has to do with unsafe foreign calls, then you can
 implement the database calls in a separate process. Not the easiest
 options, but I can think of no other.

 
  Günther
 

 /Mads Lindstrøm



 ___
 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] Threads with high CPU usage

2008-12-21 Thread Mads Lindstrøm
Hi Peter,

Peter Verswyvelen wrote:
 Would forkOS instead of forkIO help in this case?

No, according to
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent.html#v%3AforkOS
 :

Using forkOS instead of forkIO makes no difference at all to the
scheduling behaviour of the Haskell runtime system. It is a common
misconception that you need to use forkOS instead of forkIO to avoid
blocking all the Haskell threads when making a foreign call; this isn't
the case. To allow foreign calls to be made without blocking all the
Haskell threads (with GHC), it is only necessary to use the -threaded
option when linking your program, and to make sure the foreign import is
not marked unsafe.

/Mads

 
 On Sun, Dec 21, 2008 at 11:16 PM, Mads Lindstrøm
 mads_lindstr...@yahoo.dk wrote:
 Hi Günter
 
 Günther Schmidt wrote:
  Hi,
 
  in an application of mine I start a long-running operation
 in a thread via
  forkIO so that the UI process doesn't get blocked.
  It just so happens, that the long-running process also takes
 the CPU to
  nearly 100% while it runs.
 
  During that time the run-time system does *not* switch back
 and forth
  between the UI-process and the long-running task, it seems
 that the UI
  process only gets woken up *after* the high CPU thread
 finishes completely.
 
  To the effect of course that it makes no difference at all
 to the UIs
  responsiveness whether I use forkIO or not.
 
  The long running process is pretty atomic, it's a single
 query to the
  database which takes up to a minute to complete so I don't
 see a chance to
  squeeze a mainIteration in there.
 
 
 It could be the database library, as it may use unsafe foreign
 calls.
 Unsafe foreign calls blocks all other threads, even if you
 compile with
 the -threaded option. See
 
 http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent.html#4
  .
 
 I cannot claim to know how all Haskell database libraries are
 implemented, but at least some of them use unsafe foreign
 calls. So
 which database library is you using?
 
 
  What can I do?
 
 If the problem has to do with unsafe foreign calls, then you
 can
 implement the database calls in a separate process. Not the
 easiest
 options, but I can think of no other.
 
 
  Günther
 
 
 /Mads Lindstrøm
 
 
 
 
 ___
 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: Threads with high CPU usage

2008-12-21 Thread Mads Lindstrøm
Hi Günther,

 Hi Mads,
 
 I'm using HDBC with sqlite3

Looking at
http://software.complete.org/software/repositories/entry/hdbc-sqlite3/Database/HDBC/Sqlite3/Connection.hs
 and 
http://software.complete.org/software/repositories/entry/hdbc-sqlite3/Database/HDBC/Sqlite3/Statement.hsc
 you can see that HDBC-sqlite's foreign calls are indeed marked unsafe.

/Mads

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


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


Re: [Haskell-cafe] Re: Threads with high CPU usage

2008-12-21 Thread Don Stewart
redcom:
 Hi Mads,
 
 I just noticed that too.
 
 I had been wondering why this problem does not occur with the sample app  
 from RWH eventhough I was employing the same technics as they did.
 
 It just occured to me that all the DB interactions in their app are fairly  
 short and thus the problem never becomes apparent.
 
 Thanks everyone, I was going crazy here, couldn't figure out what I was  
 doing wrong.
 
 Would anyone happen to know of a safe alternative to HDBC?

Modify the 'unsafe' inports to be 'safe'? I don't think HDBC is going to
call back in, so should be fine. John?

That said, we use Takusen or sqlite3 at work, without troubles.

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


Re: [Haskell-cafe] Re: Threads with high CPU usage

2008-12-21 Thread Günther Schmidt

Hi Mads,

I just noticed that too.

I had been wondering why this problem does not occur with the sample app  
from RWH eventhough I was employing the same technics as they did.


It just occured to me that all the DB interactions in their app are fairly  
short and thus the problem never becomes apparent.


Thanks everyone, I was going crazy here, couldn't figure out what I was  
doing wrong.


Would anyone happen to know of a safe alternative to HDBC?

Günther


Am 21.12.2008, 23:39 Uhr, schrieb Mads Lindstrøm  
mads_lindstr...@yahoo.dk:



Hi Günther,


Hi Mads,

I'm using HDBC with sqlite3


Looking at
http://software.complete.org/software/repositories/entry/hdbc-sqlite3/Database/HDBC/Sqlite3/Connection.hs  
and  
http://software.complete.org/software/repositories/entry/hdbc-sqlite3/Database/HDBC/Sqlite3/Statement.hsc  
you can see that HDBC-sqlite's foreign calls are indeed marked unsafe.


/Mads



Günther

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



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



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


Re: [Haskell-cafe] Re: Threads with high CPU usage

2008-12-21 Thread Günther Schmidt

Hi Don,



Modify the 'unsafe' inports to be 'safe'? I don't think HDBC is going to
call back in, so should be fine. John?


Sorry, total noob here, could you be more specific?

Günther



That said, we use Takusen or sqlite3 at work, without troubles.


I might also check into that.



-- Don



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


Re: [Haskell-cafe] Comparing on multiple criteria

2008-12-21 Thread David Menendez
On Sun, Dec 21, 2008 at 11:20 AM, Jan-Willem Maessen
jmaes...@alum.mit.edu wrote:
 On Dec 21, 2008, at 8:52 AM, Martijn van Steenbergen wrote:

 Hello all,

 Data.Ord has a handy function called comparing, and its documentation
 shows an example of its use.

 But what if you want to sort a list of values based on multiple criteria?
 It turns out there is a neat way to do this:

 compareTuple = mconcat [comparing fst, comparing snd]

 The default Monoid instances for Ordering and functions work exactly as
 required here. (Thanks to vixey in #haskell for the hint to look at
 monoids!)

 Indeed, this is great to know.  I can't help but notice that there is no
 documentation of any kind at all for the Monoid instance of Ordering; how
 were we supposed to know this behavior existed in the first place, except by
 hunting down the source code for the instance declaration?

This is a great example of why it's a bad idea to introduce new
functionality with a Monoid instance. Even if you know the instance
exists, mappend is so general that it's difficult or impossible to
predict what it will do at a given type.

There should be an explicit function for combining Ordering values
lexicographically, with a note in the documentation saying that it's
the basis of the Monoid instance.

-- 
Dave Menendez d...@zednenem.com
http://www.eyrie.org/~zednenem/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Trouble with the ST monad

2008-12-21 Thread Andre Nathan
Hello,

I'm trying to write a function that would take an STArray and and
shuffle its elements. I'm having trouble with the ST monad, though, and
couldn't find out how fix this issue.

The problem happens when I use runST to extract the shuffled array from
the ST monad. I'm getting the following error:

  Inferred type is less polymorphic than expected
Quantified type variable `s' is mentioned in the environment:
  a :: STArray s Int a

The full code is at

  http://hpaste.org/13240#a1

Any help would be appreciated.

Thanks,
Andre

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


Re: [Haskell-cafe] The Haskell re-branding exercise

2008-12-21 Thread ajb

G'day all.

Quoting Sebastian Sylvan syl...@student.chalmers.se:


Personally I find the current logo horrendous. I think it's ugly and
intimidating at the same time. I don't really care too much which one of the
proposals should win, just so long as I can weed out some of the ones I
really hate.


I guess this is one difference between the Haskell rebranding exercise
and other corporate rebranding exercises: Nobody especially likes the
current logo.

(Disclaimer: It would be fair to say that there are some who don't hate
it as much as Sebastian, but nobody really likes it.)

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


Re: [Haskell-cafe] Trouble with the ST monad

2008-12-21 Thread Ryan Ingram
The problem is that you are trying to return a mutable array out of an
ST computation.  This lets the mutability of the computation escape.
 That's what the s type variable is for;  without it, runST is just
unsafePerformIO.

To solve your problem, you need to eliminate any references to the
state from the output of runST.  I suggest looking into the function
freezeSTArray:

From 
http://haskell.org/ghc/docs/latest/html/libraries/base/GHC-Arr.html#v:freezeSTArray
freezeSTArray :: Ix i = STArray s i e - ST s (Array i e)

(See my annotation at http://hpaste.org/13240#a2)

This allows you to remove any reference to the state from the array
computation.  Alternatively, if you want this to be part of a larger
mutable computation, you can return the result in ST; this is what the
version of shuffle you have in the paste does.

  -- ryan

On Sun, Dec 21, 2008 at 4:14 PM, Andre Nathan an...@digirati.com.br wrote:
 Hello,

 I'm trying to write a function that would take an STArray and and
 shuffle its elements. I'm having trouble with the ST monad, though, and
 couldn't find out how fix this issue.

 The problem happens when I use runST to extract the shuffled array from
 the ST monad. I'm getting the following error:

  Inferred type is less polymorphic than expected
Quantified type variable `s' is mentioned in the environment:
  a :: STArray s Int a

 The full code is at

  http://hpaste.org/13240#a1

 Any help would be appreciated.

 Thanks,
 Andre

 ___
 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] Records and associated types

2008-12-21 Thread Wolfgang Jeltsch
Am Donnerstag, 11. Dezember 2008 22:04 schrieb Taru Karttunen:
 Hello

 What is the correct way to transform code that uses record selection
 with TypeEq (like HList) to associated types?

Hello Taru,

you might want to look at

http://www.mail-archive.com/glasgow-haskell-users%40haskell.org/msg12788.html

and its follow-ups.

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


Re: [Haskell-cafe] Threads with high CPU usage

2008-12-21 Thread Andrea Vezzosi
Tried running the program with +RTS -Nn where n = 2 or more? that should use
more OS threads

On Sun, Dec 21, 2008 at 10:43 PM, Günther Schmidt red...@fedoms.com wrote:

 Hi,

 in an application of mine I start a long-running operation in a thread via
 forkIO so that the UI process doesn't get blocked.
 It just so happens, that the long-running process also takes the CPU to
 nearly 100% while it runs.

 During that time the run-time system does *not* switch back and forth
 between the UI-process and the long-running task, it seems that the UI
 process only gets woken up *after* the high CPU thread finishes completely.

 To the effect of course that it makes no difference at all to the UIs
 responsiveness whether I use forkIO or not.

 The long running process is pretty atomic, it's a single query to the
 database which takes up to a minute to complete so I don't see a chance to
 squeeze a mainIteration in there.

 What can I do?

 Günther

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

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


[Haskell-cafe] A hell of a question

2008-12-21 Thread Andrzej Jaworski

I just want to say Hello to let you know that there are some serious entities 
watching you besides
monads and FBI:-)

There has been a hell of a discussion recently about logos, languages and 
religion and I want to add
to this.

First let me disassociate Haskell from Taoism which to may taste has left us in 
an unhealthy climate.
It suffices to say that Taoism is a school of clever trics and cute aphorisms 
but without the
slightest attempt to explain or generalize let alone produce an abstract idea 
or a system. That is
why its wisdom is non transferable in spite of majority of humans desending 
from it. Haskell on the
contrary is a minority school that implements abstract ideas for problem 
solving in the most
transferable way to date, so that other languages look into it for their share. 
But don't worry,
thay will choke becouse it is them who practice Taoizm. Playing too many tricks 
will eventually
trick them, even if some are powerful enough to brainwash dicent professors to 
preach
interoperability or the like. Every viable complexity needs a single underlying 
concept to survive,
including you and the universe. Microsoft and the like excluding;-)
Haskell has all that: consistency, transparency and self-contained concept.

However Haskell is also somehow asynchronic with the Bible as it is condemned 
to perpetual purity
only to be saved from it via monads, which according to Spinoza are arranged 
by God in a perfect
order which ascends to God, the supreme monad!!!. Thus we can look at 
Haskell's purity as a kind of
harmless attempt to play God by means of incapsulating the world only to ignor 
it. This could
somehow put it in the same boat with the devil. They both prefer your brain to 
Turing machin:-)

I would leave with the eternal question what the hell Haskell is? and with my 
Santa Close
emphasising Haskell's purity and my simplicity.
Here: http://haskell.org/sitewiki/images/7/79/WCF.Andrzej.Jaworski.gif

   Have fun,
-Andrzej Jaworski

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


Re: [Haskell-cafe] Trouble with the ST monad

2008-12-21 Thread Andre Nathan
On Sun, 2008-12-21 at 16:47 -0800, Ryan Ingram wrote:
 The problem is that you are trying to return a mutable array out of an
 ST computation.  This lets the mutability of the computation escape.
  That's what the s type variable is for;  without it, runST is just
 unsafePerformIO.

Thanks!

If only I knew that was the problem... It wouldn't have costed me the 
whole afternoon :P

Is there any difference between using freeze/thaw from Data.Array.MArray
versus freezeSTArray/thawSTArray from GHC.Arr?

Best,
Andre

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


Re: [Haskell-cafe] Threads with high CPU usage

2008-12-21 Thread Don Stewart
redcom:
 Hi,
 
 in an application of mine I start a long-running operation in a thread via  
 forkIO so that the UI process doesn't get blocked.
 It just so happens, that the long-running process also takes the CPU to  
 nearly 100% while it runs.
 
 During that time the run-time system does *not* switch back and forth  
 between the UI-process and the long-running task, it seems that the UI  
 process only gets woken up *after* the high CPU thread finishes completely.
 
 To the effect of course that it makes no difference at all to the UIs  
 responsiveness whether I use forkIO or not.
 
 The long running process is pretty atomic, it's a single query to the  
 database which takes up to a minute to complete so I don't see a chance to  
 squeeze a mainIteration in there.
 

How are you compiling this code (-O -threaded ?) and what does the
forkIO'd thread do? Does it allocate?

Would increasing the runtime scheduling ticks help? (Perhaps , if the UI
is mostly sleeping).

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


Re: [Haskell-cafe] Pattern combinators

2008-12-21 Thread Andrew Wagner
I'd love to see a copy of this go up on hackage for experimentation. Would
you care to upload your code, or send it to me so I can upload it?

On Sun, Dec 21, 2008 at 12:37 AM, David Menendez d...@zednenem.com wrote:

 On Sat, Dec 20, 2008 at 9:34 PM, Jacques Carette care...@mcmaster.ca
 wrote:
  Andrew Wagner wrote:
 
  Wadler posted a blog entry the other day about a paper on
 pattern-matching
  in Haskell (http://wadler.blogspot.com/). I've taken a first stab at
 turning
  it into actual code for hackage (http://hpaste.org/13215). There are
 two
  commented-out definitions that don't type-check, though, and the types
 are
  too wild for me to grok. Anybody have any suggestions for 1.) How to fix
 it
  and/or 2.) How to use data/type/newtype to simplify the types and make
 it
  more manageable? Thanks!
 
  Both errors are because you are using any instead of any'; you might
  wish to put
  import Prelude hiding any
  at the top of your code, just to avoid such confusion.

 Example 14 also uses (.-.) where it should use (..), and it either
 needs some more parentheses or some precedence declarations for the
 operators.

  To make the types more readable (but not necessarily more manageable), I
  have made some changes to my version of this code.

 One oddity in the paper is the type of the failure continuations, ()
 - ans. I'm guessing that's left over from an earlier phase of
 development. In my own transcription of the library, I eliminated the
 () parameter without apparent loss of functionality.

 I think I've managed to work out the structure of the types, which can
 mostly be expressed in modern Haskell.

 The matching part of the patterns have this general form:

type PMatch vec vec' ans = (vec - ans) - (() - ans) - vec' - ans

 where vec and vec' are the list of argument types before and after the
 subpattern match, and ans is the final answer. (In my code, I just use
 ans instead of () - ans for the failure continuation.)

 This gets us:

 nil   :: PMatch vec vec ans
 one   :: a - PMatch (a,vec) vec ans
 (#)   :: PMatch vec vec' ans - PMatch vec' vec'' ans - PMatch vec vec''
 ans
 fail  :: PMatch vec vec' ans
 catch :: PMatch vec vec' ans - PMatch vec vec' ans - PMatch vec vec' ans

 These types are less general than the ones Haskell would infer, but
 they do not appear to lose any functionality.

 The currying part of the pattern is less easy to analyze. I've been
 able to use type families to relate the curried and uncurried form of
 the function types, but I'm working with GHC 6.8, so it's possible
 this won't work with the more modern implementations.

 Given the list of argument types and the answer type, generate a
 curried function type:

type family Curry vec ans
type instance Curry () ans = ans
type instance Curry (a,vec) ans = a - Curry vec ans

 zero, succ zero, and so forth take a function in curried form and
 transform it into a function that takes a nested tuple:

type CurryDigit vec ans = Curry vec ans - vec - ans

zero :: CurryDigit () ans
succ zero :: CurryDigit (a,()) ans

succ :: CurryDigit vec ans - CurryDigit (a,vec) ans
succ . succ :: CurryDigit vec ans - CurryDigit (a,(b,vec)) ans

 So the currying part of the pattern will have the form:

type PCurry vec vec' ans = CurryDigit vec' ans - CurryDigit vec ans

 So a pattern has the type,

type Pattern a vec vec' ans = (PCurry vec vec' ans, a - PMatch
 vec vec' ans)

 where a is the value being examined, vec and vec' are the list of
 unbound argument types before and after the match, and ans is the
 result.

var :: Pattern a (a,vec) vec ans
cst :: (Eq a) = a - Pattern a vec vec ans
pair :: Pattern a vec vec' ans - Pattern b vec' vec'' ans -
 Pattern (a,b) vec vec'' ans


 Coming from the other side, match takes a value and a case statement
 and produces a result:

type Case a ans = a - (() - ans) - ans   -- or just a - ans -
 ans in my code

match :: a - Case a ans - ans

 (|||) combines case statements:

(|||) :: Case a ans - Case a ans - Case a ans

 and (-) creates them from a pattern and a curried function,

(-) :: Pattern a vec () ans - Curry vec ans - Case a ans

 Note that (-) requires the pattern to leave no unbound variables
 after matching.


 Given the way everything is polymorphic in ans, it may be possible to
 hide it, but I haven't tried yet.


  The principal weakness of these pattern-matching combinators is that
 there
  is no support for algebraic types, i.e. things like
  data Tree a = Leaf | Branch (Tree a) (Tree a)
  I can see how to use Typeable to deal with that, but is there a simpler
 way?

 You can define the patterns manually:

 leaf = (id, \v - case v of { Leaf - nil; _ - fail })

 branch p q = (curry_p . curry_q, \v - case v of { Branch l r -
 match_p l # match_q r; _ - fail})
where
(curry_p, match_p) = p
(curry_q, match_q) = q

 I assume generating these would be pretty straightforward to automate
 with Template 

[Haskell-cafe] Can I build and install GHC 6.10.1 without previous installed ghc

2008-12-21 Thread Wang, Chunye (NSN - CN/Beijing)
Hi All,
 
 
   I have our own Linux distribution installed in my server. 
   it is based on RedHat 9.0. Because it is the server, I can 
   not update it to any other linux distribution

   Here is my situation, I have no machine with any version of ghc
installed. 

   This is what I did

% wget http://haskell.org/ghc/dist/6.10.1/ghc-6.10.1-src.tar.bz2
% wget
http://haskell.org/ghc/dist/6.10.1/ghc-6.10.1-src-extralibs.tar.bz2
% tar -jxf ghc-6.10.1-src-extralibs.tar.bz2 
%tar -jxvf ghc-6.10.1-src.tar.bz2 
% cd ghc-6.10.1
 % sh boot
grep: packages: No such file or directory
Booting .
Booting libraries/base
Booting libraries/directory
/usr/share/aclocal/libgcrypt.m4:23: warning: underquoted definition of
AM_PATH_LIBGCRYPT
  run info '(automake)Extending aclocal'
  or see
http://sources.redhat.com/automake/automake.html#Extending-aclocal
/usr/share/aclocal/ao.m4:9: warning: underquoted definition of
XIPH_PATH_AO
Booting libraries/editline
Booting libraries/network
Booting libraries/old-time
Booting libraries/process
Booting libraries/regex-posix
Booting libraries/time
Booting libraries/unix

% ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Canonicalised to: x86_64-unknown-linux
checking for ghc... no
checking for ghc-pkg matching ... no
checking for ghc-pkg... no
checking whether ghc has editline package... no
checking for nhc... no
checking for nhc98... no
checking for hbc... no
checking for ld... /usr/local/bin/ld
configure: error: GHC is required unless bootstrapping from .hc files.

I know http://hackage.haskell.org/trac/ghc/wiki/Building/Prerequisites
said that GHC 6.6 is required to build and install the GHC 6.10.1
So I try to follow the instructions
http://hackage.haskell.org/trac/ghc/wiki/Building/Porting.
Because I don't have any ghc installed in any machine. I have to use the
Porting GHC to a new platform 

%./configure --enable-hc-boot --enable-hc-boot-unregisterised
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Canonicalised to: x86_64-unknown-linux
checking for ghc... no
checking for ghc-pkg matching ... no
checking for ghc-pkg... no
checking whether ghc has editline package... no
checking for nhc... no
checking for nhc98... no
checking for hbc... no
checking for ld... /usr/local/bin/ld
checking for path to top of build tree... ./configure: line 2733: -v0:
command not found
./configure: line 2737: utils/pwd/pwd: No such file or directory
configure: error: cannot determine current directory

I think it is because the utils/pwd/pwd.hs is not compiled and linked
into the ``pwd''.
So I create a bash version of pwd

#!/bin/bash
pwd 

And m make it executeble, chmod +x utils/pwd/pwd 

Then I try to run the  ./configure --enable-hc-boot
--enable-hc-boot-unregisterised again

%./configure --enable-hc-boot --enable-hc-boot-unregisterised again
%cd includes
%make 
%cd ..

Finnally, I found I still need ghc is intalled on the host machine. 

%perl --version

This is perl, v5.8.5 built for x86_64-linux-thread-multi

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to
the
Internet, point your browser at http://www.perl.com/, the Perl Home
Page.

%gcc --version
gcc (GCC) 4.1.2
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

%make --version
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

%autoconf --version
autoconf (GNU Autoconf) 2.59
Written by David J. MacKenzie and Akim Demaille.

Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

%automake --version
automake (GNU automake) 1.9.2
Written by Tom Tromey tro...@redhat.com.

Copyright 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

%sed --version
GNU sed version 4.1.2
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE,
to the extent permitted by law.

%diff --version
diff (GNU 

Re: [Haskell-cafe] Can I build and install GHC 6.10.1 without previous installed ghc

2008-12-21 Thread Don Stewart
chunye.wang:
 Hi All,
  
  
I have our own Linux distribution installed in my server. 
it is based on RedHat 9.0. Because it is the server, I can 
not update it to any other linux distribution
 
Here is my situation, I have no machine with any version of ghc
 installed. 

Please use a basic linux binary.

http://haskell.org/ghc/download_ghc_6_10_1.html#x86linux

Such as Linux (x86)

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


RE: [Haskell-cafe] Can I build and install GHC 6.10.1 without previous installed ghc

2008-12-21 Thread Wang, Chunye (NSN - CN/Beijing)
 
Hi Don,

I tried to install the ghc 6.8.0 last year but failed for some
reason.
Now I decide to do it again, because I'd like to try
some 
examples in Real World Haskell

Now I remember why I try to install it from source code,

because the binary version has the following problem.

%./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Which we'll further canonicalise into: x86_64-unknown-linux
checking for path to top of build tree... pwd: timer_create: Invalid
argument
configure: error: cannot determine current directory

I know my linux distribution is a private modified version,
which is based on RedHat 9.0
I guess it is pretty old version. 
 
I also installed many other software from source code. 

I guess ``timer_create '' is failed because of library
confliction.

Best Regards
Chunye Wang chunye.w...@nsn.com


-Original Message-
From: ext Don Stewart [mailto:d...@galois.com] 
Sent: Monday, December 22, 2008 11:31 AM
To: Wang, Chunye (NSN - CN/Beijing)
Cc: Haskell-Cafe@haskell.org; glasgow-haskell-us...@haskell.org
Subject: Re: [Haskell-cafe] Can I build and install GHC 6.10.1 without
previous installed ghc

chunye.wang:
 Hi All,
  
  
I have our own Linux distribution installed in my server. 
it is based on RedHat 9.0. Because it is the server, I can 
not update it to any other linux distribution
 
Here is my situation, I have no machine with any version of ghc

 installed.

Please use a basic linux binary.

http://haskell.org/ghc/download_ghc_6_10_1.html#x86linux

Such as Linux (x86)

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


[Haskell-cafe] ANN: llvm-0.4.0.1

2008-12-21 Thread Lennart Augustsson
We have now released version 0.4.0.1 of the Haskell LLVM bindings.
(This release that is quite incompatible with the old 0.0.2 release.)

LLVM is a virtual machine and the bindings allow you to generate code
for this virtual machine.  This code can then be executed by a JIT
or written to a file for further processing by the LLVM tools.

The LLVM bindings has two layers.  You can either use the low level
bindings that is just the same as the C bindings for the LLVM.  This
level is quite unsafe as there is very little type checking.
The recommended way is a high level binding (somewhat less complete)
which eliminates many errors by leveraging the Haskell type system.

A simple example, generating code for a function that adds two
numbers and then calling it from Haskell:

import Data.Int
import LLVM.Core
import LLVM.ExecutionEngine

cgplus :: CodeGenModule (Function (Int32 - Int32 - IO Int32))
cgplus =
createFunction InternalLinkage $ \ x y - do
r - add x y
ret r

main = do
ioplus - simpleFunction cgplus
let plus = unsafePurify ioplus

print $ plus 20 22


Enjoy!
Bryan O'Sullivan
Lennart Augustsson
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe