Re: [Haskell-cafe] [ANNOUNCE] Fmark markup language

2012-09-18 Thread Stefan Monnier
 The problem with that is that some people DO end some headings with
 a full stop; for them your special syntax is not natural.

Markdown/ReST is already using the no syntax idea (e.g. compared to
pre-wiki markup such a LaTeX or Texinfo), so he's simply trying to push
this idea further.

I suspect it'll be difficult.

 What if I want to use indentation to express quotation instead?

I think this one is solvable: a paragraph that's more indented than the
previous heading can be considered a quote.


Stefan


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


Re: [Haskell-cafe] Darcs fetches too little files

2012-08-29 Thread Stefan Monnier
 Albert Einstein said:
   Insanity: doing the same thing over and over again and expecting
 different results.
 I repeated the command today and it worked!

So, did you expect the result to be different, or did you re-try just to
confirm that it doesn't work?


Stefan


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


Re: [Haskell-cafe] Haskell development in Mac OS X after Gatekeeper

2012-02-22 Thread Stefan Monnier
 I think, Apple has made their stance quite clear by releasing the
 command line dev tools:

I'm not sure what you mean by that, but looking at the history of Apple
devices, especially the recent history with iPad, iPhone, etc... it's
pretty clear to me where this is headed: keep as tight a control on the
machine as possible without alienating too many users.

As time passes, the average users become accustomed to the idea that
they shouldn't actually control their own device, which allows
tightening the control yet a bit more.

Cryptography and formal methods will eventually make it provably
difficult to use your own device in any way other than the one
Apple intended.


Stefan


PS: Of course, Apple is not the only company aiming for that, it's just
the one leading the way.


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


Re: [Haskell-cafe] Misleading MVar documentation

2011-01-15 Thread Stefan Monnier
 I'll try another writeup. Does anyone know where the original papers for
 MVars might be?

In my mind, full/empty variables date back to dataflow machines.
But I don't know where I got this idea.


Stefan


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


Re: [Haskell-cafe] What's the motivation for η rules?

2010-12-28 Thread Stefan Monnier
One way to look at it is that β rules are the application of an
eliminator (e.g. function application) to its corresponding constructor
(the lambda expression), whereas η rules correspond to the application
of a constructor to its corresponding eliminator.

E.g.

   λ y . (x y)=  x
   if x then True else False  =  x
   (π₁ x, π₂ x)   =  x

IOW there's no need for a motivation: those rules just appear naturally.


Stefan


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


[Haskell-cafe] Re: GHC 7.0.1 developer challenges

2010-11-25 Thread Stefan Monnier
 And if it actually freezes your machine (as opposed to making it go
 really slowly), that's a kernel bug.

Very true, tho sometimes the difference between a real freeze and just
going very slow is pretty subtle.


Stefan

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


[Haskell-cafe] Re: Strict Core?

2010-10-17 Thread Stefan Monnier
 That said, I've been told that UHC's core language uses the ideas from
 Strict Core, and they have/had a student at Utretch (Tom Lokhorst) who
 was working on implementing optimisations like arity raising and deep
 unboxing for the language.

Many/most implementations of ML-ish languages use a similar approach.
E.g. SML/NJ's Flint internal language is fairly similar to Strict Core
(except for the lack of memoization of zero-arg functions, since that's
not very often useful in the context of a strict language like SML) and
uses the same kind of wrapper+inlinling to perform most of
its optimizations.

Note that in my experience working on SML/NJ's optimizer (using
wrapper+inlining), such an approach to code transformation doesn't care
about types at all, and indeed most/all of what tacc-hs09.pdf presents
is mostly unrelated to whether the language is typed: e.g. the
uncurrying of the zipWith higher-order argument is performed by the
inliner (when inlining the various wrappers) without paying any
attention to types.  So types do not enable the optimization of
higher-order functions: it's the wrapper+inlining strategy that
enables it.  Admittedly, the use of a statically typed intermediate
language makes it easier to catch bugs in such optimization phases.


Stefan

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


[Haskell-cafe] Re: A rant against the blurb on the Haskell front page

2010-10-17 Thread Stefan Monnier
 Good start, if only the advanced were replaced with something more
 characteristic, like lazy, or statically typed. Which, BTW, both do not
 appear in the whole blurb, even though they are *the* characteristics of
 Haskell, lazyness being even something that sets it apart from most other
 languages.

AFAIK laziness is a property of the major implementations of Haskell,
but not really of the language itself.  All I see in the Haskell report
points at it being applicative, call by name, but nowhere does the
report seem to mandate a lazy strategy.  It's just that being purely
functional implies that the compiler is free to use laziness.


Stefan

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


[Haskell-cafe] Re: Chuch encoding of data structures in Haskell

2010-05-27 Thread Stefan Monnier
 churchedBool :: t - t - t

Important detail: the precise type is ∀t. t → t → t.

 encodeBool x = \t e - if x then t else e

So the type of encodeBool should be:

 Bool → ∀t. t → t → t

whereas Haskell will infer it to be

  ∀t. Bool → t → t → t

which means that a given object can only be eliminated to one type.
I.e. to make such an encoding really usable, you need deep
polymorphism (which GHC supports just fine, but which is not part of
the Haskell standard).


Stefan

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


[Haskell-cafe] Re: US Patent for the idea of using Haskell to implement UAX #9

2010-04-18 Thread Stefan Monnier
 revealed a link to a US Patent (7120900) for the idea of implementing
 the Unicode Bidirectional Algorithm (UAX #9
 http://www.unicode.org/reports/tr9) in Haskell, making use, as far as I
 can tell, of nothing more than the normal approach any functional
 programmer would use, namely separation of concerns etc.
 In which case the patent should be null and void since obvious ideas aren't 
 patentable, AFAIK.

Doesn't matter: you'd need to pay lawyers to defend yourself to convince
a court that it is null and void.  So even if you may end up winning in
the end (which is far from obvious), you'll have wasted a lot of time,
effort, and money.


Stefan

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


[Haskell-cafe] Re: Embedded funcional programming?

2010-04-18 Thread Stefan Monnier
 As a side comment, I haven't noticed any reaction in the
 Haskell/iPhone community about Apple's recent policy change.

The stricter they make it, the better, since it hopefully gets us closer
to the point where people will see that they should stay the heel away
from any such handcuffs,


Stefan

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


[Haskell-cafe] Re: instance Eq (a - b)

2010-04-14 Thread Stefan Monnier
 Why isn't there an instance Eq (a - b) ?

I guess it's because even for those cases where it can be written, it
will rarely be what you want to do, so it's better to require the
programmer to explicitly request a function-comparison than to risk
silently using such a costly operation when the programmer intended no
such thing.

While we're here, I'd be more interested in a dirtyfast comparison
operation which could look like:

eq :: a - a - IO Bool

where the semantics is if (eq x y) returns True, then x and y are the
same object, else they may be different.  Placing it in IO is not great
since its behavior really depends on the compiler rather than on the
external world, but at least it would be available.


Stefan

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


[Haskell-cafe] Re: If the local variable can be changed ...

2010-03-10 Thread Stefan Monnier
 So if the local variable can be changed, then we can use loop,
 etc. same as imperative languages.  For example, for (i=0; i100; i++)
 where `i` is a local variable in function.

It is true that a pure language could support such things (some pure
languages do, e.g. Sisal).  The experience of people using SML and
Haskell seems to indicate that this is not very important in those
languages: it's easy for the programmer to turn his variable-assignments
into something pure (using new variables instead), and it's reasonably
easy as well for the compiler to recognize loops and handle them just as
efficiently as if they were while/for loops in an imperative language.

OTOH, allowing modification of variables makes the whole language
impure, because of variables caught in closures, e.g.:

let count = 0
in \() - count := count + 1; count

so it has very far reaching consequences.


Stefan

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


[Haskell-cafe] Re: GPL answers from the SFLC

2010-03-04 Thread Stefan Monnier
 Note that this is a safety measure for the submitter: If the code is,
 indeed, released to the public, it is (dual licesed) GPL, anyway, even
 if that might not have been the intent.

No.  If the submitter did not explicitly release his code under the GPL,
then it is not licensed under the GPL, even if is a derivative of
GPL code.  Instead, it is a breach of the GPL license and the submitter
is exposing himself to a civil suit.


Stefan

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


[Haskell-cafe] Re: GPL answers from the SFLC

2010-03-04 Thread Stefan Monnier
 The next question that comes to mind is thus:
 What if a new library X' released under BSD or MIT license implements
 the X API (making possible to compile Y against it)? Can such a new
 library X' be licensed under something else than the GPL (we guess Yes
 because we don't think it is possible to license the API itself)?

Yes.

 Why should the existence of X' make any difference for the author
 of Y?

Because the existence of X' makes it possible to use Y without using X.
The order in which X and X' come to exist doesn't matter.

This exact scenario took place for the GMP library, whose API was
reimplemented as fgmp, specifically so that a user of the GMP
library could release their code under a different library than the GPL.


Stefan

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


Re: [Haskell-cafe] Re: GPL answers from the SFLC

2010-03-04 Thread Stefan Monnier
 The thing is that the new X' library can provide the same API while
 not being very useful (bug, performance, whatever).  And in this case,
 it is trivial to make that new X'.  So I don't understand why the
 answer was no in the first place.

The law is not a set of mathematical rules.  It all needs to be
interpreted, compared to the underlying intentions etc...
So while you can say that it's pointless if you push the idea to its
limit, that doesn't mean that it's meaningless in the context of
the law.
All it might mean is that in some cases, the interpretation is
not clear.  It's those cqases where a court needs to decide which
interpretation should be favored.


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


[Haskell-cafe] Re: Non-termination of type-checking

2010-02-01 Thread Stefan Monnier
 And I'm pretty sure that there's no way to convince Agda that F = R,
 or  something similar, because, despite the fact that Agda has
 injective type  constructors like GHC (R x = R y = x = y), it doesn't
 let you make the  inference R Unit = F Unit = R = F. Of course, in
 Agda, one could arguably say that it's true, because Agda has no type
 case, so there's (I'm pretty sure) no  way to write an F such that
 R T = F T, but R U /= F U, for some U /= T.

It's easy to construct an F that is different from R but agrees with
R for the case of Unit: F = λ _ - R Unit
So there's a good reason why Agda doesn't let F and R unify: it would
really be completely wrong.


Stefan

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


[Haskell-cafe] Re: ssh ports for monk and nun?

2010-01-13 Thread Stefan Monnier
 Trying to get ssh working via putty from behind my company firewall.

My recommendation is to get access to an outside machine where you run
an OpenVPN server on port 80 or 443.  This will solve it once and for
all.
But first, please complain loudly and repeatedly about the firewall
being closed to port 22.


Stefan

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


[Haskell-cafe] Re: Why?

2009-12-10 Thread Stefan Monnier
 This is a matter that I genuinely at the present time do not grasp and
 I am hoping that some of you who are more familiar with the Haskell
 language may be able to help enlighten me. I feel the question to be
 an important one. What material benefit does Haskell derive from being
 a pure functional language as opposed to an impure one? Please
 provide examples as I require instruction.

I think the STM monad is one of the greatest examples of why Haskell's
approach to side-effects is a resounding success.  Without having to
change anything to the language and compiler, i.e. as a mere library
addition (more or less), you get a concurrency system with optimistic
synchronization, where all the needed invariants are trivially enforced
by the type-system:
- no prints or other un-revertable side effects in transactions.
- all accesses to shared variables are protected by a transaction.
- ...
Monads aren't always perfect when it comes to side-effects, but in the
context of STM, they really shine.


Stefan

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


[Haskell-cafe] Re: Status of TypeDirectedNameResolution proposal?

2009-11-20 Thread Stefan Monnier
 You know, another solution to the records problem, which is not quite
 as convenient but much simpler (and has other applications) is to
 allow local modules.

 module Foo where
   module Bar where
 data Bar = Bar { x :: Int, y :: Int }
   module Baz where
 data Baz = Baz { x :: Int, y :: Int }

   f a b = Bar.x a + Baz.y b

For someone coming from an SML background, that makes a lot of sense.
You could also add an automatic lightweight module, like Agda does,
where

  data Baz = Node { x :: Int, y :: Int }

implicitly defines a local module Baz with record selection functions
Baz.x and Baz.y and even a Baz.Node constructor.


Stefan

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


[Haskell-cafe] Daniel Schüssler anotheraddr...@gmx.de

2009-11-04 Thread Stefan Monnier
 this is rather trivial, but maybe someone else finds these useful:

 darcs get http://code.haskell.org/~daniels/haskell-snippets/

Since Emacs already comes bundled with several template systems
(at least skeleton.el and tempo.el, where the first seems to be
marginally more canonical), I think it would be better to define your
templates using skeleton and thus remove the dependency on yasnippet.


Stefan

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


Re: [Haskell-cafe] Re: cvs.haskell.org down? haskell-mode abandoned?

2009-10-22 Thread Stefan Monnier
 In any case, I need it fixed before I can work on haskell-mode.
 Preferably by migrating haskell-mode over to cvs. :-)
 You mean migrating to DaRCS?  That would be appreciated, yes.
 Um, yes.
 I can get the revision history into darcs pretty easily, such as it
 is, assuming cvs.haskell.org comes back up.  Then I'll put the
 repository somewhere you can get at it.  That fine?

Yes, that would be wonderful.  Ideally, it will eventually make it into
something like darcs.haskell.org.

 who *is* the current maintainer?
 Last I heard, it was me.  But if someone wants to take over,
 he's welcome.
 You're saying you don't have time to maintain it?

Pretty much, yes.  At least, I don't think I've done a good job
maintaining it over the last couple years.

 Still, there needs to be a new release,

Yes, urgently.

 and I've got a lot of improved haskell-mode code (written by other
 people) that isn't currently in the repository.

Can you show me the patches?


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


[Haskell-cafe] Re: cvs.haskell.org down? haskell-mode abandoned?

2009-10-20 Thread Stefan Monnier
 In any case, I need it fixed before I can work on haskell-mode.
 Preferably by migrating haskell-mode over to cvs. :-)

You mean migrating to DaRCS?  That would be appreciated, yes.

 who *is* the current maintainer?

Last I heard, it was me.  But if someone wants to take over,
he's welcome.


Stefan


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


[Haskell-cafe] Re: Best Editor In Windows

2009-10-16 Thread Stefan Monnier
 Real programmers use butterflies!!

In Emacs-23, this is available as M-x butterfly C-M-c
Too bad it wasn't around when I was writing my thesis,


Stefan

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


Re: [Haskell-cafe] Re: Best Editor In Windows

2009-10-16 Thread Stefan Monnier
 The only thing I haven't figured out is how to do tab-completion of
 words in the ghci buffer.  Do I need to use a different key
 combination?  I couldn't find that in the documentation.
 I think it's just a missing feature.
 OK!  Let me know if there's anything I can do to help.  I noticed that
 other modes, e.g. ESS for R, do have tab-completion, but just skimming
 the source code I couldn't find how exactly they do that.

You could try to just send the TAB directly to the underlying process
and let ghci do the completion.


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


[Haskell-cafe] Re: Best Editor In Windows

2009-10-15 Thread Stefan Monnier
 I'm very new at Haskell, i'm reading a book and starting, but i want to
 know which is the best editor for development under Windows, because now
 i'm using Notepad++(That i use to develop in C++).

The best editor for development is Emacs, of course.
http://www.gnu.org/software/emacs


Stefan



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


[Haskell-cafe] Re: Best Editor In Windows

2009-10-15 Thread Stefan Monnier
 The only thing I haven't figured out is how to do tab-completion of
 words in the ghci buffer.  Do I need to use a different key
 combination?  I couldn't find that in the documentation.

I think it's just a missing feature.


Stefan

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


[Haskell-cafe] Re: I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.

2009-09-30 Thread Stefan Monnier
 I might also point out that 90% of all desktop computers run Windows, and
 yet every single C library binding on Hackage fails to compile on
 Windows.  That really needs to be fixed.

Luckily, this is being fixed ... by the Free Software movement.


Stefan

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


[Haskell-cafe] Re: accessible layout proposal?

2009-09-23 Thread Stefan Monnier
 http://www.haskell.org/haskellwiki/Accessible_layout_proposal

I see two main problems with such a proposal (other than the particular
details of the syntax chosen for it):
- layout is not very well supported by most of the text editors,
  contrary to parens/brackets/braces.
- more importantly: it introduces a new syntax that doesn't replace the
  old one, so it makes the language more complex.  Compare that with the
  layout for `do', `let', `where' and `case' which is fine because it's
  used 99% of the time and the alternative syntax is the same for each
  one of them (simply add {;;;}).

So I'd be OK with a switch from

data foo = Toto | Tata Int | Titi
to
data foo = { Toto ; Tata Int ; Titi }
and
data foo =
Toto
Tata Int
Titi

and similarly for module import lists, but only if it comes with
a deprecation of the current syntax.


Stefan

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


[Haskell-cafe] Re: Why is Bool no instance of Num and Bits?

2009-05-09 Thread Stefan Monnier
 [...] unsafe [PerformIO ...] looks safer to me.

Hmmm


Stefan

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


[Haskell-cafe] Re: Darcs as undo/redo system?

2009-05-09 Thread Stefan Monnier
 I have thought about applications of patch theory like this as well.
 I could imagine applying it to the undo stack in GIMP.  Allowing you
 to undo things on different layers.  I think one of the things you

Don't know about the GIMP, but in Emacs, you can select a region of text
and undo just the changes in that region.


Stefan

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


[Haskell-cafe] Re: Is curryfication practical with dynamic scope?

2009-04-28 Thread Stefan Monnier
 PS: In a meta interpreter, lexical scope seems to be actually easier
 to implement than dynamic scope.

Depends on whether your meta-language is lexically or
dynamically scoped.


Stefan

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


[Haskell-cafe] Re: Haskell/JS -- better through typeclasses?

2009-04-26 Thread Stefan Monnier
 There's a tool for converting SML to JavaScript:

Such tools converting between different languages, are usually called
compilers, by the way.


Stefan


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


[Haskell-cafe] Re: Is 78 characters still a good option? Was: breaking too long lines

2009-04-23 Thread Stefan Monnier
 I think the non-applicable to code observation is very likely true –
 we'd like to be able to write nice descriptive variable names.
 In  doing this, we probably want them to be more than the 1 or
 2  characters that Haskellers traditionally use, maybe of the order of
 5-10.

 Given this, it would seem a shame to only be able to fit 6-13 litterals on
 a line, that sounds like we'll quickly be having to wrap lines with
 deffinititions of any significance on them.

I really like the 80-columns rule.  And I also agree that long
identifiers can be useful.  All this means is that you use up
more lines.  Note that this can be a good thing: indentation is
information, so by using more lines, you give more
indentation information.

 My personal preference with Haskell is to ignore the 78 character limit,
 but only when layout otherwise becomes horrible otherwise.

I consider screen real-estate a very valuable resource (and I'm appaled
by the fact that current 21 displays are limited to 1600x1200 when they
could go up to 1800x1400 ten years ago), and in this light the 80
columns limit tends to work fairly well: using significantly less (like
50) makes the code really difficult to write, whereas using more tends
to waste a lot of space because, while some lines will make good use of
the extra columns, most of them won't.

Finally, I find that the indentation-pressure imposed by the 80-columns
limit forces me to write better code: when code indentation grows too
high, I'm forced to move it to a separate function, making the code more
readable at the same time (by being forced to choose a name for the
function and to choose appropriate arguments and return values).


Stefan

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


[Haskell-cafe] Re: Issues with running Ghci from emacs

2009-04-16 Thread Stefan Monnier
 It is looking for the closest ancestor directory with a file ending in
 .cabal, and that's where cd goes. Probably the simplest way to trick it
 without chaniging any setting is to create an empty dummy.cabal in the
 directory of your program.

The haskell-mode code in the CVS repository has a fix for that problem.


Stefan

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


[Haskell-cafe] Re: Amazing

2009-02-15 Thread Stefan Monnier
 So IMO static typing is good, but it's only with functional programming that
 it really shines.

You can go one step further: if you start using dependent types, you'll
see that it gets yet harder to get your program to type-check, and once
it does, you don't even bother to run it since it's so blindingly
obvious that it's correct.


Stefan

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


[Haskell-cafe] Re: Verifying Haskell Programs

2009-02-02 Thread Stefan Monnier
 State of the art is translating subsets of Haskell to Isabelle, and
 verifying them. Using model checkers to verify subsets, or extracting
 Haskell from Agda or Coq.

Another state of the art is to use type classes, GADTs, and/or type
functions, to specify and prove the properties you want about
your program.  Basically using similar techniques as used in dependently
typed languages.


Stefan

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


[Haskell-cafe] Re: WYSIWYG literate programming

2009-01-28 Thread Stefan Monnier
 http://haskell.org/haskellwiki/Emacs#Unicodifying_symbols_.28Pretty_Lambda_for_Haskell-mode.29

I'm pretty sure this text wasn't there last time I looked, yet last time
I looked was already long after Haskell-mode integrated such a feature.
In any case I've added a note to mention that all you need to do is
(setq haskell-font-lock-symbols t).


Stefan

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


[Haskell-cafe] Re: Dr Dobbs: Time to get good at functional programming

2008-12-08 Thread Stefan Monnier
 http://www.ddj.com/development-tools/212201710;jsessionid=3MQLTTYJRPL3CQSNDLRSKH0CJUNN2JVN

Do they purposefully obfuscate names?
I mean who are those Martin Obersky and Don Sype?


Stefan

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


[Haskell-cafe] Re: Gluing pipes

2008-12-05 Thread Stefan Monnier
   \ x y - f (g x) (h y)
[...]
   f $. g ~ h ~ id

I keep help wonder: other than a 5 chars, what is it we have gained?


Stefan

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


[Haskell-cafe] Re: What *not* to use Haskell for

2008-11-12 Thread Stefan Monnier
 So I should clarify I'm not a troll and do see the Haskell light. But
 one thing I can never answer when preaching to others is what does
 Haskell not do well?

The most obvious cases where Haskell does not do well, for me:

- When you feed it Java code.  Incidentally, the same holds when you
  feed it C code.

- When you try to write a malloc library.


Stefan

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


[Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Stefan Monnier
 2.4x - x
 That's supposed to be 2.4x - 2, of course.
 Ah, damn it.  I was hoping for a long discussion on just what math
 would look like with rounding like that ;-)

I think it has a name...  modulo maybe?


Stefan

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


[Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Stefan Monnier
 The instance selection for an interface is done at run-time and this is
 inherently necessary.  The instance (in a different sense) selection for
 type classes is almost always resolvable statically.  In Haskell 98

In both cases, the dispatch is inherently dynamic, and in both cases,
most dispatches can be resolved at compile-time with sufficient effort.
The actual percentage may be quite different, tho.
Implementation techniques are also fairly different, and the resulting
coding style is also very different, but the two concepts are
fundamentally very close to each other.


Stefan

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


[Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Stefan Monnier
 leaders and pioneers: if you know one language, picking up others
 should be easy, they just differ in syntax.
 I have heard it, and I used to believe it.  Now I think it's only true
 provided the one language you know is suitably advanced (and currently
 non-existent, I think).

It all depends on what you consider as knowing a language.
After all, a Real Programmer can write Fortran in any programming language,


Stefan

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


Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Stefan Monnier
 Would you please explain this a bit more:

 the various unfortunate consequences of type erasure in Java are
 avoided by the fact that Haskell types lack constructors, so the user
 never expects to be able to conjure up a value of an unknown type.

Even if Haskell had Java-style constructors, it wouldn't be a problem,
since type classes exist independently from any object, so the code that
needs the constructor will simply receive it in the
corresponding dictionary.


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


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

2008-09-30 Thread Stefan Monnier
 I am not allowed to use such an interpretation. The (expensive and very
 carefully researched) legal advice used to shape the use of Open Source
 code at my employer has resulted in a no LGPL under any circumstances
 whatsoever policy.
[...]
 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.


Stefan

___
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-09-26 Thread Stefan Monnier
 When I compare GPL and MIT/BSD licenses, I do a simple reasoning.
 Suppose a doctor in a battle field meet a badly injuried enemy.
 Should he help the enemy?

My answer would be that he indeed should, at the condition that the
patient will switch side.  Oh wait, that's just what the GPL says.


Stefan Analogies are broken

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


[Haskell-cafe] Re: Line noise

2008-09-24 Thread Stefan Monnier
  qsort [] = []
  qsort (x:xs) = qsort (filter (x ) xs) ++ [x] ++ qsort (filter (x =) xs)

Note that you can help the reader by making the precedence a bit more
obvious:

 qsort [] = []
 qsort (x:xs) = qsort (filter (x ) xs)
++ [x]
++ qsort (filter (x =) xs)

I find that my students can understand this much better than the
1½ liner.  Regarding the mapM_ example:

 mapM_ (\(n,v) - putStrLn $ [ ++ show n ++ ] =  ++ show v) (zip [0..] vs)

 To somebody familiar with Haskell, that is as clear as day.

I guess I'm not familiar with Haskell, because I find the paren-counting
to be difficult to do in my head (and god knows that I'm familiar with
parenthese).

Also, I tend to shy away from ($) and (.) and to only use them when
I have a list of functions to compose/apply and want to avoid growing
the depth of my AST with the length of the list.  So I'd probably write
the mapM_ example as:

 mapM_ (\(n,v) -
 putStrLn ([ ++ show n ++ ] =  ++ show v))
   (zip [0..] vs)

which I find a lot easier to read.


Stefan

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


[Haskell-cafe] Re: Line noise

2008-09-24 Thread Stefan Monnier
 I believe this was voiced as an SML issue more than an OCaml issue, though
 honestly I don't know enough of the differences to distinguish them. Before
 I mentioned that function/prefix application always binds tighter than
 operator/infix application, he was using many redundant parentheses, thanks
 to defensive programming against whichever dialect was at fault.

It was apparently a programmer issue rather than a language issue: SML's
precedence rules are pretty much identical to Haskell's in this regard.


Stefan

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


[Haskell-cafe] Re: Haskell Weekly News: Issue 85 - September 13, 2008

2008-09-15 Thread Stefan Monnier
 A more difficult question is: how do I know that the formal
 specification I've  written for my program is the right one? Tools can
 fairly easily check that  your programs conform to a given
 specification, but they cannot (to my  knowledge) check that your
 specification says exactly what you want it to say.

The key is *redundancy*: as long as your property is sufficiently
different (in structure, in authorship, etc...) you can hope that if the
spec has a bug, the code will not have a corresponding bug and
vice versa.  It's only a hope, tho.


Stefan

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


[Haskell-cafe] Re: Bug in Emacs Haskell Mode

2008-06-24 Thread Stefan Monnier
 Emacs Haskell Mode has the following useful feature: when Haskell -
 Load File is used to load a file into GHCi from Emacs, Haskell Mode
 automatically looks for a *.cabal file in an attempt to find the
 project directory.

I'm truly sorry about the fact that I only release new versions
rather rarely.  I recommend you use the CVS version, where this bug was
fixed a few months ago.


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


[Haskell-cafe] do and ifthenelse indentation in GHC

2008-06-19 Thread Stefan Monnier
http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse says
(and my memory seems to agree) that GHC has been changed to accept
things like

   readnums f n = do eof - hIsEOF f
 if eof
 then return n
 else do l - hGetLine f
 readnums f (n + read l)

where the `then' and `else' are aligned with the `if' rather than being
slightly more indented as the Haskell 98 standard requires.
Yet, when I try it with GHCi 6.8.2 I get an error:

   Prelude :load /home/monnier/tmp/foo.hs
   [1 of 1] Compiling Main  ( /home/monnier/tmp/foo.hs, interpreted )
   
   /home/monnier/tmp/foo.hs:6:18:
   parse error (possibly incorrect indentation)
   Failed, modules loaded: none.
   Prelude 

Does anybody know what's up with that?


Stefan

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


[Haskell-cafe] Re: type families and type signatures

2008-04-07 Thread Stefan Monnier
 Id is an operation over types yielding a type, as such it doesn't make
 much sense to me to have (Id a - Id a) but rather something like (a -
 Id a).

Actually, it can make perfect sense: e.g. if the `Id' function acts as
a constraint.


Stefan

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


[Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-08 Thread Stefan Monnier
  You seem to write 12 as 1 :+ 2 instead of () :+ 1 :+ 2.  But I think, the
  latter representation should probably be prefered.  With it, :+ always
  has a number as its left argument and a digit as its right.  Without the
  () :+ we get ugly exceptional cases.
  You can see this, for example, in the instance
  declarations for Compare.  With the second representation, we could
  reduce the number of instances dramatically.  We would define a
  comparison of digits (verbose) and than a comparison of numbers based on
  the digit comparison (not verbose).
 
 Even if () would be preferred from the programmers point of view (I'm
 not sure how much we could reduce the number of instances though), it
 makes the representation less attractive on the user-side. Anyone
 using the library would find it annoying and would wonder why is it
 neccessary.

 I wouldn’t wonder.  Leaving out the () :* part just works because our 
 type-level “values” are not typed, i.e., there aren’t different kinds Digit 
 and Number but only kind *.  If :+ would be a data constructor (on the value 
 level), it would take a number and a digit argument which would forbid using 
 a digit as its left argument.  So I consider using a digit on the left 
 as “unclean”.  It’s similar to using a number as the second part of a cons 
 cell in LISP.

How 'bout treating :+ as similar to `append' rather than similar to `cons'?
Basically treat :+ as taking 2 numbers (rather than a number and
a digit).


Stefan

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


[Haskell-cafe] Re: anybody can tell me the pronuncation of haskell?

2008-01-28 Thread Stefan Monnier
 *did* disagree with me was also named Jeremy. How confusing.

Are both Jeremys pronounced identically?


Stefan

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


[Haskell-cafe] Re: The programming language market (was Re: Why functional programming matters

2008-01-26 Thread Stefan Monnier
 * Say computers are cheap but programmers are expensive whenever
 explaining a correctness or productivity feature.
 This is true only if talking to people in high-income nations.

Is it?  Maybe you're right.

But historically, computers have been available at all kinds of price
ranges, so people chose the price point that fit them.  So, for the last
15 years or so already computers have been chosen (in the wealthy
countries) to be cheaper than programmers.

Is there any reason to think that the same forces aren't at play in
lower-income nations?  After all, cheap (typically second hand)
computers are easy to come by.


Stefan

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


[Haskell-cafe] Re: Newbie question

2008-01-21 Thread Stefan Monnier
 How does caller choose which particular instance of Num they want?

By passing the type they want.  That's what the Num a = thingy does.

 In object-oriented language If function return type is an interface it means
 that it can return any implementation of this interface, but caller can't
 choose which particular inplementation they want.

The full type of f you've given is:

  forall a . (Num a) = Integer - a

where the forall a . is normally not written.  What you describe (a
function that returns something where the type can be chosen by the
function itself) would have type:

  Integer - (exists a . (Num a) = a)

I.e. the a is not passed as a (type) argument, but instead it's
returned by the function.

 What the difference between haskell class and interface in object-oriented
 languge such Java or C#?

From a low-level point of view, the difference is that the vtable is
manipulated separately from the objects.  The Num a basically stands
for the type of the vtable (which is called dictionary in Haskell).

To bundle an object with its vtable as is traditionally done in OO
languages, you need to create an existential package, e.g. something of
type (exists a . (Num a) = a).


Stefan

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


[Haskell-cafe] Re: Why purely in haskell?

2008-01-15 Thread Stefan Monnier
 Yes, this is a doctrinal problem. Since *any* concrete reaction, e.g., an
 error message is a kind of answer, the only - unusable as it is - way of
 not providing it is to fail the termination...

You can just disallow the call, using the type system.
Not that it's always easy or practical either, mind you.


Stefan

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


Re: [Haskell-cafe] Haskell-mode 2.4

2008-01-11 Thread Stefan Monnier
 Johan == Johan Tibell [EMAIL PROTECTED] writes:

  Emacs is completely frozen until I press C-g and then it goes back to
  normal (without loading the file). Here's the back trace:
 
  Debugger entered--Lisp error: (quit)
accept-process-output(#process haskell)
(and (not (re-search-forward comint-prompt-regexp nil t))
  (accept-process-output proc))
 
 So it seems to be waiting for the prompt but can't find it.
 If you look at the buffer containing the interactive process, is there
 a prompt there?  If not, can you try and figure out why not?
 If yes, can you try and figure out why it is not recognized by the
 comint-prompt-regexp?

 I had the following in my .ghci to make GHCi's prompt less verbose:

 :set prompt  

 Removing that solves the problem.

You can also add the following to your .emacs:

  (add-hook 'inferior-haskell-mode-hook
(lambda ()
  (set (make-local-variable 'comint-prompt-regexp)
   ^ )))

Or some fancier regexp (the default is
^\\*?[A-Z][\\._a-zA-Z0-9]*\\( \\*?[A-Z][\\._a-zA-Z0-9]*\\)* ).


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


[Haskell-cafe] Re: viewing HS files in Firefox

2008-01-10 Thread Stefan Monnier
 My problem is when viewing plain darcs repositories (like mine on
 darcs.johantibell.com which I recently fixed with the above mime type
 hack.)

Please complain to your browser('s authors): most browsers only provide
*one* way to view a given mime-type, which is stupid.  It's not specific
to .hs files.

They could at least provide a way to override the provided mime-type, so
you can say display this application/octet-stream file as
a text/plain.  Similarly they should allow you to choose (via
a context-menu, for example) to open a pdf file in the pdf plugin or in
a separate application.


Stefan

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


Re: [Haskell-cafe] Haskell-mode 2.4

2008-01-10 Thread Stefan Monnier
 First of all, thanks. My Aqua Emacs (on OS X Leopard) hangs when I
 send a command like C-c C-l or C-c C-t to the interpreter (I can quit
 the command using C-g) . Starting the interpreter and using :l from
 inside it works fine. This is using GHC 6.8 (and I think I also tried
 6.6.) What could be the problem?
 
 I also tried to eval this but it didn't make a difference:
 
 (setq inferior-haskell-find-project-root nil)

 It looks like this is a problem with 6.8.2 as haskell-mode-2.3 has the
 same problem? Seems like the commands being sent to the haskell
 process never reaches it.

Try can you try to look into the nature of the hang?
Is Emacs completely frozen?  Does C-g get you back to something usable?
If so, can you set Options = Enter Debugger on Quit, then reproduce the
problem than hit C-g and show me the backtrace?
If not, can you run Emacs under a debugger and give me a backtrace of
when Emacs is frozen?


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


Re: [Haskell-cafe] Haskell-mode 2.4

2008-01-10 Thread Stefan Monnier
  First of all, thanks. My Aqua Emacs (on OS X Leopard) hangs when I
  send a command like C-c C-l or C-c C-t to the interpreter (I can quit
  the command using C-g) . Starting the interpreter and using :l from
  inside it works fine. This is using GHC 6.8 (and I think I also tried
  6.6.) What could be the problem?
 
  I also tried to eval this but it didn't make a difference:
 
  (setq inferior-haskell-find-project-root nil)
 
  It looks like this is a problem with 6.8.2 as haskell-mode-2.3 has the
  same problem? Seems like the commands being sent to the haskell
  process never reaches it.
 
 Try can you try to look into the nature of the hang?
 Is Emacs completely frozen?  Does C-g get you back to something usable?
 If so, can you set Options = Enter Debugger on Quit, then reproduce the
 problem than hit C-g and show me the backtrace?
 If not, can you run Emacs under a debugger and give me a backtrace of
 when Emacs is frozen?

 Emacs is completely frozen until I press C-g and then it goes back to
 normal (without loading the file). Here's the back trace:

 Debugger entered--Lisp error: (quit)
   accept-process-output(#process haskell)
   (and (not (re-search-forward comint-prompt-regexp nil t))
 (accept-process-output proc))

So it seems to be waiting for the prompt but can't find it.
If you look at the buffer containing the interactive process, is there
a prompt there?  If not, can you try and figure out why not?
If yes, can you try and figure out why it is not recognized by the
comint-prompt-regexp?


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


[Haskell-cafe] Haskell-mode 2.4

2007-12-11 Thread Stefan Monnier
Here's for Xmas, version 2.4 of the Haskell-mode package.
Haskell-mode is an Elisp package to support editing Haskell in Emacs.
See the home page at

   http://www.iro.umontreal.ca/~monnier/elisp/


-- Stefan


Changes since 2.3:

* Update license to GPLv3.

* New derived major mode for .hsc files.

* Removed the C-c C-r binding to reload a file.  You can still call
  inferior-haskell-reload-file (and/or bind it to your favorite key,
  including C-c C-r) or you can now use C-u C-c C-l.

* C-c C-d looks up the symbol at point in the Haddock docs.

* Haddock comments are highlighted with font-lock-doc-face if it exists.

* Use `tex' rather than `latex' for haskell-literate.

* inf-haskell.el tries to find the root of the module hierarchy to determine
  the root of a project (either by looking for a Cabal file or relying on
  the `module' declaration line).  If all works well, this will make C-c C-l
  automatically switch to the root dir, so that dependencies in other
  directories are automatically found.  If it doesn't, complain and/or set
  inferior-haskell-find-project-root to nil.

* The new command haskell-hoogle helps you query Hoogle from Emacs.


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


[Haskell-cafe] Re: Monad.Reader 8: Haskell, the new C++

2007-09-14 Thread Stefan Monnier
 PS: And, no, you won't be able to set breakpoints in type-level
 programs...

Yet.


Stefan

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


[Haskell-cafe] Re: Functional dependencies conflict between instance declarations

2007-09-12 Thread Stefan Monnier
 Never mind, that GHC compiler was again more clever than me, sigh.
 That's really frustrating about Haskell: the compiler captures so many
 errors at compile time, that newbies hardly get anything done, it's
 a constant battle against the errors. But once it compiles, it usually
 works at runtime :-)
 This is what I love about Haskell: If it typechecks, it probably does the
 thing you meant it to.  I've never seen any other language like
 it.  It's amazing!

Next stop: Coq, where the fight with the type checker is so much more
difficult that when the code finally type checks you don't even need to
run it at all.


Stefan

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


[Haskell-cafe] Re: Using haskell with emacs

2007-08-08 Thread Stefan Monnier
 C-c C-b ... when pressed for the first time this will start an
 interpreter (ghci or hugs most of the time), when pressed with a
 running interpreter it'll switch to that buffer.
 
 C-c C-l ... Load the current file into the editor.  There is no
 function-wise compilation.

More generally, in Emacs C-h m will give you a list of keybindings for the
current major mode.  Also many major modes offer a menu in the menu-bar
where the main special features are advertized.

 Don't forget C-c C-r to reload the file in the buffer.

I've removed it from the next release of haskell-mode, so if you need it,
please explain why.


Stefan

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


[Haskell-cafe] Re: Using haskell with emacs

2007-08-08 Thread Stefan Monnier
 I've removed it from the next release of haskell-mode, so if you need it,
 please explain why.

 So C-c C-l is the preferred method for re-loading?

Yes.

 I don't know enough about the details to know if :l and :r do exactly the
 same things in ghci.

I don't either.  But experimentation suggests that the only
difference is that :r doesn't need an argument (which in the case of
haskell-mode doesn't make any difference since the arg is provided by
haskell-mode anyway).


Stefan

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


[Haskell-cafe] Re: Newbie question: multi-methods in Haskell

2007-08-06 Thread Stefan Monnier
 Remember that type classes do not provide object-oriented functionality.
 The dispatch is static, not dynamic.

I beg to disagree.

   map (\n. n + n)

calls different (+) operations depending on the (type of the) argument list.
That's why dictionaries are passed around (they are called vtables in many
OO languages) by several Haskell implementations.


Stefan

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


[Haskell-cafe] Re: Indentation woes

2007-07-27 Thread Stefan Monnier
 I wish to be able to indent my code like so:
 longFunctionName various and sundry arguments
 | guard1 = body1
 | guard2 = body2
 | ...
 where declarations
 That is, with guards and where clauses indented to the same level as
 the function name.

Sounds like a generalization of the idea of allowing indentation like

 if foo then bar
 else baz

in `do' notation.  It might probably be obtained similarly by just adding
a few optional semi-colons at the right place in the BNF rules.  whether
those optional semi-colons will render the grammar significantly
more complex, I don't know.


Stefan


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


[Haskell-cafe] Re: Haskell mode for emacs - some questions

2007-06-19 Thread Stefan Monnier
 I finally got emacs using Haskell-mode working. It seems that the latest

Sounds like it was difficult.  Could you describe what you tried, what
didn't work, and what did work in the end?  Hopefully I can then improve
the doc.

 - How can I just compile and run in one go without having to type ghc
 --make main.hs as arguments for the compile... command and then typing
 main.exe for shell command...? This is what you do all the time when
 using Visual Studio, Eclipse, etc: just hit the F5 key which builds all the
 dependencies and runs one or more generated executables. Easy. Visual
 Haskell does this (in the cases it does not hang for some unknown reason).
 Of course I could dig into ELISP, but somehow I feel this must be supported
 somehow.

I never use GHC in this way, I always use GHCi instead.  Furthermore, I tend
to work on only parts of a program, so there isn't necessarily
a main function.  I'd be happy to add support for your usage pattern, but
since I'm not familiar with it, I'm not sure what to add.
Another problem is that unless your project is tiny, it'll have several
files and currently Emacs doesn't know which file is the main one.  I added
very-preliminary support for Cabal in the CVS code of haskell-mode which
should allow haskell-mode (at some point in the future) to figure out what's
the main file an how to compile it.
Currently all it does (other than font-lock the cabal file itself) is look
for the Cabal file to figure out the root of the project, so that C-c C-l
first does a cd to the root, which should allow dependencies in other
directories to work more seemlessly.

Patches (or precise feature requests) are very welcome.  E.g. it should be
fairly easy to add an F5 binding like you describe.  The main issue is how
to inform Emacs of what should be done.  In VS or Eclipse, what do you have
to do in order for F5 to work?  Is opening some random source file enough,
or do you have to select a Cabal file or what?

 Use C-c C-l to load the file into GHCi. This is better than just compiling
 it: you get an interactive environment in which to play around with, test
 out functions, etc. You can still 'run' your program by typing 'main'
 in GHCi.

We could also add a binding which sends main to GHCi.

 - There seems to be support for Haskell Font Lock Symbols, which should
 convert \, - and maybe other symbols to good looking Unicode fonts.
 I can't get the correct fonts working on Windows.

I never use Windows so I can't really help you there.  Maybe ask on
gnu.emacs.help how to get those chars displayed.  I'm pretty sure Windows
has the needed fonts, so all that's missing is some way to help Emacs make
use of them.
If you figure it out, please send me a note about what you had to do, so
I can add it to the documentation.  

 Now as I understood this is not really supported because of indentation
 problems, as underneed the single Unicode arrow character is converted
 into -?

You slightly misunderstood: this hack is fully supported.  I just added some
warnings to the docstring to make sure the user doesn't blame me when he
gets bitten.

 This is unfortunate, because that's one of the things I really
 like about Sun's Fortress: the usage of Unicode symbols makes the text
 look much more mathematically, versus the half-century-old ASCII text.
 Furthermore in almost all Haskell books the richer font symbols are used
 for clarity.  Any hints on this topic?

I use this hack all the time and haven't been bitten yet.  Some important
aspects:
- the λ should use a 1-char-wide lambda (i.e. the unicode one).
  There's also a JIS lambda used if the unicode one can't be found, but this
  one is 2-char wide, so it risks introducing mis-indentation.
- the → and ← OTOH should use the 2-char-wide JIS arrow, rather than the
  unicode arrows for the same reasons.
- ...

 I wouldn't be surprised if this code had bit-rotted, or if there never has
 been Windows support.

I use it all the time, so it definitely hasn't bit-rotted (actually, it's
one of the most often updated part of the code).  There shouldn't need to be
anything special for Windows, but indeed I've never tried it on Windows
(and don't intend to either).

 It's a corner function, used by few and therefore not that polished. By
 all means, try it out, and if it doesn't work, feel free to submit
 patches, but I doubt it'll get changed any time soon by a haskell-mode
 developer :)

You'd be surprised,


Stefan

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


[Haskell-cafe] Re: Tutorial on Haskell

2007-04-16 Thread Stefan Monnier
 No we don't! At least not anywhere near as much of an exaggeration as that
 statement would be about an strongly typed imperative language (sequencing
 can't be type checked*, imperative programs are mostly sequencing, thus
 imperative programs are mostly unchecked).

Actually, side effects *can* be type checked, but it's a lot more painful
(the type of an assignment is not nearly as simple as the one you're used to).


Stefan

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


[Haskell-cafe] Re: A wish for relaxed layout syntax

2007-04-01 Thread Stefan Monnier
 list := '[' item* ';'? ']'

Indeed, it's the same idea as the 'else' in do-blocks.


Stefan

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


[Haskell-cafe] Re: literate Haskell newbie question

2007-03-10 Thread Stefan Monnier
 cat foo.lhs | grep -e ^ | sed s/^ //

Running for the Useless Use of cat Award?
A simpler version would be:

  sed -n -e 's/^//p foo.lhs

I don't guarantee that this will work correctly, tho.  Maybe

  sed -n -e 's/^ //p foo.lhs

will work better?  This said, the OP talked about TeX, so presumably he uses
the other format, so maybe a better sed would be:

sed -n -e '/^\\begin{code}/,/\\end{code}/{/^\\begin{code}/d;/^\\end{code}/d;p}'
foo.lhs


-- Stefan

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


[Haskell-cafe] Re: Church Encoding Function

2007-03-10 Thread Stefan Monnier
 I'm pretty sure you can define a catamorphism for any regular algebraic
 data type.

Actually, so-called negative occurrences in (regular) data types cause
problems.  Try to define the catamorphism of

data Exp = Num Int | Lam (Exp - Exp) | App Exp Exp

to see the problem,


Stefan

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


[Haskell-cafe] Re: LGPL libraries

2007-03-06 Thread Stefan Monnier
 Gtk2Hs and HDBC are both LGPL licensed, but aren't they always
 static linked? Is there a way to use them in closed-source programs?

Of course, just read the LGPL again.  It doesn't prevent use of
static-linking.  It's a bit long and verbose with odd-sounding rationales,
but all it really says is that you should make sure that the LGPL'd part of
your application can be modified by the end user.  Dynamic linking is the
easiest way to get that result, but it's not the only one.


Stefan

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


[Haskell-cafe] Re: seq does not preclude parametricity (Re: IO is not a monad)

2007-01-24 Thread Stefan Monnier
 FYI, don't try to run this in GHC, because it gives the simplifier fits.

You mean it triggers a bug in the inliner?


Stefan

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


[Haskell-cafe] Re: GHC performance of 64-bit

2007-01-08 Thread Stefan Monnier
 I noticed that GHC generates slower code on an Linux amd64 bit platform than 
 the 32-bit version on a cheaper 32-bit machine.
 CPUTime for running sieve of Erathostenes to generate 10,000 primes:
 Athlon XP 2800 (32-bit): 7.98 secs
 Athlon 64 3800 (64-bit): 10.29 secs
 This is using GHC 6.6 on the 64-bit machine and 6.4.1 on the 32-bit one.

 I googled around and could not find any information regarding degraded 
 performance of ghc/haskell on 64-bit machines. Any ideas?

Could it be the effect of doubling the size of pretty much everything,
leading to poorer memory-hierarchy performance?


Stefan

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


[Haskell-cafe] Re: Simple GADT parser for the eval example

2006-10-31 Thread Stefan Monnier
 ...No surprise there, since there is no way to fail in the event of a
 maltyped Expr.  The next thing to try is a type class solution... 

Think about it: you need to do type checking.
For our little language we used Template Haskell to do your Expr - Term a
translation, thus the type-checking of our input programs is actually done
by Haskell's type checker ;-)

See our PLPV paper http://www.iro.umontreal.ca/~monnier/tct.pdf


Stefan

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


[Haskell-cafe] Re: Why is Haskell not homoiconic?

2006-10-31 Thread Stefan Monnier
 Homiconic means that the primary representation of programs is also a
 data structure in a primitive type of the language itself

 The main reason is that Haskell is designed as a compiled
 language, so the source of the programme can safely
 disappear at runtime.  So there's no need to have a
 representation of it beyond the source code.

I'm not sure it's relevant.  In syntactically scoped Lisps, the code is
mostly manipulated at compile-time by macros, rather than at run-time.

And indeed, Template Haskell makes Haskell pretty much homoiconic.


Stefan

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


[Haskell-cafe] Re: What's going on in our courses?

2006-10-14 Thread Stefan Monnier
 Last Spring my Functional Programming class implemented a Genetic  Algorithm
 with Neural Networks that learned to play Nim. The students  had a really
 good time--they also learned lots about Functional  Programming
 with Haskell.
 Part of the final exam was a tournament.

 This Fall in AI we'll be  doing GA's again and Genetic Programming.

 Is there a list or forum that talks about teaching our students
 about  Haskell?

Indeed, I'd be interested as well.
I'm actually looking for a good textbook for a concepts of programming
language course.  All the books I can find tend to emphasize OO or
imperative programming too much for my taste.


Stefan

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


[Haskell-cafe] Re: Haskell performance (again)!

2006-10-10 Thread Stefan Monnier
 Assuming your machine architecture supports something like condition  codes.
 On, e.g., the MIPS you would need to test for  and ==  separately.

And even if your machine supports condition codes, you'll need one test plus
two conditional jumps.  Not much better than MIPS's 2 independent tests plus
2 conditional jumps.


Stefan

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


[Haskell-cafe] Re: [newbie] How to test this function?

2006-09-23 Thread Stefan Monnier
 First, how do I fix the identation of the if then else?
 getList = find 5
 where find 0 = return []
 find n = do
 ch - getChar
 if ch `elem` ['a'..'e']
 then do tl - find (n-1)
 return (ch : tl)
 else find n
 
 OK.  Thanks.  I didn't find that one because it's not offered as an
 identation option in emacs haskell mode.

It's not just a missing option, it's a bug.  I'll hopefully get around to
fixing it soon.

 Emacs is evil!

Of course, that's why we like it so much.

 It also inserts random tab characters into your code just to save a few
 space bytes.

Actually, it has nothing to do with saving space: it only uses TABs because
many people *want* to use tabs.  Of course, the rest of the users *doesn't
want* to use tabs, so we get to be flogged both ways.

BTW, when was the last time you tried haskell-mode?  Haskell-mode (at least
since version 2.0) makes it difficult for the user to insert TABs
by mistake.

 Tends to completely trash indentation e.g. when pasting code
 into mails etc.

Huh?  You mean your mail reader doesn't display tabs in the same way as
8 spaces?  TABs are evil for many reasons, but I've never seen this one.


Stefan

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


[Haskell-cafe] Re: [newbie] How to test this function?

2006-09-23 Thread Stefan Monnier
 For that one, if it doesn't get mended for long enough,
 Haskell' might accept the present layout.
 http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse

Hmm... the bug in haskell-mode has been known for almost a year now.
So you're saying that I should just wait even more and it'll get fixed
by Haskell'?
IOW Haskell isn't just lazy but it even rewards laziness?


Stefan

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


[Haskell-cafe] Re: Monad laws

2006-09-07 Thread Stefan Monnier
 Are you really sure Haskell compilers do that optimization?
 I would regard a compiler that does optimizations that are justified  by
 laws that the compiler cannot check as broken.

You mean like the non-aliasing law in Fortran?


Stefan ;-)

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


[Haskell-cafe] Re: does the compiler optimize repeated calls?

2006-09-06 Thread Stefan Monnier
 Purely functional does give you some performance benefits, though.

Nice theory.  People don't use functional languages for their performance,
mind you.  All the optimizations that are supposedly made possible by having
a pure functional language tend to be either not quite doable (because of
non-termination making the language a bit less pure) or simply too hard: the
difficulty being to decide when/where the optimization is indeed going to
improve performance rather than worsen it.

It's much too difficult for a compiler to figure out which functions might
benefit from memoization (and with which specific form of memoization).
Especially compared with how easy it is for the programmer to do the
memoization explicitly.


Stefan

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


[Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Stefan Monnier
 I simply can't let this pass without comment.  It's irrelevant if you're
 using a functional or imperative language, debuggers are invariably
 a waste of time.  The only reason to use a debugger is because you need
 to inspect the contents of a processes address-space;

That's a very narrow definition of debugger.


Stefan


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


[Haskell-cafe] Re: map (-2) [1..5]

2006-08-17 Thread Stefan Monnier
 I'd have thought it would have been simpler to just make the rule that -2 
 (no spaces between '-' and '2') would be a single lexeme,

But then x-2 won't mean subtract 2 from x but call x with arg -2.


Stefan

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


[Haskell-cafe] Re: Why Not Haskell?

2006-08-07 Thread Stefan Monnier
 Well I understand the free as in free speech not free beer motto, but
 suppose person A is talented at writing software but prefers a peaceful
 existence and lacks the contacts/refs/desire/energy etc to be a consultant
 or contractor, and has had the bad experience of being forced to work
 extremely long hours with low pay while in an employed position, and person
 B is outgoing, ebullient, and talented at marketing and advertising.  Now
 person A spends some years quietly writing some code, which uses a GPL
 library and is therefore GPL'd, and sells it, as is his/her right under the
 GPL to person B.

If person A really worked for years using a GPL'd library and hoping to make
money selling the resulting program (rather than services around that
program), he's a complete and total idiot.

In any case, making a living by selling a program (as opposed to services
around that program) is a difficult business.  Except when it's a program
written on-demand for a customer who pays you directly to write it (in
which case the GPL probably won't get in way, BTW).

 I can't entirely dismiss GNU/FSF/GPL but it poses a fundamental conflict
 with the only way I can see of earning a living so it's like a continuous
 background problem which drains some of my energy and enthusiasm hence the
 length of my rambling post where I made another attempt to understand my
 relation to it.

Maybe you should thank the FSF for making you doubt: you should really think
very hard about how you're going to make a living off of selling a program,
even if that program hasn't been anywhere near any GPL'd code.  In all
likelihood it'll be much easier to earn your money by selling services
around your program than just the program itself.


Stefan

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


[Haskell-cafe] Re: Why Not Haskell? (sidenote on licensing)

2006-08-07 Thread Stefan Monnier
 Sorry, I didn't mean to offend anybody, or be misleading.  I like GPL,
 but I also like the disease metaphor (although is not as much being
 sneezed at as having sex with somebody :-).

Then you should think twice before using such metaphors: you end up
propagating hate for something which you like.

 And it's really not as easy to control as you suggest: If you ever
 take in a single patch under the GPL,

Any patch or outside piece of code you choose to include in your code should
be checked to see if its licence allows you to use it like you intend.
That's true for any license, not just for the GPL.  And don't forget: the
default license is no licence at all (i.e. basically just what the
copyright's fair use says, which seems to be asymptotically moving towards
the empty set as time goes).

 or even implement a new feature in an obvious way that has been
 implemented by somebody else under the GPL, you are in trouble.

Doesn't sound credible.  You're free to write and sell a program whose
source code is exactly the same as Emacs's (or PowerPoint for that matter)
as long as you can show it was pure accident (or if you like a more classic
example url:http://en.wikipedia.org/wiki/Pierre_Menard_(fictional_character))
AFAIK The problem you talk about only comes with patents and is unrelated
to copyright/licenses/GPL.


Stefan

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


[Haskell-cafe] Re: ANN: System.FilePath 0.9

2006-07-27 Thread Stefan Monnier
 Trying to design a consistent naming system, it helps if we all agree
 on what the various parts of a filepath are called, this is my draft
 of that:

 http://www-users.cs.york.ac.uk/~ndm/temp/filepath.png

For what it's worth, the FSF's coding conventions uses path only for
lists of directories (typically used for a search, e.g. MANPATH, PATH,
LD_LIBRARY_PATH, load-path, ...), not for file names.  In their convention,
/foo/bar/baz is a file name, where bar is a file name element IIRC.


Stefan

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


[Haskell-cafe] Re: Why does Haskell have the if-then-else syntax?

2006-07-27 Thread Stefan Monnier
 Confusingly,

 if c
 then t
 else f

 Also works, although no-one really knows why.

Actually, it doesn't work inside a `do' layout,


Stefan

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


[Haskell-cafe] Re: help with MPTC for type proofs?

2006-05-27 Thread Stefan Monnier
 I'm thinking that either the functional dependency constraint is weaker
 than I thought, or that somehow GADTs aren't interacting with FDs as I'd
 like, but I'm not sure which.  Or, of course, it may be that my recursive
 instance is not doing what I like.  Or I may be just plain confused, as is
 pretty clearly the case...

The interaction between FD and GADTs is not very good, in our experience.
Hopefully this will be fixed at some point.  But in the mean time, what we
ended up doing is to use GADTs instead of classes and FDs:

   data Eq a b where refl_eq :: Eq a a

   data Commute a b c d where
 various axioms defining how D can result form A, B, and C

   -- Lemma that says that D is uniquely defined by A, B, and C.
   Comm_unique :: Commute a b c d - Commute a b c d' - Eq d d'
   -- Proof.
   Comm_unique p1 p2 = ...

The problem is that in your case it seems that you do not want to explain to
the type checker how D depends on A B C: you just want to say that it's
uniquely defined.  But maybe you can get away with:

   data Eq a b where refl_eq :: Eq a a
   data Commute a b c d -- No axioms provided to Haskell.
   -- Lemma that says that D is uniquely defined by A, B, and C.
   Comm_unique :: Commute a b c d - Commute a b c d' - Eq d d'
   -- The proof is not given either.
   Comm_unique p1 p2 = undefined

When you'll do a case on Comm_unique a b (which will tell the type checker
that D and D' are one and the same) you'll just want to make sure that
Haskell doesn't try to look at the `refl_eq' value.


Stefan

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


[Haskell-cafe] Re: lambda evaluator in GADT

2006-04-09 Thread Stefan Monnier
 The introduction to GADT usually starts with a little expression
 evaluator.  So I gave it a try, but there are some troubles.

Actually, the generalization is not necessarily trivial at all, depending on
what you need to do with your ASTs.

 data E a where
 Lit :: a - E a
 App :: E (a - b) - E a - E b
 Lam :: Var a - E b - E (a - b)
 Val :: Var a - E a
 
 data Var a = Var String

You're using a first-order abstract syntax.  Each GADT branch corresponds to
one of the typing rule of your language, and when you introduce variables,
your typing rules end up needing an extra environment (which maps each var
to its type), which you also need to add here: E env a.  Building up `env'
is left as an exercise.

An alternative is to use higher-order abstract syntax, which correspond to
using hypothetic judgments in your typing rules instead of an
extra environment.  I.e. something like:

 data E a where
 Lit :: a - E a
 App :: E (a - b) - E a - E b
 Lam :: (E a - E b) - E (a - b)

 eval (Lit x) = x
 eval (App f x) = (eval f) (eval x)
 eval (Lam f) x = f (Lit x)


Stefan

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


[Haskell-cafe] Re: haskell-mode indentation

2006-03-31 Thread Stefan Monnier
 Being an emacs-addicted person, I'm using haskell-mode for editing
 haskell code.  But its default indentation rule doesn't seem to
 be correct.  I mean when i type something like the code below, i've got
 the  following indentation:

 doSomeStuff a b c = do
   somefunc a
anotherfunc b
onemorefunc c

 Whereas the correct indentation (in my opinion) is as follows:

 doSomeStuff a b c = do
   somefunc a
   anotherfunc b
   onemorefunc c

Yup, there's clearly a bug here (or at least misfeature).
But at least

 doSomeStuff a b c = do
   somefunc a
anotherfunc b
onemorefunc c

would make sense as well, if somefunc can take 5 arguments (and
haskell-mode doesn't do any kind of type-inference, so it should
conservatively allow this indentation as well).


Stefan


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


[Haskell-cafe] Re: Code completion? (IDE)?

2006-02-20 Thread Stefan Monnier
 vim7 has introduced omni-completion... So I'm interested wether there
 are any projects which support any kind of completion.?

 I have been working on some code completion support for EclipseFP. It
 is right now in a really infant stage, but it at least is something.

 Just take a look at the latest integration build that you are able to find at

 http://eclipsefp.sourceforge.net/download

Could you describe the general approach taken?

I'd like to see something like that added to Emacs's haskell-mode as well,
and I expect a fair bit of the work can be done on the Haskell side and thus
shared among editors.


Stefan

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


[Haskell-cafe] Re: Why is $ right associative instead ofleftassociative?

2006-02-07 Thread Stefan Monnier
 The trouble with monad comprehensions was that it became far too easy to
 write ambiguous programs, even when you thought you were just working with
 lists.

One solution was already suggested: to make the comprehension syntax be pure
syntactic sugar whose semantics depends on the semantics of the identifiers
the syntactic sugar expands into.

So you could keep the current list-only comprehension as default, and allow
monad comprehension by providing a library (which the users need to import
so as to hide the Prelude's definition).


Stefan

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


[Haskell-cafe] Re: Announcing Djinn, version 2004-12-11, a coding wizard

2005-12-14 Thread Stefan Monnier
 I've written a small program that takes a (Haskell) type
 and gives you back a function of that type if one exists.
 It's kind of fun, so I thought I'd share it.

Doh!  It seems your code takes a string representing the type and returns
a string representing the code, whereas I expected at first you were doing
some funky type class molestation so you can use djinn in your code and
let Haskell fill it in.


Stefan

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


[Haskell-cafe] Re: Indenting issue with Haskell mode

2005-12-08 Thread Stefan Monnier
 I believe the following is not indented correctly. It only happens  with
 (x:xs) when you use nested cases, I think.

 case foo of
[] -
case bar of
  [] -
  return ()
 (x:xs) -

Thanks.  The indentation indeed works particularly poorly here in ways that
I hadn't seen yet.  I don't have time to look into right now, but I've added
it to the indent.hs file in the mean time.


Stefan




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


[Haskell-cafe] Re: layout problem

2005-11-16 Thread Stefan Monnier
 Indeed!  I always use braces and semicolons with do-notation.  You are
 free to do so too!  Nothing requires you to use layout. Indeed, you can
 freely mix the two.

 I would not recommend braces and semicolons, because these allow a bad
 layout (easy to parse for a compiler, but hard to read for a human), unless
 you invest the time to make a tidy layout despite the braces and
 semicolons. (So why not only make a tidy layout?)

Unless you use a simplistic text editor, the braces and semi-colons allow
the text editor to do the layout for you.  While I find the layout notation
attractively clean, I find the redundancy of autolayout+braces+semicolons to
save me from a lot of trouble.


Stefan

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


  1   2   >