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
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
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
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
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
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
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
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
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
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
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,
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
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
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
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
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
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
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
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
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 ;-)
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
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
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
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
...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
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
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
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
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
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
* 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
*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
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
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
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
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
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
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
___
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
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
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.
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
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
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 ::
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
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
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
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,
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
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
a b c
which is a short-cut of a b \land b c
The confusion between f(x) and x.f(x) is indeed a real bummer.
OTOH I like the abc shorthand because it's both obvious and unambiguous
(as long as the return value of can't be passed as an argument to , which
is typically the case when the
The various UTF encodings do not have this particular problem; if a UTF
string is valid, then it is a unique representation of a unicode string.
However, decoding is still a partial function and can fail.
And while it is partly true, it is qualified by the problems relative to
canonicalization
It would be useful to specify a function as so:
doSomethingToAModule :: SCode(SModule) - SomeRandomOtherType
You may want to check out the work done on refinement types, mostly by Frank
Pfenning and some of his students IIRC.
Stefan
___
It's not about Haskell directly but I would like to
know how can I customize Emacs in haskell-mode when
i'm using Emacs for windows.
What kind of customization are you looking for?
You can start with M-x customize-group RET haskell RET
Please, I'm trying to do it but it doesn't do anything.
I've got haskell mode working with Emacs and ghc, this works okay, though
the mode seems a little rough-edged, and the indentation appears slightly
wonky at times.
Bug reports welcome,
Stefan Haskell-mode maintainer
___
Haskell-Cafe
I don't think it's so much bugs as it's funky indentation :-). For
example...
data TableInfo = TableInfo {
avgPot :: Double,
I would have preferred not to offset the fields from the brace but I don't
know how to change this and maybe I'm going against standard
You mean you'd like
data TableInfo = TableInfo {
avgPot :: Double,
No, I would actually like to offset avgPot 4 spaces from TableInfo.
In that case I'm with you. It's on my wish list as well.
which is much better. I'd personally prefer
case findprop attr
Can I throw a vote in for handling
data T = T { granularity :: (Int, Int, Int, Int)
, items :: Map (Int, Int, Int, Int) [Item] }
correctly? That (and case statements) are the only things that really
still bother me about haskell-mode.
AFAIK this is handled correctly in the
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
[...] unsafe [PerformIO ...] looks safer to me.
Hmmm
Stefan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
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
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:
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
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
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
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,
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.
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
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
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
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
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
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
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
\ 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
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
Has anyone already tried to embed prolog-style logic programming as
a Haskell library? Kind of like Schelog but for Haskell?
I know about Curry, but I'd like a Haskell library rather than
another language.
Stefan
___
Haskell-Cafe mailing
File descriptors aren't simply a resource in the sense that memory
is. Closing a descriptor may have significance beyond the process
which closes it. If it refers to the write end of a pipe or socket,
closing it may cause the reader to receive EOF; if it refers to a
file, any locks will be
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
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
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
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
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*
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
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
1 - 100 of 110 matches
Mail list logo