[Haskell-cafe] Announcing OneTuple-0.1.0

2008-10-01 Thread John Dorsey
Fellow Haskellers,

Much attention has been paid over the years to the regrettable
omission of singleton tuples from Haskell.

I am pleased to announce OneTuple, a humble implementation of the
singleton tuple for Haskell.  Now you can:

*  Wrap a single value of any type in a OneTuple !

*  Pattern match to retrieve your value !

*  Solve any of the software problems that cannot be solved without
   the singleton tuple !

*  Enjoy instances for all the classes normal tuples have, plus more !

*  Proclaim feature parity with Python !

Note:  the singleton tuple does not support tuple syntax.

Contributions are welcome.  The project could use a tutorial, and a
decent test suite.  Strict singleton tuples are planned for the next
version.

Enjoy!

Regards,
John Dorsey

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


[Haskell-cafe] Restricted file reading monad

2008-10-01 Thread oleg

George Pollard wrote:
> The structure of an ID3 tag goes something like this:
> Header:
> - total size of tag
> - other header info
> A series of frames, each with:
> - total size of frame
> - other header info
> - frame data
>
> Since the ID3 tag as a whole has size information, I need to pass that
> into the frame-reading functions to ensure that I never read past the
> end of the total header. This exact same requirement is present within
> the frame-reading function itself; it must read the frame data without
> reading past the end of the frame.

The structure of the chunk-encoded content is similar: first comes the
size, then come data of that size. We have to read exactly that amount
(and then check for the chunk trailer, CRLF). In a sense, we have a
data stream embedded inside another stream. The Iteratee IO framework 
was specifically designed to process these sorts of arbitrarily
nested and encoded data streams. In particular, the file

http://okmij.org/ftp/Haskell/Iteratee/IterateeM.hs

contains the function

-- Read n elements from a stream and apply the given iteratee to the
-- stream of the read elements. Unless the stream is terminated early, we
-- read exactly n elements (even if the iteratee has accepted fewer).
-- This procedure shows a different way of composing two iteratees:
-- `vertical' rather than `horizontal'
stake :: Monad m =>
 Int -> IterateeG el m a -> IterateeGM el m (IterateeG el m a)

The implementation is 11 lines long, counting the `where' line. I
believe the code is declarative rather than imperative. The function
stake (the analogue of List.take) is then used in

enum_chunk_decoded :: Monad m => Iteratee m a -> IterateeM m a

The end of the file IterateeM.hs has several complete tests.


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


[Haskell-cafe] Class Quantification

2008-10-01 Thread oleg

Bas van Dijk wrote:

> ... it's possible to define 'foo' and 'bar' like so:
>
> > foo :: (Num c, Num d) => (forall b. Num b => a -> b) -> a -> (c, d)
> > foo f x = (f x, f x)
>
> > bar :: (Read c, Read d) => (forall b. Read b => a -> b) -> a -> (c, d)
> > bar f x = (f x, f x)
>
> Which allows us to write:
>
> > testFoo = foo fromInteger 1  :: (Int, Float)
> > testBar = bar read   "1" :: (Int, Float)
>
> Now I would like to generalise 'foo' and 'bar' to 'bla' so that I can write:
>
>  testBla1 = bla fromInteger 1  :: (Int, Float)
>  testBla2 = bla read   "1" :: (Int, Float)


Quantification over classes is *easily* achievable in
Haskell. Although functional dependencies are required, overlapping or
undecidable instances are not. The technique is also far simpler than
that in SYB3 and takes only a few lines to write. The complete code
follows. One may note that Rank2 types are *not* needed. Therefore, we
do not even have to give signature to the function bla as it can be
inferred. That technique suggests that Rank2 types are already present
in some form in Haskell (even Haskell98) already.

In more detail, the technique is explained in

  Class-parameterized classes, and the type-level logarithm
  http://okmij.org/ftp/Haskell/types.html#peano-arithm

  Type-class overloaded functions: second-order typeclass programming with
  backtracking
  http://okmij.org/ftp/Haskell/types.html#poly2

Here is the code

{-# LANGUAGE RankNTypes, MultiParamTypeClasses, FunctionalDependencies #-}
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}

-- the result type determines the argument type
class RApply l a b | l b -> a where
rapply :: l -> a -> b

-- the expected instance
instance RApply (a->b) a b where
rapply = ($)

data LRead = LRead
instance Read b => RApply LRead String b where
rapply _ = read

data LFromInt = LFromInt
instance Num b => RApply LFromInt Integer b where
rapply _ = fromInteger


bla x arg = (rapply x arg, rapply x arg)

testBla1 = bla LFromInt  1  :: (Int, Float)
testBla2 = bla LRead"1" :: (Int, Float)

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


Re: [Haskell-cafe] Health effects

2008-10-01 Thread ajb

G'day all.

Quoting Adrian Neumann <[EMAIL PROTECTED]>:


I often wonder how many cuts you need to divide a steak in n pieces.


One, if the cut is allowed to be curved and self-intersecting.

I think that the spirit of the problem, though is encapsulated in this
question: Given a circle, what is the maximum number of pieces that you
can divide it into by performing n straight cuts?

This is a great problem to set undergraduates, because if you work out
some small values of n on paper, you get:

n   #pieces
0   1
1   2
2   4
3   7

Most undergrads will stall at this point trying to work out how to
place the third line to get 8 pieces, and probably come up with an
incorrect justification for why it should be 2^n.

The details are here:

http://www.research.att.com/~njas/sequences/A000124

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


[Haskell-cafe] Haskell Weekly News: Issue 87 - October 1, 2008

2008-10-01 Thread Brent Yorgey
---
Haskell Weekly News
http://sequence.complete.org/hwn/20081001
Issue 87 - October 01, 2008
---

   Welcome to issue 87 of HWN, a newsletter covering developments in the
   [1]Haskell community.

   ICFP was held last week in Victoria, and by all accounts was a great
   success! This edition of the HWN includes much ICFP and Haskell
   Symposium-related content, including [2]videos of the Haskell symposium
   presentations, [3]programming contest results, some [4]notes on the
   future of Haskell, and slides from [5]a Haskell tutorial and [6]a talk
   about the Haskell Platform. But ICFP didn't seem to slow down the
   community all that much: you'll find the usual mix of newly released
   and updated packages, blog posts, mailing list discussions, and silly
   quotes as well.

Announcements

   Haskell-Embedded System Design: ForSyDe 3.0 and Tutorial. Alfonso
   Acosta [7]announced the [8]3.0 release of [9]ForSyDe. The ForSyDe
   (Formal System Design) methodology has been developed with the
   objective to move system design (e.g. System on Chip, Hardware and
   Software systems) to a higher level of abstraction. ForSyDe is
   implemented as a Haskell-embedded behavioral DSL (Domain Specific
   Language). The 3.0 release includes a new deep-embedded DSL and
   embedded compiler, as well as a new user-friendly tutorial.

   Graphalyze-0.1. Ivan Miljenovic [10]announced the initial release of
   his graph-theoretic analysis library, [11]Graphalyze. This is a
   pre-release of the library he is writing for his mathematics honours
   thesis, "Graph-Theoretic Analysis of the Relationships in Discrete
   Data".

   Symposium videos. Malcolm Wallace [12]announced [13]guerrilla videos of
   the Haskell Symposium 2008 presentations.

   ICFP programming contest results. Malcolm Wallace [14]sent a link to
   [15]a video of the ICFP programming contest results presentation.

   Version 0.4.3 of happs-tutorial is a HAppS job board, done in HAppS..
   Thomas Hartman [16]announced version 4 of the [17]self-demoing HAppS
   tutorial, a HAppS job board.

   TH code for deriving Binary and NFData instances. Tim Newsham
   [18]announced some [19]Template Haskell code for automatically deriving
   Data.Binary and Control.Parallel.Strategies.NFData instances.

   Notes on the future of Haskell from ICFP. Bryan O'Sullivan [20]posted a
   [21]writeup from the ICFP conference floor on the future of Haskell and
   functional programming.

   datapacker 1.0.1. John Goerzen [22]announced the [23]release of
   datapacker 1.0.1.

   A Functional Implementation of the Garsia-Wachs Algorithm. Nicolas
   Pouillard [24]announced a [25]Haskell implementation of an algorithm
   that builds a binary tree with minimum weighted path length from
   weighted leaf nodes given in symmetric order. This can be used to build
   optimum search tables, to balance a 'ropes' data structure in an
   optimal way.

   graphviz-2008.9.20. Ivan Miljenovic [26]announced a new version of
   [27]Matthew Sackman's Haskell bindings to Graphviz. See Ivan's original
   announcement for information on what new features are included, and
   what the difference is among the various graphviz-related packages on
   Hackage.

   darcs 2.1.0pre2. Eric Kow [28]announced the release of darcs 2.1.0pre2,
   formerly known as 2.0.3. See Eric's announcement for a list of new
   features and bug fixes in this release.

   protocol-buffers-0.2.9 for Haskell is ready. ChrisK [29]announced the
   release of the [30]protocol-buffers package, which generates Haskell
   data types that can be converted back and forth to lazy ByteStrings
   that interoperate with Google's generated code in C++/Java/python.

   panda blog engine. Jinjing Wang [31]announced the release of [32]panda,
   a simple blog engine written in Haskell.

   OpenSPARC project applicant chosen. Duncan Coutts [33]announced that
   Ben Lippmeier has been chosen for the [34]OpenSPARC project. Ben will
   spend three months hacking on GHC to make it perform well on the latest
   multi-core OpenSPARC chips.

   Hugs on the iPhone. Alberto Galdo [35]announced that he has gotten Hugs
   to run on the iPhone, and has made packages available for others who
   would like to install it as well.

Discussion

   Shooting yourself in the foot in Haskell. John Van Enk [36]asked how to
   shoot yourself in the foot with Haskell, with humorous results.

   Total Functional Programming in Haskell. Jason Dagit started a
   [37]discussion on total functional programming, Haskell, abstraction
   boundaries and the IO monad, and related topics.

   Health effects. Andrew Coppin told a [38]story about a chocolate bar
   and recursion, which led to a discussion of optimization problems,
   Dedekind cuts, some meta-discussion of the discu

Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Jason Dusek
  Reply to all?

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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Marco Túlio Gontijo e Silva
Op woensdag 01-10-2008 om 10:15 uur [tijdzone +0200], schreef Ketil
Malde:
> Derek Elkins <[EMAIL PROTECTED]> writes:
> 
> >> parseCSVFromFile "in.csv" >>= return . either (const "error!")
> 
> > Whenever you see this >>= return . f pattern think liftM or fmap or <$>.
> 
> ...and "return . f >>= action" is just "action . f", no?

Maybe you meant "return f >>= action" is the same as "action f".

Greetings.

-- 
marcot
Página: http://marcotmarcot.iaaeee.org/
Blog: http://marcotmarcot.blogspot.com/
Correio: [EMAIL PROTECTED]
XMPP: [EMAIL PROTECTED]
IRC: [EMAIL PROTECTED]
Telefone: 25151920
Celular: 98116720
Endereço:
  Rua Turfa, 639/701
  Prado 30410-370
  Belo Horizonte/MG Brasil


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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Marco Túlio Gontijo e Silva
Op woensdag 01-10-2008 om 13:25 uur [tijdzone -0700], schreef Martin
DeMello:
> 2008/10/1 wman <[EMAIL PROTECTED]>:
> >
> > PS: Sorry, Andrew, that I first posted the reply directly to you, still
> > getting used to the fact that gmail kindly replies to the user on whose
> > behalf the message was sent, not to the list.
> 
> I think that's a list setting, not a gmail one.

The list could set reply-to, which is usually not very recommended in
netiquettes.  And gmail doesn't have a reply-to-list option, which is
very useful when the lists doesn't set reply-to, like haskell-cafe.

Greetings.

-- 
marcot
Página: http://marcotmarcot.iaaeee.org/
Blog: http://marcotmarcot.blogspot.com/
Correio: [EMAIL PROTECTED]
XMPP: [EMAIL PROTECTED]
IRC: [EMAIL PROTECTED]
Telefone: 25151920
Celular: 98116720
Endereço:
  Rua Turfa, 639/701
  Prado 30410-370
  Belo Horizonte/MG Brasil


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


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread ajb

G'day all.

On Wed, Oct 1, 2008 at 3:42 PM, Jake McArthur <[EMAIL PROTECTED]> wrote:


Couldn't match expected type 'Deer' against inferred type 'Foot'


No instance for (Target Foot)
  arising from use of `shoot' at SelfInflictedInjury.hs:1:0
Possible fix: add an instance declaration for (Target Foot)
In the expression: shoot foot

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


Re: [Haskell-cafe] Restricted file reading monad

2008-10-01 Thread Jason Dusek
  This is something of the blind leading the blind, but you seem
  to need a bit of state monad mixed with IO monad. So you could
  look into StateT, a monad transformer, which should make you a
  StateIO monad specialized to FileReader. Then you define a
  `runFileReader` that allows you to jump into the FileReader
  monad.

  I defined a "pointer walking" monad a while back, but that did
  all the IO with `unsafePerformIO`, so I could use a pure State
  monad.

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


[Haskell-cafe] Restricted file reading monad

2008-10-01 Thread George Pollard
Hello all,

I'm currently working on a (toy) ID3 [1] tag reader, which made me think
of a library which might be quite useful.

The structure of an ID3 tag goes something like this:

Header: 
- total size of tag
- other header info
A series of frames, each with:
- total size of frame
- other header info
- frame data

Since the ID3 tag as a whole has size information, I need to pass that
into the frame-reading functions to ensure that I never read past the
end of the total header. This exact same requirement is present within
the frame-reading function itself; it must read the frame data without
reading past the end of the frame.

It would be nice to have some kind of monad or similar so that I could
do:

> readTag = do
>   size <- -- read size
>   -- read other header info
>   withLimit size $ -- read frames

then the read-frames function would be able to do its work without
having to worry about size-checking all the time, as this would be
implicit. (And similarly with the frame-reading functions as well.) This
could easily be extended to:

> f x = readManyWithLimit size readerFunction

where readManyWithLimit would return a list of results of applying the
reader function as many times as possible within the size limit (and
possibly returning some kind of error if the reader function 'bails
early' and doesn't gobble right up to the end of the size limit).

The thing is, I've not implemented a monad of any substantial size so I
don't have a clue where to start. Calling it FileReader (for want of a
better name), I guess it would almost be the same as a parsing monad, so
the type would have a reference to the file Handle and the current index
into the file, as well as the last point that it's allowed to read up
to.

So, umm... a rather open-ended question, but how would I go about this?

[1]: http://www.id3.org/Developer_Information


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] flipped IO sequence

2008-10-01 Thread Luke Palmer
2008/10/1 Cetin Sert <[EMAIL PROTECTED]>:
> warn :: String → IO Int
> warn = return 1 << putStrLn-- causes an error
>   -- = \msg → return 1 << putStrLn msg -- works just fine
>   -- = \msg → putStrLn msg >> return 1 -- works just fine
>
> (<<) :: Monad m ⇒ m b → m a → m b
> b << a = a >>= \_ → b
>
> Why do I get this compile-time error?? How can one define << ?

While this isn't directly what you're doing, you might be interested
in the Kleisli composition operators in Control.Monad:

  (>=>) :: (Monad m) => (a -> m b) -> (b -> m c) -> (a -> m c)
  (<=<) :: (Mnoad m) => (b -> m c) -> (a -> m b) -> (a -> m c)

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


Re: [Haskell-cafe] Re: Total Functional Programming in Haskell

2008-10-01 Thread wren ng thornton

Jason Dagit wrote:

I was asserting that Haskell is currently 2 layered.  Purely functional vs.
IO.  They integrate nicely and play well together, but I still think of them
as distinct layers.  Perhaps this is not fair or confusing though.  The
paper I cited did indeed use codata to define streams so that something,
such as an OS, that needs to process infinite streams of requests can still
do so.


For a first take on monads, that's not a bad way of thinking about it. 
But, once you move beyond first thoughts, monads aren't a special 
separate layer and thinking of them as such is liable to land you in 
trouble. Monads really are pure, it's just that they get there by 
existentializing over impurities.[1]


Perhaps you really do mean only the IO monad and not any others, but 
then the question becomes: whose IO? The IO monad is well-known to be a 
sin bin for things people don't know or care enough about. Over time 
things get added to IO and over time things get broken off into their 
own monads. So then where is the layer boundary over time? I assert that 
there's no meaningful place to draw the boundary because there's nothing 
particularly special about IO that isn't shared by other monads like ST 
or ACIO.


It'd be nice to have a total core language, but it's not clear how to 
helpfully represent such things in the type system. One variety of 
non-totality is the |error| function. We could design our types to say 
that people can't call it, but the whole purpose of |error| is to raise 
exceptions (a monadic action) from pure code; so as far as the types are 
concerned, we already can't do any such things. We can eliminate many 
instances of those non-totalities by adding in refinement types (a 
modest proposal), in order to prevent people from passing [] to |head| 
or |tail|, or passing 0 as the denominator of (/), etc.


But there are other non-totalities, such as _|_ which cannot be captured 
by such means. In order to capture many instances of _|_ we'd need to 
have our type represent their depth so that we can do co/induction in 
order to ensure that the function terminates. While we can capture a 
surprising level of such detail in Haskell's type system, this is 
marching off in the direction of dependent types which would be making 
things more complex rather than simpler. I'm not saying that we 
shouldn't head there, but it doesn't seem to be addressing the goals you 
had in mind.



[1] Just like existential types, you can put something in but you can 
never get it back out again. For inescapable monads like IO and ST, this 
is why they have the behavior of sucking your whole program into the 
existential black-hole.


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


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread Luke Palmer
On Wed, Oct 1, 2008 at 3:42 PM, Jake McArthur <[EMAIL PROTECTED]> wrote:
> John Van Enk wrote:
>>
>> I had a co-worker ask me how you'd shoot your self in the foot with
>> Haskell. [...] Some one please give me something more worth of the original
>> list.
>
> Couldn't match expected type 'Deer' against inferred type 'Foot'

This one is my favorite!

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


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread Gwern Branwen
On 2008.10.01 15:38:08 -0700, Jason Dagit <[EMAIL PROTECTED]> scribbled 4.3K 
characters:
>Heh.  Nice.  Oleg has earned himself the Haskell equivalent of a Chuck 
> Norris reputation.
>Except that Oleg has really earned the respect he gets from our teasing. 
> BTW, is there an
>Oleg Facts website?
>
>Jason

Lambdabot has/had a number of OlegFacts in its quote database. @quote as usual, 
or if you want to look at the whole list of quotes, gunzip State/quote.

--
gwern
Trade UXO Consul Golf genetic import JOTS DCSS Flame lead


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


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread Martin DeMello
On Wed, Oct 1, 2008 at 3:39 PM, Bill <[EMAIL PROTECTED]> wrote:
> On Wed, 2008-10-01 at 16:46 -0400, John Van Enk wrote:
>   . . .
>> I fully realize how un-clever this is. Some one please give me
>> something more worth of the original list. :)
>
> You shoot the gun but nothing happens (Haskell is pure, after all).

putting the unsafe in unsafePerformIO!

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


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread John Melesky

On Oct 1, 2008, at 1:46 PM, John Van Enk wrote:

"You shoot the gun, but the bullet gets trapped in the IO monad."


You have a shootFoot function which you've proven correct. QuickCheck  
validates it for arbitrary you-like values. It will be evaluated only  
when you end up at the hospital. You hope this doesn't come to pass,  
as it actually returns a bullet-ridden copy of yourself and you don't  
want to be garbage-collected.


or

foreign import ccall "shootparts.h shootfoot" shoot_foot :: Gun ->  
Programmer -> IO ()



-johnnn

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


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread Evan Laforge
On Wed, Oct 1, 2008 at 3:39 PM, Bill <[EMAIL PROTECTED]> wrote:
> On Wed, 2008-10-01 at 16:46 -0400, John Van Enk wrote:
>   . . .
>> I fully realize how un-clever this is. Some one please give me
>> something more worth of the original list. :)
>
> You shoot the gun but nothing happens (Haskell is pure, after all).

Your foot is fine, until you try to walk on it, at which point it
becomes mangled.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread Bill
On Wed, 2008-10-01 at 16:46 -0400, John Van Enk wrote:
   . . .
> I fully realize how un-clever this is. Some one please give me
> something more worth of the original list. :)

You shoot the gun but nothing happens (Haskell is pure, after all).

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


Re: [Haskell-cafe] Re: Health effects

2008-10-01 Thread Bill
On Wed, 2008-10-01 at 20:56 +0100, Andrew Coppin wrote:
   . . .
> You know, it's interesting... I posted this in another forum, and people 
> just said "dude, why would you try to eat a whole 2 Kg of chocolate? 
> That's really unhealthy." I post the same thing here and now people are 
> arguing about Dedekind cuts... da HELL?! o_O
> 
> An interesting dichotomy of perspectives, don't you think?

Maybe the dichotomy is in the distribution of free-wheeling imagination.
I'm reminded of the (apocryphal?) story about Hilbert's assessment of
poetry and mathematics.

 -- Bill Wood


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


Re: [Haskell-cafe] (A little humour)

2008-10-01 Thread Dan Piponi
On Wed, Oct 1, 2008 at 2:45 PM, Dan Piponi <[EMAIL PROTECTED]> wrote:

> In the proposed notation, within [[]]'s there is an implied <*> for every 
> space.

Come to think of it, surely that's why they're called *applicative*
functors. In Haskell, a space between identifiers corresponds
implicitly to the 'application' operator. (Sometimes it's written
explicitly as @, as in
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.54.6644).
Applicative functors are simply a mechanism to allow the redefinition
of application, just like how monads allow you to 'redefine' the
semicolon.
--
Dan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread John Van Enk
On Wed, Oct 1, 2008 at 6:38 PM, Jason Dagit <[EMAIL PROTECTED]> wrote:

>
>
> Heh.  Nice.  Oleg has earned himself the Haskell equivalent of a Chuck
> Norris reputation.  Except that Oleg has really earned the respect he gets
> from our teasing.  BTW, is there an Oleg Facts website?
>
> Jason
>
>
Not that I know of, but there is a Stallman Facts website:

Originated here:
http://www.reddit.com/r/programming/comments/675jj/richard_stallman_is_the_new_chuck_norris
URLed here: http://www.stallmanfacts.com/

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


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Krzysztof Skrzętnicki
On Thu, Oct 2, 2008 at 00:00, Svein Ove Aas <[EMAIL PROTECTED]> wrote:
> That aside, why not start downloading in the background, while it's
> doing whatever you started cabal for? Assuming the network is working,
> you should have an updated package list by the time it's done;
> granted, it won't be used for *that* invocation, but next time you
> invoke cabal it will. If the download fails, just ignore it.

Personally I don't like the idea: If we know that there is newer
package list, why not use it? It feels somewhat unintuitive to me.

All best

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


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread Jason Dagit
On Wed, Oct 1, 2008 at 3:27 PM, Simon Brenner <[EMAIL PROTECTED]> wrote:

> On 10/1/08, John Van Enk <[EMAIL PROTECTED]> wrote:
> > There's the well known "How to shoot your self in the foot" list which I
> > have it printed and taped on my desk at work.
> >
> > http://www-users.cs.york.ac.uk/susan/joke/foot.htm
> >
> >  I had a co-worker ask me how you'd shoot your self in the foot with
> > Haskell. Here's the best I could do:
> >
> > "You shoot the gun, but the bullet gets trapped in the IO monad."
>
> While compiling your program the compiler produces a type error long
> enough to overflow a kernel buffer, overwrite the trigger control
> register and shoot you in the foot.
>
> or
>
> After trying to decipher the type errors from the compiler, your head
> explodes.


Or as GHC says:
My brain just exploded.

And of course it says that because:
I can't handle pattern bindings for existentially-quantified
constructors.
Instead, use a case-expression, or do-notation, to unpack the
constructor.

But, telling people that part takes the fun out of :)



>
>
> or
>
> After you've finally found a way to circumvent the type system and
> shoot yourself in the foot, Oleg appears out of nothing and shoots you
> in the foot for coming up with it before him.


Heh.  Nice.  Oleg has earned himself the Haskell equivalent of a Chuck
Norris reputation.  Except that Oleg has really earned the respect he gets
from our teasing.  BTW, is there an Oleg Facts website?

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


Re: [Haskell-cafe] Re: Health effects

2008-10-01 Thread Brandon S. Allbery KF8NH

On 2008 Oct 1, at 15:56, Andrew Coppin wrote:

Benjamin L.Russell wrote:

On Tue, 30 Sep 2008 19:54:17 +0200, Adrian Neumann
<[EMAIL PROTECTED]> wrote:
I often wonder how many cuts you need to divide a steak in n  
pieces.  You can obviously get n pieces with (sqrt n) cuts by  
cutting a grid.  But I'm sure some smart mathematician thought of  
a (log n) way.


Good thing that the chocolate slab was only 2 kg and of finite  
length.

Had it been of infinite length, we would need Dedekind cuts to
partition it ;)


You know, it's interesting... I posted this in another forum, and  
people just said "dude, why would you try to eat a whole 2 Kg of  
chocolate? That's really unhealthy." I post the same thing here and  
now people are arguing about Dedekind cuts... da HELL?! o_O


An interesting dichotomy of perspectives, don't you think?



And if you'd posted on the LOPSA (http://lopsa.org) list it would  
probably be a discussion of which OS is which kind of chocolate.   
So?  :)


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
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] Shooting your self in the foot with Haskell

2008-10-01 Thread Simon Brenner
On 10/1/08, John Van Enk <[EMAIL PROTECTED]> wrote:
> There's the well known "How to shoot your self in the foot" list which I
> have it printed and taped on my desk at work.
>
> http://www-users.cs.york.ac.uk/susan/joke/foot.htm
>
>  I had a co-worker ask me how you'd shoot your self in the foot with
> Haskell. Here's the best I could do:
>
> "You shoot the gun, but the bullet gets trapped in the IO monad."

While compiling your program the compiler produces a type error long
enough to overflow a kernel buffer, overwrite the trigger control
register and shoot you in the foot.

or

After trying to decipher the type errors from the compiler, your head explodes.

or

After you've finally found a way to circumvent the type system and
shoot yourself in the foot, Oleg appears out of nothing and shoots you
in the foot for coming up with it before him.

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


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Svein Ove Aas
On Wed, Oct 1, 2008 at 10:52 PM, Duncan Coutts
<[EMAIL PROTECTED]> wrote:
> On Wed, 2008-10-01 at 20:53 +0200, Svein Ove Aas wrote:

>> and you have network access, start updating it.
>
> That's hard. Detecting if we would be able to make a network connection
> without actually doing it is not something I know how to do (esp in a
> portable way). We would very much appreciate some help in this area.
>
OS X has a function to test that, and a way to get notified when the
access state changes; it never occurred to me that other OSs might
not. It only tests for local connectivity, though.

That aside, why not start downloading in the background, while it's
doing whatever you started cabal for? Assuming the network is working,
you should have an updated package list by the time it's done;
granted, it won't be used for *that* invocation, but next time you
invoke cabal it will. If the download fails, just ignore it.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread wman
On Wed, Oct 1, 2008 at 10:52 PM, Duncan Coutts
<[EMAIL PROTECTED]>wrote:

> > and you have network access, start updating it.
>
> That's hard. Detecting if we would be able to make a network connection
> without actually doing it is not something I know how to do (esp in a
> portable way). We would very much appreciate some help in this area.
>
> Duncan
>

Well, i wouldn't try to detect it. If someone has some auto-update interval
specified, it would be sensible enough to try the update automatically imho.

Or, if the package server would responds to ICMP echo requests (seems like
it doesn't), this seems as a cheap-enough way to test whether it should try
to update.

Or how about http/1.1 if-modified-since header field ?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] (A little humour)

2008-10-01 Thread Dan Piponi
On Wed, Oct 1, 2008 at 2:59 AM, Manlio Perillo <[EMAIL PROTECTED]> wrote:
> Miguel Mitrofanov ha scritto:

> By the way, is it technically possible (and feasible), in Haskell, to define
> a space operator?

In a way it's what is described in this paper:
http://www.cs.nott.ac.uk/~ctm/IdiomLite.pdf

In the proposed notation, within [[]]'s there is an implied <*> for every space.
--
Dan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread Jake McArthur

John Van Enk wrote:
I had a co-worker ask me how you'd shoot your self in the foot with 
Haskell. [...] Some one please give me something more worth of the 
original list.

Couldn't match expected type 'Deer' against inferred type 'Foot'

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


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Duncan Coutts
On Wed, 2008-10-01 at 20:53 +0200, Svein Ove Aas wrote:
> On Wed, Oct 1, 2008 at 7:54 PM, Duncan Coutts
> > Because we actually consult the index of available packages more often
> > than you think. Every time you cabal install in a local directory we
> > make sure all the required packages are available and consistent. If we
> > had to go to the network every time you would not be happy.
> >
> > There should be a solution here that lets us update more automatically
> > while still allowing people to do offline operations. I'm not sure what
> > that solution is yet though.
> >
> The solution seems obvious to me, actually:
> 
> Check the timestamp of the package file at every access. If it's older
> than some configurable value,

Yes, that's the interim solution we're suggesting in the ticket, though
warning rather than actually blocking and going to the network.

> and you have network access, start updating it.

That's hard. Detecting if we would be able to make a network connection
without actually doing it is not something I know how to do (esp in a
portable way). We would very much appreciate some help in this area.

Duncan

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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Claus Reinke

(writeFile "output.csv") =<< (liftM printCSV $ liftM (map
updateLine) $ parseCSVFromFile "input.csv")



Um... Does anybody else find it interesting that we are "showing the
beauty of Haskell" by attempting to construct the most terse, cryptic,
unmaintainable tangle of point-free code


I don't agree at all!  How could a pipeline like this possibly be more
clearly expressed than by the pattern: 


  readInputFile "input" >>= mungeStuff >>= writeOutputFile "output"


   interact pureMungeStuff

After all, you're looking for oneliners, not real programs.

   interact $ either (error . show) (printCSV . map updateLine) . parseCSV "" 


Claus

-- some people need a vacation


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


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread Martin DeMello
2008/10/1 Joachim Breitner <[EMAIL PROTECTED]>:
>
> You shoot the gun, but nobody notices because no-one evaluates the
> target.

Who'd've thunk it!

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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread wman
On Wed, Oct 1, 2008 at 10:40 PM, Andrew Coppin
<[EMAIL PROTECTED]>wrote:

> Maybe I should start a new tradition where Haskellers have a blob of
> Haskell as their sig?
>
> (I can't *wait* to see what the luminaries such as dons, dcoutts and igloo
> come up with...)
>

Some haskell equivalent of :

(lambda(x)x x)x)x)x)x)x)x)x))
(lambda(x)(lambda(y)(x(x y)
   (lambda(x)(x)x))
  (lambda()(printf "Greetings, Jos~n"

? ;-)))

and seeing ketil's sig, i cannot keep to myself this beautiful
bastardization of the "shoulders of giants" line which i found today:

Most men stand on the shoulders of giants. Matthew Garrett stamps on the
testicles of midgets.

PS: it seems the list won't re-send the message to people to whom it was
directly addressed. so to stay in my on-click lazy mode, i'm trying the
reply-to-all button. In the case i start flooding your mailboxes, just
kindly kick my butt. thx
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Gwern Branwen
On 2008.10.01 13:24:55 -0700, Martin DeMello <[EMAIL PROTECTED]> scribbled 0.9K 
characters:
> On Wed, Oct 1, 2008 at 1:06 PM, Gwern Branwen <[EMAIL PROTECTED]> wrote:
>
> > Yi fails on Alex because Cabal doesn't track executables, nor executables 
> > needed for installation. You want 'cabal install alex yi';
>
> Yay, that finally worked :) Had to add ~/.cabal/bin to my path first,
> which wasn't hard to figure out but should probably also be in a faq
> somewhere.

The exact issue of where to install executables is somewhat tricky; adding 
~/.cabal/bin is one option, but you could've used --prefix=/home/martin/ or you 
could've used the symlink option in ~/.cabal/config or... There's not really a 
Cabal-install FAQ for that because there's no clear answer.

> > I believe the FAQ covers this.
>
> Nope. I was following http://www.haskell.org/haskellwiki/Yi when I got
> stuck, and the page makes no mention of how to resolve the alex
> dependency
>
> > As for cabal install yi-gtk, unless things have changed since I last 
> > looked, the answer is Don't Do That. yi-gtk and yi-vty are solely for yi 
> > 0.3 and below - it's obsolete, in other words. Yi depends directly on vty 
> > (which cabal install will handle) and GTK2HS, which unfortunately is not on 
> > Hackage and so you or your distro has to handle that.
>
> Okay, thanks :)
>
> martin

I've added those 2 questions to the installation section. They've come up so 
often I was sure they were already there.

--
gwern
monarchist DCJFTF EADA SASSTIXS Kamumaruha Waihopai phones Colonel IA wideband


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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Ketil Malde
Andrew Coppin <[EMAIL PROTECTED]> writes:

>> (writeFile "output.csv") =<< (liftM printCSV $ liftM (map
>> updateLine) $ parseCSVFromFile "input.csv")

> Um... Does anybody else find it interesting that we are "showing the
> beauty of Haskell" by attempting to construct the most terse, cryptic,
> unmaintainable tangle of point-free code

I don't agree at all!  How could a pipeline like this possibly be more
clearly expressed than by the pattern: 

   readInputFile "input" >>= mungeStuff >>= writeOutputFile "output"

?  The OP asks for improvements, which got rid of a couple of
gratuitous liftMs and such, but otherwise I think it's a pretty
straightforward idiom.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Martin DeMello
On Wed, Oct 1, 2008 at 1:06 PM, Gwern Branwen <[EMAIL PROTECTED]> wrote:

> Yi fails on Alex because Cabal doesn't track executables, nor executables 
> needed for installation. You want 'cabal install alex yi';

Yay, that finally worked :) Had to add ~/.cabal/bin to my path first,
which wasn't hard to figure out but should probably also be in a faq
somewhere.

> I believe the FAQ covers this.

Nope. I was following http://www.haskell.org/haskellwiki/Yi when I got
stuck, and the page makes no mention of how to resolve the alex
dependency

> As for cabal install yi-gtk, unless things have changed since I last looked, 
> the answer is Don't Do That. yi-gtk and yi-vty are solely for yi 0.3 and 
> below - it's obsolete, in other words. Yi depends directly on vty (which 
> cabal install will handle) and GTK2HS, which unfortunately is not on Hackage 
> and so you or your distro has to handle that.

Okay, thanks :)

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


Re: [Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread Joachim Breitner
Hi,

Am Mittwoch, den 01.10.2008, 16:46 -0400 schrieb John Van Enk:
> There's the well known "How to shoot your self in the foot" list which
> I have it printed and taped on my desk at work.
> 
> http://www-users.cs.york.ac.uk/susan/joke/foot.htm
> 
>  I had a co-worker ask me how you'd shoot your self in the foot with
> Haskell. Here's the best I could do:
> 
> "You shoot the gun, but the bullet gets trapped in the IO monad."

You shoot the gun, but nobody notices because no-one evaluates the
target.

Greetings,
Joachim

-- 
Joachim "nomeata" Breitner
  mail: [EMAIL PROTECTED] | ICQ# 74513189 | GPG-Key: 4743206C
  JID: [EMAIL PROTECTED] | http://www.joachim-breitner.de/
  Debian Developer: [EMAIL PROTECTED]


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Shooting your self in the foot with Haskell

2008-10-01 Thread John Van Enk
There's the well known "How to shoot your self in the foot" list which I
have it printed and taped on my desk at work.

http://www-users.cs.york.ac.uk/susan/joke/foot.htm

 I had a co-worker ask me how you'd shoot your self in the foot with
Haskell. Here's the best I could do:

"You shoot the gun, but the bullet gets trapped in the IO monad."

I fully realize how un-clever this is. Some one please give me something
more worth of the original list. :)

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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Andrew Coppin

wman wrote:

Thats why i put those quotation marks around that part of sequence ;-))
AFAIK one-liners never were about comprehensibility, just about what 
you can cram into one line of code.


Any programmer should have no problems guessing what the line does 
does (even more so when looking at the "final" version without the 
abundant liftM's), the beauty of it lies in figuring how the heck it 
does what it does. And figuring that out should bring the "profound 
enlightenment experience; that experience which should make you a 
better programmer for the rest of your days, even if you never 
actually use Lisp -erm Haskell- itself a lot" (my apologies, P. 
Graham, for cannibalizing your words).


I should probably get myself a signature stating that i will 
explicitly warn the reader when being serious ;-)


Ah, well then... ;-)

Over in the land of POV-Ray, it's sort-of a tradition for your email 
signature to contain a tiny block of Scene Description Language source 
code that causes POV-Ray to render your name, or at least render 
something appropriate. (For those who don't know, POV-Ray is a ray 
tracer who's Scene Description Language is now in fact Turing-complete - 
although it is only a sort of macro expansion kind of beast.)


Maybe I should start a new tradition where Haskellers have a blob of 
Haskell as their sig?


(I can't *wait* to see what the luminaries such as dons, dcoutts and 
igloo come up with...)


Ah, but a blob of code that does _what_? POV-Ray renders your name in 
trippy 3D, but Haskell...?


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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Martin DeMello
2008/10/1 wman <[EMAIL PROTECTED]>:
>
> PS: Sorry, Andrew, that I first posted the reply directly to you, still
> getting used to the fact that gmail kindly replies to the user on whose
> behalf the message was sent, not to the list.

I think that's a list setting, not a gmail one.

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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Brandon S. Allbery KF8NH

On Oct 1, 2008, at 15:51 , Andrew Coppin wrote:

wman wrote:
Long story short, I promised him a one-liner to "show the power and  
beauty of Haskell".


(writeFile "output.csv") =<< (liftM printCSV $ liftM (map  
updateLine) $ parseCSVFromFile "input.csv")


Is there room for improvement ?


Um... Does anybody else find it interesting that we are "showing the  
beauty of Haskell" by attempting to construct the most terse,  
cryptic, unmaintainable tangle of point-free code that the combined  
mindpower of the entire mailing list can produce?



To a certain geek mindset, that *is* the power and beauty.
(Then again, that's the mindset that publishes incomprehensible JAPHs  
in their .signature files.)


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
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] csv one-liner

2008-10-01 Thread wman
Thats why i put those quotation marks around that part of sequence ;-))
AFAIK one-liners never were about comprehensibility, just about what you can
cram into one line of code.

Any programmer should have no problems guessing what the line does does
(even more so when looking at the "final" version without the abundant
liftM's), the beauty of it lies in figuring how the heck it does what it
does. And figuring that out should bring the "profound enlightenment
experience; that experience which should make you a better programmer for
the rest of your days, even if you never actually use Lisp -erm Haskell-
itself a lot" (my apologies, P. Graham, for cannibalizing your words).

I should probably get myself a signature stating that i will explicitly warn
the reader when being serious ;-)

PS: Sorry, Andrew, that I first posted the reply directly to you, still
getting used to the fact that gmail kindly replies to the user on whose
behalf the message was sent, not to the list.

On Wed, Oct 1, 2008 at 9:51 PM, Andrew Coppin
<[EMAIL PROTECTED]>wrote:

> wman wrote:
>
>> Long story short, I promised him a one-liner to "show the power and beauty
>> of Haskell".
>>
>> (writeFile "output.csv") =<< (liftM printCSV $ liftM (map updateLine) $
>> parseCSVFromFile "input.csv")
>>
>> Is there room for improvement ?
>>
>
> Um... Does anybody else find it interesting that we are "showing the beauty
> of Haskell" by attempting to construct the most terse, cryptic,
> unmaintainable tangle of point-free code that the combined mindpower of the
> entire mailing list can produce?
>
> Yes, there is much to be said for the power and brevity of Haskell. But you
> *can* go over the top here, people! o_O
>
> Keep it short _yet comprehensible_, IMHO.
>
>
> ___
> 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: Hmm, what license to use?

2008-10-01 Thread Philippa Cowderoy
On Wed, 1 Oct 2008, Don Stewart wrote:

> malcolm.wallace:
> > Just a small nuance to what Don wrote:
> > > so opinion seems to be that LGPL licensed *Haskell
> > > libaries* are unsuitable for any projects you want to ship
> > > commercially, without source code.
> > 
> > Unless you use a different compiler.
> > 
> > Malcolm "keeping the dream of multiple implementations alive"  
> 
> And keep dividing our compiler teams' efforts, while
> single-implementation languages conquer :)
> 
> Don "thinking that compiler developer fragmentation doesn't help now 
> the language research is 'done'"
> 

I'm not at all sure I agree with you there. That said, licensing's a 
particularly poor reason for a separate implementation.

-- 
[EMAIL PROTECTED]

'In Ankh-Morpork even the shit have a street to itself...
 Truly this is a land of opportunity.' - Detritus, Men at Arms
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Hmm, what license to use?

2008-10-01 Thread Tom Schrijvers

   Don "thinking that compiler developer fragmentation doesn't help now the language 
research is 'done'"


Language researchers should move to a new language?

Tom

--
Tom Schrijvers

Department of Computer Science
K.U. Leuven
Celestijnenlaan 200A
B-3001 Heverlee
Belgium

tel: +32 16 327544
e-mail: [EMAIL PROTECTED]
url: http://www.cs.kuleuven.be/~toms/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Gwern Branwen
On 2008.10.01 12:52:47 -0700, Martin DeMello <[EMAIL PROTECTED]> scribbled 1.2K 
characters:
> On Tue, Sep 30, 2008 at 9:01 PM, Duncan Coutts
> <[EMAIL PROTECTED]> wrote:
> > On Wed, 2008-10-01 at 01:59 +0200, Cetin Sert wrote:
> >> A reminder:
> >>
> >> When I wanted to upgrade to yi 0.4.6.2, I needed to download the new
> >> package list
> >>
> >> cabal update   #download list of new packages
> >> cabal upgrade #make any upgrades
> >
> > Note that 'cabal upgrade' upgrades everything you've currently got
> > installed (which in general is not necessarily possible).
> >
> > The standard workflow is just:
> >
> > cabal update#download list of new packages
> > cabal install yi#install latest version of yi
>
> $ cabal install yi
> Resolving dependencies...
> 'yi-0.4.6.2' is cached.
> Configuring yi-0.4.6.2...
> cabal: alex version >=2.0.1 && <3 is required but it could not be found.
> cabal: Error: some packages failed to install:
> yi-0.4.6.2 failed during the configure step. The exception was:
> exit: ExitFailure 1
>
> $ cabal install yi-gtk
> Resolving dependencies...
> cabal: cannot configure yi-gtk-0.2.1. It requires sourceview >=0.9.11
> There is no available version of sourceview that satisfies >=0.9.11
>
> Trying cabal upgrade didn't fix it - it still throws the same error.
>
> martin

Yi fails on Alex because Cabal doesn't track executables, nor executables 
needed for installation. You want 'cabal install alex yi'; I believe the FAQ 
covers this.

As for cabal install yi-gtk, unless things have changed since I last looked, 
the answer is Don't Do That. yi-gtk and yi-vty are solely for yi 0.3 and below 
- it's obsolete, in other words. Yi depends directly on vty (which cabal 
install will handle) and GTK2HS, which unfortunately is not on Hackage and so 
you or your distro has to handle that.

--
gwern
beef Croatian Waco, Mace H


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


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Martin DeMello
On Wed, Oct 1, 2008 at 1:04 PM, Svein Ove Aas <[EMAIL PROTECTED]> wrote:
> On Wed, Oct 1, 2008 at 9:52 PM, Martin DeMello <[EMAIL PROTECTED]> wrote:
>>
>> $ cabal install yi
>> Resolving dependencies...
>> 'yi-0.4.6.2' is cached.
>> Configuring yi-0.4.6.2...
>> cabal: alex version >=2.0.1 && <3 is required but it could not be found.
>> cabal: Error: some packages failed to install:
>> yi-0.4.6.2 failed during the configure step. The exception was:
>> exit: ExitFailure 1
>>
>> $ cabal install yi-gtk
>> Resolving dependencies...
>> cabal: cannot configure yi-gtk-0.2.1. It requires sourceview >=0.9.11
>> There is no available version of sourceview that satisfies >=0.9.11
>>
>> Trying cabal upgrade didn't fix it - it still throws the same error.
>>
> This is because the sourceview package is not on hackage - it's
> legacy, non-cabal code and can be found on
> http://www.haskell.org/gtk2hs/
>
> You'll have to install it manually, I'm afraid.

It's not just yi-gtk, though - yi itself isn't installing via cabal,
due to the alex version >=2.0.1 && <3 dependency.

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


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Svein Ove Aas
On Wed, Oct 1, 2008 at 9:52 PM, Martin DeMello <[EMAIL PROTECTED]> wrote:
>
> $ cabal install yi
> Resolving dependencies...
> 'yi-0.4.6.2' is cached.
> Configuring yi-0.4.6.2...
> cabal: alex version >=2.0.1 && <3 is required but it could not be found.
> cabal: Error: some packages failed to install:
> yi-0.4.6.2 failed during the configure step. The exception was:
> exit: ExitFailure 1
>
> $ cabal install yi-gtk
> Resolving dependencies...
> cabal: cannot configure yi-gtk-0.2.1. It requires sourceview >=0.9.11
> There is no available version of sourceview that satisfies >=0.9.11
>
> Trying cabal upgrade didn't fix it - it still throws the same error.
>
This is because the sourceview package is not on hackage - it's
legacy, non-cabal code and can be found on
http://www.haskell.org/gtk2hs/

You'll have to install it manually, I'm afraid.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: cabal upgrade

2008-10-01 Thread Svein Ove Aas
On Wed, Oct 1, 2008 at 9:56 PM, Stefan Monnier <[EMAIL PROTECTED]> wrote:
>> It's something to consider in the future, although a change-aware
>> "filesystem" (git, say? It's fast) would probably be better.
>^^^
>
> You misspelled "darcs".
>
I know how git would improve on darcs here:
It's (much) faster, and uses less space.

How would darcs improve on git?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Hmm, what license to use?

2008-10-01 Thread Don Stewart
malcolm.wallace:
> Just a small nuance to what Don wrote:
> 
> >   * Haskell libraries are always statically linked and agressively
> > inlined,
> 
> But only for GHC (and jhc?).
> 
> > so opinion seems to be that LGPL licensed *Haskell
> > libaries* are unsuitable for any projects you want to ship
> > commercially, without source code.
> 
> Unless you use a different compiler.
> 
> Malcolm "keeping the dream of multiple implementations alive"  

And keep dividing our compiler teams' efforts, while
single-implementation languages conquer :)

Don "thinking that compiler developer fragmentation doesn't help now the 
language research is 'done'" 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: cabal upgrade

2008-10-01 Thread Stefan Monnier
> It's something to consider in the future, although a change-aware
> "filesystem" (git, say? It's fast) would probably be better.
^^^

You misspelled "darcs".


Stefan

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


Re: [Haskell-cafe] Re: Health effects

2008-10-01 Thread Andrew Coppin

Benjamin L.Russell wrote:

On Tue, 30 Sep 2008 19:54:17 +0200, Adrian Neumann
<[EMAIL PROTECTED]> wrote:

  
I often wonder how many cuts you need to divide a steak in n pieces.  
You can obviously get n pieces with (sqrt n) cuts by cutting a grid.  
But I'm sure some smart mathematician thought of a (log n) way.



Good thing that the chocolate slab was only 2 kg and of finite length.
Had it been of infinite length, we would need Dedekind cuts to
partition it ;)
  


You know, it's interesting... I posted this in another forum, and people 
just said "dude, why would you try to eat a whole 2 Kg of chocolate? 
That's really unhealthy." I post the same thing here and now people are 
arguing about Dedekind cuts... da HELL?! o_O


An interesting dichotomy of perspectives, don't you think?

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


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Martin DeMello
On Tue, Sep 30, 2008 at 9:01 PM, Duncan Coutts
<[EMAIL PROTECTED]> wrote:
> On Wed, 2008-10-01 at 01:59 +0200, Cetin Sert wrote:
>> A reminder:
>>
>> When I wanted to upgrade to yi 0.4.6.2, I needed to download the new
>> package list
>>
>> cabal update   #download list of new packages
>> cabal upgrade #make any upgrades
>
> Note that 'cabal upgrade' upgrades everything you've currently got
> installed (which in general is not necessarily possible).
>
> The standard workflow is just:
>
> cabal update#download list of new packages
> cabal install yi#install latest version of yi

$ cabal install yi
Resolving dependencies...
'yi-0.4.6.2' is cached.
Configuring yi-0.4.6.2...
cabal: alex version >=2.0.1 && <3 is required but it could not be found.
cabal: Error: some packages failed to install:
yi-0.4.6.2 failed during the configure step. The exception was:
exit: ExitFailure 1

$ cabal install yi-gtk
Resolving dependencies...
cabal: cannot configure yi-gtk-0.2.1. It requires sourceview >=0.9.11
There is no available version of sourceview that satisfies >=0.9.11

Trying cabal upgrade didn't fix it - it still throws the same error.

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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Andrew Coppin

wman wrote:
Long story short, I promised him a one-liner to "show the power and 
beauty of Haskell".


(writeFile "output.csv") =<< (liftM printCSV $ liftM (map updateLine) 
$ parseCSVFromFile "input.csv")


Is there room for improvement ?


Um... Does anybody else find it interesting that we are "showing the 
beauty of Haskell" by attempting to construct the most terse, cryptic, 
unmaintainable tangle of point-free code that the combined mindpower of 
the entire mailing list can produce?


Yes, there is much to be said for the power and brevity of Haskell. But 
you *can* go over the top here, people! o_O


Keep it short _yet comprehensible_, IMHO.

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


Re: [Haskell-cafe] Re: cabal upgrade

2008-10-01 Thread Svein Ove Aas
On Wed, Oct 1, 2008 at 8:59 PM, Achim Schneider <[EMAIL PROTECTED]> wrote:
> Additionally, you could use rsync instead of a tbz download to speed
> things up. Gentoo does this right.
>
It wouldn't be *that* much faster, and the server load would be
higher. The current package index is.. what, half a megabyte?

It's something to consider in the future, although a change-aware
"filesystem" (git, say? It's fast) would probably be better.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] pure Haskell database

2008-10-01 Thread Manlio Perillo

Graham Fawcett ha scritto:

[...]

Never though about sparse array, what is the advantage?
For the complexity, the same of a good hash map.


Almost certainly worse complexity than a hash map; but the overhead
could be much smaller. If (for example) you only needed a small number
of key/value pairs (say, hundreds of thousands), you could implement
your "database" trivially, e.g. a NULL-terminated array of key/value
structs in shared memory. (Though having separate arrays for keys and
values might help cache locality and boost performance). Lookup might
be O(n) but with a small-ish N and with such a low overhead, it could
perform very, very well.




This seems an interesting idea, thanks.


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


[Haskell-cafe] Re: Hmm, what license to use?

2008-10-01 Thread Gour
> "Don" == Don Stewart <[EMAIL PROTECTED]> writes:

Don> * Only a small percent of Haskell libarires are LGPL, and
Don> nothing for which we don't have workarounds (e.g. HDBC vs
Don> galois-sqlite3 vs takusen).

Hmm, Gtk2Hs & wxhaskell - major GUI libs...


Sincerely,
Gour

-- 

Gour  | Zagreb, Croatia  | GPG key: C6E7162D



pgpUqC83iosJJ.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Doing something constructive. [Was: Climbing up the shootout...]

2008-10-01 Thread Manlio Perillo

Don Stewart ha scritto:

manlio_perillo:
However I'm looking for a good environment for implementing generic 
internet servers, or web applications with special needs.
As an example one of my "maybe future" tasks is to write a simple 
BitTorrent tracker + seeder.


You could look at conjure, the bitorrent client that uses STM for
network multiplexing,

http://darcs.haskell.org/~lemmih/conjure/



Its unfortunate that the project seems to be dead.

Twisted (a Python asynchronous framework) is a confortable environment, 
but I feel concurrent Haskell is superior.


Should be a lot faster, given there's compiled native code, and no
global locks. 


With Twisted you usually don't use threads.

> [...]


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


[Haskell-cafe] Re: cabal upgrade

2008-10-01 Thread Achim Schneider
"Svein Ove Aas" <[EMAIL PROTECTED]> wrote:

> On Wed, Oct 1, 2008 at 7:54 PM, Duncan Coutts
> > Because we actually consult the index of available packages more
> > often than you think. Every time you cabal install in a local
> > directory we make sure all the required packages are available and
> > consistent. If we had to go to the network every time you would not
> > be happy.
> >
> > There should be a solution here that lets us update more
> > automatically while still allowing people to do offline operations.
> > I'm not sure what that solution is yet though.
> >
> The solution seems obvious to me, actually:
> 
> Check the timestamp of the package file at every access. If it's older
> than some configurable value, and you have network access, start
> updating it.
>
Additionally, you could use rsync instead of a tbz download to speed
things up. Gentoo does this right.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.

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


Re: [Haskell-cafe] Re: Hmm, what license to use?

2008-10-01 Thread Malcolm Wallace

Just a small nuance to what Don wrote:


   * Haskell libraries are always statically linked and agressively
 inlined,


But only for GHC (and jhc?).


 so opinion seems to be that LGPL licensed *Haskell
 libaries* are unsuitable for any projects you want to ship
 commercially, without source code.


Unless you use a different compiler.

Regards,
Malcolm "keeping the dream of multiple implementations alive"  
Wallace


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


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Svein Ove Aas
On Wed, Oct 1, 2008 at 7:54 PM, Duncan Coutts
> Because we actually consult the index of available packages more often
> than you think. Every time you cabal install in a local directory we
> make sure all the required packages are available and consistent. If we
> had to go to the network every time you would not be happy.
>
> There should be a solution here that lets us update more automatically
> while still allowing people to do offline operations. I'm not sure what
> that solution is yet though.
>
The solution seems obvious to me, actually:

Check the timestamp of the package file at every access. If it's older
than some configurable value, and you have network access, start
updating it.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Hmm, what license to use?

2008-10-01 Thread Don Stewart
magnus:
> On Wed, Oct 1, 2008 at 3:31 AM, brian <[EMAIL PROTECTED]> wrote:
> [..]
> > as big a problem as I imagined. My understanding is that I can satisfy
> > the requirements of the LGPL by dynamically linking, and that's
> > already happening. Is there something else to worry about? I'd be in
> > violation if I shipped something statically linked, but cabal doesn't
> > seem inclined to do that by default.
> 
> I'm not sure I understand you here.  Would you clarify your words
> here, bearing in mind that GHC doesn't do dynamic linking of Haskell
> modules?

Yes, its very simple:

* C libraries are classically dynamically linked, so you're in
  compliance there with any LGPL C lib you use. (under the usual
  interpretation of the LGPL)

* Haskell libraries are always statically linked and agressively
  inlined, so opinion seems to be that LGPL licensed *Haskell
  libaries* are unsuitable for any projects you want to ship
  commercially, without source code.

* Only a small percent of Haskell libarires are LGPL, and nothing
  for which we don't have workarounds (e.g. HDBC vs galois-sqlite3
  vs takusen).

* None of the core system or Haskell platform are LGPLd, they're all
  "BSD3"

* "BSD3" style reminds the vast majority, and preferred license, for
  Haskell code.

IANAL.

-- Don "ship some Haskell today" Stewart
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Haskell Platform

2008-10-01 Thread Don Stewart
vigalchin:
>Hello,
> 
>  I probably missed some details for which I apologize. My feeling is
>that "periodically" the "haskell platform server" should attempt to
>rebuild the Haskell library. Any library that fails to rebuild then the
>"maintainer" of that library should be notified, e.g. email, pager(;^)),
>

Yes, automated build reporting and emails to maintainers are on the
agenda. 

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


[Haskell-cafe] Haskell, GHC, and ABI

2008-10-01 Thread Sean Leather
> Dynamic linking doesn't solve all the problems, we still have the problem
> that GHC does a lot of cross-module inlining, regardless of whether dynamic
> linking is used.  However, I really would like to have a way to have
> complete control over what is exposed across a package boundary.  We need
> this not just for licensing reasons, but also for making a dynamic library
> with a fixed ABI, so it can be upgraded later.
>
> Incedentally the lack of this feature is one reason I've not being rushing
> to get shared libraries into GHC.  They're just not that useful unless you
> can upgrade a library independently of the things it depends on.
>

I completely agree. Having a fixed ABI that survives library changes and
compiler upgrades is an important factor in achieving a useful system.

Incidentally, I perused
http://hackage.haskell.org/trac/ghc/wiki/DynamicLinking and didn't see much
about this here. Is there some notes or a plan for reaching this goal with
GHC (or any other Haskell compiler)?

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


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Duncan Coutts
On Wed, 2008-10-01 at 08:58 +0100, Malcolm Wallace wrote:
> >> When I wanted to upgrade to yi 0.4.6.2, I needed to download the new
> >> package list
> >>
> >> cabal update   #download list of new packages
> >> cabal upgrade #make any upgrades
> 
> I never knew there was a 'cabal update' command, and it worries me.   
> In my unhappy experience of packaging systems (apt/Aptitude, fink/ 
> FinkCommander, and DarwinPorts/MacPorts) it was never obvious when it  
> should be necessary to run the update.  Indeed, the advice given by  
> each of these tools IIRC was to update every time you used it, before  
> doing anything else.  (So why was it a manual task then?)

Because we actually consult the index of available packages more often
than you think. Every time you cabal install in a local directory we
make sure all the required packages are available and consistent. If we
had to go to the network every time you would not be happy.

There should be a solution here that lets us update more automatically
while still allowing people to do offline operations. I'm not sure what
that solution is yet though.

> On the other hand, every one of those tools eventually failed for me on the  
> update step, leaving me with an inconsistent and non-working  
> configuration.

You will be glad to know that cabal's update is atomic (as of
cabal-install-0.5.2). It downloads the new index and atomically replaces
the old. So if the download is corrupted it should fail to gunzip and we
would not overwrite the old index.

Duncan

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


[Haskell-cafe] Re: [Haskell] ANN: Haskell-Embedded System Design: ForSyDe 3.0 and Tutorial

2008-10-01 Thread Don Stewart
alfonso.acosta:
> Hi everyone,
> 
> I am glad to announce the 3.0 release of ForSyDe's implementation, now
> available from HackageDB.
> 

Awesome, native packages now available,

http://aur.archlinux.org/packages.php?ID=20422

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


[Haskell-cafe] Re: Hmm, what license to use?

2008-10-01 Thread Simon Marlow

brian wrote:

On Tue, Sep 30, 2008 at 8:54 PM, Stefan Monnier
<[EMAIL PROTECTED]> wrote:

That still leaves anyone free to use LGPL if they want to, but please
don't assume that it allows commercial use by all potential users.

It *does* allow commercial use.  Your example just shows that some
people may decide not to take advantage of it, based not on problematic
restrictions but just on paranoia.


I was confused and worried about this subject lately, too; at some
point in the future, I may want to ship closed-source commercial
software that uses various LGPL libraries. But it doesn't seem to be
as big a problem as I imagined. My understanding is that I can satisfy
the requirements of the LGPL by dynamically linking, and that's
already happening.


Dynamic linking doesn't solve all the problems, we still have the 
problem that GHC does a lot of cross-module inlining, regardless of 
whether dynamic linking is used.  However, I really would like to have a 
way to have complete control over what is exposed across a package 
boundary.  We need this not just for licensing reasons, but also for 
making a dynamic library with a fixed ABI, so it can be upgraded later.


Incedentally the lack of this feature is one reason I've not being 
rushing to get shared libraries into GHC.  They're just not that useful 
unless you can upgrade a library independently of the things it depends on.


Cheers,
Simon

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


Re: [Haskell-cafe] Re: Health effects

2008-10-01 Thread Anton van Straaten

Achim Schneider wrote:

Jon Fairbairn <[EMAIL PROTECTED]> wrote:


Adrian Neumann <[EMAIL PROTECTED]> writes:


I often wonder how many cuts you need to divide a steak in n
pieces.  You can obviously get n pieces with (sqrt n) cuts
by cutting a grid.  But I'm sure some smart mathematician
thought of a (log n) way.

Are you allowed to move the pieces between cuts?


Later you're also going to demand to bend it in N dimensions, aren't
you?


If extra dimensions are needed, perhaps the LHC could be pressed into 
service.  Any Haskell programmers working there?


I'm sure we could settle many of these questions by injecting some 
chocolate particles into the accelerator.  Who among us hasn't wondered 
what chocolate looks like when traveling at relativistic speeds?  Best 
case, we produce an infinitely dense micro-black hole made of chocolate, 
which pretty much takes care of the whole recursive subdividing problem.


Plus, when popped into your mouth, it would evaporate via the tastiest 
Hawking radiation imaginable.


Anton

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


Re: [Haskell-cafe] Re: Health effects

2008-10-01 Thread Gianfranco Alongi
Throw the "no free lunch"-theorem on top of that.

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

On Wed, Oct 1, 2008 at 3:33 PM, Dominic Steinitz
<[EMAIL PROTECTED]> wrote:
> Adrian Neumann  inf.fu-berlin.de> writes:
>
>>
>> I often wonder how many cuts you need to divide a steak in n pieces.
>> You can obviously get n pieces with (sqrt n) cuts by cutting a grid.
>> But I'm sure some smart mathematician thought of a (log n) way.
>>
>
> You might try the ham sandwich theorem
> http://en.wikipedia.org/wiki/Ham_sandwich_theorem as an hors d'oeuvre.
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Patience is the last resort for those unable to take action
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Version 0.4.3 of happs-tutorial is a HAppS job board, done in HAppS.

2008-10-01 Thread Thomas Hartman
Oh, the whole point of this was to put preview of the latest chapters
I've been working on.

The new stuff is at

http://happstutorial.com:5002/

So far there's an introduction to macid, macid data safety and
backups, and using utf8 data with happs.

I'm particularly intereted in hearing what the happs devs and others
have to say on the topic of keeping data safe:

http://happstutorial.com:5002/tutorial/macid-data-safety

Thomas.

2008/9/30 John Melesky <[EMAIL PROTECTED]>:
> Thomas,
>
> The tutorial site seems to be unreachable or otherwise down.
>
> I know the modern programming landscape is fast-moving, HAppS is new and
> constantly changing, so i probably should have grabbed the content when you
> posted it, but perhaps keeping it up for more than a day and a half might be
> good? :-)
>
> -john melesky
>
>
> On Sep 28, 2008, at 6:36 PM, Thomas Hartman wrote:
>
>> Hello, world.
>>
>> In Version 4 of the ongoing self-demoing HAppS Tutorial, we implement
>> a HAppS job board using HAppS.
>>
>> demo: http://happstutorial.com:5001
>>
>> install: sudo cabal install happs-tutorial
>>
>> darcs head: darcs get http://code.haskell.org/happs-tutorial
>>
>> There aren't any new lessons compared to the last release, but the
>> code is much cleaner, and... well... the web site actually does
>> something.
>>
>> Coming soon, lessons on form processing and HAppS State.
>>
>> Enjoy!
>>
>> Thomas.
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Class Quantification

2008-10-01 Thread Jules Bean

Bas van Dijk wrote:

On Wed, Oct 1, 2008 at 3:01 AM, Reiner Pope <[EMAIL PROTECTED]> wrote:

I believe there is no way to simply express this "abstraction over classes",
but the Scrap your boilerplate with class[1] paper discusses this same
problem and present a workaround by defining the class's dictionary of
methods as an explicit type.

What follows is the code to implement their workaround for your example.

First some fairly standard extensions:


{-# LANGUAGE Rank2Types, EmptyDataDecls, FlexibleInstances, KindSignatures
#-}

And some more controversial, but necessary ones:


{-# LANGUAGE UndecidableInstances, OverlappingInstances #-}


Just an observation:

That terrifying list of extensions is needed for this 'full' solution.

To just literally encode what the OP wanted you just need a concrete 
dictionary and existentials, AFAIK.


Jules

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


[Haskell-cafe] Re: Health effects

2008-10-01 Thread Dominic Steinitz
Adrian Neumann  inf.fu-berlin.de> writes:

> 
> I often wonder how many cuts you need to divide a steak in n pieces.  
> You can obviously get n pieces with (sqrt n) cuts by cutting a grid.  
> But I'm sure some smart mathematician thought of a (log n) way.
> 

You might try the ham sandwich theorem 
http://en.wikipedia.org/wiki/Ham_sandwich_theorem as an hors d'oeuvre.

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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Derek Elkins
On Wed, 2008-10-01 at 10:15 +0200, Ketil Malde wrote:
> Derek Elkins <[EMAIL PROTECTED]> writes:
> 
> >> parseCSVFromFile "in.csv" >>= return . either (const "error!")
> 
> > Whenever you see this >>= return . f pattern think liftM or fmap or <$>.
> 
> ...and "return . f >>= action" is just "action . f", no?


Well actually that's \x -> action (return (f x)) x via the (r ->)
instance of Monad.  I think what you wanted was
\x -> return (f x) >>= action which is
\x -> action (f x)
action . f via the monad laws.

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


Re: [Haskell-cafe] Re: Health effects

2008-10-01 Thread Gianfranco Alongi
Are we assuming the bars to have an even distribution of mass along
the whole body?


On Wed, Oct 1, 2008 at 2:10 PM, Achim Schneider <[EMAIL PROTECTED]> wrote:
> Jon Fairbairn <[EMAIL PROTECTED]> wrote:
>
>> Adrian Neumann <[EMAIL PROTECTED]> writes:
>>
>> > I often wonder how many cuts you need to divide a steak in n
>> > pieces.  You can obviously get n pieces with (sqrt n) cuts
>> > by cutting a grid.  But I'm sure some smart mathematician
>> > thought of a (log n) way.
>>
>> Are you allowed to move the pieces between cuts?
>>
> Later you're also going to demand to bend it in N dimensions, aren't
> you?
>
> --
> (c) this sig last receiving data processing entity. Inspect headers
> for copyright history. All rights reserved. Copying, hiring, renting,
> performance and/or quoting of this signature prohibited.
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Patience is the last resort for those unable to take action
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage Build Failures

2008-10-01 Thread Emil Axelsson

Stephan Friedrichs skrev:

Emil Axelsson wrote:

[...]

The error comes from using QuickCheck 2, which happens to also use the 
operator (><). I can see two ways to solve the problem:


(1) Add "< 2" after "QuickCheck" in the Wired.cabal file.

(2) Add "hiding ((><))" after "import Test.QuickCheck" in 
Data/Hardware/Internal.hs


Emil,

my suggestion is: Please use alternative (2), at least if there are no 
further problems with quickcheck 2! Otherwise, depending on quickcheck 
<2 just introduces unnecessary package incompatibilities.


Hi Stephan,

Option (1) was only meant as a temporary solution for Cetin. It just occurred 
that the obvious solution to make both QC1 and QC2 users happy is to have an 
explicit import list rather than hiding (><) (there are no further problems with 
QC2). I'll do this until QC2 is standard in GHC.


/ Emil


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


RE: [Haskell-cafe] Hackage Build Failures

2008-10-01 Thread Mitchell, Neil
> > The error comes from using QuickCheck 2, which happens to 
> also use the 
> > operator (><). I can see two ways to solve the problem:
> > 
> > (1) Add "< 2" after "QuickCheck" in the Wired.cabal file.
> > 
> > (2) Add "hiding ((><))" after "import Test.QuickCheck" in 
> > Data/Hardware/Internal.hs
> 
> Emil,
> 
> my suggestion is: Please use alternative (2), at least if 
> there are no further problems with quickcheck 2! Otherwise, 
> depending on quickcheck
> <2 just introduces unnecessary package incompatibilities.

Note that if you import hiding something that doesn't existing you'll
have a problem. Therefore this fix will require >= 2 for quickcheck, and
introduce incompatibilities either way.

Thanks

Neil

==
Please access the attached hyperlink for an important electronic communications 
disclaimer: 

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==

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


Re: [Haskell-cafe] Hackage Build Failures

2008-10-01 Thread Stephan Friedrichs

Emil Axelsson wrote:

[...]

The error comes from using QuickCheck 2, which happens to also use the 
operator (><). I can see two ways to solve the problem:


(1) Add "< 2" after "QuickCheck" in the Wired.cabal file.

(2) Add "hiding ((><))" after "import Test.QuickCheck" in 
Data/Hardware/Internal.hs


Emil,

my suggestion is: Please use alternative (2), at least if there are no 
further problems with quickcheck 2! Otherwise, depending on quickcheck 
<2 just introduces unnecessary package incompatibilities.




[...]



//Stephan

--

Früher hieß es ja: Ich denke, also bin ich.
Heute weiß man: Es geht auch so.

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


[Haskell-cafe] Re: Health effects

2008-10-01 Thread Achim Schneider
Jon Fairbairn <[EMAIL PROTECTED]> wrote:

> Adrian Neumann <[EMAIL PROTECTED]> writes:
> 
> > I often wonder how many cuts you need to divide a steak in n
> > pieces.  You can obviously get n pieces with (sqrt n) cuts
> > by cutting a grid.  But I'm sure some smart mathematician
> > thought of a (log n) way.
> 
> Are you allowed to move the pieces between cuts?
>
Later you're also going to demand to bend it in N dimensions, aren't
you?

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.

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


Re: [Haskell-cafe] Hackage Build Failures

2008-10-01 Thread Emil Axelsson

Hi Cetin!

Glad to see at least one person trying my package :)

The error comes from using QuickCheck 2, which happens to also use the operator 
(><). I can see two ways to solve the problem:


(1) Add "< 2" after "QuickCheck" in the Wired.cabal file.

(2) Add "hiding ((><))" after "import Test.QuickCheck" in 
Data/Hardware/Internal.hs

I guess this means you can't use cabal-install...?

Does anybody know the best way to avoid this problem without manual 
intervention? Or should I just require people to use QuickCheck 2?


PS. Cetin, please let me know if you have any questions regarding Wired. I'm 
slowly working on enhancing the library, and I'll soon upload a version with 
timing analysis and a DEF backend in.


/ Emil



Cetin Sert skrev:

Hi,

what is the best action to take if a package from hackage fails to 
build? Is there a recommended/established common way to deal with build 
failures/runtime bugs etc.?


For example:

[EMAIL PROTECTED]:~/Links/Elite/ac> cabal install wired
Resolving dependencies...
Downloading Wired-0.1.1...
Configuring Wired-0.1.1...
Preprocessing library Wired-0.1.1...
Building Wired-0.1.1...
[ 1 of 21] Compiling Data.Hardware.Internal ( Data/Hardware/Internal.hs, 
dist/build/Data/Hardware/Internal.o )


Data/Hardware/Internal.hs:198:15:
Ambiguous occurrence `><'
It could refer to either `Data.Hardware.Internal.><', defined at 
Data/Hardware/Internal.hs:129:4
  or `Test.QuickCheck.><', imported from 
Test.QuickCheck at Data/Hardware/Internal.hs:11:0-21

cabal: Error: some packages failed to install:
Wired-0.1.1 failed during the building phase. The exception was:
exit: ExitFailure 1

Regards,
CS




___
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: (A little humour)

2008-10-01 Thread Achim Schneider
Benjamin L.Russell <[EMAIL PROTECTED]> wrote:

> Read that interview and tell me what you think.
>
I think I'll link that in my next CV for a job requiring C++ knowledge.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.

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


[Haskell-cafe] Job Opportunity

2008-10-01 Thread Michael Bott
Afternoon,

 

I have been recommended to use this site from a couple of people I have
spoken to. Sorry if this offends anyone but I have an amazing
opportunity for a 2 Functional Programmers based in London.

 

Functional Programming - (HASKELL / ERLANG / OCAML) - Financial 

This is an incredible opportunity for a FUNCTIONAL PROGRAMMER (Haskell /
Erlang or Ocaml) to join an expanding London software house who
specialise in Asset Management for top financial clients - they
specialise in providing algorithmic execution solutions for hedge funds.


My client are a leading provider in financial software, they are looking
for a top Graduates or 1-2 years experienced Java / Functional
Programmers to join the team and really make a difference to the company
and work with the biggest clients in the UK. 

Desirable Skills - 

* Functional Programming - ( Haskell or Erlang or Ocaml to name 3). 

* Java 

* Degree Education - top University - 2:1 and above only. 

* Experience within the finance and/or banking sector would be highly
advantageous. 


This is an URGENT requirement and my client are keen to get at least 2
exceptional developers into the team ASAP. You will join a relaxed team
who work on exciting projects, and use the most up to date
technologies 

To learn more about the role and the client please contact Mike at
Lawrence Harvey.

 

Please contact me if you are interested.

 

Kind Regards,

 

Mike

Michael Bott 
Java Recruitment Specialist 
Lawrence Harvey Search & Selection 

Tel:  +44 (0)208 875 4353
Fax: +44 (0)208 870 8116 
Mobile: +44 (0)7966 554892

Email: [EMAIL PROTECTED]   
Web: www.Lawrenceharvey.com   

LinkedIn - http://www.linkedin.com/in/mikebott
 

The information transmitted contains confidential material and is
intended only for the person or organisation to which it is addressed.
Any review, retransmission, dissemination or other use of this
information by persons or entities other than the intended recipient is
prohibited. If you received this in error, please contact the sender and
delete the material from any computer.  No liability whatsoever is
accepted by Lawrence Harvey Search & Selection in respect of the
contents of this email.

 

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


Re: [Haskell-cafe] Class Quantification

2008-10-01 Thread Bas van Dijk
On Wed, Oct 1, 2008 at 3:01 AM, Reiner Pope <[EMAIL PROTECTED]> wrote:
> I believe there is no way to simply express this "abstraction over classes",
> but the Scrap your boilerplate with class[1] paper discusses this same
> problem and present a workaround by defining the class's dictionary of
> methods as an explicit type.
>
> What follows is the code to implement their workaround for your example.
>
> First some fairly standard extensions:
>
>> {-# LANGUAGE Rank2Types, EmptyDataDecls, FlexibleInstances, KindSignatures
>> #-}
>
> And some more controversial, but necessary ones:
>
>> {-# LANGUAGE UndecidableInstances, OverlappingInstances #-}
>>
>> module Cls where
>>
>
> The working bla function. Unfortunately, the "pseudoclass" cls needs
> to have its type explicitly named, hence the (uninhabited) Proxy type.
>
>> bla :: forall cls a c d. (Sat (cls c), Sat (cls d)) => Proxy cls ->
>> (forall b. Sat (cls b) => a -> b) -> a -> (c,d)
>> bla _ f x = (f x, f x)
>
> Again, testFoo and testBar unfortunately have to name which dictionary type
> to use, via the Proxy.
>
>> testFoo = bla (undefined :: Proxy NumD) fromInteger 1 :: (Int,Float)
>> testBar = bla (undefined :: Proxy ReadD) read "1" :: (Int,Float)
>
> The Sat class, straight from SYB:
>
>> class Sat a where
>> dict :: a
>> data Proxy (cxt :: * -> *)
>
> The explicit dictionary construction for the Read class:
>
>> data ReadD a = ReadD { readsPrecD :: Int -> ReadS a }
>> instance (Read a) => Sat (ReadD a) where
>> dict = ReadD readsPrec
>> instance (Sat (ReadD a)) => Read a where
>> readsPrec = readsPrecD dict
>
> The explicit dictionary construction for the Num class:
>
>> data NumD a = NumD { plusD :: a -> a -> a,
>>  timesD :: a -> a -> a,
>>  negateD :: a -> a,
>>  absD :: a -> a,
>>  signumD :: a -> a,
>>  fromIntegerD :: Integer -> a }
>> instance (Num a) => Sat (NumD a) where
>> dict = NumD (+) (*) negate abs signum fromInteger
>
> We define these fake Eq,Show instances just to make the
> Num instance valid. It would be longer, but not more
> difficult, to genuinely encode the (Eq,Show)=>Num hierarchy.
>
>> instance (Sat (NumD a)) => Show a where {}
>> instance (Sat (NumD a)) => Eq a where {}
>> instance (Sat (NumD a)) => Num a where
>> (+) = plusD dict
>> (*) = timesD dict
>> negate = negateD dict
>> abs = absD dict
>> signum = signumD dict
>> fromInteger = fromIntegerD dict
>
> [1] http://homepages.cwi.nl/~ralf/syb3/ Sections 3.2 and 4.1
>
> On Wed, Oct 1, 2008 at 9:01 AM, Bas van Dijk <[EMAIL PROTECTED]> wrote:
>>
>> On Tue, Sep 30, 2008 at 11:25 PM, Sean Leather <[EMAIL PROTECTED]>
>> wrote:
>> > But perhaps you're looking for potentially unknown classes?
>>
>> Yes indeed.
>>
>> Thanks,
>>
>> Bas
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>

Nice!

The explicit passing of the proxy type is indeed unfortunate but it's
nice that the type of your 'bla' is almost identical to mine:

> bla :: forall cls a c d. (Sat (cls c), Sat (cls d)) => Proxy cls -> (forall 
> b. Sat (cls b) => a -> b) -> a -> (c,d)
> bla :: forall cls. (cls c, cls d) => (forall b. cls b => a -> b) -> a -> (c, 
> d)

Thanks,

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


[Haskell-cafe] ANN: Haskell-Embedded System Design: ForSyDe 3.0 and Tutorial

2008-10-01 Thread Alfonso Acosta
Hi everyone,

I am glad to announce the 3.0 release of ForSyDe's implementation, now
available from HackageDB.

The ForSyDe (Formal System Design) methodology has been developed with
the objective to move system design (e.g. System on Chip, Hardware and
Software systems) to a higher level of abstraction.

ForSyDe is implemented as a Haskell-embedded behavioral DSL (Domain
Specific Language).

>From this release, ForSyDe includes a new deep-embedded DSL and
embedded compiler. We have also published tutorial which should be
much more user-friendly than the Haddock documentation and the ForSyDe
research papers.

ForSyDe includes two DSL flavours  which offer different features:

  1) Deep-embedded DSL (ForSyDe.Signal)

Deep-embedded signals, based on the same concepts as Lava, are
aware of the system structure. Based on that structural information
ForSyDe's embedded compiler, can perform different analysis and
transformations.
o Thanks to Template Haskell, computations are expressed in
   Haskell, not needing to specifically design a DSL for that
   purpose.
o Embedded compiler backends:
  + Simulation
  + VHDL (with support for Modelsim and Quartus II)
  + GraphML (with yFiles graphical markup support.)
o Synchronous model of computation.
o Support for components.
o Support for fixed-sized vectors à la VHDL.

  2) Shallow-embedded DSL (ForSyDe.Shallow.Signal)

Shallow-embedded signals are modeled as streams of data
isomorphic to lists. Systems built with them are unfortunately
restricted to simulation, however, shallow-embedded signals
provide a rapid-prototyping framework with which to experiment
with Models of Computation (MoCs).
o Synchronous MoC.
o Untimed MoC.
o Continuous Time MoC.
o Domain Interfaces allow connecting various subsystems
   with different timing (domains) regardless of their MoC.
o Deep-embedded models can be integrated through
   simulation.

Links

ForSyDe website:
http://www.ict.kth.se/org/ict/ecs/sam/projects/forsyde/www/
ForSyDe tutorial:
http://www.ict.kth.se/org/ict/ecs/sam/projects/forsyde/www/files/tutorial/tutorial.html
HackageDB package page:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ForSyDe
Darcs repository: darcs get
http://www.ict.kth.se/org/ict/ecs/sam/projects/forsyde/www/darcs/ForSyDe/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


tutorial site back up Re: [Haskell-cafe] Version 0.4.3 of happs-tutorial is a HAppS job board, done in HAppS.

2008-10-01 Thread Thomas Hartman
Well, at least I know people are trying to read the tutorial :)

I'll say a few words about what happened.

The underlying problem is that HAppS dies unpredictably because of
problems in the haskell network library, a but I reported at
http://code.google.com/p/happs/issues/detail?id=40

I wrote a cron job to restart my server when it dies, but I recently
tweaked the job in order to serve the "head" version as well as what
is on hackage, and the tweak broke the cron job's functionality.
(fixed now -- at least, I hope it's fixed.)

To be honest I don't really understand the underlying problem in the
haskell network library, but it would be great if somebody who does
could fix this.

Thomas.

2008/9/30 John Melesky <[EMAIL PROTECTED]>:
> Thomas,
>
> The tutorial site seems to be unreachable or otherwise down.
>
> I know the modern programming landscape is fast-moving, HAppS is new and
> constantly changing, so i probably should have grabbed the content when you
> posted it, but perhaps keeping it up for more than a day and a half might be
> good? :-)
>
> -john melesky
>
>
> On Sep 28, 2008, at 6:36 PM, Thomas Hartman wrote:
>
>> Hello, world.
>>
>> In Version 4 of the ongoing self-demoing HAppS Tutorial, we implement
>> a HAppS job board using HAppS.
>>
>> demo: http://happstutorial.com:5001
>>
>> install: sudo cabal install happs-tutorial
>>
>> darcs head: darcs get http://code.haskell.org/happs-tutorial
>>
>> There aren't any new lessons compared to the last release, but the
>> code is much cleaner, and... well... the web site actually does
>> something.
>>
>> Coming soon, lessons on form processing and HAppS State.
>>
>> Enjoy!
>>
>> Thomas.
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] postmortem question about xmonad

2008-10-01 Thread minh thu
2008/10/1 Jason Dagit <[EMAIL PROTECTED]>:
>
>
> On Tue, Sep 30, 2008 at 1:20 PM, Don Stewart <[EMAIL PROTECTED]> wrote:
>>
>> noteed:
>> > Hi,
>> >
>> > I'd like to know, now that time got by a bit, what the writers of the
>> > X monad think about the use of the ReaderT/WriterT/IO brought to them
>> > (to isolate Configuration data and dynamic data and glue them together
>> > with IO). Are you happy of it, did it make things easier or not, would
>> > you do it again ?
>>
>> It made the structuring and invariants between runtime data, and
>> configuration data clean and precise. Yes, A+++ would buy again.
>
> I can add to this, saying that I used WriterT/ReaderT and Unique in a
> CodeGen monad I created for a compiler I'm writing and this approach of
> stacking monads (well, really transformers) works amazingly well.  Many of
> the existing monads abstractly handle a particular task very well.  When you
> combine this with generalized newtype deriving it's not just code reuse,
> it's also code specialization.  You quickly glue together existing
> functionality that works but expose it with the API that meets your problem
> domain.  I'd say this is not unlike the way people glue together unix tools
> on the command line.  This is RAD in Haskell.
>
> I agree with Don, I would buy this again.  In fact, I've already placed an
> order for use in future projects.

Thanks for your answer (to Don too).

While building the stack (of transformers), do you implement several things
with each one its transformer (or directly its corresponding monad) or do you
try to make the good combination first ?

If the former (combine them later), is it a problem to add lift (or
liftIO) to go
deep enough in the stack ?

What approach do you use ?

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


Re: [Haskell-cafe] flipped IO sequence

2008-10-01 Thread Daniel Fischer
Am Mittwoch, 1. Oktober 2008 12:18 schrieb Cetin Sert:
> warn :: String → IO Int
> warn = return 1 << putStrLn-- causes an error

try
warn = (return 1 <<) . putStrLn


>   -- = \msg → return 1 << putStrLn msg -- works just fine
>   -- = \msg → putStrLn msg >> return 1 -- works just fine
>
> (<<) :: Monad m ⇒ m b → m a → m b
> b << a = a >>= \_ → b

(<<) = flip (>>)
>
> Why do I get this compile-time error?? How can one define << ?
>
> [EMAIL PROTECTED]:~/lab/test/qths/p> ghc -fglasgow-exts -O2 -o d64x --make
> demo2.hs system.hs
> [1 of 2] Compiling Netman.System( system.hs, system.o )
>
> system.hs:23:14:
> No instance for (Num (IO Int))
>   arising from the literal `1' at system.hs:23:14
> Possible fix: add an instance declaration for (Num (IO Int))
> In the first argument of `return', namely `1'
> In the first argument of `(<<)', namely `return 1'
> In the expression: return 1 << putStrLn

Okay
warn = (return 1) << putStrLn

putStrLn :: String -> IO ()
return 1 :: m b
(<<) :: m b -> m a -> m b
warn :: String -> IO Int

so we must have
(String -> IO ()) === m a
(String -> IO Int) === m b

So the monad is ((->) String),
a === IO ()
b === IO Int,
hence in
return 1 :: String -> IO Int
the 1 must have type IO Int. Now 1 is actually 
fromInteger 1, 
fromInteger :: (Num a) => Integer -> a,
so the compiler looks for the
instance Num (IO Int) where ...
which it doesn't find.

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


Re: [Haskell-cafe] flipped IO sequence

2008-10-01 Thread Martin Huschenbett
Hi Cetin,

what you seem to want is

> warn :: String -> IO Int
> warn = (return 1 <<) . putStrLn

Cetin Sert schrieb:
> warn :: String → IO Int
> warn = return 1 << putStrLn-- causes an error
>   -- = \msg → return 1 << putStrLn msg -- works just fine
>   -- = \msg → putStrLn msg >> return 1 -- works just fine
> 
> (<<) :: Monad m ⇒ m b → m a → m b
> b << a = a >>= \_ → b
> 
> Why do I get this compile-time error?? How can one define << ?
> 
> [EMAIL PROTECTED]:~/lab/test/qths/p> ghc -fglasgow-exts -O2 -o d64x 
> --make demo2.hs system.hs
> [1 of 2] Compiling Netman.System( system.hs, system.o )
> 
> system.hs:23:14:
> No instance for (Num (IO Int))
>   arising from the literal `1' at system.hs:23:14
> Possible fix: add an instance declaration for (Num (IO Int))
> In the first argument of `return', namely `1'
> In the first argument of `(<<)', namely `return 1'
> In the expression: return 1 << putStrLn
> 
> 
> 
> 
> ___
> 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] flipped IO sequence

2008-10-01 Thread Dougal Stanton
2008/10/1 Cetin Sert <[EMAIL PROTECTED]>:
> warn :: String → IO Int
> warn = return 1 << putStrLn-- causes an error
>   -- = \msg → return 1 << putStrLn msg -- works just fine
>   -- = \msg → putStrLn msg >> return 1 -- works just fine
>
> (<<) :: Monad m ⇒ m b → m a → m b
> b << a = a >>= \_ → b
>
> Why do I get this compile-time error?? How can one define << ?
>
> [EMAIL PROTECTED]:~/lab/test/qths/p> ghc -fglasgow-exts -O2 -o d64x --make
> demo2.hs system.hs
> [1 of 2] Compiling Netman.System( system.hs, system.o )
>
> system.hs:23:14:
> No instance for (Num (IO Int))
>   arising from the literal `1' at system.hs:23:14
> Possible fix: add an instance declaration for (Num (IO Int))
> In the first argument of `return', namely `1'
> In the first argument of `(<<)', namely `return 1'
> In the expression: return 1 << putStrLn
>

This works for me (type signature added so GHCi doesn't choke)

Prelude> let (<<) = flip (>>) :: IO b -> IO a -> IO b

And thus:

Prelude> return 1 << putStrLn "yo"
yo
1
Prelude>

You might be having problems with the point-free code:

Prelude> let warn' = return 1 << putStrLn

:1:24:
Couldn't match expected type `IO a'
   against inferred type `String -> IO ()'
In the second argument of `(<<)', namely `putStrLn'
In the expression: return 1 << putStrLn
In the definition of `warn'': warn' = return 1 << putStrLn

Adding in variable names straightens that out for me:

Prelude> let warn s = return 1 << putStrLn s
Prelude> warn "help"
help
1
Prelude>


Cheers,


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


[Haskell-cafe] flipped IO sequence

2008-10-01 Thread Cetin Sert
warn :: String → IO Int
warn = return 1 << putStrLn-- causes an error
  -- = \msg → return 1 << putStrLn msg -- works just fine
  -- = \msg → putStrLn msg >> return 1 -- works just fine

(<<) :: Monad m ⇒ m b → m a → m b
b << a = a >>= \_ → b

Why do I get this compile-time error?? How can one define << ?

[EMAIL PROTECTED]:~/lab/test/qths/p> ghc -fglasgow-exts -O2 -o d64x --make
demo2.hs system.hs
[1 of 2] Compiling Netman.System( system.hs, system.o )

system.hs:23:14:
No instance for (Num (IO Int))
  arising from the literal `1' at system.hs:23:14
Possible fix: add an instance declaration for (Num (IO Int))
In the first argument of `return', namely `1'
In the first argument of `(<<)', namely `return 1'
In the expression: return 1 << putStrLn
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Total Functional Programming in Haskell

2008-10-01 Thread apfelmus
Jason Dagit wrote:
> apfelmus wrote:
>>
>> It seems to me that dependent types are best for ensuring totality.
> 
> Bear with me, as I know virtual nothing about dependent types yet.

Ah, my bad. Time to change that ;) Personally, I found

  Th. Altenkirch, C. McBride, J. McKinna.
  Why dependent types matter.
  http://www.cs.st-andrews.ac.uk/~james/RESEARCH/ydtm-submitted.pdf

to be a very gentle introduction.

> In the
> total functional paradigm the language lacks a value for bottom.  This means
> general recursion is out and in the paper I cited it was replaced with
> structural recursion on the inputs.  How do dependent types remove bottom
> from the language?

Originally, all typed lambda calculi - like the simply typed lambda
calculus or System F on which Haskell is based - are strongly
normalizing by default, i.e. every computation terminates. Thus, bottom
is actually *added* to Haskell, in particular by providing the new primitive

  fix :: (a -> a) -> a

When viewed through the Curry-Howard Isomorphism, it's clear that  fix
is a bad idea. I mean, it corresponds to the "theorem"

  forall A. (A -> A) -> A

which is clearly wrong, for it can prove the existence of Santa Claus:

  fix (\Santa Claus exists -> Santa Claus exists) = Santa Claus exists


Since dependently typed languages perform computations on the type
level, most do not add general recursion or at least pay special
attention to it. Furthermore, as Luke said, they give you the necessary
tools to easily express programs that are not structurally recursive,
but nonetheless terminate. One example would be a function to represent
a natural in binary:

  data Nat = Succ Nat | Zero
  data Digit = D0 | D1

  digits :: Nat -> [Digit]
  digits = reverse digits'
where
digits' 0 = []
digits' n
 | even n = D0:digits' (n `div` 2)
 | odd  n = D1:digits' (n `div` 2)

This is not structurally recursive (at least not directly), but clearly
terminates. You can use dependent types to prove that it does. For a
more complicated example, see also

http://www.iis.sinica.edu.tw/~scm/2008/well-founded-recursion-and-accessibility/


>> The IO layer can be interpreted as "co-total", i.e. as codata.
> 
> I was asserting that Haskell is currently 2 layered.  Purely functional vs.
> IO.  They integrate nicely and play well together, but I still think of them
> as distinct layers.  Perhaps this is not fair or confusing though.  The
> paper I cited did indeed use codata to define streams so that something,
> such as an OS, that needs to process infinite streams of requests can still
> do so.

Well, you can interpret IO as a data type

  data IO a where
 Bind:: IO a -> (a -> IO b) -> IO b
 Return  :: a -> IO a

 PutChar :: Char -> IO ()
 GetChar :: IO Char

just like any other data type. In fact, that's what

  W. Swierstra, Th. Altenkirch. Beauty in the Beast.
  http://www.cs.nott.ac.uk/~txa/publ/beast.pdf

do in order to QuickCheck programs with IO.


Regards,
apfelmus

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


Re: [Haskell-cafe] (A little humour)

2008-10-01 Thread Manlio Perillo

Miguel Mitrofanov ha scritto:
I think you might be interested in 
http://www.research.att.com/~bs/whitespace98.pdf




By the way, is it technically possible (and feasible), in Haskell, to 
define a space operator?


Of cource not with the current grammar.

> [...]


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


Re: [Haskell-cafe] (A little humour)

2008-10-01 Thread Manlio Perillo

Miguel Mitrofanov ha scritto:
I think you might be interested in 
http://www.research.att.com/~bs/whitespace98.pdf




By the way, is it technically possible (and feasible), in Haskell, to 
define a space operator?


Of cource not with the current grammar.

> [...]


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


Re: [Haskell-cafe] Re: Hmm, what license to use?

2008-10-01 Thread Magnus Therning
On Wed, Oct 1, 2008 at 3:31 AM, brian <[EMAIL PROTECTED]> wrote:
[..]
> as big a problem as I imagined. My understanding is that I can satisfy
> the requirements of the LGPL by dynamically linking, and that's
> already happening. Is there something else to worry about? I'd be in
> violation if I shipped something statically linked, but cabal doesn't
> seem inclined to do that by default.

I'm not sure I understand you here.  Would you clarify your words
here, bearing in mind that GHC doesn't do dynamic linking of Haskell
modules?

Cheers,
M

-- 
Magnus Therning(OpenPGP: 0xAB4DFBA4)
magnus@therning.org  Jabber: magnus@therning.org
http://therning.org/magnus identi.ca|twitter: magthe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: (A little humour)

2008-10-01 Thread Benjamin L . Russell
On Fri, 26 Sep 2008 15:40:49 -0400, "Andrew Wagner"
<[EMAIL PROTECTED]> wrote:

>Brilliant. This made my day. I must admit, I looked briefly at the
>paper after I saw the link, yawned, and closed it. Then I saw Andrew's
>comment, skimmed the paper, becoming more and more convinced that it
>was a joke, saw the last line, and then had to go back and read the
>whole thing again. Just awesome.

You didn't even need to read the last line.  On page 6 of that paper:

>A preprocessor that implements the facility for any current C++ implementation 
>can be freely
>downloaded from http://www.research.att.com/~bs/whitespace.html.

Click on that link and tell me what you see.

Incidentally, this is just typical Bjarne Stroustrup humor.  It
reminds me of "An Interview with Bjarne Stroustrup" (see
http://www.ariel.com.au/jokes/An_Interview_with_Bjarne_Stroustrup.html).
Read that interview and tell me what you think.

-- Benjamin L. Russell

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


[Haskell-cafe] Re: cabal upgrade

2008-10-01 Thread Stephane Bortzmeyer
On Wed, Oct 01, 2008 at 08:58:53AM +0100,
 Malcolm Wallace <[EMAIL PROTECTED]> wrote 
 a message of 23 lines which said:

> Indeed, the advice given by each of these tools IIRC was to update
> every time you used it, before doing anything else.  (So why was it
> a manual task then?)

You can put it in cron (Ubuntu does it by default).

> On the other hand, every one of those tools eventually failed for me
> on the update step, leaving me with an inconsistent and non-working
> configuration.

??? If something is wrong in the update step, the installed packages
are not modified. If the database of *available* packages is corrupted
(something I never saw with apt/aptitude or Gentoo's portage), then
you cannot install new packages but existing packages work fine (the
*available* packages database is distinct from the *installed*
packages database).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Health effects

2008-10-01 Thread Jon Fairbairn
Adrian Neumann <[EMAIL PROTECTED]> writes:

> I often wonder how many cuts you need to divide a steak in n
> pieces.  You can obviously get n pieces with (sqrt n) cuts
> by cutting a grid.  But I'm sure some smart mathematician
> thought of a (log n) way.

Are you allowed to move the pieces between cuts?

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


Re: [Haskell-cafe] Total Functional Programming in Haskell

2008-10-01 Thread Conor McBride

Hi

I've been reticent to join this thread as it has the potential
to eat my life, but I thought I'd say some technical things.

On 30 Sep 2008, at 22:54, Derek Elkins wrote:


On Mon, 2008-09-29 at 20:02 -0700, Jason Dagit wrote:

Maybe instead of using (->) as the function constructor for total
functions we use a different symbol, say (|->), and the compiler  
knows

to use the more specialized semantics on those definitions.  I'm not
sure how make this work for values that are total functional versus
values that are just pure (partial) functional.


This can be done exactly the same way it is done with IO.  Remove
general recursion* from Haskell and have a partiality monad with
fix :: (a -> a) -> Partial a


I'm not sure that's the best type for fix, to be honest (though it
would do in a pinch). It doesn't nest very neatly.

Some argue for

  sfix :: (a -> Partial a) -> Partial a

which allows you to make partial computations from recursive values.
Being a happy Haskeller, I'd prefer

  lfix :: (Partial a -> Partial a) -> Partial a

which is probably just join . fix as you present it, but says that
its body gets a computation which it can choose to run, or not, as
appropriate.

In the dependently typed world, remember there are two separate
notions of operational semantics
  (1) the open evaluation used by the typechecker, reducing
under lambda, etc
  (2) the closed evaluation used at run-time, with no computation
under binders

It should be straightforward to make lfix a constant in (1),
whilst (2) would actually run it. So that is indeed very like IO,
handing off computations to an unscrupulous run-time system. Of
course, we'd provide laws to reason about Partial computations
(monad laws, unrolling, fixpoint induction) with sufficient means
to allow escape from Partial on presentation of a (non-Partial)
termination proof (erased for (2)). That's all to say that we can
set things up so you can pay as you go. Of course, that's just to
say we can model the phenomena, not that we can present them
ergonomically...

But what of Haskell?


This particular idea has been discussed several times in a couple of
places.  Most people seem to think it would be too much of a hassle to
use.


Not the most copper-bottomed of arguments, as well you know,
but if programming in Partial entails clunky monadification of
lovely terse applicative code, most people are probably right.
However, what if we were to find a way to break that entailment?
The idiom bracket notation is a step in that direction, but it's
still not enough.

Suppose we were to find a way to program with our usual notation,
but with the extra freedom to vary the 'ambient' monad? We could
choose Id for total programs, Partial for workaday slackness, and
a whole bunch of other stuff at our convenience. We'd need some
way to change the ambient monad locally, of course.

To be frank, I don't know if such a setup could be made to fit
with Haskell's existing design choices. But I think it's an
attractive possibility, worth looking into.

Locally, however, my point is to ask whether there's a specific
hassle with the Partial monad beyond the usual notational
annoyances that come with any monad. If so, that would be
interesting to hear about, and new to my ears.

All the best

Conor

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


Re: [Haskell-cafe] csv one-liner

2008-10-01 Thread Ketil Malde
Derek Elkins <[EMAIL PROTECTED]> writes:

>> parseCSVFromFile "in.csv" >>= return . either (const "error!")

> Whenever you see this >>= return . f pattern think liftM or fmap or <$>.

...and "return . f >>= action" is just "action . f", no?

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal upgrade

2008-10-01 Thread Malcolm Wallace

When I wanted to upgrade to yi 0.4.6.2, I needed to download the new
package list

cabal update   #download list of new packages
cabal upgrade #make any upgrades


I never knew there was a 'cabal update' command, and it worries me.   
In my unhappy experience of packaging systems (apt/Aptitude, fink/ 
FinkCommander, and DarwinPorts/MacPorts) it was never obvious when it  
should be necessary to run the update.  Indeed, the advice given by  
each of these tools IIRC was to update every time you used it, before  
doing anything else.  (So why was it a manual task then?)  On the  
other hand, every one of those tools eventually failed for me on the  
update step, leaving me with an inconsistent and non-working  
configuration.


Regards,
Malcolm

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


[Haskell-cafe] Re: Health effects

2008-10-01 Thread Achim Schneider
Benjamin L.Russell <[EMAIL PROTECTED]> wrote:

> Russell
>
Any relationship?

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.

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


  1   2   >