[Haskell-cafe] Real World Haskell Chapter 11 ... Testing

2008-10-12 Thread Galchin, Vasili
Hi,

  Testing of pure code ... . way cool ... I am sure there literature
from the first order logic, model theory, categorical logic viewpoint??

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


Re: [Haskell-cafe] Re: Ubuntu Haskell

2008-10-12 Thread Ariel J. Birnbaum
  Have you thought about doing this for Ubuntu? If you know how to
  automatically generate packages, you could set up a PPA (private package
  archive) on Launchpad.

 I've spoken with Jeremy Shaw, who has similar systems in place, based
 also on Cabal (and cabal-install), for generating native packages for
 Debian  Ubuntu.

 However, we do need some Ubuntu champions who can work incrementally,
 over a long time, to keep packages up to date on their systems.

Pray tell, what kind of feats are expected of such a champion?

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


Re: [Haskell-cafe] ANNOUNCE: Salsa: A .NET Bridge for Haskell

2008-10-12 Thread Andrew Appleyard

Jason Dagit wrote:

Thank you for releasing this!


No worries.  I might never have got around to releasing it if it wasn't
for the encouragement of Manuel Chakravarty, Don Stewart, and others.
Thanks guys!

[...] as I understand it the Haskell you write still lives in 
Haskell-land and the .NET code you interface with lives in .NET land.


Yep, that's correct.  Compiling Haskell to .NET IL is a significantly
more adventurous project!  I wouldn't have managed to acheive a
practical result in the time I had for my thesis if I had taken that route.

Salsa's approach to type system mapping could be useful in such a
project though.

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


Re: [Haskell-cafe] [ANN] Haskell Cheatsheet v1.0

2008-10-12 Thread Andrew Coppin

Justin Bailey wrote:

Thanks to everyone for their feedback. I've made some updates and
posted the PDF to my blog:

  http://blog.codeslower.com/2008/10/The-Haskell-Cheatsheet
  


I was wondering why there isn't a PDF directly downloadable anywhere... ;-)

FWIW, I just learned something by looking at this. I was under the 
impression that a literal number can have *any* type, and therefore 1 
and 1.0 are completely equivilent. Apparently this is untrue. (!)


Your numbers section is actually mostly list comprehensions. While 
it's interesting that you need a space between .. and - for negative 
numbers, this wasn't immediately clear from reading your text. Maybe it 
would be better to write that as a sentence? (Or just format the correct 
syntax in monotype so the space is more obvious.)


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


[Haskell-cafe] Pandoc questions

2008-10-12 Thread Andrew Coppin
There doesn't seem to be any option to make Pandoc produce actual MathML 
output. Is there a reason for this?


(The only option I can see is to spit out raw LaTeX plus a 70KB 
JavaScript program to transform this into MathML at the client end --- 
which seems a little silly to me. There's also no way to style the raw 
LaTeX differently in case JavaScript is unavailable.)




Also, while Markdown *almost* does what I want, there are a few small 
constructs it doesn't have. For example, I'd like to have some way to 
denote a term the first time I use it. I could just use italics, but 
I'd prefer some way to visually indicate that this isn't just an 
emphasised word, it's a new technical term. In HTML, I'd use a style 
class, and in LaTeX I'd define a new command. But I can't see a way to 
do something that will still allow Pandoc to generate correct LaTeX 
*and* correct HTML from a single Markdown source... Any hints?


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


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

2008-10-12 Thread Luke Palmer
On Sat, Oct 11, 2008 at 8:32 PM, Simon Richard Clarkstone
[EMAIL PROTECTED] wrote:
 (Darnit Thunderbird, why don't you DWIM when I hit reply or reply-all?)

You're not writing about Perl, you're writing about Haskell!  It
should have been a type error.

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


Re: [Haskell-cafe] How to translate Haskell to other languages?

2008-10-12 Thread Matthew
Hi Jason,

 So in an automatic translation I would replace partial application
 with lambdas.  This shouldn't be a problem right?

suppose f is a 3-argument function, and you encounter the application
f x.  One possible translation would be to replace f x with

  (\y. \z. f (x,y,z))

I don't know if this is what you mean.  Anyway, the problem is that f
might not be a function name; it could be the argument of a
higher-order function, in which case we don't know how many
lambda-bound variables to introduce.  It's easiest just to define f
as f() = \x. \y. \z. e rather than f (x,y,z) = e, I think.

  A translation scheme, D[], from a combinator definition to a Python
  definition might look as follows.
 
   D[c v* = e]   =   def c() : return (lambda v1: ... lambda vn: E[e])
   E[e0 e1]  =   E[e0] (E[e1])
   E[v]  =   v
   E[c]  =   c()
 
  Here is the result of (manually) applying D to the list-reversing program.
 
 
 If nil() corresponds to [] in Haskell, then how did you arrive at this
 definition?  As Derek Elkins points out your transformation is a CPS based.
 So I'm going to guess that c is the continuation and n represents the nil?

Regarding terminology: be careful not to confuse the CPS
transformation with the transformation that encodes data as functions.
I've made this mistake in the past.  To my knowledge, the CPS
transformation refers to the transformation that enforces strict
evaluation in a program.  Encoding data as functions removes data
constructors and case expressions from a program (albeit using
continuations).  I think the latter is known by at least two names:
Scott's encoding, and Berarducci and Bohm's encoding.  It is not the
same as the Church encoding.  I first read about it in a paper by Jan
Martin Jansen.

  Jan Martin Jansen, Pieter Koopman and Rinus Plasmeijer. Efficient
  Interpretation by Transforming Data Types and Patterns to Functions.
  Trends in Functional Programming, Volume 7, Intellect, 2007.

(Googling the title should reveal a PDF.)

But since then, I've noticed the transformation used (anonamously) in
several old texts about compiling functional languages.

 Also, how do I allow Python to then access the Haskell values?  I
 guess your definition of list above is an example of that, but I'm
 not sure how I'd pull that off in general.

Converting data to function-encoded data: this can be done with a
fold, e.g. foldr cons nil should do the trick for lists.

Converting function-encoded data back to data: it should be possible
to generate a function like my list(xs) (which returns a Python
represention of a function-encoded Haskell list xs) for any given data
type.

Alternatively, you could just add constructors and case expressions to
the syntax I gave for combinator programs, and deal with them
explicitly in the translation.

   N[e0 e1]   =   N[e0] (\x. N[e1])
   N[v]   =   v (\x. x)
   N[f]   =   f

 What i are you referring to?

Woops, i refers to the combinator representing the function \x. x.
(I wrote NOTE 2 before realising NOTE 1!)  Basically, the (\x. x)
above can be replaced with any expression that terminates, but
preferrably one that will be cheap to evaluate.

  Now, non-strict evaluation is all very well, but what we really want
  is lazy evaluation.  Let's take the N transformation, rename it to L
  for Lazy, and indulge in a side-effecting reference, ML style.
 
 
 
   L[e0 e1]   =   L[e0] (let r = ref None in
   \x. match !r with
  None - let b = L[e1] in r := Some b ; b
| Some b - b)
   L[v]   =   v (\x. x)
   L[f]   =   f

 Could you explain this a bit more.  I don't know ML, so the code is a bit
 hard for me to read, but also I was wondering why you introduced a
 side-effecting reference?

Generally: a reference is created for every argument in a
function-call.  The first time that argument is evaluated, the
reference is updated to store the result of the evaluation, so that it
is never performed again.

More specifically:

  * ref creates a mutable reference.  In ML, bindings of a let are
evaluated before the body of the let.

  * !r gets the value at a reference r, and r := e updates the
value at reference r.

  * None and Some are the ML equivalents to Nothing and Just.

  * e0 ; e1 evaluates e0 before e1 and then returns the value of e1.


 Is that basically the same as my thunk type?

I imagine it is very similar to your thunk type, but I don't know
enough Python to say for sure.

 So, supposing I went with a translation scheme like what you gave.
 I think I would end up with deeply nested function calls, this is
 probably very bad for the python run-time.

There are some optimisations to the translation.  For example, if a
function is applied to an argument, and that argument is not
referenced more than once in the body of f, then there is no need to
create a reference for said argument.

Matthew.

Re: [Haskell-cafe] Haskell on the JVM

2008-10-12 Thread Jon Harrop
On Saturday 11 October 2008 17:45:39 John A. De Goes wrote:
 I have strong interest in hosting GHC on the JVM. And I suspect it
 would be good for the Haskell community, as the JVM already runs on
 nearly every machine known to man, has a wealth of cross-platform
 libraries, and is getting improved support for dynamic and functional
 languages (method handles, tail call).

The JVM has been about to get basic features like tail calls for several years 
now.

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


Re: [Haskell-cafe] Haskell on the JVM

2008-10-12 Thread Jan-Willem Maessen


On Oct 12, 2008, at 6:19 AM, Jon Harrop wrote:


On Saturday 11 October 2008 17:45:39 John A. De Goes wrote:

I have strong interest in hosting GHC on the JVM. And I suspect it
would be good for the Haskell community, as the JVM already runs on
nearly every machine known to man, has a wealth of cross-platform
libraries, and is getting improved support for dynamic and functional
languages (method handles, tail call).


The JVM has been about to get basic features like tail calls for  
several years

now.


As a gentle correction of fact, while folks have been *asking* for  
tail calls in the JVM for over 10 years, it's only in the last year or  
two that there's actually been support from VM implementors for their  
inclusion.  I've had specific discussions with JVM folks on this very  
topic on numerous occasions over the last 5 years.  [I can't speak to  
what other basic features might have been slated for inclusion  
several years ago; I'll note that invokedynamic has been slated for  
inclusion for much longer, but required some wrangling between  
competing VM implementors and language designers to actually settle on  
an implementable spec.  The result looks nothing at all like my memory  
of the original proposal.]


Back to your regularly scheduled Haskell discussion.

-Jan


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


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


[Haskell-cafe] ANNOUNCE: Graphalyze-0.4 and SourceGraph-0.2

2008-10-12 Thread Ivan Lazar Miljenovic
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I'd like to announce version 0.4 of my Graphalyze library [1] and 0.2 of my
SourceGraph programme [2].

[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Graphalyze
[2] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SourceGraph

This should fix the bugs reported by Gwern Branwen, Magnus Therning (thanks to
Niklas Broberg for stating the correct version for Haskell-Src-Exts) and
Christopher Hinson.  No really new features are included in this release.  I
was planning on fixing this and releasing it sooner but - to utilise what seems
to be a current meme [3] - I accidentally my Gentoo on Tuesday night and only
fixed it yesterday.

[3] http://encyclopediadramatica.com/I_accidentally_X

Since I'm more awake now than I was when I made the initial release, here's a
run-down of what SourceGraph is:

SourceGraph is a programme designed to help you analyse the static complexity
of your Haskell code when represented as a graph.  At the moment, it does the
following (M == for each module, I = for imports, C = the whole codebase):

* Visualise it {M,I,C}
* See a collapsed visualisation {M}
* Proposed module/directory layout using two different algorithms {I,C}
* See the core visualisation (recursively strip off roots/leaves) {M}
* Calculate the Cyclomatic complexity [4] {M,I,C}
* Root analysis (compare what's exported to what actually is a root) {M,I,C}
* Determine how many components you have, to see if you should split {M,I,C}
* Clique Analysis (find co-recursive functions) {M,C}
* Cycle analysis (non-cliques) {M,I,C}
* Chain detection (e.g. straight-line functions/imports) {M,I,C}

[4] http://en.wikipedia.org/wiki/Cyclomatic_complexity

Current limitations:

* An automatic  refactoring tool: SourceGraph gives *you* information on how you
  might want to possibly refactor your code.  It's not smart: it can't tell
  that you've clumped functions foo and bar in the same module because they do
  similar things or because it's a utility module, even though they're not
  related.  For automatic refactoring, see something like HaRe [5].
* SourceGraph ignore's data-based functions, i.e. record-functions and
  class/instance declarations, as it's too confusing (IMHO) which actual
  function you mean (if you see show being called, is it for Int, Double, or
  something else?).
* Despite using Haskell-Src-Exts, some extensions (e.g. TH) are ignored, mainly
  because I have no idea how they work and nothing to test it on.  GHC
  extensions should be supported (read the parser won't choke on them) though.
* Reporting output is currently rather limited:
  - The report will be generated in a subdirectory called SourceGraph of the
codebase directory; this is currently hardwired in.
  - It will produce an all-in-one html file report, with no fancy CSS magic to
make it look pretty.  Ideally, it would produce a split-file, and allow you
to choose output format.
  - Large graphs are shrunk down to being a maximum of 15x10.  Ideally, I'd
like to extend this later so that large graphs will have a shrunk version
in the graph, which link to a larger version (note though that these graphs
get very large very fast).
  - The output of individual function names, etc. could be improved.

[5] http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html

SourceGraph can be installed with cabal-install.  Once you've done so, you can
analyse a cabalized library/application Foo as follows:

$ SourceGraph /path/to/codebase/Foo.cabal 
Report generated at: /path/to/codebase/SourceGraph/Foo.html

This has been written as part of my mathematics Honours Thesis,
Graph-Theoretic Analysis of the Relationships in Discrete Data.  Since I've
actually got to write the thesis up now, I won't be making any more releases
for a while.  After uni is over for the semester though, I hope to tidy it up
and extend it.

If you want to check the code out yourselves, there's also darcs repositories
for Graphalyze [6] and SourceGraph [7].

[6] http://code.haskell.org/Graphalyze
[7] http://code.haskell.org/SourceGraph/

Note that whilst Graphalyze is fully documented, etc., the internals of
SourceGraph are a bit fugly (mainly due to time constraints).

Enjoy!

- -- 
Ivan Lazar Miljenovic
[EMAIL PROTECTED]
IvanMiljenovic.wordpress.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkjyAacACgkQfEfFJ9JhvyiHEACfVVuRk2FR3ZQiJ6H18FFK/de/
sukAn0tuCLwqxmzlQvWicQKQ3qEJKC1K
=HRUK
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Pandoc questions

2008-10-12 Thread David Menendez
On Sun, Oct 12, 2008 at 6:21 AM, Andrew Coppin
[EMAIL PROTECTED] wrote:
 Also, while Markdown *almost* does what I want, there are a few small
 constructs it doesn't have. For example, I'd like to have some way to denote
 a term the first time I use it. I could just use italics, but I'd prefer
 some way to visually indicate that this isn't just an emphasised word, it's
 a new technical term. In HTML, I'd use a style class,

Markdown allows arbitrary HTML tags, so you can just put the terms in
a dfn element.

I don't know if that will work with the LaTeX conversion. Markdown is
specifically designed to produce HTML, so it's not clear to me how
Pandoc does any of the non-HTML output formats.

-- 
Dave Menendez [EMAIL PROTECTED]
http://www.eyrie.org/~zednenem/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell on the JVM

2008-10-12 Thread frantisek kocun
There is CAL language (purely functional, very Haskell like, the most I have
seen). CAL Eclipse plugin (IDE for CAL for non java-ers) is incredible, with
support for code comletition, documentation, refactor, code navigation..
They have graphical editor GemCutter for it as well. You can use java
libraries within it with unsafe imports or call cal function from java or
there is even embedded CAL in Java:)

Check out: http://openquark.org
Embeded CAL: http://groups.google.com/group/cal_language/web/embedded-cal


This is from CAL for Haskell Programmers:
CAL implements essentially all the non-syntactic sugar features of Haskell
98 (with its standard
addendums) including:
• algebraic functions with parametric polymorphism and inferred types
o type declarations can specialize or assert types
• data declarations for algebraic types
o strictness flags for data constructor arguments
• a module system supporting separate compilation
• expression syntax supporting if-then-else, case, let (for both local
variable and function definitions)
and lambda expressions
o support for most of Haskell's expression operators
• special syntax for tuples, strings, characters, numbers and lists
• an extensive collection of standard libraries
• single parameter type classes
o superclasses
o derived instances, such as the instance declaration for Eq List
o deriving clauses for common classes
o default class method definitions
o higher-kinded type variables, such as with the Functor type class
• dynamics support via the Typeable type class and Dynamic type
• user documentation generated from source code (similar to Haddock)
• foreign function support
• hierarchical module names

Another interesting project is COHATOE (contributing Haskell to Eclipse) by
which one can write Haskell plugins to Eclipse, but I have no clue how it
works.
http://eclipsefp.sourceforge.net/cohatoe/

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


[Haskell-cafe] Could not deduce .. why ?

2008-10-12 Thread Marc Weber
Surely I've overseen a small point. But I can't see it:
Why doesn't ghc recognize taht elc_ (class decl), elc (instance decl) and elc_1 
are the same type
To help you find the connecting pieces faster I've marked them with ## ##

Marc


data PT a b = PT b -- phantom type containing state a and the result b

class AddEl el_ el2_ elc_ where
  addEl :: el_ - elc - el2_ -- el, child
 
-- == adding sub elements (tags) =
class AddElT est el_ 
 estc ##elc_##
 est2 el2_
| estc est - est2
, est est2 estc el2_ - el_
, est est2 estc el2_ - elc_
where
  addElT :: PT est el_ - PT estc ##elc_## - PT est2 el2_
 
-- first child ? attrs ok? 
instance (
AddEl el el2 ##elc##   -- this is not recognized because elc != 
elc_1
  , Consume st (Elem celType) st'
  , DetermineElAddEl (NYV (Element elType AttrsOk st HFalse)) el
 (Valid celType) elc
 (NYV (Element elType AttrsOk st' HTrue)) el2
  ) = AddElT (NYV (Element elType AttrsOk st HFalse)) el
  (Valid celType) ##elc## -- elc_ from class declaration
  (NYV (Element elType AttrsOk st' HTrue)) el2
  where
addElT (PT t) (PT ##c##) = PT $ addEl t c   --  line 435, c should 
have  type elc, not elc_1
 
 
src/Text/XML/Validated/Types.hs|435 col 32 error| 
|| Could not deduce (AddEl el el2 elc_1)
||   from the context (AddElT
||   (NYV (Element elType AttrsOk st HFalse))
||   el
||   (Valid celType)
||   elc
||   (NYV (Element elType AttrsOk st' HTrue))
||   el2,
|| AddEl el el2 elc,
|| Consume st (Elem celType) st',
|| DetermineElAddEl
||   (NYV (Element elType AttrsOk st HFalse))
||   el
||   (Valid celType)
||   elc
||   (NYV (Element elType AttrsOk st' HTrue))
||   el2)
||   arising from a use of `addEl'
||at src/Text/XML/Validated/Types.hs:435:32-40
|| Possible fix:
||   add (AddEl el el2 elc_1) to the context of the instance
declaration
|| In the second argument of `($)', namely `addEl t c'
|| In the expression: PT $ addEl t c
|| In the definition of `addElT':
|| addElT (PT t) (PT c) = PT $ addEl t c
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Pandoc questions

2008-10-12 Thread Andrew Coppin

David Menendez wrote:

Markdown allows arbitrary HTML tags, so you can just put the terms in
a dfn element.

I don't know if that will work with the LaTeX conversion. Markdown is
specifically designed to produce HTML, so it's not clear to me how
Pandoc does any of the non-HTML output formats.
  


Well, no... Markdown is a way of marking up text in a way which is still 
moderately readable to human beings. You can turn it into any markup 
format in principle. The trouble as, as soon as Pandoc doesn't 
understand the markup, you can't really expect it to handle the 
translation any more...


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


Re: [Haskell-cafe] Could not deduce .. why ?

2008-10-12 Thread Daniel Fischer
Am Sonntag, 12. Oktober 2008 17:38 schrieb Marc Weber:
 Surely I've overseen a small point. But I can't see it:
 Why doesn't ghc recognize taht elc_ (class decl), elc (instance decl) and
 elc_1 are the same type To help you find the connecting pieces faster I've
 marked them with ## ##

 Marc


 data PT a b = PT b -- phantom type containing state a and the result b

 class AddEl el_ el2_ elc_ where
   addEl :: el_ - elc - el2_ -- el, child
   ^^
I suspect that might be responsible, didn't you mean to write elc_ there?


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


[Haskell-cafe] Still stacking monad transformers

2008-10-12 Thread Andrew Coppin
I am becoming extremely frustrated now. The task I want to perform is 
simple, yet I simply cannot make Haskell do what I want.


I've given up hope of ever getting my program to handle infinite result 
sets. That means I can make do with just ListT. So I have the following 
monad:


 type MyMonad x = StateT MyState (ListT Identity) x

Now I'm trying to run two computations, starting from _the same state_, 
and combine the two resulting lists. The trouble is, I am literally 
losing the will to live trying to comprehend the whinings of the type 
checker. The operation I'm trying to perform is perfectly simple; I 
don't understand why this has to be so damned *difficult*! _


Any suggestions?

I found that by using the brief and easily memorable construction 
runIdentity $ runListT $ runStateT foo state I can get at the result 
set for each action, and combine them. But nothing in hell seems to 
transform this from [((), MyState)] back into MyMonad ().


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


Re: [Haskell-cafe] Still stacking monad transformers

2008-10-12 Thread Duncan Coutts
On Sun, 2008-10-12 at 18:08 +0100, Andrew Coppin wrote:
 I am becoming extremely frustrated now. The task I want to perform is 
 simple, yet I simply cannot make Haskell do what I want.
 
 I've given up hope of ever getting my program to handle infinite result 
 sets. That means I can make do with just ListT. So I have the following 
 monad:
 
   type MyMonad x = StateT MyState (ListT Identity) x
 
 Now I'm trying to run two computations, starting from _the same state_, 
 and combine the two resulting lists. The trouble is, I am literally 
 losing the will to live trying to comprehend the whinings of the type 
 checker. The operation I'm trying to perform is perfectly simple; I 
 don't understand why this has to be so damned *difficult*! _
 
 Any suggestions?

Have you tried pure lazy functional programming without stacked monads?

I've never been convinced that stacked monads is a good way to write
ordinary code. Monad transformers are great for building your own custom
monads but they should be wrapped in a newtype and made abstract. One
shouldn't have to see the multiple layers. If ordinary code is full of
'lift' then it would seem to me that one is doing something wrong.

Duncan

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


Re: [Haskell-cafe] Still stacking monad transformers

2008-10-12 Thread Miguel Mitrofanov


On 12 Oct 2008, at 21:08, Andrew Coppin wrote:

I found that by using the brief and easily memorable construction  
runIdentity $ runListT $ runStateT foo state I can get at the  
result set for each action, and combine them. But nothing in hell  
seems to transform this from [((), MyState)] back into MyMonad ().


Well, State monad (and StateT transformer) doesn't work with STATE,  
they work with STATE CHANGES. So, instead of [((), MyState], you  
should have something like (MyState - [((), MyState)]). And that can  
be transformed to MyMonad () quite easily:


Prelude Control.Monad.State Control.Monad.List  
Control.Monad.Identity :t \f - StateT $ ListT . Identity . f
\f - StateT $ ListT . Identity . f :: (s - [(a, s)]) - StateT s  
(ListT Identity) a


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


Re: [Haskell-cafe] Still stacking monad transformers

2008-10-12 Thread David Menendez
On Sun, Oct 12, 2008 at 1:08 PM, Andrew Coppin
[EMAIL PROTECTED] wrote:
 I am becoming extremely frustrated now. The task I want to perform is
 simple, yet I simply cannot make Haskell do what I want.

 I've given up hope of ever getting my program to handle infinite result sets.

Did you miss this message?

http://article.gmane.org/gmane.comp.lang.haskell.cafe/45952/

-- 
Dave Menendez [EMAIL PROTECTED]
http://www.eyrie.org/~zednenem/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Constraints at construction

2008-10-12 Thread Iain Barnett


On 12 Oct 2008, at 9:28 pm, Henning Thielemann wrote:



On Thu, 9 Oct 2008, Iain Barnett wrote:

If I were to create an object in C#, for instance, I could add  
code to the constructor that might limit the type further e.g.



public class Car
{
string model;
int wheels;

public Car ( string model, int no_of_wheels )
{
if (  no_of_wheels = 2 ) {
throw new Exception( a car must have at least 3 
wheels);
}
this.model = model;
this.no_of_wheels = no_of_wheels;
}
}


I think it is not the right way to handle the number of wheels with  
an exception. This should be considered an error.

   http://www.haskell.org/haskellwiki/Error


Only if you think through the code you're writing - i.e. non  
idiomatic C#   ;)


Iain



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


Re: [Haskell-cafe] Still stacking monad transformers

2008-10-12 Thread wren ng thornton

David Menendez wrote:

On Sun, Oct 12, 2008 at 1:08 PM, Andrew Coppin
[EMAIL PROTECTED] wrote:

I am becoming extremely frustrated now. The task I want to perform is
simple, yet I simply cannot make Haskell do what I want.

I've given up hope of ever getting my program to handle infinite result sets.


Did you miss this message?

http://article.gmane.org/gmane.comp.lang.haskell.cafe/45952/


And if you don't like that one, there's also LogicT 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/logict. The 
function you're looking for is called Control.Monad.Logic.interleave. I 
know LogicT and fair disjunction were brought up earlier, though I seem 
to have mislaid the post.


In case you don't like the efficient Logic or LogicT implementations of 
MonadLogic, defining your own only requires that you can define msplit 
:: m a - m (Maybe (a, m a)) which pulls the first content out of your 
monad without forcing the rest of it.



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


Re: [Haskell-cafe] Overlapping/Incoherent instances

2008-10-12 Thread wren ng thornton

J. Garrett Morris wrote:

Hello everyone,

As part of a project to formalize the theory of overlapping instances,
I'm looking for examples of overlapping and incoherent instances and
their usage.  One such example would be the old version of the Monad
Transformer Library, which used overlapping instances together with
MonadTrans.  Any other examples or suggestions would be greatly
appreciated!


I use overlapping instances extensively with my (unpublished) work on 
heterogeneous and extensible unification. In particular, the portion 
based on Swierstra's _Data Types a la Carte_[1]. I'm sure other folks 
have been using DTalC for interesting projects as well.


[1] http://wadler.blogspot.com/2008/02/data-types-la-carte.html

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


Re: [Haskell-cafe] Overlapping/Incoherent instances

2008-10-12 Thread Marc Weber
 MonadTrans.  Any other examples or suggestions would be greatly
 appreciated!

All the OOHAskell stuff?

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


Re: [Haskell-cafe] Overlapping/Incoherent instances

2008-10-12 Thread Don Stewart
jgmorris:
 Hello everyone,
 
 As part of a project to formalize the theory of overlapping instances,
 I'm looking for examples of overlapping and incoherent instances and
 their usage.  One such example would be the old version of the Monad
 Transformer Library, which used overlapping instances together with
 MonadTrans.  Any other examples or suggestions would be greatly
 appreciated!

Though I note mtl doesn't actually list OverlappingInstances in its
.cabal file,

MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, 
TypeSynonymInstances

Now, this is *exactly* why having 'haskell prime' flags for this pays
off. Researches can now go and inspect all of http://hackage.haskell.org
for particular language features.

A quick, ad hoc search reveals, for the OverlappingInstances flag,
(some of these may only mention it in docs or in test suites),

anydbm-1.0.5
AutoForms-0.4.2
cedict-0.2.5
cgi-undecidable-3000.0.0
ConfigFile-1.0.4
conjure-0.1
darcs-buildpackage-0.5.12
datapacker-1.0.1
DBus-0.4
dfsbuild-1.0.2
emgm-0.1
fgl-5.4.1.1
ForSyDe-3.0
ftphs-1.0.4
generic-xml-0.1
gopherbot-0.1.0
Graphalyze-0.3
HAppS-Data-0.9.2.1
HAppS-IxSet-0.9.2.1
HAppS-Util-0.9.2.1
haskeline-0.3.2
haxr-3000.1.1.1
haxr-th-3000.0.0
HDBC-1.1.5
HDBC-postgresql-1.1.4.0
HDBC-sqlite3-1.1.4.0
hgalib-0.2
hg-buildpackage-1.0.4
hjs-0.2.1
HJScript-0.4.4
HList-0.1
hoogle-4.0.0.5
hpodder-1.1.5
HSH-1.2.6
HsJudy-0.2
hslogger-1.0.6
hsp-0.4.4
HsParrot-0.0.2
HsPerl5-0.0.6
hstidy-0.2
HStringTemplate-0.4
hsx-0.4.4
hsx-xhtml-0.4.4
ivor-0.1.5
libGenI-0.16.1
ListLike-1.0.1
logfloat-0.9.1
microbench-0.1
MissingH-1.0.2.1
monad-param-0.0.2
parsely-0.1
PostgreSQL-0.2
pugs-compat-0.0.5
pugs-DrIFT-2.2.3.0
RJson-0.3.5
scenegraph-0.1
sessions-2008.7.18
srcinst-0.8.10
StrategyLib-4.0.0.0
syb-with-class-0.4
Takusen-0.8.3
TV-0.4
twidge-0.99.3
TypeCompose-0.5
uvector-0.1.0.3
Wired-0.1.1

For IncoherentInstances, we have a fair few less,

hjs-0.2.1
HsJudy-0.2
hgalib-0.2
TV-0.4
AutoForms-0.4.2
HsPerl5-0.0.6
IOR-0.1
hoogle-4.0.0.5
hstidy-0.2
uvector-0.1.0.3
pugs-DrIFT-2.2.3.0

Note that at least for 'uvector' the flags are used in the testsuite. 

Also, packages may well use these extensions, but only implicitly (if
they're enabled by more general flags, like -fglasgow-exts)

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


[Haskell-cafe] 2008-10-12 Hackage status with GHC 6.10 release candidate

2008-10-12 Thread Don Stewart
Hey all.

The GHC 6.10 RCs are out, and we're preparing the release. To help manage the 
transistion to GHC 6.10 it is now possible to actually build all the 3rd party
Haskell packages, and publish their results wrt. the release candidate.

For the first time ever, we're able to have all the 3rd party code
tested and ready to go *prior* to the release of the new compiler and
base libraries.

Using GHC 6.10 RC, Cabal 1.6 and cabal-install 1.16, of 682 libraries and apps
tried in total,

  1 UnpackFailed
  2 DownloadFailed
  2 InstallFailed
 16 ConfigureFailed
 73 DependencyFailed
132 BuildFailed
456 InstallOk

Note that these builds are with soft deps, provided on hackage,

base  4
parsec  3
HaXml == 1.13.*
QuickCheck  2

which train cabal-install to build a larger set of packages.

The important result:

*46 packages produce different results to ghc 6.8.2*

These packages and their logs are listed below.

If you maintain one of the following packages, and are able to fix it before
GHC 6.10 is released, your users will be happy.

The most common issues for these differences are,

* Changes to Arrow class definition
* Changes to types of Map and Set functions
* Cabal changes
* Changes to ghc-api
* Changes to when 'forall' is parsed (add Rank2Types)
* GHC.Prim was moved,
* Changes to -fvia-C and headers
* GADT changes,
* pragma warnings tightened
* Integer constructors have moved
* New warnings and used -Werror

How to address these, as library maintainers, is addressed here,

http://haskell.org/haskellwiki/Upgrading_packages

Build reports for everything, produced today, are here,

http://galois.com/~dons/tmp/build-logs-2008-10-12/

The following packages are producing different results than with ghc 6.8.2.
Package maintainers are invited to look at them.

ArrayRef-0.1.2
CLASE-2008.9.23.2
EdisonCore-1.2.1.2
HPDF-1.4
HaLeX-1.1
Hashell-0.15
Hipmunk-0.2
MemoTrie-0.0
NewBinary-0.1.1
PArrows-0.1
TypeCompose-0.5
WebBits-0.9.2
YamlReference-0.9.2
Yampa-0.9.2.2
arrows-0.4
bytestring-show-0.2
cabal-setup-1.2.1
chp-1.1.0
cmath-0.3
fixpoint-0.1
hasim-0.1
hask-home-2007.12.6
hetris-0.2
hexpat-0.2
hinstaller-2008.2.16
hint-0.2.4.1
hslackbuilder-0.0.1
hxt-8.1.0
iException-0.0.1
libGenI-0.16.1
list-extras-0.2.2
logfloat-0.9.1
mage-1.1.0
numeric-prelude-0.0.4
plugins-1.3
quantum-arrow-0.0.4
regex-tdfa-0.94
streamproc-1.1
stringtable-atom-0.0.4
typalyze-0.1.1
xmonad-utils-0.1
yhccore-0.9

If you'd like to try your own build of all of hackage, grab a package
list (such as this one),

http://www.galois.com/~dons/tmp/pkgs-6.10 

Install a GHC 6.10 release candidate, upgrade to Cabal 1.6 (on hackage),
and cabal-install 0.6 (on hackage), and then simply,

cabal install -v -O0 $(cat pkgs-6.10) --build-reports

This will construct a clever plan to install all the packages in the
right order, and write logs to ~/.cabal/logs and a full structured build
report into ~/.cabal/packages/hackage.*/build-report.log

-- Don

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


Re: [Haskell-cafe] Overlapping/Incoherent instances

2008-10-12 Thread wren ng thornton

Don Stewart wrote:

A quick, ad hoc search reveals, for the OverlappingInstances flag,
(some of these may only mention it in docs or in test suites),

[...]
logfloat-0.9.1



Ah yes, logfloat is using them too, for some of the auxiliary stuff.


* PartialOrd was designed to fix certain brokennesses of the Prelude's 
Ord. Naturally any totally ordered type is also partially ordered, so 
we'd like to have |Ord a = PartialOrd a| with the obvious 
implementation[1]. However the Ord instances for Float and Double are 
lies because of NaN values.


I derive the |Ord a = PartialOrd a| instance because I'm a bad little 
Haskeller who wanted to make things easier for users of the library. 
This usage of OverlappingInstances seems fairly common when people 
introduce new classes to the hierarchy, particularly when they are 
relaxing requirements of the official classes. That is, there are some 
default implementations we'd like to give but cannot for some reason, 
and OverlappingInstances allows us to give them.



* Transfinite uses it for similar reasons to fix brokenness of the 
realToFrac function when converting transfinite values into the Rational 
type. That is, |Transfinite a = RealToFrac a Rational| is not 
inhabitable for any |a| since Rational cannot absorb transfinite values.



Both of these seem like good changes for haskell' in order to correct 
the behavior of Float and Double (and because there are many more 
partially ordered types than totally ordered ones). Alas I've not had a 
chance to file the suggestions.



[1] Given that Ord is more popular. Conversely, if the Prelude is 
changed, we may wish to require PartialOrd for all Ord instances, and 
thing give Ord a default implementation that removes the Just from the 
PartialOrd versions.


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


[Haskell-cafe] Re: [Haskell] ANNOUNCE: Graphalyze-0.4 and SourceGraph-0.2

2008-10-12 Thread Ivan Lazar Miljenovic
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sun, 12 Oct 2008 13:24:40 -0400
Gwern Branwen [EMAIL PROTECTED] wrote:
 
 However, I happened to want to look at the output for one of my modules,
 XMonad.Util.XSelection - and it simply isn't there. Most of the XMC modules
 seem to be there, but that one isn't. It's in the cabal file, SourceGraph did
 not output any errors or warnings, but XSelection is not mentioned in the
 HTML output nor are any PNGs generated with regard to it. See:

H. that means that SourceGraph isn't able to parse it and dies
silently.  I'll have a look at myself later and try to find out why.


- -- 
Ivan Lazar Miljenovic
[EMAIL PROTECTED]
IvanMiljenovic.wordpress.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkjygdoACgkQfEfFJ9JhvyigPACfejpPr5vYnSOxCFg6DQTfnk2U
cpIAnAhh7fzI9OtzPAXYxPpDg66UZzeD
=upq7
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: [Haskell] ANNOUNCE: Graphalyze-0.4 and SourceGraph-0.2

2008-10-12 Thread Gwern Branwen
On 2008.10.13 09:01:42 +1000, Ivan Lazar Miljenovic [EMAIL PROTECTED] 
scribbled 1.3K characters:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On Sun, 12 Oct 2008 13:24:40 -0400
 Gwern Branwen [EMAIL PROTECTED] wrote:
 
  However, I happened to want to look at the output for one of my modules,
  XMonad.Util.XSelection - and it simply isn't there. Most of the XMC modules
  seem to be there, but that one isn't. It's in the cabal file, SourceGraph 
  did
  not output any errors or warnings, but XSelection is not mentioned in the
  HTML output nor are any PNGs generated with regard to it. See:

 H. that means that SourceGraph isn't able to parse it and dies
 silently.  I'll have a look at myself later and try to find out why.


 - --
 Ivan Lazar Miljenovic

'K. So SourceGraph doesn't do any error reporting? I'll keep that in mind.

--
gwern
Trident Satellite Flu High mailbomb Competitor MCI SEAL NSRB PARKHILL


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


[Haskell-cafe] Error building GHC 6.8.3: version of ../../compiler/stage1/ghc-inplace could not be determined

2008-10-12 Thread Devin Mullins
Hi,

I'm trying to build 6.8.3 on Linux PowerPC, based on an old binary of
6.4 (latest build for this arch that I found). stage1 seems to have
built, but from there, building libraries almost immediately fails:

 make -C libraries all
 make[1]: Entering directory `/home/twifkak/arch/ghc/src/ghc-6.8.3/libraries'
 rm -f -f stamp/configure.library.*.base base/unbuildable
 ( cd base  setup/Setup configure \
   --enable-library-profiling --enable-split-objs \
  --prefix=/NONEXISTANT \
  --bindir=/NONEXISTANT \
  --libdir=/NONEXISTANT \
  --libsubdir='$pkgid' \
  --libexecdir=/NONEXISTANT \
  --datadir=/NONEXISTANT \
  --docdir=/NONEXISTANT \
  --htmldir=/NONEXISTANT \
  --interfacedir=/NONEXISTANT \
  --with-compiler=../../compiler/stage1/ghc-inplace \
  --with-hc-pkg=../../utils/ghc-pkg/ghc-pkg-inplace \
  --with-hsc2hs=../../utils/hsc2hs/hsc2hs-inplace \
  --with-ld=/usr/bin/ld \
  --haddock-options=--use-contents=../index.html \
  --use-index=../doc-index.html \
 --configure-option='--prefix=/usr'  
 --configure-option='CFLAGS=-mtune=powerpc -O2 -pipe -mpowerpc-gfxopt' \
  --configure-option=--with-cc=gcc ) \
  touch stamp/configure.library.build-profiling-splitting.base 
 || touch base/unbuildable
 Configuring base-3.0.2.0...
 Setup: ghc version =6.2 is required but the version of 
 ../../compiler/stage1/ghc-inplace could not be determined.
 if ifBuildable/ifBuildable base; then \
 cd base  \
 cmp -s ../Makefile.local Makefile.local || cp ../Makefile.local .; \
 mv GNUmakefile GNUmakefile.tmp; \
 setup/Setup makefile -f GNUmakefile; \
 cmp -s GNUmakefile GNUmakefile.tmp  mv GNUmakefile.tmp GNUmakefile; 
 \
 make -wr  \
 setup/Setup register --inplace; \
   fi
 mv: cannot stat `GNUmakefile': No such file or directory
 Setup: error reading dist/setup-config; run setup configure command?
 
 make[2]: Entering directory 
 `/home/twifkak/arch/ghc/src/ghc-6.8.3/libraries/base'
 make[2]: *** No targets specified and no makefile found.  Stop.
 make[2]: Leaving directory 
 `/home/twifkak/arch/ghc/src/ghc-6.8.3/libraries/base'
 make[1]: *** [make.library.base] Error 2
 make[1]: Leaving directory `/home/twifkak/arch/ghc/src/ghc-6.8.3/libraries'
 make: *** [stage1] Error 2

(This particular transcript is from an unclean build, but the same error
occurred on a freshly untarred ghc.)

The subsequent errors seems to stem from the root one of being unable to
configure:

 [EMAIL PROTECTED] base]$ setup/Setup configure -v3
 Configuring base-3.0.2.0...
 Creating dist (and its parents)
 /home/twifkak/usr/bin/ghc --numeric-version
 Warning: cannot determine version of /home/twifkak/usr/bin/ghc :
 
 Setup: ghc version =6.2 is required but the version of 
 /home/twifkak/usr/bin/ghc could not be determined.
 [EMAIL PROTECTED] base]$ ghc --numeric-version
 6.4
 [EMAIL PROTECTED] base]$ setup/Setup configure 
 --with-compiler=../../compiler/stage1/ghc-inplace -v3
 Configuring base-3.0.2.0...
 Creating dist (and its parents)
 ../../compiler/stage1/ghc-inplace --numeric-version
 Warning: cannot determine version of ../../compiler/stage1/ghc-inplace :
 
 Setup: ghc version =6.2 is required but the version of 
 ../../compiler/stage1/ghc-inplace could not be determined.
 [EMAIL PROTECTED] base]$ ../../compiler/stage1/ghc-inplace --numeric-version
 6.8.3

What's going wrong? How do I fix it? Is there a better mailing list to
ask?

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


Re: [Haskell-cafe] Overlapping/Incoherent instances

2008-10-12 Thread J. Garrett Morris
On Sun, Oct 12, 2008 at 2:12 PM, Don Stewart [EMAIL PROTECTED] wrote:
 Though I note mtl doesn't actually list OverlappingInstances in its
 .cabal file,

Indeed - MTL seems to have been rewritten at some point in the past to
prefer exhaustive enumeration to overlap.

Thank you for the other suggestions!  Presumably this also doesn't
cover if they're enabled by LANGUAGE pragmas in individual files?

 /g

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


Re: [Haskell-cafe] Interesting new user perspective

2008-10-12 Thread Jonathan Cast
On Fri, 2008-10-10 at 18:13 -0500, John Goerzen wrote:
 On Fri, Oct 10, 2008 at 02:29:54PM -0700, Jonathan Cast wrote:
   I've  
   got a Haskell book here (Hutton, 170 pages) that doesn't even mention  
   how to open a file!
  
  That short, and you expect minor features like that (that not every
  program even needs) to be squeezed in?
 
 Uh... yes.  Opening and closing files, command-line parsing, etc --
 needed by almost every program.  Aside from some very simple
 stdin-to-stdout filters, it is difficult to imagine a program where
 you don't need to open a file!

Again, you need a bigger imagination.  My day job is almost entirely
DB-centric; code that uses file I/O is very much a special case.

jcc


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


Re: [Haskell-cafe] Interesting new user perspective

2008-10-12 Thread John Goerzen
On Sun, Oct 12, 2008 at 06:39:58PM -0700, Jonathan Cast wrote:
 On Fri, 2008-10-10 at 18:13 -0500, John Goerzen wrote:
  On Fri, Oct 10, 2008 at 02:29:54PM -0700, Jonathan Cast wrote:
I've  
got a Haskell book here (Hutton, 170 pages) that doesn't even mention  
how to open a file!
   
   That short, and you expect minor features like that (that not every
   program even needs) to be squeezed in?
  
  Uh... yes.  Opening and closing files, command-line parsing, etc --
  needed by almost every program.  Aside from some very simple
  stdin-to-stdout filters, it is difficult to imagine a program where
  you don't need to open a file!
 
 Again, you need a bigger imagination.  My day job is almost entirely
 DB-centric; code that uses file I/O is very much a special case.

Not saying that it doesn't exist (though of course most databases
still use file I/O at some level, even if abstracted).  Just that it's
very, very common.  I wouldn't support at all teaching database
interactions or network programming before file I/O.

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


Re: [Haskell-cafe] Interesting new user perspective

2008-10-12 Thread Jonathan Cast
On Sun, 2008-10-12 at 21:34 -0500, John Goerzen wrote:
 On Sun, Oct 12, 2008 at 06:39:58PM -0700, Jonathan Cast wrote:
  On Fri, 2008-10-10 at 18:13 -0500, John Goerzen wrote:
   On Fri, Oct 10, 2008 at 02:29:54PM -0700, Jonathan Cast wrote:
 I've  
 got a Haskell book here (Hutton, 170 pages) that doesn't even mention 
  
 how to open a file!

That short, and you expect minor features like that (that not every
program even needs) to be squeezed in?
   
   Uh... yes.  Opening and closing files, command-line parsing, etc --
   needed by almost every program.  Aside from some very simple
   stdin-to-stdout filters, it is difficult to imagine a program where
   you don't need to open a file!
  
  Again, you need a bigger imagination.  My day job is almost entirely
  DB-centric; code that uses file I/O is very much a special case.
 
 Not saying that it doesn't exist (though of course most databases
 still use file I/O at some level, even if abstracted).  Just that it's
 very, very common.  I wouldn't support at all teaching database
 interactions or network programming before file I/O.

I'm not advocating that.  But I do think demanding the teaching of *any*
interface issues before you've shown enough Haskell to write interesting
logic to tie to the interface is backwards.

jcc


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


[Haskell-cafe] the ghc reflection thing?

2008-10-12 Thread Galchin, Vasili
hello,

   Several months ago I saw on the wiki or maybe it was a discussion on
mechanism to get the ghc compiler's state. I can't remember enough to
ask even well. I know there is a wiki entry. Sorry ... I can only hint at
this ... ??

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


Re: [Haskell-cafe] Error building GHC 6.8.3: version of ../../compiler/stage1/ghc-inplace could not be determined

2008-10-12 Thread Devin Mullins
On Sun, Oct 12, 2008 at 06:03:30PM -0700, Devin Mullins wrote:
 I'm trying to build 6.8.3 on Linux PowerPC, based on an old binary of
 6.4 (latest build for this arch that I found). stage1 seems to have
 built, but from there, building libraries almost immediately fails:
 
  Configuring base-3.0.2.0...
  Setup: ghc version =6.2 is required but the version of 
  ../../compiler/stage1/ghc-inplace could not be determined.

Okay, for those of you keeping score, here's an update. It looks like
Distribution.Simple.Program.findProgramVersion is swallowing the
exception that Distribution.Simple.Utils.rawSystemStdout is throwing,
leading to the null string in the verbose log. Here's a simple test
program:

 module Main where
 
 import Prelude hiding (catch)
 import Control.Exception (catch)
 import Distribution.Simple.Utils (rawSystemStdout)
 import Distribution.Verbosity (deafening)
 
 main :: IO ()
 main = putStrLn = rawSystemStdout deafening /bin/ls [] `catch` (return . 
 show)

And the output (as compiled by ghc-6.4):
$ ./Main
(/bin/ls,[])
/dev/null: openFile: invalid argument (Invalid argument)

Whuh?

Perhaps I should try bootstrapping 6.6 first...
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] the ghc reflection thing?

2008-10-12 Thread Bernie Pope

Hi Vasili,

Perhaps you are looking for GHC as a library:

http://www.haskell.org/haskellwiki/GHC/As_a_library

Cheers,
Bernie.

On 13/10/2008, at 2:26 PM, Galchin, Vasili wrote:


hello,

   Several months ago I saw on the wiki or maybe it was a discussion  
on mechanism to get the ghc compiler's state. I can't remember  
enough to
ask even well. I know there is a wiki entry. Sorry ... I can only  
hint at this ... ??


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


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


Re: [Haskell-cafe] the ghc reflection thing?

2008-10-12 Thread Galchin, Vasili
Hi Bernie,

   yep ... thanks!

Regards, Vasili

On Sun, Oct 12, 2008 at 11:30 PM, Bernie Pope [EMAIL PROTECTED]wrote:

 Hi Vasili,

 Perhaps you are looking for GHC as a library:

http://www.haskell.org/haskellwiki/GHC/As_a_library

 Cheers,
 Bernie.


 On 13/10/2008, at 2:26 PM, Galchin, Vasili wrote:

  hello,

   Several months ago I saw on the wiki or maybe it was a discussion on
 mechanism to get the ghc compiler's state. I can't remember enough to
 ask even well. I know there is a wiki entry. Sorry ... I can only hint
 at this ... ??

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



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