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

2011-03-07 Thread rusi


On Feb 28, 7:59 pm, Tom Hawkins  wrote:
> I have been wanting to gain a better understanding of interactive
> theorem proving for some time.  And I've often wondered: Can theorem
> proving be made into a user-friendly game that could attract mass
> appeal?  And if so, could a population of gamers collectively solve
> interesting and relevant mathematical problems?
>
> To try to answer these questions -- and to gain some experience myself
> with theorem proving -- I started a project called TheoremQuest [1].
> TheoremQuest intends to be a multi-player game system, where the game
> server receives requests by clients, such as theorem queries and
> inference rule applications.  The TheoremQuest server validates
> deductions, compares them with existing theorems in the database, then
> returns results.  TheoremQuest's deductive system borrows that of John
> Harrison's HOL Light [2].
>
> There are 2 Hackage packages:  theoremquest [3] is a library that
> declares types for terms, inference rules, and client-server
> transactions, used by both server and clients; and theoremquest-client
> [4] is an example client (tq).  All the code, including the
> server-side, is hosted at github [5].
>
> Currently the client-server interface is working, but little else.
> The library has defined most of the core inference rules, but has none
> of the basic types or axioms.  And the "tq" client is nothing at all
> like a game; at this point it is just a command line tool to test the
> server.  Currently "tq" can ping the server, create a new user, apply
> inference rules, and print out theorems.  Here's how "tq" can prove "x
> |- x":
>
> $ tq newuser tomahawkins tomahawk...@gmail.com
> Ack
> $ export THEOREMQUEST_USER=tomahawkins
> $ tq infer 'ASSUME (Var (Variable "x" Bool))'
> Id 1
> $ tq theorem 1
> assumptions:
> Var (Variable "x" Bool)
> conclusion:
> Var (Variable "x" Bool)
>
> I'd love to have help with this project, if anyone's interested.

I am curious -- how easy is it to use theoremquest for playing with
equational theories?

In particular equational logic -- see

https://www.ideals.illinois.edu/bitstream/handle/2142/11411/A%20Rewriting%20Decision%20Procedure%20for%20Dijkstra-Scholten%27s%20Syllogistic%20Logic%20with%20Complements.pdf?sequence=2

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


[Haskell-cafe] Questions on list administration

2011-03-07 Thread Karthick Gururaj
Hello,

I recently joined Haskell group and wanted to share a few points.

First, I came to Haskell cafe from google groups (groups.google.com ->
search for Haskell). Two groups are listed: fa.haskell and
haskell-cafe. I became a "member" of Haskell Cafe via the google
groups interface (the operation was successful according to google).
When I posted a message, I got an automated email (within a few
seconds, so I think there was no human moderation):

You are not allowed to post to this mailing list, and your message has
been automatically rejected.  If you think that your messages are
being rejected in error, contact the mailing list owner at
haskell-cafe-ow...@haskell.org.

I wrote to the email address mentioned and didn't get any response.
Funny thing is, google reports that my post was successful, and my
post was "visible" on google groups even after I signed out from my
google account.

I next wrote to the group owner, again from the google groups
interface (there is an option to "send email to the owner"). No
response here as well.

I then went to Haskell.org -> Mailing lists and saw there are atleast
three lists of immediate relevance, including one for beginners. The
website also describes the posting guidelines and other information.
Very useful. I would have stuck to asking questions on the beginner's
group if I had known earlier..

Can I ask a couple of changes be done to help others like me?
a. In google groups ->
https://groups.google.com/group/haskell-cafe/about -> add a link to
the haskell.org -> Mailing lists for more info.
b. Let users join from google groups interface, or if this is not
possible, mention that in the "about" page
c. Change the contents of the reject email (reproduced above) to
include the following:
"If you want to subscribe to the Haskell Cafe mailing list, please
visit http://www.haskell.org/mailman/listinfo/haskell-cafe";

Aside: the Haskell Cafe mailing list page (at
http://www.haskell.org/mailman/listinfo/haskell-cafe) has a dead link
at the bottom of the page. The "Overview of all haskell.org mailing
lists" points to http://www.haskell.org/cgi-bin/mailman/listinfo (404
error) instead of http://haskell.org/mailman/listinfo.

Thanks!

Warm regards,
Karthick

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


[Haskell-cafe] have anyone tried GHC 7.0.2

2011-03-07 Thread Qi Qi
Hi,

After I installed GHC 7.0.2 and cabal-install 0.10.0 using Cabal library
1.10.1, I found that some package failed to install. For example like
Happy, I got the following error:

cabal install happy
Resolving dependencies...
: cannot satisfy -package Cabal-1.10.1.0: 
Cabal-1.10.1.0-64e8f05722ea5bbdf07df2e5a3491105 is unusable due to missing 
or recursive dependencies:
  directory-1.1.0.0-85d1d0f9d96dffdacf64f3cc6fba6f2f 
process-1.0.1.5-4cab1bf0666275ac101dd48c7565b64c
(use -v for more information)
cabal: Error: some packages failed to install:
happy-1.18.6 failed during the configure step. The exception was:
ExitFailure 1

Besides happy package, some other packages like ghc-mod, hmatrix also
failed to install. Does anyone else have the same issue after installed
ghc 7.0.2? 

By the way, does anyone hear anything about Haskell-platform 2011.2 ?


Thanks!

-- 
Qi Qi

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread Hamish Mackenzie
Please try the version here https://github.com/jutaro

Hopefully we will be in a position to release a new version very soon.

Hamish

On 8/03/2011, at 5:39, Daniel Fischer  wrote:

> On Monday 07 March 2011 16:08:01, Alberto G. Corona wrote:
>> I use leksah, and I want to say thanks to the people that maintain it. I
>> want also to encourage them to continuing its valuable work.
>> 
>> from the last release of Leksah, I particulary appreciate its:
>> 
>> Multiplatform support
>> Ease of installation in all platforms including windows
>> capability to works with many cabal packages in a single workspace
>> its detection of dependencies and rebuilding of the affected packages
>> Integration of GHCI and the GHCI debugger
>> integrated building of documentation
>> referencing and navigation trough the  source of the installed packages
>> and of course all the other traditional IDE capabilities
> 
> That sounds nice, so I thought I'd try out leksah again.
> 
> Unfortunately, the dependencies rule out GHC-7 (base < 4.3, Cabal < 1.9, 
> containers < 0.4 were the ones that sprang to the eyes immediately).
> Bummer
> 
> Maybe someone could try relaxing the bounds and build it with GHC-7, and - 
> if it works - upload a new version?
> (I could try if I get a go-ahead from Hamish or Jürgen)
> 
> ___
> Leksah mailing list
> lek...@projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/leksah

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Felipe Almeida Lessa
On Mon, Mar 7, 2011 at 6:32 PM, Remi Turk  wrote:
> - If you need to pass C structs (by value), you'll have to use
>  libffi: cinvoke doesn't support them at all.

What about CInvStructure[1]?  I was just glancing at the documentation
when I saw this.

Cheers! =)

[1] 
http://www.nongnu.org/cinvoke/doc/cinvoke_8h.html#b39daa4325b8b87aa246cd8acf8a7e65

-- 
Felipe.

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


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread wren ng thornton

On 3/7/11 6:58 PM, Alexander Solla wrote:

The "magic" semantics of evaluating the first argument are done by the
compiler/runtime, and are apparently not expressible in Haskell.


Of course this is true. The only ways of forcing evaluation in Haskell 
are (a) to perform pattern matches on a value, (b) use 'seq'--- either 
directly or in its disguised forms: strict data constructors and 
-XBangPatterns.


In order to use pattern matching you need to know what the constructors 
of the type are in order to force a choice between different 
constructors; therefore you can't use case analysis to define a function 
with the type and semantics of 'seq'.


But 'seq' is still defined in the Haskell report and therefore a part of 
Haskell. Many have lamented the problems introduced by a parametric 
polymorphic 'seq'; if it were just type-class polymorphic then it 
wouldn't be such a problem. But then a type-class polymorphic 'seq' 
could lead to maintenance issues similar to those faced by Java's 
checked exceptions, which is why it was rejected from Haskell.


--
Live well,
~wren

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


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread Daniel Fischer
On Tuesday 08 March 2011 00:38:53, Alexander Solla wrote:
> On Sat, Mar 5, 2011 at 5:06 AM, wren ng thornton  
wrote:
> > 
> > If we have,
> > 
> >   data OneTuple a = One a
> > 
> > Then
> > 
> >_|_ /= One _|_
> 
> That is vacuously true.  I will demonstrate the source of the
> contradiction
> 
> later.  But you also have "_|_ == One _|_", by evaluation:
> > Just undefined
> 
> Just *** Exception: Prelude.undefined
> 

But that shows that _|_ and Just _|_ aren't the same (in Haskell), doesn't 
it?

case x of
Just _ -> "Just something"
Nothing -> "Nothing"

produces "Just something" for (Just _|_), but not for _|_.

> > This can be detected by seq: the left-hand side doesn't terminate,
> > whereas the right-hand side does. And moreover, this can mess up
> > other things (e.g., monads) by introducing too much laziness. Space
> > leaks are quite a serious matter and they have nothing to do with
> > trying to compare uncomputable values. Do you want a seemingly
> > insignificant refactoring to cause your program to suddenly hang
> > forever? Or to take up gobs more space than it used to?
> 
> 'seq' is not a "function", since it breaks referential transparency

Does it, if one assumes that 'seq a b' is *not* the same as 'b' ?

> and
> possibly extensionality in function composition.  By construction, "seq
> a b = b", and yet "seq undefined b /= b".  Admittedly, the Haskell
> report and the GHC implementation, diverge on this issue.  Haskell98
> specifically defines seq in terms of a comparison with bottom, whereas
> GHC "merely" reduces the first argument to WHNF.

But reducing to WHNF is precisely what is needed to detect bottom.
If a value is a constructor application or a lambda, it's not bottom.

> In any case, the
> reduction is a side effect, with which can lead to inconsistent
> semantics if 'seq' is included in "the language".

But seq is "in the language", as specified by the report. You can argue 
that it shouldn't and campaign for its removal, but it's in now and 
speaking about Haskell, one can only sometimes ignore it.


> > 
> > It is not the case that for every pair, ab, we have that:
> >ab == (fst ab, snd ab)
> > 
> > Why? Well consider ab = undefined:
> >_|_ /= (_|_,_|_)
> > 
> > (undefined, undefined)
> 
> (*** Exception: Prelude.undefined
> 
> That is as close to Haskell-equality as you can get for a proto-value
> that does not have an Eq instance.  As a consequence of referential
> transparency, evaluation induces an equivalence relation.  This implies
> that (_|_, _|_) = _|_ = (_|_, _|_).

But

case x of
  (_, _) -> "Okay"

distinguishes _|_ and (_|_, _|_). In Haskell98 and Haskell2010, they are 
not the same.

> 
> I value referential transparency, and so reject constructs which violate
> it.
> 
> 
> Please demonstrate a proof that _|_ /= (_|_, _|_), so that I can exclude
> the unsound constructs you will undoubtedly have to use from

Pattern matching

> my interpretation of "the language".
> I am more interested in finding the
> consistent fragment of what you call Haskell than defending what I call
> Haskell.

That can be a source of much confusion. Usually, 'Haskell' is understood as 
the language defined in the report. There's some room for interpretation, 
but not too much. If you call soemthing too different 'Haskell', people 
won't understand you. 

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


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread wren ng thornton

On 3/7/11 6:38 PM, Alexander Solla wrote:

'seq' is not a "function", since it breaks referential transparency and
possibly extensionality in function composition.  By construction, "seq a b
= b", and yet "seq undefined b /= b".  Admittedly, the Haskell report and
the GHC implementation, diverge on this issue.  Haskell98 specifically
defines seq in terms of a comparison with bottom, whereas GHC "merely"
reduces the first argument to WHNF.  In any case, the reduction is a side
effect, with which can lead to inconsistent semantics if 'seq' is included
in "the language".

It is nice to know that we can work in a consistent language if we avoid
certain constructs, such as 'seq', 'unsafePerformIO', and probably others.
  In addition to making the "core language" conceptually simpler, it means
that we can be sure we aren't inadvertently destroying the correctness
guarantees introduced by the Howard-Curry correspondence theorem.


You are free to reason in whichever language you so desire. But that 
does not mean the semantics of the language you desire are the same as 
the semantics of Haskell. Fact of the matter is that Haskell has 'seq' 
and bottom, even if you choose to call them non-functions or non-values.




It is not the case that for every pair, ab, we have that:

ab == (fst ab, snd ab)

Why? Well consider ab = undefined:

_|_ /= (_|_,_|_)



> (undefined, undefined)
(*** Exception: Prelude.undefined

That is as close to Haskell-equality as you can get for a proto-value that
does not have an Eq instance.  As a consequence of referential transparency,
evaluation induces an equivalence relation.  This implies that (_|_, _|_) =
_|_ = (_|_, _|_).

I value referential transparency, and so reject constructs which violate it.


Please demonstrate a proof that _|_ /= (_|_, _|_), so that I can exclude the
unsound constructs you will undoubtedly have to use from my interpretation
of "the language".  I am more interested in finding the consistent fragment
of what you call Haskell than defending what I call Haskell.


The trivial proof is:

seq _|_ () == _|_

/=

seq (_|_,_|_) () == ()

But you refuse to believe that 'seq' exists, so here's another proof:

case _|_ of (_,_) -> () == _|_

/=

case (_|_,_|_) of (_,_) -> () == ()

Do you refuse to believe that case analysis exists too?

--
Live well,
~wren

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


[Haskell-cafe] AusHack 2011

2011-03-07 Thread Ivan Lazar Miljenovic
It is time once again to start planning for AusHac (the Hackathon Down Under)!

The current proposed dates are 8-10 July.  This time we're trying to
organise a venue in the Sydney CBD, but if all else fails we'll be at
UNSW again.

So, is anyone vehemently opposed to having AusHac at this time or place?

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com

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


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread Daniel Fischer
On Tuesday 08 March 2011 00:58:36, Alexander Solla wrote:
> 
> As a matter of fact, if you read GHC.Prim, you will see that seq is a
> bottom!

No, you don't. GHC.Prim is a dummy module whose only purpose is to let 
haddock generate documentation. Every function there has the code
let x = x in x, e.g.

plusWord# :: Word# -> Word# -> Word#
plusWord# = let x = x in x

minusWord# :: Word# -> Word# -> Word#
minusWord# = let x = x in x

undefined is not yet available, otherwise probably everything in GHC.Prim 
would be pseudo-defined as undefined for haddock.

> 
> seq :: a -> b -> b
> seq = let x = x in x
> 
> The "magic" semantics of evaluating the first argument are done by the
> compiler/runtime, and are apparently not expressible in Haskell.

Right.
But neither is addition of Word# etc., for the primitives, you have to do 
something special.

> This is true of
> inline
> lazy
> unsafeCoerce
> 
> and dozens of others, all of which are expressed as specialized types
> with the same equation:
> let x = x in x

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


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread Alexander Solla
On Mon, Mar 7, 2011 at 3:38 PM, Alexander Solla wrote:

>
>
> This can be detected by seq: the left-hand side doesn't terminate, whereas
>> the right-hand side does. And moreover, this can mess up other things (e.g.,
>> monads) by introducing too much laziness. Space leaks are quite a serious
>> matter and they have nothing to do with trying to compare uncomputable
>> values. Do you want a seemingly insignificant refactoring to cause your
>> program to suddenly hang forever? Or to take up gobs more space than it used
>> to?
>>
>
> 'seq' is not a "function", since it breaks referential transparency and
> possibly extensionality in function composition.  By construction, "seq a b
> = b", and yet "seq undefined b /= b".  Admittedly, the Haskell report and
> the GHC implementation, diverge on this issue.  Haskell98 specifically
> defines seq in terms of a comparison with bottom, whereas GHC "merely"
> reduces the first argument to WHNF.  In any case, the reduction is a side
> effect, with which can lead to inconsistent semantics if 'seq' is included
> in "the language".
>
> It is nice to know that we can work in a consistent language if we avoid
> certain constructs, such as 'seq', 'unsafePerformIO', and probably others.
>  In addition to making the "core language" conceptually simpler, it means
> that we can be sure we aren't inadvertently destroying the correctness
> guarantees introduced by the Howard-Curry correspondence theorem.
>
>
As a matter of fact, if you read GHC.Prim, you will see that seq is a
bottom!

seq :: a -> b -> b
seq = let x = x in x

The "magic" semantics of evaluating the first argument are done by the
compiler/runtime, and are apparently not expressible in Haskell.  This is
true of
inline
lazy
unsafeCoerce

and dozens of others, all of which are expressed as specialized types with
the same equation:
let x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread Alexander Solla
On Sat, Mar 5, 2011 at 5:06 AM, wren ng thornton  wrote:

> On 3/4/11 4:33 PM, Alexander Solla wrote:
>
>> On Thu, Mar 3, 2011 at 10:14 PM, wren ng thornton
>>  wrote:
>>
>>> On 3/3/11 2:58 AM, Antti-Juhani Kaijanaho wrote:
>>>
 On Thu, Mar 03, 2011 at 12:29:44PM +0530, Karthick Gururaj wrote:

  Thanks - is this the same "unit" that accompanies IO in "IO ()" ? In
> any case, my question is answered since it is not a tuple.
>
>
 It can be viewed as the trivial 0-tuple.


>>> Except that this is problematic since Haskell doesn't have 1-tuples
>>> (which
>>> would be distinct from plain values in that they have an extra bottom).
>>>
>>>
>>>  I don't get this line of thought.  I understand what you're saying, but
>> why
>> even bother trying to distinguish between bottoms when they can't be
>> compared by equality, or even computed?
>>
>
> If we have,
>
>   data OneTuple a = One a
>
> Then
>
>_|_ /= One _|_
>
>
That is vacuously true.  I will demonstrate the source of the contradiction
later.  But you also have "_|_ == One _|_", by evaluation:

> Just undefined
Just *** Exception: Prelude.undefined



> This can be detected by seq: the left-hand side doesn't terminate, whereas
> the right-hand side does. And moreover, this can mess up other things (e.g.,
> monads) by introducing too much laziness. Space leaks are quite a serious
> matter and they have nothing to do with trying to compare uncomputable
> values. Do you want a seemingly insignificant refactoring to cause your
> program to suddenly hang forever? Or to take up gobs more space than it used
> to?
>

'seq' is not a "function", since it breaks referential transparency and
possibly extensionality in function composition.  By construction, "seq a b
= b", and yet "seq undefined b /= b".  Admittedly, the Haskell report and
the GHC implementation, diverge on this issue.  Haskell98 specifically
defines seq in terms of a comparison with bottom, whereas GHC "merely"
reduces the first argument to WHNF.  In any case, the reduction is a side
effect, with which can lead to inconsistent semantics if 'seq' is included
in "the language".

It is nice to know that we can work in a consistent language if we avoid
certain constructs, such as 'seq', 'unsafePerformIO', and probably others.
 In addition to making the "core language" conceptually simpler, it means
that we can be sure we aren't inadvertently destroying the correctness
guarantees introduced by the Howard-Curry correspondence theorem.


>
> Nope, it contains one. Just ask any proof theorist, or anyone who uses
> witnesses to capture information in the type system.
>
>
I have studied enough proof theory, model theory, and lattice theory to know
that there is room for both positions.  Just because you /can/ lift a
lattice into one with bottom, it doesn't mean you /should/, if it means
losing conceptual clarity.  In particular, I don't see why you want to
generate an algebra of special cases that add no expressiveness, and include
them in "the language", when you can use a quotient construction to remove
them from the language.  As a practical matter, 'seq' is necessary.  But it
should be treated as a special case (like unsafePerformIO), because it IS
one.

Also, there is no need for a set to contain an element for it to be named or
quantified over.  The empty set can be a witness just as well as a singleton
set.  EmptyDataDecls works just as well whether you interpret (undefined ::
Blah) to mean "a Blah that is not defined" or "a Blah that is the value
'undefined'".  Indeed, the latter is paradoxical.  'undefined = undefined'
type checks, but it is not well-founded -- which is exactly why it is not
defined!  'undefined' is not a value.   It is the name for a thing which
cannot be evaluated.  We happen to know that there are a lot of things which
cannot be evaluated, but the quotient construction treats them all the same.
 (There is the practical issue of GHC handling Prelude.undefined differently
than the other bottoms.  But I won't complain about that ;0)


>  If you choose to interpret all bottoms as being the same non-existent,
>> unquantifiable (in the language of Haskell) "proto-value", you get the
>> isomorphism between types a and (a), as types.
>>
>
> Nope, because we have
>
>notBottom :: OneTuple a -> Bool
>notBottom x = x `seq` True
>
> whereas
>
>isBottom :: a -> Bool
>isBottom x = x `seq` True
>
>
seq is not a function, and is removed from consideration by the quotient
construction I have mentioned, specifically because of how it behaves on
bottom and the fact that the Haskell98 report defines it in terms of
comparing values to bottom, an operation which is known to be impossible.
 notBottom and isBottom are also not functions, for the same reason.


>
>

>  Indeed, those are the
>> semantics in use by the language.  A value written (a) is interpreted as
>> a.
>>  A type written (a) is interpreted as a.
>>
>
> That's a syntactic matter. Those ar

Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Remi Turk
On Mon, Mar 07, 2011 at 10:31:25PM +0100, Daniel Fischer wrote:
> On Monday 07 March 2011 22:14:38, Remi Turk wrote:
> > cinvoke (the C library) is obviously not installed on the testing
> > machine. Does that really mean no library with uncommon C dependencies
> > gets documentation on hackage?
> > 
> > Remi
> 
> Basically, yes. As far as I know, documentation is only built for libraries 
> that build on hackage.
> 
> Maybe it would be a good idea to have the opportunity to upload haddock 
> bundles to hackage too for such libraries.

That sucks :(
Uploading haddock bundles could solve the problem, though I don't
currently understand why being able to successfully configure a
package is a prerequisite to generating the docs.

Anyway, I just put the docs online somewhere else with a link
from the homepage: http://haskell.org/haskellwiki/Library/cinvoke

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Daniel Fischer
On Monday 07 March 2011 22:14:38, Remi Turk wrote:
> On Mon, Mar 07, 2011 at 10:00:47PM +0100, Daniel Fischer wrote:
> > On Monday 07 March 2011 21:42:16, Gábor Lehel wrote:
> > > It's reporting a build failure.
> > 
> > Missing C library.
> 
> cinvoke (the C library) is obviously not installed on the testing
> machine. Does that really mean no library with uncommon C dependencies
> gets documentation on hackage?
> 
> Remi

Basically, yes. As far as I know, documentation is only built for libraries 
that build on hackage.

Maybe it would be a good idea to have the opportunity to upload haddock 
bundles to hackage too for such libraries.

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Remi Turk
On Mon, Mar 07, 2011 at 10:00:47PM +0100, Daniel Fischer wrote:
> On Monday 07 March 2011 21:42:16, Gábor Lehel wrote:
> > 
> > It's reporting a build failure.
> >
> 
> Missing C library.

cinvoke (the C library) is obviously not installed on the testing machine.
Does that really mean no library with uncommon C dependencies
gets documentation on hackage?

Remi

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Daniel Fischer
On Monday 07 March 2011 21:42:16, Gábor Lehel wrote:
> 
> It's reporting a build failure.
>

Missing C library.

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Gábor Lehel
On Mon, Mar 7, 2011 at 7:32 PM, Remi Turk  wrote:
> On Mon, Mar 07, 2011 at 09:41:27AM +, Max Bolingbroke wrote:
>> Hi Remi,
>>
>> On 6 March 2011 13:38, Remi Turk  wrote:
>> > I am happy to finally announce cinvoke 0.1, a binding to the
>> > C library cinvoke[1], allowing functions to be loaded and called
>> > whose names and types are not known before run-time.
>>
>> As the author of the libffi package
>> (http://hackage.haskell.org/package/libffi-0.1) which does a similar
>> thing, could you say when it would be appropriate to use one or the
>> other package?
>>
>> Cheers,
>> Max
>
> Of course:
>
> - libffi doesn't do library/function loading; you'll need to use
>  System.Posix.DynamicLinker or System.Win32.DLL for that.
>  cinvoke will not only load your libraries and functions,
>  but even collect the garbage afterwards.
> - Things seem to have changed, but back when I first looked at
>  cinvoke, getting libffi to run under windows didn't seem too
>  realistic.
> - If you need to pass C structs (by value), you'll have to use
>  libffi: cinvoke doesn't support them at all.
> - The current version of libffi is not exception safe (I do have
>  some code lying around here though...)
> - cinvoke is actually haddockized (although hackage still hasn't
>  generated the docs, apparently).

It's reporting a build failure.

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



-- 
Work is punishment for failing to procrastinate effectively.

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Remi Turk
On Mon, Mar 07, 2011 at 09:41:27AM +, Max Bolingbroke wrote:
> Hi Remi,
> 
> On 6 March 2011 13:38, Remi Turk  wrote:
> > I am happy to finally announce cinvoke 0.1, a binding to the
> > C library cinvoke[1], allowing functions to be loaded and called
> > whose names and types are not known before run-time.
> 
> As the author of the libffi package
> (http://hackage.haskell.org/package/libffi-0.1) which does a similar
> thing, could you say when it would be appropriate to use one or the
> other package?
> 
> Cheers,
> Max

Of course:

- libffi doesn't do library/function loading; you'll need to use
  System.Posix.DynamicLinker or System.Win32.DLL for that.
  cinvoke will not only load your libraries and functions,
  but even collect the garbage afterwards.
- Things seem to have changed, but back when I first looked at
  cinvoke, getting libffi to run under windows didn't seem too
  realistic.
- If you need to pass C structs (by value), you'll have to use
  libffi: cinvoke doesn't support them at all.
- The current version of libffi is not exception safe (I do have
  some code lying around here though...)
- cinvoke is actually haddockized (although hackage still hasn't
  generated the docs, apparently).

Groeten, Remi

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


Re: [Haskell-cafe] silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread trystan . s


I was not aware of that! Very cool. 




Trystan Spangler 



- Original Message - 
From: "Henning Thielemann"  
To: "trystan s"  
Cc: "Felipe Almeida Lessa" , haskell-cafe@haskell.org 
Sent: Monday, March 7, 2011 9:56:16 AM 
Subject: Re: silently-0.0.1 (prevent IO actions from writing to stdout) 


On Mon, 7 Mar 2011, trysta...@comcast.net wrote: 

> * I could see what OS it is and try those options and use a temp file only if 
> it's an 
> unexpected os. Unfortunately System.Info.os reports windows (and some other 
> os's) as 
> "mingw32", I think it's because of how GHC was compiled. Who knows what the 
> real os is 
> or what each os will be reported as in the future or how they appear to other 
> compilers 
> and runtimes. 

You could add a check to Cabal and then choose a platform-dependent module 
using 

If os(windows) 
Hs-Source-Dirs: windows/src 
Else 
Hs-Source-Dirs: unix/src 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread Henning Thielemann


On Mon, 7 Mar 2011, trysta...@comcast.net wrote:


* I could see what OS it is and try those options and use a temp file only if 
it's an
unexpected os. Unfortunately System.Info.os reports windows (and some other 
os's) as
"mingw32", I think it's because of how GHC was compiled. Who knows what the 
real os is
or what each os will be reported as in the future or how they appear to other 
compilers
and runtimes.


You could add a check to Cabal and then choose a platform-dependent module 
using


  If os(windows)
Hs-Source-Dirs: windows/src
  Else
Hs-Source-Dirs: unix/src

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


Re: [Haskell-cafe] [Haskell] ANNOUNCE: silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread trystan . s


Thanks for the feedback! I'll definitely update the documentation. I agree that 
temp files are a weird way to go about it but they're the least surprising and 
dangerous way I could think of handling it. 




Unix has /dev/null and Windows has a NUL device that works the same way so I 
could use those. 

* I could see what OS it is and try those options and use a temp file only if 
it's an unexpected os. Unfortunately System.Info.os reports windows (and some 
other os's) as "mingw32", I think it's because of how GHC was compiled. Who 
knows what the real os is or what each os will be reported as in the future or 
how they appear to other compilers and runtimes. 

* I could write to /dev/null or NUL if they exist and use a temp file if 
neither does, but if there's a legitimate /dev/null or NUL file then having 
some unrelated program write to them would be very very bad and a major pain 
for whoever has to figure that one out. 




I'd rather not use temp files but both of these seem problematic. Does anyone 
have a better idea or think that either of those are acceptable? 




Trystan Spangler 


- Original Message - 
From: "Felipe Almeida Lessa"  
To: "Trystan Spangler"  
Cc: haskell-cafe@haskell.org 
Sent: Monday, March 7, 2011 3:41:07 AM 
Subject: Re: [Haskell] ANNOUNCE: silently-0.0.1 (prevent IO actions from 
writing to stdout) 

Hello! 

I wouldn't expect that a function that ignores the output directs it 
to a temporary file. I think that should be clearly stated on the 
documentation, as this may be undesirable. I don't know if there is a 
better way of solving this problem, though. 

(Note, however, that on Unix systems you could probably direct the 
output to /dev/null.) 

Cheers, 

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread Daniel Fischer
On Monday 07 March 2011 16:08:01, Alberto G. Corona wrote:
> I use leksah, and I want to say thanks to the people that maintain it. I
> want also to encourage them to continuing its valuable work.
> 
> from the last release of Leksah, I particulary appreciate its:
> 
> Multiplatform support
> Ease of installation in all platforms including windows
> capability to works with many cabal packages in a single workspace
> its detection of dependencies and rebuilding of the affected packages
> Integration of GHCI and the GHCI debugger
> integrated building of documentation
> referencing and navigation trough the  source of the installed packages
> and of course all the other traditional IDE capabilities

That sounds nice, so I thought I'd try out leksah again.

Unfortunately, the dependencies rule out GHC-7 (base < 4.3, Cabal < 1.9, 
containers < 0.4 were the ones that sprang to the eyes immediately).
Bummer

Maybe someone could try relaxing the bounds and build it with GHC-7, and - 
if it works - upload a new version?
(I could try if I get a go-ahead from Hamish or Jürgen)

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread JP Moresmau
The eclipseFP Help forum or mailing list is probably a better medium
for EclipseFP questions than haskell-cafe, I'd say...
EclipseFP uses the scion library, but comes bundled with it, so it
should be able to build it (including downloading dependencies from
hackage) itself without you building scion manually (if you still want
to do it, there is a flag you can set to specify the version of Cabal
you're using).
I think you're confusing the instructions to install EclipseFP and use
it to develop in Haskell with the instructions on the build page that
are for people that wish to hack EclipseFP itself. Basically you need
to install EclipseFP using the Eclipse "install new software" features
and take it from there.
You can of course have different workspaces, one for your haskell
projects, one for your android projects, but it doesn't matter if you
have projects of different types in the same workspace.
Good luck, and if you're still confused feel free to contact me directly.

JP

On Mon, Mar 7, 2011 at 3:19 PM, David Virebayre
 wrote:
> 2011/3/3 JP Moresmau :
>
>> Hello, I'm one of the maintainers of EclipseFP. It is a real
>> alternative: it works, it is maintained, supported and enhanced. I use
>> it for my own projects, and of course I use it to work on the version
>> of the scion library that ships with it, so we eat our own dogfood
>> :-). A new minor version is going to come out in the next couple of
>> weeks. Why don't you give it a try? We appreciate any feedback!
>
> from  http://eclipsefp.sourceforge.net/eclipsefp2.html I understand that
> building scion is automatically done, but can be optionally done it it's too
> long.
> but from http://eclipsefp.sourceforge.net/build.html I see that I do have to
> build it. But :
>
> git clone http://github.com/JPMoresmau/scion.git
> Initialized empty Git repository in /data/code/scion/.git/
> remote: Counting objects: 3563, done.
> remote: Compressing objects: 100% (1310/1310), done.
> remote: Total 3563 (delta 2137), reused 3342 (delta 1970)
> Receiving objects: 100% (3563/3563), 580.09 KiB | 395 KiB/s, done.
>
> Resolving deltas: 100% (2137/2137), done.
>
> david@pcdavid:~/code$ cd scion/
>
> david@pcdavid:~/code/scion$ sudo cabal install
> [sudo] password for david:
> Resolving dependencies...
> cabal: dependencies conflict: ghc-6.12.3 requires Cabal ==1.8.0.6 however
> Cabal-1.8.0.6 was excluded because scion-0.1.0.8 requires Cabal ==1.6.*
>
> I'm not sure what to do now. Trying to install eclipsefp without scion built
> in case it works, but I'm not used to eclipse, I could use some screenshots
> to take me step by step through the process. For example, My "project" menu
> has open grayed, and file/import wants me to choose an import source (I
> chose Existing project into workspace) but then do I copy projects into
> workspace ( I did not )
> I have eclipse already setup with android development (I have just a toy
> project, I planned to learn about android programming), when I imported the
> projects they appeared at the same place. Is there a way not to mix android
> and haskell projects ? Do I create a new workspace, or assign working sets ?
> Anyway the projects are in the workspace, and there's 123 warnings; but I
> can't really tell if the build failed or not.
> Selecting all the project, and right-click - refresh didn't seem to change
> anything.
> But it seems it worked, because step 7 does launch a new eclipse window, and
> I can see haskell in the preferences. Except that I had an error message
> regarding scion, and stupid me, clicked ok before I could remember what was
> written.
> I tried rebuild scion, but nothing seemed to happen. I closed the first
> Eclipse window (the one that has all the eclipsefp projects in the package
> explorer), but then the second one closed too. I lauched eclipse again, run
> configurations, etc and this time it looks like scion is building (well
> something happens in the Console tab)
> While this is building, I'm wondering if there's a way to launch eclise
> directly in the right "mode". Not having to go to run configurations, etc.
> Ah, the build failed. Complains that HUnit is missing. So I cabal install
> it, close my Eclipse window, run configurations again on the first Eclipse
> window, and the build resumes.
>  And build success. Now to open a haskell source file and play with
> Eclipse.
> 
> David.
>



-- 
JP Moresmau
http://jpmoresmau.blogspot.com/

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread Alberto G. Corona
I use leksah, and I want to say thanks to the people that maintain it. I
want also to encourage them to continuing its valuable work.

from the last release of Leksah, I particulary appreciate its:

Multiplatform support
Ease of installation in all platforms including windows
capability to works with many cabal packages in a single workspace
its detection of dependencies and rebuilding of the affected packages
Integration of GHCI and the GHCI debugger
integrated building of documentation
referencing and navigation trough the  source of the installed packages
and of course all the other traditional IDE capabilities


2011/3/7 David Virebayre 

> 2011/3/3 JP Moresmau :
>
>
> > Hello, I'm one of the maintainers of EclipseFP. It is a real
> > alternative: it works, it is maintained, supported and enhanced. I use
> > it for my own projects, and of course I use it to work on the version
> > of the scion library that ships with it, so we eat our own dogfood
> > :-). A new minor version is going to come out in the next couple of
> > weeks. Why don't you give it a try? We appreciate any feedback!
>
> from  http://eclipsefp.sourceforge.net/eclipsefp2.html I understand that
> building scion is automatically done, but can be optionally done it it's too
> long.
> but from http://eclipsefp.sourceforge.net/build.html I see that I do have
> to build it. But :
>
> git clone http://github.com/JPMoresmau/scion.git
> Initialized empty Git repository in /data/code/scion/.git/
> remote: Counting objects: 3563, done.
> remote: Compressing objects: 100% (1310/1310), done.
> remote: Total 3563 (delta 2137), reused 3342 (delta 1970)
> Receiving objects: 100% (3563/3563), 580.09 KiB | 395 KiB/s, done.
>
> Resolving deltas: 100% (2137/2137), done.
>
> david@pcdavid:~/code$ cd scion/
>
> david@pcdavid:~/code/scion$ sudo cabal install
> [sudo] password for david:
> Resolving dependencies...
> cabal: dependencies conflict: ghc-6.12.3 requires Cabal ==1.8.0.6 however
> Cabal-1.8.0.6 was excluded because scion-0.1.0.8 requires Cabal ==1.6.*
>
> I'm not sure what to do now. Trying to install eclipsefp without scion
> built in case it works, but I'm not used to eclipse, I could use some
> screenshots to take me step by step through the process. For example, My
> "project" menu has open grayed, and file/import wants me to choose an import
> source (I chose Existing project into workspace) but then do I copy projects
> into workspace ( I did not )
>
> I have eclipse already setup with android development (I have just a toy
> project, I planned to learn about android programming), when I imported the
> projects they appeared at the same place. Is there a way not to mix android
> and haskell projects ? Do I create a new workspace, or assign working sets ?
>
> Anyway the projects are in the workspace, and there's 123 warnings; but I
> can't really tell if the build failed or not.
> Selecting all the project, and right-click - refresh didn't seem to change
> anything.
>
> But it seems it worked, because step 7 does launch a new eclipse window,
> and I can see haskell in the preferences. Except that I had an error message
> regarding scion, and stupid me, clicked ok before I could remember what was
> written.
>
> I tried rebuild scion, but nothing seemed to happen. I closed the first
> Eclipse window (the one that has all the eclipsefp projects in the package
> explorer), but then the second one closed too. I lauched eclipse again, run
> configurations, etc and this time it looks like scion is building (well
> something happens in the Console tab)
>
> While this is building, I'm wondering if there's a way to launch eclise
> directly in the right "mode". Not having to go to run configurations, etc.
>
> Ah, the build failed. Complains that HUnit is missing. So I cabal install
> it, close my Eclipse window, run configurations again on the first Eclipse
> window, and the build resumes.
>
>  And build success. Now to open a haskell source file and play with
> Eclipse.
>
> 
>
> David.
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread David Virebayre
2011/3/7 David Virebayre 

>  And build success. Now to open a haskell source file and play with
> Eclipse.
>

... and I keep having those "Problem occurred" popups:

'Occurrences has encountered a problem
An internal error has occurred.

In the detail:

An internal error has occurred.
java.lang.NullPointerException

In show error log tab, 3 messages; all have 'net.sf.eclipsefp.haskell.ui' in
the Plug-in column :
TWICE:
eclipse.buildId=M20100211-1343
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=fr_FR
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data
/data/code/eclipse/../runtime-New_configuration -dev
file:/data/code/eclipse/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties
-os linux -ws gtk -arch x86


Info
Mon Mar 07 15:15:13 CET 2011
cabal executable: /usr/local/bin/cabal, cabal-install 0.8.2, Cabal library
version 1.8.0.2

AND ONCE:
eclipse.buildId=M20100211-1343
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=fr_FR
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data
/data/code/eclipse/../runtime-New_configuration -dev
file:/data/code/eclipse/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties
-os linux -ws gtk -arch x86


Info
Mon Mar 07 15:03:33 CET 2011
cabal executable: /home/david/bin/cabalinit, cabal-install , Cabal library
version

Cheers,

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread David Virebayre
2011/3/3 JP Moresmau :

> Hello, I'm one of the maintainers of EclipseFP. It is a real
> alternative: it works, it is maintained, supported and enhanced. I use
> it for my own projects, and of course I use it to work on the version
> of the scion library that ships with it, so we eat our own dogfood
> :-). A new minor version is going to come out in the next couple of
> weeks. Why don't you give it a try? We appreciate any feedback!

from  http://eclipsefp.sourceforge.net/eclipsefp2.html I understand that
building scion is automatically done, but can be optionally done it it's too
long.
but from http://eclipsefp.sourceforge.net/build.html I see that I do have to
build it. But :

git clone http://github.com/JPMoresmau/scion.git
Initialized empty Git repository in /data/code/scion/.git/
remote: Counting objects: 3563, done.
remote: Compressing objects: 100% (1310/1310), done.
remote: Total 3563 (delta 2137), reused 3342 (delta 1970)
Receiving objects: 100% (3563/3563), 580.09 KiB | 395 KiB/s, done.

Resolving deltas: 100% (2137/2137), done.

david@pcdavid:~/code$ cd scion/

david@pcdavid:~/code/scion$ sudo cabal install
[sudo] password for david:
Resolving dependencies...
cabal: dependencies conflict: ghc-6.12.3 requires Cabal ==1.8.0.6 however
Cabal-1.8.0.6 was excluded because scion-0.1.0.8 requires Cabal ==1.6.*

I'm not sure what to do now. Trying to install eclipsefp without scion built
in case it works, but I'm not used to eclipse, I could use some screenshots
to take me step by step through the process. For example, My "project" menu
has open grayed, and file/import wants me to choose an import source (I
chose Existing project into workspace) but then do I copy projects into
workspace ( I did not )

I have eclipse already setup with android development (I have just a toy
project, I planned to learn about android programming), when I imported the
projects they appeared at the same place. Is there a way not to mix android
and haskell projects ? Do I create a new workspace, or assign working sets ?

Anyway the projects are in the workspace, and there's 123 warnings; but I
can't really tell if the build failed or not.
Selecting all the project, and right-click - refresh didn't seem to change
anything.

But it seems it worked, because step 7 does launch a new eclipse window, and
I can see haskell in the preferences. Except that I had an error message
regarding scion, and stupid me, clicked ok before I could remember what was
written.

I tried rebuild scion, but nothing seemed to happen. I closed the first
Eclipse window (the one that has all the eclipsefp projects in the package
explorer), but then the second one closed too. I lauched eclipse again, run
configurations, etc and this time it looks like scion is building (well
something happens in the Console tab)

While this is building, I'm wondering if there's a way to launch eclise
directly in the right "mode". Not having to go to run configurations, etc.

Ah, the build failed. Complains that HUnit is missing. So I cabal install
it, close my Eclipse window, run configurations again on the first Eclipse
window, and the build resumes.

 And build success. Now to open a haskell source file and play with
Eclipse.



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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Christian Maeder
Am 07.03.2011 14:20, schrieb Stephen Tetley:
> Hi Klaus
> 
> Unless you have very specific white-space considerations, you really
> want to be using Parsec's Token and LanguageDef modules.

Well, I would want to use Parsec's Token and LanguageDef modules just to
get the white spaces (and comments to be ignored) right.

Simply skip spaces and comments after every lexical token (by your own
wrapper function like "Text.ParserCombinators.Parsec.Token.lexeme").

C.

> 
> There are examples in the "legacy" Parsec 2.0 distribution available
> from Daan Leijen's old website:
> http://legacy.cs.uu.nl/daan/parsec.html
> 
> Best wishes
> 
> Stephen

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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Hauschild, Klaus (EXT)
Hi Daniel,

I actually corrected the order of these two.

Thanks

-Ursprüngliche Nachricht-
Von: Daniel Fischer [mailto:daniel.is.fisc...@googlemail.com] 
Gesendet: Montag, 7. März 2011 14:29
An: haskell-cafe@haskell.org
Cc: Hauschild, Klaus (EXT)
Betreff: Re: [Haskell-cafe] Overlaping Parsec rules

On Monday 07 March 2011 13:48:31, Hauschild, Klaus (EXT) wrote:
> But there are still other problems to solve.

One thing that I saw which wasn't mentioned before (or I missed it) is that 
you need to try parsing binders before parsing identifiers. Currently, all 
binders are happily accepted as identifiers.

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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Daniel Fischer
On Monday 07 March 2011 13:48:31, Hauschild, Klaus (EXT) wrote:
> But there are still other problems to solve.

One thing that I saw which wasn't mentioned before (or I missed it) is that 
you need to try parsing binders before parsing identifiers. Currently, all 
binders are happily accepted as identifiers.

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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Stephen Tetley
Hi Klaus

Unless you have very specific white-space considerations, you really
want to be using Parsec's Token and LanguageDef modules.

There are examples in the "legacy" Parsec 2.0 distribution available
from Daan Leijen's old website:
http://legacy.cs.uu.nl/daan/parsec.html

Best wishes

Stephen

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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Christian Maeder
Am 07.03.2011 13:48, schrieb Hauschild, Klaus (EXT):
> Thanks Christian,
> 
> I adapted the "keyword" parser and now "n" <-> "negi" does not occur.
> 
> But there are still other problems to solve. If I activate the parseFunction 
> the parser will answer to fact.gml unexpected end of input, expecting space 
> or "}".

Your redefinition of spaces (= skipMany1 space) is problematic and:

 parseList = sepBy parseGml' spaces

Allow for the original (optional) spaces after parseGml':

  parseGml'' = liftM2 const parseGml' spaces

  parseList = many parseGml''

C.

P.S. why do you call? many (noneOf "")

   manyTill anyChar newline

   or just: many (noneOf "\n")

   (a trailing newline will be skipped by spaces)

> 
> Any ideas?
> 
> 
> -Ursprüngliche Nachricht-
> Von: Christian Maeder [mailto:christian.mae...@dfki.de] 
> Gesendet: Montag, 7. März 2011 12:23
> An: Hauschild, Klaus (EXT)
> Cc: haskell-cafe@haskell.org
> Betreff: Re: Overlaping Parsec rules
> 
> You should parse keywords using:
> 
> keyword s = try (string s) >> notFollowedBy (letter <|> digit)
> 
> C.
> 
> Am 07.03.2011 11:34, schrieb Hauschild, Klaus (EXT):
>> Hi,
>>  
>> to solve this ICFP task _http://www.cs.cornell.edu/icfp/task.htm_ I'm
>> currnetly working on the parser. With the hint from Thu (reading Phillip
>> Wadlers monadic parser paper) and consulting
>> _http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/Parsing_
>> I produce a first working version of the parser.
>> After this great moment I completed the token definition and near all
>> parsing rules. For the complete code have a look at
>> _http://code.google.com/p/hgmltracer/source/browse/#svn%2Ftrunk%2FhGmlTracer_
>>  
>> data GmlToken =
>>
>> -- structures
>>
>> FunctionToken TokenSequence |
>>
>> ArrayToken TokenSequence|
>>
>> -- control operators
>>
>> ApplyToken  |
>>
>> IfToken |
>>
>> -- number operators
>>
>> AddiToken   |
>>
>> AddfToken   |
>>
>> ACosToken   |
>>
>> ASinToken   |
>>
>> ClampfToken |
>>
>> CosToken|
>>
>> DiviToken   |
>>
>> DivfToken   |
>>
>> EqiToken|
>>
>> EqfToken|
>>
>> FloorToken  |
>>
>> FracToken   |
>>
>> LessiToken  |
>>
>> LessfToken  |
>>
>> ModiToken   |
>>
>> MuliToken   |
>>
>> MulfToken   |
>>
>> NegiToken   |
>>
>> NegfToken   |
>>
>> ToRealToken |
>>
>> SinToken|
>>
>> SqrtToken   |
>>
>> SubiToken   |
>>
>> SubfToken   |
>>
>> -- points
>>
>> GetXToken   |
>>
>> GetYToken   |
>>
>> GetZToken   |
>>
>> PointToken  |
>>
>> -- arrays
>>
>> GetToken|
>>
>> LengthToken |
>>
>> -- environment
>>
>> IdentifierToken String  |
>>
>> BinderToken String  |
>>
>> -- types
>>
>> BoolToken Bool  |
>>
>> IntToken Int|
>>
>> RealToken Double|
>>
>> StringToken String  deriving Show  
>>  
>> And
>>  
>> parseGml :: String -> [GmlToken]
>>
>> parseGml input = case parse parseList "gml" input of
>>
>> Left err -> error ("Parse error: " ++ (show err))
>>
>> Right gml -> gml
>>
>>
>>
>> parseList = sepBy parseGml' spaces
>>
>>
>>
>> parseGml' =
>>
>> -- structures
>>
>> --parseFunction
>>
>> --<|> parseArray
>>
>> -- control operators
>>
>> parseControlOperators
>>
>> -- number operators
>>
>> <|> parseNumberOperators
>>
>> -- points
>>
>> <|> parsePointOperators
>>
>> -- arrays
>>
>> <|> parseArrayOperators
>>
>>  

Re: [Haskell-cafe] ghc in debian sid

2011-03-07 Thread rustom
There are other instabilities (sid is after all unstable) so staying
with testing for now.


On Mar 7, 5:59 pm, rustom  wrote:
> I tried to move from debian testing to sid and got the message that a
> whole load of libghc**'s would be removed.
>
> Are more recent ones lined up?
>
> ___
> Haskell-Cafe mailing list
> Haskell-C...@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe

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


[Haskell-cafe] ghc in debian sid

2011-03-07 Thread rustom
I tried to move from debian testing to sid and got the message that a
whole load of libghc**'s would be removed.

Are more recent ones lined up?

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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Hauschild, Klaus (EXT)
Thanks Christian,

I adapted the "keyword" parser and now "n" <-> "negi" does not occur.

But there are still other problems to solve. If I activate the parseFunction 
the parser will answer to fact.gml unexpected end of input, expecting space or 
"}".

Any ideas?


-Ursprüngliche Nachricht-
Von: Christian Maeder [mailto:christian.mae...@dfki.de] 
Gesendet: Montag, 7. März 2011 12:23
An: Hauschild, Klaus (EXT)
Cc: haskell-cafe@haskell.org
Betreff: Re: Overlaping Parsec rules

You should parse keywords using:

keyword s = try (string s) >> notFollowedBy (letter <|> digit)

C.

Am 07.03.2011 11:34, schrieb Hauschild, Klaus (EXT):
> Hi,
>  
> to solve this ICFP task _http://www.cs.cornell.edu/icfp/task.htm_ I'm
> currnetly working on the parser. With the hint from Thu (reading Phillip
> Wadlers monadic parser paper) and consulting
> _http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/Parsing_
> I produce a first working version of the parser.
> After this great moment I completed the token definition and near all
> parsing rules. For the complete code have a look at
> _http://code.google.com/p/hgmltracer/source/browse/#svn%2Ftrunk%2FhGmlTracer_
>  
> data GmlToken =
>
> -- structures
>
> FunctionToken TokenSequence |
>
> ArrayToken TokenSequence|
>
> -- control operators
>
> ApplyToken  |
>
> IfToken |
>
> -- number operators
>
> AddiToken   |
>
> AddfToken   |
>
> ACosToken   |
>
> ASinToken   |
>
> ClampfToken |
>
> CosToken|
>
> DiviToken   |
>
> DivfToken   |
>
> EqiToken|
>
> EqfToken|
>
> FloorToken  |
>
> FracToken   |
>
> LessiToken  |
>
> LessfToken  |
>
> ModiToken   |
>
> MuliToken   |
>
> MulfToken   |
>
> NegiToken   |
>
> NegfToken   |
>
> ToRealToken |
>
> SinToken|
>
> SqrtToken   |
>
> SubiToken   |
>
> SubfToken   |
>
> -- points
>
> GetXToken   |
>
> GetYToken   |
>
> GetZToken   |
>
> PointToken  |
>
> -- arrays
>
> GetToken|
>
> LengthToken |
>
> -- environment
>
> IdentifierToken String  |
>
> BinderToken String  |
>
> -- types
>
> BoolToken Bool  |
>
> IntToken Int|
>
> RealToken Double|
>
> StringToken String  deriving Show  
>  
> And
>  
> parseGml :: String -> [GmlToken]
>
> parseGml input = case parse parseList "gml" input of
>
> Left err -> error ("Parse error: " ++ (show err))
>
> Right gml -> gml
>
> 
>
> parseList = sepBy parseGml' spaces
>
> 
>
> parseGml' =
>
> -- structures
>
> --parseFunction
>
> --<|> parseArray
>
> -- control operators
>
> parseControlOperators
>
> -- number operators
>
> <|> parseNumberOperators
>
> -- points
>
> <|> parsePointOperators
>
> -- arrays
>
> <|> parseArrayOperators
>
> -- types
>
> <|> parseBool
>
> <|> parseInteger
>
> <|> parseString
>
> -- environment
>
> <|> parseIdentifier
>
> <|> parseBinder
>
> 
>
> parseArray = parseSequence '[' ']'
>
> parseFunction = parseSequence '{' '}'
>
> parseSequence start end = do char start
>
>  array <- parseList
>
>  char end
>
>  return $ ArrayToken array
>
> 
>
> parseControlOperators = parseApply <|> parseIf
>
> parseApply = do

Re: [Haskell-cafe] groupBy huh?

2011-03-07 Thread Henning Thielemann
Jacek Generowicz schrieb:
> Hi Cafe,
> 
> It seems that I don't understand what groupBy does.
> 
> I expect it to group together elements as long as adjacent ones satisfy
> the predicate, so I would expect ALL four of the following to give one
> group of 3 and a group of 1.
> 
> Prelude> :m + Data.List
> Prelude Data.List> groupBy (<) "abcb"
> ["abcb"]
> Prelude Data.List> groupBy (<) "abca"
> ["abc","a"]
> Prelude Data.List> groupBy (<) [1,2,3,2]
> [[1,2,3,2]]
> Prelude Data.List> groupBy (<) [1,2,3,1]
> [[1,2,3],[1]]
> 
> What am I missing?


http://hackage.haskell.org/packages/archive/utility-ht/0.0.5.1/doc/html/Data-List-HT.html#v:groupBy


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


Re: [Haskell-cafe] [Haskell] ANNOUNCE: silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread Felipe Almeida Lessa
Hello!

I wouldn't expect that a function that ignores the output directs it
to a temporary file.  I think that should be clearly stated on the
documentation, as this may be undesirable.  I don't know if there is a
better way of solving this problem, though.

(Note, however, that on Unix systems you could probably direct the
output to /dev/null.)

Cheers,

-- 
Felipe.

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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Christian Maeder
You should parse keywords using:

keyword s = try (string s) >> notFollowedBy (letter <|> digit)

C.

Am 07.03.2011 11:34, schrieb Hauschild, Klaus (EXT):
> Hi,
>  
> to solve this ICFP task _http://www.cs.cornell.edu/icfp/task.htm_ I'm
> currnetly working on the parser. With the hint from Thu (reading Phillip
> Wadlers monadic parser paper) and consulting
> _http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/Parsing_
> I produce a first working version of the parser.
> After this great moment I completed the token definition and near all
> parsing rules. For the complete code have a look at
> _http://code.google.com/p/hgmltracer/source/browse/#svn%2Ftrunk%2FhGmlTracer_
>  
> data GmlToken =
>
> -- structures
>
> FunctionToken TokenSequence |
>
> ArrayToken TokenSequence|
>
> -- control operators
>
> ApplyToken  |
>
> IfToken |
>
> -- number operators
>
> AddiToken   |
>
> AddfToken   |
>
> ACosToken   |
>
> ASinToken   |
>
> ClampfToken |
>
> CosToken|
>
> DiviToken   |
>
> DivfToken   |
>
> EqiToken|
>
> EqfToken|
>
> FloorToken  |
>
> FracToken   |
>
> LessiToken  |
>
> LessfToken  |
>
> ModiToken   |
>
> MuliToken   |
>
> MulfToken   |
>
> NegiToken   |
>
> NegfToken   |
>
> ToRealToken |
>
> SinToken|
>
> SqrtToken   |
>
> SubiToken   |
>
> SubfToken   |
>
> -- points
>
> GetXToken   |
>
> GetYToken   |
>
> GetZToken   |
>
> PointToken  |
>
> -- arrays
>
> GetToken|
>
> LengthToken |
>
> -- environment
>
> IdentifierToken String  |
>
> BinderToken String  |
>
> -- types
>
> BoolToken Bool  |
>
> IntToken Int|
>
> RealToken Double|
>
> StringToken String  deriving Show  
>  
> And
>  
> parseGml :: String -> [GmlToken]
>
> parseGml input = case parse parseList "gml" input of
>
> Left err -> error ("Parse error: " ++ (show err))
>
> Right gml -> gml
>
> 
>
> parseList = sepBy parseGml' spaces
>
> 
>
> parseGml' =
>
> -- structures
>
> --parseFunction
>
> --<|> parseArray
>
> -- control operators
>
> parseControlOperators
>
> -- number operators
>
> <|> parseNumberOperators
>
> -- points
>
> <|> parsePointOperators
>
> -- arrays
>
> <|> parseArrayOperators
>
> -- types
>
> <|> parseBool
>
> <|> parseInteger
>
> <|> parseString
>
> -- environment
>
> <|> parseIdentifier
>
> <|> parseBinder
>
> 
>
> parseArray = parseSequence '[' ']'
>
> parseFunction = parseSequence '{' '}'
>
> parseSequence start end = do char start
>
>  array <- parseList
>
>  char end
>
>  return $ ArrayToken array
>
> 
>
> parseControlOperators = parseApply <|> parseIf
>
> parseApply = do string "apply"
>
> return $ ApplyToken
>
> parseIf = do string "if"
>
>  return $ IfToken
>
> 
>
> parseNumberOperators = do string "addi"
>
>   return $ AddiToken
>
><|> do string "addf"
>
>   return $ AddfToken
>
><|> do string "acos"
>
>   return $ ACosToken
> 

[Haskell-cafe] Explicitly Typed Exceptions in Haskell 98 (Was: Idiomatic error handling in Haskell)

2011-03-07 Thread Henning Thielemann


On Wed, 2 Mar 2011, Henning Thielemann wrote:


On Wed, 2 Mar 2011, Rouan van Dalen wrote:

I would like to know what is the preferred Haskell mechanism for handling 
exceptions in the IO monad?  I am not concerned with mechanisms such as 
Maybe / Either, but would like to know about exception mechanisms inside 
the IO monad.


The 2 I know of are:
 o) throwDyn
 o) ioError and catch

I do need the exceptions to be extendable.  So which is the preferred way
to handle exceptions in Haskell for new libs?



I recently had an idea of how to design extensible explicit type safe 
exceptions in Haskell 98, i.e. with single parameter type classes and 
non-overlapping instances. It seems to work quite well, the only drawback 
is that you have to define n^2 instances for n exceptions. This is much 
inspired by:

  http://users.dsic.upv.es/~jiborra/papers/explicitexceptions.pdf


Consider two exceptions: ReadException and WriteException. In order to be 
able to freely combine these exceptions, we use type classes, since type 
constraints of two function calls are automatically merged.


import Control.Monad.Exception.Synchronous (ExceptionalT, )

class ThrowsRead  e where throwRead  :: e
class ThrowsWrite e where throwWrite :: e

readFile  :: ThrowsRead  e => FilePath -> ExceptionalT e IO String
writeFile :: ThrowsWrite e => FilePath -> String -> ExceptionalT e IO ()


For example for

copyFile src dst =
   writeFile dst =<< readFile src

the compiler automatically infers

copyFile ::
  (ThrowsWrite e, ThrowsRead e) =>
  FilePath -> FilePath -> ExceptionalT e IO ()


Instead of ExceptionalT you can also use EitherT or ErrorT. It's also 
simple to add parameters to throwRead and throwWrite, such that you can 
pass more precise information along with the exception. I just want to 
keep it simple for now.


With those definitions you can already write a nice library and defer the 
decision of the particular exception types to the library user. The user 
might define something like


data ApplicationException =
 ReadException
   | WriteException

instance ThrowsRead ApplicationException where
   throwRead = ReadException

instance ThrowsWrite ApplicationException where
   throwWrite = WriteException


Using ApplicationException however it is cumbersome to handle only 
ReadException and propagate WriteException. The user might write 
something like


  case e of
 ReadException -> handleReadException
 WriteException -> throwT throwWrite

in order to handle a ReadException and regenerate a 'ThrowWrite e => e' 
type variable, instead of the concrete ApplicationException type.


He may choose to switch on multi-parameter type classes and overlapping 
instances, define an exception type like 'data EE l' and then use the 
technique from control-monad-exception for exception handling with the 
ExceptionalT monads.


Now I like to propose a technique for handling a particular set of 
exceptions in Haskell 98:


data ReadException e =
 ReadException
   | NoReadException e

instance ThrowsRead (ReadException e) where
throwRead = ReadException

instance ThrowsWrite e => ThrowsWrite (ReadException e) where
throwWrite = NoReadException throwWrite


data WriteException e =
 WriteException
   | NoWriteException e

instance ThrowsRead e => ThrowsRead (WriteException e) where
throwRead = NoWriteException throwRead

instance ThrowsWrite (WriteException e) where
throwWrite = WriteException



Defining exception types as a sum of "this particular exception" and 
"another exception" lets us compose concrete types that can carry a 
certain set of exceptions on the fly. This is very similar to switching 
from particular monads to monad transformers. Thanks to the type class 
approach the order of composition needs not to be fixed by the throwing 
function but is determined by the order of catching. We even do not have 
to fix the nested exception type fully when catching an exception. It is 
enough to fix the part that is interesting for 'catch':



import Control.Monad.Exception.Synchronous (Exceptional(Success,Exception))

catchRead :: ReadException e -> Exceptional e String
catchRead ReadException = Success "catched a read exception"
catchRead (NoReadException e) = Exception e

throwReadWrite :: (ThrowsRead e, ThrowsWrite e) => e
throwReadWrite =
   asTypeOf throwRead throwWrite

exampleCatchRead :: (ThrowsWrite e) => Exceptional e String
exampleCatchRead =
   catchRead throwReadWrite


Note how in exampleCatchRead the constraint ThrowsRead is removed from the 
constraint list of throwReadWrite.


As I said, the nasty thing is, that the library has to define n^2 
instances for n exceptions. Even worse, if an application imports package 
A and package B with their sets of exceptions, you have to make the 
exception types of A instances of the exception class of B and vice versa, 
and these are orphan instances.


However I am still uncertain, how sophisticated an exception system really 
must be. In princ

[Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Hauschild, Klaus (EXT)
Hi,

to solve this ICFP task http://www.cs.cornell.edu/icfp/task.htm I'm currnetly 
working on the parser. With the hint from Thu (reading Phillip Wadlers monadic 
parser paper) and consulting 
http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/Parsing I 
produce a first working version of the parser.
After this great moment I completed the token definition and near all parsing 
rules. For the complete code have a look at 
http://code.google.com/p/hgmltracer/source/browse/#svn%2Ftrunk%2FhGmlTracer

data GmlToken =

-- structures

FunctionToken TokenSequence |

ArrayToken TokenSequence|

-- control operators

ApplyToken  |

IfToken |

-- number operators

AddiToken   |

AddfToken   |

ACosToken   |

ASinToken   |

ClampfToken |

CosToken|

DiviToken   |

DivfToken   |

EqiToken|

EqfToken|

FloorToken  |

FracToken   |

LessiToken  |

LessfToken  |

ModiToken   |

MuliToken   |

MulfToken   |

NegiToken   |

NegfToken   |

ToRealToken |

SinToken|

SqrtToken   |

SubiToken   |

SubfToken   |

-- points

GetXToken   |

GetYToken   |

GetZToken   |

PointToken  |

-- arrays

GetToken|

LengthToken |

-- environment

IdentifierToken String  |

BinderToken String  |

-- types

BoolToken Bool  |

IntToken Int|

RealToken Double|

StringToken String  deriving Show

And

parseGml :: String -> [GmlToken]

parseGml input = case parse parseList "gml" input of

Left err -> error ("Parse error: " ++ (show err))

Right gml -> gml



parseList = sepBy parseGml' spaces



parseGml' =

-- structures

--parseFunction

--<|> parseArray

-- control operators

parseControlOperators

-- number operators

<|> parseNumberOperators

-- points

<|> parsePointOperators

-- arrays

<|> parseArrayOperators

-- types

<|> parseBool

<|> parseInteger

<|> parseString

-- environment

<|> parseIdentifier

<|> parseBinder



parseArray = parseSequence '[' ']'

parseFunction = parseSequence '{' '}'

parseSequence start end = do char start

 array <- parseList

 char end

 return $ ArrayToken array



parseControlOperators = parseApply <|> parseIf

parseApply = do string "apply"

return $ ApplyToken

parseIf = do string "if"

 return $ IfToken



parseNumberOperators = do string "addi"

  return $ AddiToken

   <|> do string "addf"

  return $ AddfToken

   <|> do string "acos"

  return $ ACosToken

   <|> do string "asind"

  return $ ASinToken

   <|> do string "clampf"

  return $ ClampfToken

   <|> do string "cos"

  return $ CosToken

   <|> do string "divi"

  return $ DiviToken

   <|> do string "divf"

  return $ DivfToken

   <|> do string "eqi"

  return $ EqiToken

   <|> do string "eqf"

  return $ EqfToken

   <|> do string "floor"

  return $ FloorToken

   <|> do string "frac"

  return $ FracToken

   <|> do string "lessi"

  return $ LessiToken

   <|> do string "lessf"

  return $ LessfToken

   <|> do string "modi"

  return $ ModiToken

   <|> do string "muli"

  return $ MuliToken

   <|> do string "mulf"

  return 

Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Max Bolingbroke
Hi Remi,

On 6 March 2011 13:38, Remi Turk  wrote:
> I am happy to finally announce cinvoke 0.1, a binding to the
> C library cinvoke[1], allowing functions to be loaded and called
> whose names and types are not known before run-time.

As the author of the libffi package
(http://hackage.haskell.org/package/libffi-0.1) which does a similar
thing, could you say when it would be appropriate to use one or the
other package?

Cheers,
Max

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


Re: [Haskell-cafe] How to daemonize a threaded Haskell program?

2011-03-07 Thread David Anderson
On Mon, Mar 7, 2011 at 12:39 AM, Bas van Dijk  wrote:

> Sterling, Gregory, Brandon and David thanks for your suggestions.
>
> On 6 March 2011 05:38, David Anderson  wrote:
> > I humbly recommend doing such daemonizations from outside your program.
> > Programs that daemonize on startup make it very difficult to monitor them
> by
> > direct means, instead forcing you to rely on PID files and other
> mechanisms
> > which may not always be available or fresh.
>
> Agreed, I already noticed that debugging is a bit harder since I have
> no stdout and stderr anymore.
>
> > For reference, Upstart, the new PID 1 on Ubuntu and friends, has a
> horrible
> > hack[1] built in specifically to keep track of processes that "helpfully"
> > daemonize themselves, so that it can offer additional services like
> > restarting crashed services or notifying the owner of a problem.
> > As has been pointed out elsewhere on thread, there are plenty of
> standalone
> > programs that implement daemonization if you end up not using service
> > management software to do it for you.
>
> I plan to run the daemon on a Ubuntu server. Do you know if Upstart is
> able to daemonize a process?
>

It's perfectly simple. In fact, it's the default assumption of Upstart that
your program doesn't daemonize, and that Upstart should help it. You have to
specify if your program violates that assumption.

Here's a sample file. It specifies a service that; should run whenever the
main runlevels are entered (i.e. basic system init like mounting filesystems
is done, but no other guarantee); stops when the system leaves those
runlevels; runs a binary that does not fork or daemonize; respawns the
service if the process should die for any reason; can be manually stopped
and restarted by the admin if he feels like it.

$ cat /etc/init/demo.conf
description "Demo service that doesn't daemonize by itself"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /path/to/binary
$ sudo start demo
demo start/running, process 27469
$ sudo stop demo
demo stop/waiting
$ sudo status demo
demo stop/waiting
$

Hope this helps. The upstart configuration format is a little sparsely
documented, when I wrote scripts for it, I used the existing files in
/etc/init as a rough guide.

- Dave


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


Re: [Haskell-cafe] How to daemonize a threaded Haskell program?

2011-03-07 Thread Bas van Dijk
Sterling, Gregory, Brandon and David thanks for your suggestions.

On 6 March 2011 05:38, David Anderson  wrote:
> I humbly recommend doing such daemonizations from outside your program.
> Programs that daemonize on startup make it very difficult to monitor them by
> direct means, instead forcing you to rely on PID files and other mechanisms
> which may not always be available or fresh.

Agreed, I already noticed that debugging is a bit harder since I have
no stdout and stderr anymore.

> For reference, Upstart, the new PID 1 on Ubuntu and friends, has a horrible
> hack[1] built in specifically to keep track of processes that "helpfully"
> daemonize themselves, so that it can offer additional services like
> restarting crashed services or notifying the owner of a problem.
> As has been pointed out elsewhere on thread, there are plenty of standalone
> programs that implement daemonization if you end up not using service
> management software to do it for you.

I plan to run the daemon on a Ubuntu server. Do you know if Upstart is
able to daemonize a process?

Regards,

Bas

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread David Virebayre
I use kate too.

I tried and liked leksah, but the fact that everything is a project
with a cabal file felt to heavy for me when I just want to hack on a
single .hs file.

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