Re: [Haskell-cafe] Haskell on the iPhone

2009-06-23 Thread Karel Gardas
Ryan Trinkle wrote:
 Rick,
 
 I know some work has been done on JVM - iirc, Don Stewart did some work back
 in the day, www.cse.unsw.edu.au/~pls/thesis/dons-thesis.ps.gz, but I'm not
 sure how comprehensive it is.
 
 Is anyone else interested in JVM-based Haskell targets?

Hello,

certainly I am. I think it would be great if someone might combine
Haskell code with what's already written in Java (i.e. all those app
servers or development environments). In the past I've given a try to
LambdaVM[1][2] and it looked like a sane approach to get there.
Unfortunately I'm not so power-haskell user to be able to update this
patch forward to more recent GHC. I've also submitted ticket for it[3].

Cheers,
Karel
[1]: http://wiki.brianweb.net/LambdaVM/LambdaVM
[2]: http://www.cs.rit.edu/~bja8464/lambdavm/
[3]: http://hackage.haskell.org/trac/ghc/ticket/2959

 
 
 Ryan
 
 On Mon, Jun 22, 2009 at 20:42, Rick R rick.richard...@gmail.com wrote:
 
 This is definitely good news!

 So...  who's doing the Android/JVM target?  ;)



 On Mon, Jun 22, 2009 at 7:37 PM, Daniel Peebles pumpkin...@gmail.comwrote:

 How exciting! I fully support the creation of a new mailing list about
 iphone+haskell :)

 On Mon, Jun 22, 2009 at 6:30 PM, Ryan Trinkleryant5...@gmail.com wrote:
 Dear Haskellers,

 Recently, there's been a groundswell of activity in the Haskell
 community
 regarding the Haskell's use in developing iPhone games.  The iPhone is a
 powerful, innovative platform (with a great monetization scheme, to
 boot),
 and it's not surprising that many of us would want to develop apps for
 it in
 our favorite language.

 I am proud to announce today that my company, iPwn Studios Inc., is
 currently preparing to release an open source patch to GHC that allows
 it to
 output binaries for iPhone OS.  The patch will be released under a BSD
 license as soon as possible and hopefully integrated into the GHC
 main-line
 in the near future.  As the first (to my knowledge) Haskell-based game
 studio, iPwn Studios is committed to giving back to the Haskell
 community
 through open source - contributing to a rising tide that lifts us all.

 I would like to take this opportunity to propose the creation of a
 haskell-iphone mailing list, so that all Haskellers working with the
 iPhone
 - whether for profit or for pleasure - can come together to make Haskell
 a
 force to be reckoned with in the burgeoning iPhone App marketplace.


 Best wishes,
 Ryan Trinkle
 President, iPwn Studios Inc.

 P.S.: If you wish to be involved in the preparation of the GHC patch or
 in
 the creation of iPwn Studios' first game, don't hesitate to contact me
 by
 email (ryant5...@gmail.com), AIM (RyanT5000), or IRC (RyanT5000 on
 irc.freenode.net).


 ___
 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



 --
 The greatest obstacle to discovering the shape of the earth, the
 continents, and the oceans was not ignorance but the illusion of knowledge.

 - Daniel J. Boorstin


 ___
 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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Optimizing spelling correction program

2009-06-23 Thread Kamil Dworakowski
  Using Bryan O'Sullivan's fantastic BloomFilter I got it down below
  Python's run time! Now it is 35.56s, 28% of the time is spent on GC,
  which I think means there is still some room for improvement.

 One easy way to fix the GC time is to increase the default heap size.

  ./a.out +RTS -A200M

It does make the GC only 1.4% of run time but it  increases it overall
by 14s.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Optimizing spelling correction program

2009-06-23 Thread Kamil Dworakowski
On Jun 22, 10:12 pm, Bulat Ziganshin bulat.zigans...@gmail.com
wrote:
 Hello Kamil,

 Tuesday, June 23, 2009, 12:54:49 AM, you wrote:

  I went back to using Strings instead of ByteStrings and with that
  hashtable the program finishes in 31.5s! w00t!

 and GC times are? also, try ByteString+HT, it should be pretty easy to
 write hashByteString

GC time is 10%. I'll try ByteString+HT tonight. It might indeed be
faster because BloomFilter+String is slower that BloomFilter
+ByteString.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaRe (the Haskell Refactorer) in action - short screencast

2009-06-23 Thread Deniz Dogan
2009/6/23 Claus Reinke claus.rei...@talk21.com:
 I've heard that many Haskellers know HaRe only as a rumour. It has been many
 years since the original project finished, and HaRe hasn't
 been maintained for quite some time, so just pointing to the sources isn't
 quite the right answer.
 The sources are still available, and build with GHC 6.8.3 (I had to fix
 one lineending issue on windows, iirc, and copy one old bug fix that
 hadn't made it into the latest release), but there is currently noone with
 the time or funding for maintenance, fixing bugs, making releases, or
 ironing out practical issues. If anyone would provide funding, people to do
 the work could be found, but the effort would probably be better spent on
 reimplementing the ideas in a GHC / Cabal environment (instead of the
 Haskell'98 environment targetted by our Refactoring Functional Programs
 project). If you've got the funding, please get
 in touch - even a three month run could get something started at least!-)

 In principle, the project experiences and lessons learned are quite well
 documented at the project site
   http://www.cs.kent.ac.uk/projects/refactor-fp/

 but that doesn't give anyone an idea of what working with HaRe was like.
 With the recent interest in screencasts, I thought I'd make a little
 demo, for archival purposes. Nothing fancy, using only features that were
 already present in HaRe 0.3 (end of 2004), and not all of those, on a tiny
 2-module example (screenspace is a bit crowded to keep the text readable on
 YouTube).
 I hope it might give a rough idea of what the papers, slides and reports are
 talking about, for Haskellers who weren't around at the time:

   http://www.youtube.com/watch?v=4I7VZV7elnY

 For the old HaRe team,
 Claus

 --- YouTube video description:
 HaRe - the Haskell Refactorer (a mini demo) [4:10]

 The Haskell Refactorer HaRe was developed in our EPSRC project
 Refactoring Functional Programs
 http://www.cs.kent.ac.uk/projects/refactor-fp/ Building on Programatica's
 Haskell-in-Haskell frontend and Strafunski's generic programming library, it
 supported module-aware refactorings over the full Haskell'98 language
 standard. Interfaces to the refactoring engine were provided for both Vim
 and Emacs (this demo uses HaRe via GVim on Windows).

 While HaRe has continued to see occasional contributions by students and
 researchers, who use its Haskell program transformation API as a platform
 for their own work, it is not currently maintained. As the Haskell
 environment marches on, this demo is meant to record a snapshot of what
 working with HaRe could be like when it still built (here with GHC 6.8.3).
 The lessons learned (note, eg, the preservation of comments, and the limited
 use of pretty-printing, to minimize layout changes) are well documented at
 the project site, and should be taken into account when porting the ideas to
 the GHC Api, or other Haskell frontends.


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


It would be interesting to see if the Yi developers could implement
some of this functionality for the Haskell mode, which has become
quite nice and is under active development. It already has a
dollarification function which converts stuff like hello (there
(how (are you))) into hello $ there $ how $ are you (I'm bad at
coming up with examples).

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


Re: [Haskell-cafe] Getting my mind around UArray - STUArray conversion

2009-06-23 Thread Ryan Ingram
This is the best I could come up with.

We let the compiler prove that s is irrelevant to the MArray
instance for a particular instance of STUArray, and package up that
knowledge using an existential type.  We can then extract the instance
for any type; in particular, the instance for the current state
thread.  I think this argues that the class context for MArray is too
constrained.

(I don't really use GADTs here, just pack up the class context, but I
like the GADT syntax for doing this)

  -- ryan

{-# LANGUAGE GADTs, RankNTypes, FlexibleContexts, ScopedTypeVariables #-}
module StuTest where

import Control.Monad;
import Control.Monad.ST;
import Data.Array.ST;
import Data.Array.Unboxed;
import Data.Array.MArray;
import Data.Word;

data HasMArray s e where
HasMArray :: MArray (STUArray s) e (ST s) = HasMArray s e

newtype HasUnbox e = HasUnbox (forall s. HasMArray s e)

wombat :: forall s ix e. (IArray UArray e, Ix ix) = HasUnbox e -
UArray ix e - ST s (UArray ix e)
wombat (HasUnbox h) arr = case h of
   (HasMArray :: HasMArray s e) -
 (unsafeThaw arr :: ST s (STUArray s ix e)) = unsafeFreeze


intHasUnbox :: HasUnbox Int
intHasUnbox = HasUnbox HasMArray

test :: (IArray UArray e, Ix ix) = HasUnbox e - UArray ix e - UArray ix e
test ctxt mem = runST (wombat ctxt mem)

simpleTest :: Ix ix = UArray ix Int - UArray ix Int
simpleTest a = runST (wombat (HasUnbox HasMArray) a)


On Fri, Jun 19, 2009 at 6:43 PM, Scott Michelscooter@gmail.com wrote:
 I'm trying to get my mind around how to thaw and then freeze a UArray.
 Theoretically, what I've written below should be a no-op, but I keep
 getting typing errors that I can't figure out. GHCI 6.10.3 says:

 Couldn't match expected type `UArray ix a'
           against inferred type `ST s (STUArray s ix1 e)'
    In the first argument of `(=)', namely
        `(unsafeThaw mem :: ST s (STUArray s ix e))'
    In the expression:
          (unsafeThaw mem :: ST s (STUArray s ix e))
        =
          (\ mmem - unsafeFreeze mmem)
    In the definition of `wombat':
        wombat val idx mem
                    = (unsafeThaw mem :: ST s (STUArray s ix e))
                    =
                      (\ mmem - unsafeFreeze mmem)

 I'm figuring that usafeThaw with the type annotation should have given
 GHIC enough clue.

 Any suggestions?


 -scooter
  (WOMBAT = Waste Of Money Brains And Time)

 import Control.Monad;
 import Control.Monad.ST;
 import Data.Array.ST;
 import Data.Array.Unboxed;
 import Data.Array.MArray;
 import Data.Word;

 wombat :: (IArray UArray e, Ix ix, MArray (STUArray s) e (ST s)) = e
 - ix - UArray ix e - UArray ix e
 wombat val idx mem = (unsafeThaw mem :: ST s (STUArray s ix e)) =
 (\mmem - unsafeFreeze mmem)
 ___
 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] IMO ghc 6.8.2 misleading warning messages

2009-06-23 Thread Matthijs Kooijman
Hi Vasili,

 IMO the warning messages should be reversed! (parseOptional was never used
 .. called ... but I would strongly prefer the type signature warning first.
Can you motivate why? Any order looks fine to me...

Gr.

Matthijs


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


Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature

2009-06-23 Thread papa . eric
 Simple: the definition of MonadState uses those extensions.

Thanks, yes it helps and explains all. :^)

I suppose then that if -XFlexibleContexts is indeed required by the standard 
libraries, it is a safe extension, meaning supported by all compilers? Are 
many such extensions de-facto standard that anyone can enable by default?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Optimizing spelling correction program

2009-06-23 Thread Bulat Ziganshin
Hello Kamil,

Tuesday, June 23, 2009, 11:17:43 AM, you wrote:
 One easy way to fix the GC time is to increase the default heap size.

  ./a.out +RTS -A200M

 It does make the GC only 1.4% of run time but it  increases it overall
 by 14s.

not surprising - you lose L2 cache locality. try to use -A size that
is equal to your L2 cache size


-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

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


Forward compatibility (was Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature)

2009-06-23 Thread Luke Palmer
On Tue, Jun 23, 2009 at 2:20 AM, papa.e...@free.fr wrote:

  Simple: the definition of MonadState uses those extensions.

 Thanks, yes it helps and explains all. :^)

 I suppose then that if -XFlexibleContexts is indeed required by the
 standard libraries, it is a safe extension, meaning supported by all
 compilers? Are many such extensions de-facto standard that anyone can enable
 by default?


You should treat all compilers the same way as a universal quantifier in
mathematics.  It's not just all the compilers you know about, but all
possible compilers.  In which case the answer to your question is of course
no.

(Beware: incoming my recurring rant of the month, which I am trying
ferociously to cram down the throats of my peers :-p)

By measuring your software's portability on this stricter criterion, you
contribute to the exponential growth of our field.  It means that
*every *future
compiler can compile your code for 10% less effort*.  *A future innovation
may rely on one such compiler, which means it can use your code 10% sooner
-- which may be the difference between your good code being used and it
being badly reimplemented (and future bug fixes in the new code does not
benefit yours).  And so on, ad infinitum.

When you think about potability, think about it from the perspective of
twenty years in the future.  Fundeps are becoming obsolete now, will your
code still work when they are gone?  Will it still work when the typeclass
resolution algorithm is obsoleted by a superior algorithm (I'm looking at
you, Oleg! :-)?  When Haskell is obsolete, how hard will it be to port?

Of course, there is definitely a place for extensions -- we should be
testing them, to help refine the language that will one day obsolete
Haskell. A culture of extension users helps us to know that, for example,
even though implicit params are cool, nobody cares.

I think works on all existing compilers is a fine definition of portable
-- let's just realize that there is a level of portability beyond that, a
level which gives our whole field a little boost.

/rant

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


Re: Forward compatibility (was Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature)

2009-06-23 Thread Matthijs Kooijman
Hi Luke,

   Simple: the definition of MonadState uses those extensions.
  [Snip question: Is this extension supported by all compilers]
 You should treat all compilers the same way as a universal quantifier in
 mathematics.  It's not just all the compilers you know about, but all
 possible compilers.  In which case the answer to your question is of course
 no.

I think the reasoninging here is the following: If MonadState is part of the
standard library and it needs this extension to work, then all compilers must
support this extension.

I'm not completely sure how standard the MonadState class is though. Also,
it might be that there could be implementations of MonadState that do not use
the extension?

If the latter is not the case, so MonadState will always require this
extension, than it seems that using the extension in your code gives you the
same portability as using the MonadState class. Not using the extension to
improve your portability only makes sense if you also stop using the
MonadState class, right?

Gr.

Matthijs


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


Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature

2009-06-23 Thread Luke Palmer
On Tue, Jun 23, 2009 at 2:20 AM, papa.e...@free.fr wrote:

  Simple: the definition of MonadState uses those extensions.

 Thanks, yes it helps and explains all. :^)

 I suppose then that if -XFlexibleContexts is indeed required by the
 standard libraries, it is a safe extension, meaning supported by all
 compilers? Are many such extensions de-facto standard that anyone can enable
 by default?


Now to answer your question, with 50% less idealistic ranting!

There is definitely a canon of safe extensions in the community.
 Hierarchical libraries (that's not even an -X flag, it's just on),
multiparam typeclasses, fundeps are among them.  I can't say whether
FlexibleContexts is.

However, your question is rather moot here, as you are using the *mtl.  *It
uses UndecidableInstances, whose blessing into the de facto standard would
require as a precondition the batshit-insanity of the de facto community.

I personally use *transformers* as my monad library, as it is (as far as I
know) the only Haskell 98 monad library on Hackage (you'll hardly notice the
more explicit lifts, I promise!).  However, looking a bit more
optimistically into the future, I'd say *mmtl *is the most likely to
succeed, since it solves the combinatorical explosion problem which haunts
all the other monad libraries (and at least avoids the extensions which are
doomed to failure).

Anyway, it is never too early to free yourself of mtl.  Look at the monad
libraries on hackage and weigh their pros and cons; the only thing special
about mtl is its mediocrity.

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


[Haskell-cafe] INAP 2009: 2nd Call for Papers

2009-06-23 Thread Pedro Salgueiro
[apologies for cross-posting; please distribute]
---

 (PLEASE DISTRIBUTE)
 
Second Call for Papers

  INAP 2009

   18th International Conference on
   Applications of Declarative Programming
   and Knowledge Management

 November 5-7, 2009
  Evora, Portugal

  http://www.di.uevora.pt/inap2009/
http://inap.dialogengines.com/
 

  Organized by the Portuguese AI Society (APPIA), the INAP Committee
   and the Society of Logic Programming (GLP e.V.)

== Overview ==

  Declarative Programming is a family of advanced paradigms for the
  modeling and solving of complex problems.  These specification and
  implementation methods have attracted more and more attention over
  the past years, e.g. in the domains of databases and natural
  language processing, for modeling and the processing of
  combinatorial problems, and for establishing systems for the web.

== INAP 2009 ==

  INAP is a communicative and dense forum for intensive discussion of
  applications of important technologies related to Prolog, Logic and
  Constraint Programming as well as closely related advanced software.
  It comprehensively covers the impact of programmable logic solvers
  in the Internet Society, its underlying technologies, and leading
  edge applications in industry, commerce, government, and societal
  services.

  INAP 2009 continues a tradition of successful workshops cast around
  the applications of declarative programming, which were held in
  Kobe (1997), Tokyo (1995, 1996, 1998 - 2001), Potsdam (2004),
  Fukuoka (2005) and Wuerzburg (2007).

  We invite the submission of high quality papers on the described
  topics, especially, but not exclusively, on different aspects of
  Declarative Programming, Constraint Processing and Knowledge
  Management as well as their use for Distributed Systems and the Web:

- Knowledge Management,
  e.g. Data Mining, Decision Support, Deductive Databases
- Distributed Systems and the Web,
  e.g. Agents and Concurrent Engineering, Semantic Web
- Constraints,
  e.g. Constraint Systems, Extensions of Constraint (Logic) Programming
- Theoretical Foundations,
  e.g. Deductive Databases, Nonmonotonic Reasoning
- Systems and Tools for Academic and Industrial Use
- Knowledge-based Web Services - Logic Solvers and Applications

== Workshop Format ==

  The technical program of the workshop will include invited
  presentations (to be announced), regular technical sessions with
  presentations of the accepted papers, system demonstrations and a
  panel discussion.


== Conference Venue ==

  The conference will be held at the University of Evora, Portugal
  in November 5-7, 2009.

  Evora is a nice and quiet historical city located in the south of
  Portugal that can be reached from Lisbon by train or coach in under
  2 hours.  It is a small city of 60.000 inhabitants, 120 km inland
  from Lisbon and classified by Unesco as World Heritage.  The
  University of Evora was established in the 16th Century and is the
  2nd oldest Portuguese University.

  The social program is promising since the region is very rich in
  historical sites (Stone Age, Roman, Medieval and Renaissance
  remains) and also offers a very special gastronomy.  See
  http://en.wikipedia.org/wiki/%C3%89vora for more information.

== Important Dates ==

  Paper Submission Deadline:   June 29, 2009
  Notifications to Authors:August 17, 2009
  Camera-ready Version Deadline:   September 14, 2009
  INAP 2009 Workshop:  November 5-7, 2009

== Submission Guidelines ==

  Participants should submit a paper (maximum 15 pages, PDF format),
  describing their work in topics relevant to the workshop.  Accepted
  papers will be presented during the workshop.  At least one author
  of an accepted contribution is expected to register for the
  workshop, and present the paper.  All submissions should include the
  author's name(s), affiliation, complete mailing address, and email
  address.

  Authors are requested to prepare their submissions, following the
  LNCS/LNAI Springer format. Please see:
  http://www.springer.de/comp/lncs/authors.html
  for further details.

  The submission should be submitted through the electronic submission
  site:
http://www.easychair.org/conferences/?conf=inap2009

  The deadline for receipt of submissions is June 29, 2009.  Papers
  received after this date will not be reviewed.  Eligible papers will
  be peer-reviewed by at least three members of the Program Committee.
  Authors will be notified via email of the results by August 17,
  2009.  Authors of accepted papers are expected to improve their
  paper based on reviewers' comments and to 

[Haskell-cafe] Ann: Emping-0.6 and Tests/Examples

2009-06-23 Thread Hans van Thiel
Hello All, 

Version 0.6 of Emping is now, imo, at the level of a working prototype.
It is available on Hackage (but won't build there because it uses
Gtk2Hs. It did build with Cabal on FC8 with GhC 6.8 and Gtk2Hs 0.9.13). 
The package includes a user guide, but see the update on my web site
about two UI corner case bugs (program hangs). 
My site http://www.muitovar.com discusses three examples of possible
use, with tests using SQLite, OO Calc and dotty. There's also a .zip
archive of all sources (two data sets from the UCI machine learning
repository) and .csv and .dot files with the results. All comments most
welcome...

Emping is a (prototype) interactive tool for the discovery and analysis
of (universal, not statistical) predictive rules in tables of nominal
data.

Best Regards,

Hans van Thiel

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


Re: [Haskell-cafe] Re: ANN: haskell-src-exts-1.0.0

2009-06-23 Thread Niklas Broberg
Hi Maurício,

 How far is Unicode from beeing parsed? It doesn't seem to be
 a huge step (from my ill-informed viewpoint), and it would
 not let behind those who are happy to be able to declare names
 in their own native language. (Oh, and sorry for resorting to
 politically correct blackmail...)

Unicode in identifiers and symbols actually already works, assuming
you don't use the non-Unicode-aware parseFile, parseFileWithExts or
parseFileWithMode (which all use Prelude.readLine). What doesn't work
is to use the Unicode versions of special symbols like -, = etc. I'm
waiting for a stable and blessed unicode-aware text package to replace
utf8-string, before we have one of those then my support would only be
half-hearted at best. But in the mean time you can use the readLine
provided by utf8-string, and then parseFileContents on that, which
should give you the politically correct names. ;-)

Cheers,

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


[Haskell-cafe] Generate Fortran 77 parser from a yacc grammar using Happy

2009-06-23 Thread Cetin Sert
I have stumbled upon the following F77 yacc grammar:
http://yaxx.cvs.sourceforge.net/viewvc/yaxx/yaxx/fortran/fortran.y?revision=1.3view=markup
.

How can I make a Fortran 77 parser out of this file using
Happyhttp://www.haskell.org/happy/
?

Why is there some C?/C++? code in that .y file?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell on the iPhone

2009-06-23 Thread John A. De Goes


I have strong interest in Haskell on the JVM. Not for Android, however.

Seems like every time this topic comes up, the consensus is that it's  
not easy to support new targets with GHC, but that work is underway  
to make such developments easier.


Regards,

John A. De Goes
N-Brain, Inc.
The Evolution of Collaboration

http://www.n-brain.net|877-376-2724 x 101

On Jun 22, 2009, at 11:23 PM, Ryan Trinkle wrote:


Rick,

I know some work has been done on JVM - iirc, Don Stewart did some  
work back in the day, www.cse.unsw.edu.au/~pls/thesis/dons-thesis.ps.gz 
, but I'm not sure how comprehensive it is.


Is anyone else interested in JVM-based Haskell targets?


Ryan

On Mon, Jun 22, 2009 at 20:42, Rick R rick.richard...@gmail.com  
wrote:

This is definitely good news!

So...  who's doing the Android/JVM target?  ;)



On Mon, Jun 22, 2009 at 7:37 PM, Daniel Peebles  
pumpkin...@gmail.com wrote:

How exciting! I fully support the creation of a new mailing list about
iphone+haskell :)

On Mon, Jun 22, 2009 at 6:30 PM, Ryan Trinkleryant5...@gmail.com  
wrote:

 Dear Haskellers,

 Recently, there's been a groundswell of activity in the Haskell  
community
 regarding the Haskell's use in developing iPhone games.  The  
iPhone is a
 powerful, innovative platform (with a great monetization scheme,  
to boot),
 and it's not surprising that many of us would want to develop apps  
for it in

 our favorite language.

 I am proud to announce today that my company, iPwn Studios Inc., is
 currently preparing to release an open source patch to GHC that  
allows it to
 output binaries for iPhone OS.  The patch will be released under a  
BSD
 license as soon as possible and hopefully integrated into the GHC  
main-line
 in the near future.  As the first (to my knowledge) Haskell-based  
game
 studio, iPwn Studios is committed to giving back to the Haskell  
community
 through open source - contributing to a rising tide that lifts us  
all.


 I would like to take this opportunity to propose the creation of a
 haskell-iphone mailing list, so that all Haskellers working with  
the iPhone
 - whether for profit or for pleasure - can come together to make  
Haskell a

 force to be reckoned with in the burgeoning iPhone App marketplace.


 Best wishes,
 Ryan Trinkle
 President, iPwn Studios Inc.

 P.S.: If you wish to be involved in the preparation of the GHC  
patch or in
 the creation of iPwn Studios' first game, don't hesitate to  
contact me by

 email (ryant5...@gmail.com), AIM (RyanT5000), or IRC (RyanT5000 on
 irc.freenode.net).


 ___
 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



--
The greatest obstacle to discovering the shape of the earth, the  
continents, and the oceans was not ignorance but the illusion of  
knowledge.

- Daniel J. Boorstin


___
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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell on the iPhone

2009-06-23 Thread Jeff Heard
This is great news!  I'd love to be able to write our cellphone
automated vehicle location clients in Haskell.

-- Jeff

On Mon, Jun 22, 2009 at 6:38 PM, Don Stewartd...@galois.com wrote:
 If you're doing it in Haskell, please feel free to keep plugging.

 A new market for Haskell apps is highly welcome.

 ryant5000:
 Jason,

 iPwn is currently in pre-production for its first title, which will be an
 action-RPG reminiscent of Diablo and Fallout.  I'll try to keep the shameless
 plugging on Haskell-cafe to a minimum, but I make no promises :P  I will
 definitely let people know when our website is put together in some useful 
 way.


 Ryan

 On Mon, Jun 22, 2009 at 18:34, Jason Dagit da...@codersbase.com wrote:



     On Mon, Jun 22, 2009 at 3:30 PM, Ryan Trinkle ryant5...@gmail.com 
 wrote:

         Dear Haskellers,

         Recently, there's been a groundswell of activity in the Haskell
         community regarding the Haskell's use in developing iPhone games.  
 The
         iPhone is a powerful, innovative platform (with a great monetization
         scheme, to boot), and it's not surprising that many of us would want 
 to
         develop apps for it in our favorite language.

         I am proud to announce today that my company, iPwn Studios Inc., is
         currently preparing to release an open source patch to GHC that 
 allows
         it to output binaries for iPhone OS.  The patch will be released 
 under
         a BSD license as soon as possible and hopefully integrated into the 
 GHC
         main-line in the near future.  As the first (to my knowledge)
         Haskell-based game studio, iPwn Studios is committed to giving back 
 to
         the Haskell community through open source - contributing to a rising
         tide that lifts us all.


     Hi Ryan,

     This is great news!  Thanks!  Does iPwn have any up coming titles?  
 Perhaps
     a blog where we could read about them so the advertising doesn't hit 
 the
     list.




         I would like to take this opportunity to propose the creation of a
         haskell-iphone mailing list, so that all Haskellers working with the
         iPhone - whether for profit or for pleasure - can come together to 
 make
         Haskell a force to be reckoned with in the burgeoning iPhone App
         marketplace.


     Sounds good to me.  Please post back here if it gets created.

     Jason




 ___
 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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] memoization using unsafePerformIO

2009-06-23 Thread Jan Christiansen

Hi,

I have tried to implement a memo function using stable names and weak  
pointers like it is presented in the paper stretching the storage  
manager. There is an abstract datatype SNMap a b which implements a  
map that maps values of type StableName a to values of type b. The map  
is located in an IORef.



{-# NOINLINE memo #-}
memo :: (a - b) - a - b
memo f =
  unsafePerformIO (do
 tref - newSNMap
 return (applyWeak f tref))

{-# NOINLINE applyWeak #-}
applyWeak :: (a - b) - SNMap a (Weak b) - a - b
applyWeak f tbl arg =
  unsafePerformIO (do
sn - makeStableName arg
lkp - lookupSNMap tbl sn
case lkp of
 Nothing - not_found sn
 Just weak - do
val - deRefWeak weak
case val of
 Just result - return result
 Nothing - not_found sn)
 where
  not_found sn = do
let res = f arg
weak - mkWeak arg res Nothing
insertSNMap tbl sn weak
return res


Using this memo function I have implemented a fibonacci function like  
it is defined in the paper.



fib :: Int - Int
fib = memo ufib

ufib :: Int - Int
ufib 0 = 1
ufib 1 = 1
ufib n = fib (n-1) + fib (n-2)


When I compile this program with 6.10.3 fib yields the correct results  
up to 18 but for 19 it detects a loop.


Can anybody give me a hint how I can avoid this behaviour (and still  
use unsafePerformIO ; ) )?


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


Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-23 Thread Brandon S. Allbery KF8NH

On Jun 22, 2009, at 07:37 , Duncan Coutts wrote:

One explanation is that isBlah asks is this thing a blah, but we're
not asking that because there is an indirection via the filepath.  
We're
asking does this filepath refer to a directory not is this  
filename a

directory. The latter could be a function:

isDirectory :: FileInfo - Bool

along with a hypothetical

getFileInfo :: FilePath - IO FileInfo


Hypothetical?

 import System.Posix.Files (getFileStatus, isDirectory)

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell on the iPhone

2009-06-23 Thread Rick R
There seems to be quite a bit more interest now in supporting platforms
other than win/*nix on x86 these days*.
Maybe now there will be sufficient motivation to make the fundamental
changes required. Caveat: I have absolutely no idea of the scope or
complexity of said changes.  I will look through the LambdaVM code (and iPwn
when available)  to get an idea.

Perhaps we can devote a section of Haskell Wiki to generalizing Haskell for
multiple targets?

The industry has been clamoring for a unified solution to all of the mobile
platforms out there. If Haskell can provide that, it would be a huge win for
its popularity.

*  Thanks primarily to the iPhone and Android systems. I think currently
iPhone is swaying the most votes but Android is due to be on a dozen phones
and possibly even a netbook.  (I have heard two announcements and one
cancellation with regards to the netbooks).


On Tue, Jun 23, 2009 at 8:34 AM, John A. De Goes j...@n-brain.net wrote:


 I have strong interest in Haskell on the JVM. Not for Android, however.

 Seems like every time this topic comes up, the consensus is that it's not
 easy to support new targets with GHC, but that work is underway to make
 such developments easier.

 Regards,

 John A. De Goes
 N-Brain, Inc.
 The Evolution of Collaboration

 http://www.n-brain.net|877-376-2724 x 101

 On Jun 22, 2009, at 11:23 PM, Ryan Trinkle wrote:

 Rick,

 I know some work has been done on JVM - iirc, Don Stewart did some work
 back in the day, 
 www.cse.unsw.edu.au/~pls/thesis/dons-thesis.ps.gzhttp://www.cse.unsw.edu.au/%7Epls/thesis/dons-thesis.ps.gz,
 but I'm not sure how comprehensive it is.

 Is anyone else interested in JVM-based Haskell targets?


 Ryan

 On Mon, Jun 22, 2009 at 20:42, Rick R rick.richard...@gmail.com wrote:

 This is definitely good news!

 So...  who's doing the Android/JVM target?  ;)



 On Mon, Jun 22, 2009 at 7:37 PM, Daniel Peebles pumpkin...@gmail.comwrote:

 How exciting! I fully support the creation of a new mailing list about
 iphone+haskell :)

 On Mon, Jun 22, 2009 at 6:30 PM, Ryan Trinkleryant5...@gmail.com
 wrote:
  Dear Haskellers,
 
  Recently, there's been a groundswell of activity in the Haskell
 community
  regarding the Haskell's use in developing iPhone games.  The iPhone is
 a
  powerful, innovative platform (with a great monetization scheme, to
 boot),
  and it's not surprising that many of us would want to develop apps for
 it in
  our favorite language.
 
  I am proud to announce today that my company, iPwn Studios Inc., is
  currently preparing to release an open source patch to GHC that allows
 it to
  output binaries for iPhone OS.  The patch will be released under a BSD
  license as soon as possible and hopefully integrated into the GHC
 main-line
  in the near future.  As the first (to my knowledge) Haskell-based game
  studio, iPwn Studios is committed to giving back to the Haskell
 community
  through open source - contributing to a rising tide that lifts us all.
 
  I would like to take this opportunity to propose the creation of a
  haskell-iphone mailing list, so that all Haskellers working with the
 iPhone
  - whether for profit or for pleasure - can come together to make
 Haskell a
  force to be reckoned with in the burgeoning iPhone App marketplace.
 
 
  Best wishes,
  Ryan Trinkle
  President, iPwn Studios Inc.
 
  P.S.: If you wish to be involved in the preparation of the GHC patch or
 in
  the creation of iPwn Studios' first game, don't hesitate to contact me
 by
  email (ryant5...@gmail.com), AIM (RyanT5000), or IRC (RyanT5000 on
  irc.freenode.net).
 
 
  ___
  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




 --
 The greatest obstacle to discovering the shape of the earth, the
 continents, and the oceans was not ignorance but the illusion of knowledge.

 - Daniel J. Boorstin


 ___
 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 mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
The greatest obstacle to discovering the shape of the earth, the
continents, and the oceans was not ignorance but the illusion of knowledge.

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


RE: [Haskell-cafe] Haskell on the iPhone

2009-06-23 Thread Simon Peyton-Jones
Good news about the iPhone port!

There seems to be quite a bit more interest now in supporting platforms other 
than win/*nix on x86 these days*.  Maybe now there will be sufficient 
motivation to make the fundamental changes required. Caveat: I have absolutely 
no idea of the scope or complexity of said changes.  I will look through the 
LambdaVM code (and iPwn when available)  to get an idea.

There is definitely an opportunity here for someone to make an impact.  There 
is no reason in principle why Haskell can't run on a JVM or .net or other 
platform.  But it's not just a simple matter of absorbing some patch or other.  
Here's a summary I wrote a little while ago:
http://haskell.org/haskellwiki/GHC:FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_the_JVM.3F

The short summary is:

* There is interesting design work to do; and then interesting 
engineering work to make it a reality.

* We (at GHC HQ) would love to see that happen, but are not likely to 
drive it.

* If someone, or a small group, wanted to take up the cudgels and work 
on it, we'd be happy to advise.

* We'd certainly consider folding the results into the HEAD, provided 
the author(s) are willing to maintain it, and we feel that the result is 
comprehensible and maintainable.

* But another viable route might well be to use the GHC API, which 
means that the result wouldn't be part of GHC at all, just a client of the API. 
 That would make it much easier to distribute upgrades etc, just as a Cabal 
package.

Simon

From: haskell-cafe-boun...@haskell.org 
[mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Rick R
Sent: 23 June 2009 14:53
To: Haskell Cafe
Subject: Re: [Haskell-cafe] Haskell on the iPhone

There seems to be quite a bit more interest now in supporting platforms other 
than win/*nix on x86 these days*.
Maybe now there will be sufficient motivation to make the fundamental changes 
required. Caveat: I have absolutely no idea of the scope or complexity of said 
changes.  I will look through the LambdaVM code (and iPwn when available)  to 
get an idea.

Perhaps we can devote a section of Haskell Wiki to generalizing Haskell for 
multiple targets?

The industry has been clamoring for a unified solution to all of the mobile 
platforms out there. If Haskell can provide that, it would be a huge win for 
its popularity.

*  Thanks primarily to the iPhone and Android systems. I think currently iPhone 
is swaying the most votes but Android is due to be on a dozen phones and 
possibly even a netbook.  (I have heard two announcements and one cancellation 
with regards to the netbooks).

On Tue, Jun 23, 2009 at 8:34 AM, John A. De Goes 
j...@n-brain.netmailto:j...@n-brain.net wrote:

I have strong interest in Haskell on the JVM. Not for Android, however.

Seems like every time this topic comes up, the consensus is that it's not easy 
to support new targets with GHC, but that work is underway to make such 
developments easier.

Regards,

John A. De Goes
N-Brain, Inc.
The Evolution of Collaboration

http://www.n-brain.net|877-376-2724 x 101

On Jun 22, 2009, at 11:23 PM, Ryan Trinkle wrote:


Rick,

I know some work has been done on JVM - iirc, Don Stewart did some work back in 
the day, 
www.cse.unsw.edu.au/~pls/thesis/dons-thesis.ps.gzhttp://www.cse.unsw.edu.au/%7Epls/thesis/dons-thesis.ps.gz,
 but I'm not sure how comprehensive it is.

Is anyone else interested in JVM-based Haskell targets?


Ryan
On Mon, Jun 22, 2009 at 20:42, Rick R 
rick.richard...@gmail.commailto:rick.richard...@gmail.com wrote:
This is definitely good news!

So...  who's doing the Android/JVM target?  ;)


On Mon, Jun 22, 2009 at 7:37 PM, Daniel Peebles 
pumpkin...@gmail.commailto:pumpkin...@gmail.com wrote:
How exciting! I fully support the creation of a new mailing list about
iphone+haskell :)

On Mon, Jun 22, 2009 at 6:30 PM, Ryan 
Trinkleryant5...@gmail.commailto:ryant5...@gmail.com wrote:
 Dear Haskellers,

 Recently, there's been a groundswell of activity in the Haskell community
 regarding the Haskell's use in developing iPhone games.  The iPhone is a
 powerful, innovative platform (with a great monetization scheme, to boot),
 and it's not surprising that many of us would want to develop apps for it in
 our favorite language.

 I am proud to announce today that my company, iPwn Studios Inc., is
 currently preparing to release an open source patch to GHC that allows it to
 output binaries for iPhone OS.  The patch will be released under a BSD
 license as soon as possible and hopefully integrated into the GHC main-line
 in the near future.  As the first (to my knowledge) Haskell-based game
 studio, iPwn Studios is committed to giving back to the Haskell community
 through open source - contributing to a rising tide that lifts us all.

 I would like to take this opportunity to propose the creation of a
 haskell-iphone mailing list, so that all Haskellers working with the iPhone
 - whether for profit or for 

Re: [Haskell-cafe] Haskell on the iPhone

2009-06-23 Thread John A. De Goes


How about setting up some sort of Summer of Code-type project, where  
companies can pledge dollars toward a certain goal, which will cover  
the cost of the work?


Is there someone at GHC HQ who could provide guidance to a sponsored  
developer working on getting additional targets into HEAD?


Regards,

John A. De Goes
N-Brain, Inc.
The Evolution of Collaboration

http://www.n-brain.net|877-376-2724 x 101

On Jun 23, 2009, at 8:16 AM, Simon Peyton-Jones wrote:


Good news about the iPhone port!

There seems to be quite a bit more interest now in supporting  
platforms other than win/*nix on x86 these days*.  Maybe now there  
will be sufficient motivation to make the fundamental changes  
required. Caveat: I have absolutely no idea of the scope or  
complexity of said changes.  I will look through the LambdaVM code  
(and iPwn when available)  to get an idea.


There is definitely an opportunity here for someone to make an  
impact.  There is no reason in principle why Haskell can’t run on a  
JVM or .net or other platform.  But it’s not just a simple matter of  
absorbing some patch or other.  Here’s a summary I wrote a little  
while ago:

http://haskell.org/haskellwiki/GHC:FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_the_JVM.3F

The short summary is:
· There is interesting design work to do; and then  
interesting engineering work to make it a reality.
· We (at GHC HQ) would love to see that happen, but are not  
likely to drive it.
· If someone, or a small group, wanted to take up the  
cudgels and work on it, we’d be happy to advise.
· We’d certainly consider folding the results into the HEAD,  
provided the author(s) are willing to maintain it, and we feel that  
the result is comprehensible and maintainable.
· But another viable route might well be to use the GHC API,  
which means that the result wouldn’t be part of GHC at all, just a  
client of the API.  That would make it much easier to distribute  
upgrades etc, just as a Cabal package.


Simon

From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org 
] On Behalf Of Rick R

Sent: 23 June 2009 14:53
To: Haskell Cafe
Subject: Re: [Haskell-cafe] Haskell on the iPhone

There seems to be quite a bit more interest now in supporting  
platforms other than win/*nix on x86 these days*.
Maybe now there will be sufficient motivation to make the  
fundamental changes required. Caveat: I have absolutely no idea of  
the scope or complexity of said changes.  I will look through the  
LambdaVM code (and iPwn when available)  to get an idea.


Perhaps we can devote a section of Haskell Wiki to generalizing  
Haskell for multiple targets?


The industry has been clamoring for a unified solution to all of the  
mobile platforms out there. If Haskell can provide that, it would be  
a huge win for its popularity.


*  Thanks primarily to the iPhone and Android systems. I think  
currently iPhone is swaying the most votes but Android is due to be  
on a dozen phones and possibly even a netbook.  (I have heard two  
announcements and one cancellation with regards to the netbooks).



On Tue, Jun 23, 2009 at 8:34 AM, John A. De Goes j...@n-brain.net  
wrote:


I have strong interest in Haskell on the JVM. Not for Android,  
however.


Seems like every time this topic comes up, the consensus is that  
it's not easy to support new targets with GHC, but that work is  
underway to make such developments easier.


Regards,

John A. De Goes
N-Brain, Inc.
The Evolution of Collaboration

http://www.n-brain.net|877-376-2724 x 101

On Jun 22, 2009, at 11:23 PM, Ryan Trinkle wrote:


Rick,

I know some work has been done on JVM - iirc, Don Stewart did some  
work back in the day, www.cse.unsw.edu.au/~pls/thesis/dons-thesis.ps.gz 
, but I'm not sure how comprehensive it is.


Is anyone else interested in JVM-based Haskell targets?


Ryan

On Mon, Jun 22, 2009 at 20:42, Rick R rick.richard...@gmail.com  
wrote:

This is definitely good news!

So...  who's doing the Android/JVM target?  ;)



On Mon, Jun 22, 2009 at 7:37 PM, Daniel Peebles  
pumpkin...@gmail.com wrote:

How exciting! I fully support the creation of a new mailing list about
iphone+haskell :)

On Mon, Jun 22, 2009 at 6:30 PM, Ryan Trinkleryant5...@gmail.com  
wrote:

 Dear Haskellers,

 Recently, there's been a groundswell of activity in the Haskell  
community
 regarding the Haskell's use in developing iPhone games.  The  
iPhone is a
 powerful, innovative platform (with a great monetization scheme,  
to boot),
 and it's not surprising that many of us would want to develop apps  
for it in

 our favorite language.

 I am proud to announce today that my company, iPwn Studios Inc., is
 currently preparing to release an open source patch to GHC that  
allows it to
 output binaries for iPhone OS.  The patch will be released under a  
BSD
 license as soon as possible and hopefully integrated into the GHC  
main-line
 in the near 

Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-23 Thread Duncan Coutts
On Tue, 2009-06-23 at 09:31 -0400, Brandon S. Allbery KF8NH wrote:
 On Jun 22, 2009, at 07:37 , Duncan Coutts wrote:
  One explanation is that isBlah asks is this thing a blah, but we're
  not asking that because there is an indirection via the filepath.  
  We're
  asking does this filepath refer to a directory not is this  
  filename a
  directory. The latter could be a function:
 
  isDirectory :: FileInfo - Bool
 
  along with a hypothetical
 
  getFileInfo :: FilePath - IO FileInfo
 
 Hypothetical?
 
   import System.Posix.Files (getFileStatus, isDirectory)

Yeah, if we could make a standard portable variant of this, that'd be
great.

Duncan

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


Re[2]: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-23 Thread Bulat Ziganshin
Hello Duncan,

Tuesday, June 23, 2009, 6:34:17 PM, you wrote:

   import System.Posix.Files (getFileStatus, isDirectory)

 Yeah, if we could make a standard portable variant of this, that'd be
 great.

isdir - withFileStatus isdir? filename isDirectory


module System.Directory
  withFileStatus :: String - FilePath - (Ptr CStat - IO a) - IO a
  isDirectory :: Ptr CStat - IO Bool

-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

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


RE: [Haskell-cafe] rewrite rules

2009-06-23 Thread Simon Peyton-Jones
| I have a rewrite rule as follows:
| 
| {-# RULES
| transform/transform forall (f::forall m. Monoid m = (a - m) - (b -
|   m))
|   (g::forall m. Monoid m = (b - m) - (c
| - m))
|   (l::FMList c). transform f (transform g
| l) = transform (g.f) l
|#-}
| 
| It fires on this code:
| 
|print $ transform (. (*2)) (transform (. (+1)) (upto 10))
| 
| But it doesn't fire on this code:
| 
|print $ map (*2) (map (+1) (upto 10)))

That's odd. It works for me.

Specifically, I compiled the attached code with GHC 6.10, and I get two firings 
of transform/transform.

Does that not happen for you?

Simon



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


[Haskell-cafe] Re: [Haskell] ANN: Reusable Corecursive Queues via Continuations

2009-06-23 Thread Felipe Lessa
On Mon, Jun 22, 2009 at 10:31:34PM -0400, Leon Smith wrote:
 Also, a substantially revised draft of the associated paper,  Lloyd
 Allison's Corecursive Queues:  Why Continuations Matter is now available.
 [3]   This paper will appear in the upcoming Monad Reader issue 14,  and
 comments would be most appreciated.

As per [1], it seems n+k patterns will be removed from Haskell',
so you may want to remove them from the paper as well.

[1] http://hackage.haskell.org/trac/haskell-prime/wiki/Status

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


[Haskell-cafe] ICFP contest

2009-06-23 Thread Rafael Gustavo da Cunha Pereira Pinto
Hi,

The good folks here are really quiet about the ICFP Contest. Is anyone
participating this year?

As in the previous four years, I will probably download the problem, take a
look, and try for a while... Having a family don't allow me to go much
further, especially when teaming up with myself!

Best regards,


Rafael Gustavo da Cunha Pereira Pinto
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ICFP contest

2009-06-23 Thread Miguel Mitrofanov

Well, I can make a bit more concrete prediction.

I'll download the problem, take a look, try for a while, discover,  
that it's too hard to be cracked at once, and lose interest.


That sounds like a reason why I'm not participating.

On 23 Jun 2009, at 22:49, Rafael Gustavo da Cunha Pereira Pinto wrote:


Hi,

The good folks here are really quiet about the ICFP Contest. Is  
anyone participating this year?


As in the previous four years, I will probably download the problem,  
take a look, and try for a while... Having a family don't allow me  
to go much further, especially when teaming up with myself!


Best regards,


Rafael Gustavo da Cunha Pereira Pinto

___
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] Type system trickery

2009-06-23 Thread Andrew Coppin

Ross Mellgren wrote:

This works for me:

{-# LANGUAGE EmptyDataDecls, GADTs #-}
module Main where

data NoZoo
data Zoo

newtype X = X Int deriving (Show)
newtype Y = Y Char deriving (Show)

data Foobar a where
Foo :: X - Y - Foobar NoZoo
Bar :: X - Y - Foobar NoZoo
Zoo :: Foobar NoZoo - Foobar Zoo

foobar :: Foobar a - X
foobar f = case f of
 Foo x _ - x
 Zoo g   - foobar g

main :: IO ()
main = putStrLn . show $ foobar (Zoo $ Foo (X 1) (Y 'a'))


Could you post a test case?


Thinking about this more carefully, I started out with

 data Foobar a where
   Foo :: X - Y - Foobar a
   Zoo :: Foobar a - Foobar Zoo

which is no good, because Zoo can be nested arbitrarily deep. So I tried 
to change it to


 data Foobar a where
   Foo :: X - Y - Foobar NoZoo
   Zoo :: Foobar NoZoo - Foobar Zoo

But *actually*, changing the second type signature only is sufficient. 
Indeed, it turns out I don't *want* to change the first one. I want to 
use the type system to track whether Zoo may or may not be present, 
not whether it is or is not present. In other words, I want Foobar 
Zoo to mean that there *might* be a Zoo in there, but there isn't 
guaranteed to be one. But I want Foobar NoZoo to be guaranteed not to 
contain Zoo.


So anyway... my program now uses GADTs, I've spent ages chasing down all 
the typechecker errors (and, inevitably, in some places clarifying what 
the code is actually supposed to do), and my program now typechecks and 
does what it did before, except with slightly more type safety. (In 
particular, I've deleted several calls to error now, because those 
case alternatives can never occur).


Thanks to all the people for your help! :-D

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


AW: [Haskell-cafe] ICFP contest

2009-06-23 Thread Nicu Ionita
Last year the problem was not too bad, but I failed because I didn't have a
working linux installation and the live cd started on my notebook in the
first day, but in the second no more (you had to deliver a linux binary).

Two years ago there was no need to deliver a binary, but I did not have any
idea how to start.

This year I'll try again (in Haskell, of course), but you're right, alone it
can be very hard.

Nicu Ionita


 -Ursprüngliche Nachricht-
 Von: haskell-cafe-boun...@haskell.org 
 [mailto:haskell-cafe-boun...@haskell.org] Im Auftrag von 
 Miguel Mitrofanov
 Gesendet: Dienstag, 23. Juni 2009 21:27
 An: Rafael Gustavo da Cunha Pereira Pinto
 Cc: Haskell Café
 Betreff: Re: [Haskell-cafe] ICFP contest
 
 
 Well, I can make a bit more concrete prediction.
 
 I'll download the problem, take a look, try for a while, discover,  
 that it's too hard to be cracked at once, and lose interest.
 
 That sounds like a reason why I'm not participating.
 
 On 23 Jun 2009, at 22:49, Rafael Gustavo da Cunha Pereira Pinto wrote:
 
  Hi,
 
  The good folks here are really quiet about the ICFP Contest. Is
  anyone participating this year?
 
  As in the previous four years, I will probably download the problem,
  take a look, and try for a while... Having a family don't allow me  
  to go much further, especially when teaming up with myself!
 
  Best regards,
 
 
  Rafael Gustavo da Cunha Pereira Pinto
 
  ___
  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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: New release of ZeroTH

2009-06-23 Thread Robin Green
This announcement will only be of interest to Haskell programmers
using, or thinking of using, Template Haskell.

I am very pleased to announce a new release (2009.6.23.3) of ZeroTH
(also known as zeroth), a tool for preprocessing Haskell code to run
splices and remove Template Haskell dependencies:

 http://hackage.haskell.org/package/zeroth

For example, you could use it to reduce the size of your Haskell
program binaries, if you use Template Haskell. (zeroth now actually
uses itself on itself, for this very purpose, and you can use
the Distribution.ZeroTH module for that in your own cabal projects.)

It's still very much a hack - in that it would probably be more
efficient and clean to implement it as an option to GHC
- but hopefully now at least it's a slightly *better* hack.

Lemmih has kindly agreed to hand over the job of being maintainer
of ZeroTH to me. So please send any patches or complaints my way. The
new darcs repository for the project, which is a darcs 2 repository, is
at:

 http://patch-tag.com/publicrepos/zerothDarcs2

For this release, the cabal command-line tool is the only officially
supported means of installation. So you should do something like:

 cabal update
 cabal install zeroth

to install it. To get a summary of command-line options, type:

 zeroth --help

Major changes from previous releases:

* Much more Haskell code is now supported. This is partly because the
  code has been updated to work with the just-released
  haskell-src-exts 1.0.0; and partly because it supports a wider
  variety of Template Haskell code, including code which refers to
  definitions declared in the same source file.

* It is now compulsory to specify any Haskell language extensions you
  are using in the input file, with a LANGUAGE pragma. (For debugging
  purposes, zeroth prints to stderr the result of parsing the LANGUAGE
  pragma, if any. If haskell-src-exts doesn't understand the LANGUAGE
  pragma, this will be Nothing. But that shouldn't happen.)

* Template Haskell imports are now *automatically* stripped by default
  by zeroth, and so cpphs doesn't need to be run if you aren't otherwise
  using CPP.

* New command-line options have been added (see zeroth --help).

* Error messages are now more informative.

* Librification! Almost anything can benefit from being made into a
  library, and zeroth is no exception. Of course, the executable is
  still there.

* You can still use it on certain code which doesn't compile in GHC
  (yes, really, I've tested this!) but you now have to use the
  --only-splices option if you want to do this. Obviously, the splices
  themselves have to compile. --only-splices also makes zeroth faster.

It is very lightly tested, so it might not work for your code out of the
box. Please let me know if you have any problems with it, no matter how
small.

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


Re: [Haskell-cafe] Could FFI support pass-by-value of structs?

2009-06-23 Thread John Meacham
On Tue, Jun 16, 2009 at 10:48:19AM -0300, Maurí­cio wrote:
 It's not usual, but it is allowed to have values of
 structs passed between functions directly instead of
 using pointers:

 /*/
 struct ex {
 int x;
 int y;
 int z;
 };

 ex example_functions (ex p)
 {
   (...)
 }
 /*/

 Would it be possible to allow that in Haskell FFI
 by, say, allowing any instance of Storable to be
 used in a 'foreign' declaration? Like:

There are a couple problems with this. First, the storage layout for a
given C struct may be radically different depending on the back end,
even sometimes depending on the operating system. So you can't write a
portable Storable instance. 

The other problem is that the storage layout isn't enough to use structs
as arguments as the calling conventions also come into play. Some
calling conventions want structs expanded and places on the stack,
others want a pointer to some stack allocated data, returning a struct
may or may not create a hidden first argument. Now, Haskell compilers
already have to tackle calling conventions for basic types, so it is
entirely plausable to solve this, the question is, is it worth the
effort? anything you write will end up not being portable anyway because
it depends on the structure layout.

The end result being, structure passing is complicated, so if you need
to interface to a library that has pre-defined structeres, use hsc2hs to
manually peek and poke into the correct offsets, it will make things
easier and be more portable.

John

-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Could FFI support pass-by-value of structs?

2009-06-23 Thread Felipe Lessa
On Tue, Jun 16, 2009 at 10:48:19AM -0300, Maurí­cio wrote:
 /*/
 struct ex {
 int x;
 int y;
 int z;
 };

 ex example_functions (ex p)
 {
   (...)
 }
 /*/

You may adopt the approach I used with Hipmunk[1] where there is
a wrapper library written in C.  For your example you could do
something like

 void wr_example_functions(ex *p) {
   *p = example_functions(*p);
 }

and in you Haskell code you write something like

 foreign import ccall unsafe wrapper.h
 wr_example_functions :: Ptr Ex - IO ()

 exampleFunctions :: Ex - IO Ex
 exampleFunctions input =
   with input $ \ptr - do
 wr_example_functions ptr
 peek ptr

The structure is allocated on the stack, so the drawbacks are
only another function call and two structure copies, and probably
that shouldn't hurt a lot.  Note that depending on the C compiler
those costs may even get somewhat optimized (e.g. by inlining).

[1] http://hackage.haskell.org/package/Hipmunk

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


Re: [Haskell-cafe] Type system trickery

2009-06-23 Thread Brandon S. Allbery KF8NH

On Jun 22, 2009, at 14:43 , Andrew Coppin wrote:

data Foobar a where
  Foo :: X - Y - Foobar NoZoo
  Bar :: X - Y - Foobar NoZoo
  Zoo :: Foobar NoZoo - Foobar Zoo

For some reason, if I do this I get endless type check errors. I  
have to change the top two back to Foobar a before it will work.  
*sigh*



That's probably because ghc can't fix a type for Foobar a if you never  
actually use a anywhere.  Functional dependencies could solve that,  
but giving ghc a way to infer a type for it by using it where it  
doesn't affect anything important is easier and doesn't risk  
possible(?) weird interactions between FDs and GADTs.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature

2009-06-23 Thread Eric Dedieu
Thanks for your answers. I still have a question, though...

 I think the reasoninging here is the following: If MonadState is part
 of the standard library and it needs this extension to work, then all
 compilers must support this extension.

Yes, exactly, that was my point.
 
 I'm not completely sure how standard the MonadState class is
 though. Also, it might be that there could be implementations of
 MonadState that do not use the extension?

And indeed, I understand from the next (Luke Palmer's) answer that the
community does not fully agree on what should be standard:

 However, your question is rather moot here, as you are using the
 *mtl.  *It uses UndecidableInstances, whose blessing into the de
 facto standard would require as a precondition the batshit-insanity
 of the de facto community.
 
 I personally use *transformers* as my monad library, as it is (as far
 as I know) the only Haskell 98 monad library on Hackage (you'll
 hardly notice the more explicit lifts, I promise!).

I just looked through Transformers and it does not define MonadState,
indeed.

Well... I am a beginner in haskell. I have
detailed in the first post the very simplistic example I was trying to
set up, the level of a beginner's tutorial. As anyone discovering a new
language, I certainly did not intend to look so soon at compiler
extensions.

Now, trying to avoid duplicate code at this very level of simplicity
seems to require compiler extensions! Here it is:

- The MonadState type seems required to reuse the same code for State
  s a and StateT s IO a.

- MonadState needs compiler extensions and is implemented using the mtl
  library which seems to have drawbacks.


So

1) How can I use transformers instead of the mtl? This is in no
tutorial, and searchinf for mtl on the haskell wiki yields no
result at all.

2) What should be the Haskell98-compatible type signature for my play2 
function, instead of (MonadState [a] m, Eq a) =
a - m Bool ?


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


Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature

2009-06-23 Thread Luke Palmer
On Tue, Jun 23, 2009 at 6:05 PM, Eric Dedieu papa.e...@free.fr wrote:

 So

 1) How can I use transformers instead of the mtl? This is in no
 tutorial, and searchinf for mtl on the haskell wiki yields no
 result at all.


 cabal install transformers   (you need cabal-install to do this... consult
#haskell if confused)
perhaps:   ghc-pkg hide mtl   (I think mtl and transformers fight over the
Control.Monad module)

Then import Control.Monad.Trans.State instead of Control.Monad.State.  All
else should be well, if I am not forgetting something.



 2) What should be the Haskell98-compatible type signature for my play2
 function, instead of (MonadState [a] m, Eq a) =
 a - m Bool ?


That depends on the monad library.  In transformers it would be:

(Monad m, Eq a) = a - StateT [a] m Bool

State s is just a type synonym for StateT s Identity, so this works for
State as well.

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


Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature

2009-06-23 Thread Brandon S. Allbery KF8NH

On Jun 22, 2009, at 20:02 , Eric wrote:

   Non type-variable argument in the constraint: MonadState [a] m
   (Use -XFlexibleContexts to permit this)
   In the type signature for `play3':
 play3 :: (MonadState [a] m, Eq a) = a - m Bool

So how is it possible that GHCi can infer (and use) a type that you
cannot use as signature?



This is an infelicity in the GHC type checker:  if a library uses an  
extension, inferred types involving things in the library will  
silently use the extension even though you haven't declared it --- but  
if you try to specify the type manually, you have to explicitly  
declare the extension.  I think there's a bug report open on it,  
because it's poor form (not to mention confusing).


http://hackage.haskell.org/trac/ghc/ticket/1897
I think this is the right bug.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature

2009-06-23 Thread Luke Palmer
On Tue, Jun 23, 2009 at 6:05 PM, Eric Dedieu papa.e...@free.fr wrote:

 Now, trying to avoid duplicate code at this very level of simplicity
 seems to require compiler extensions! Here it is:


On a higher level, in case you are interested, here's a description of how I
would model your problem.  Take this with a grain of salt: we are already in
the area where different haskell vets will model this in different ways.
This is one of many approaches...

Instead of possibly tying the game to its side effects inside a monad, I
would model the game as a pure data structure, and then have different
interfaces just talk about the pure structure.  Note: In the real world,
things would be more polymorphic, but I'll keep it concrete for expository
purposes:  For example:

newtype Game = MkGame [Char]

empty :: Game
empty = MkGame []

play :: Char - Game - (Bool, Game)
play x (MkGame mvs) = (x `elem` moves, MkGame (x:mvs))

moves :: Game - [Char]
moves (MkGame mvs) = mvs

These constitute the only interface you have to Game; it is immoral to use
MkGame from here on out.  If you were being rigorous, these would go into a
module with export list (Game, empty, play, moves).

Everything else is straightforward from here.  The code you wished to reuse
is in play, hidden behind an abstraction barrier so the compiler may
ensure that it is reused (because there is no other way to play a Game).
State monads don't even enter the picture at this level.

(The return type of Play is Game - (Bool, Game), which is State Game
Bool... but I would just choose not to notice that; the state structure
isn't important enough here to formalize).

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


Re: [Haskell-cafe] Type system trickery

2009-06-23 Thread Ross Mellgren
I'm no expert, but it seems like those constructors should return  
Foobar NoZoo, unless you're nesting so there could be a Zoo, in which  
case the type variable a should transit, for example:


data Foobar a where
Foo :: X - Y - Foobar NoZoo
Bar :: X - Y - Foobar NoZoo
Baz :: Foobar a - Foobar a
Zoo :: Foobar NoZoo - Foobar Zoo

value = Zoo $ Foo (X 1) (Y 'a')
value2 = Zoo $ Baz $ Foo (X 1) (Y 'a')
-- value3 = Zoo $ Baz $ Zoo $ Foo (X 1) (Y 'a')
--Couldn't match expected type `NoZoo' against inferred type `Zoo'
--  Expected type: Foobar NoZoo
--  Inferred type: Foobar Zoo
--In the second argument of `($)', namely
--`Baz $ Zoo $ Foo (X 1) (Y 'a')'
--In the expression: Zoo $ Baz $ Zoo $ Foo (X 1) (Y 'a')

That is, if you construct a Baz with something else that doesn't have  
a Zoo (e.g. NoZoo) then the resultant type is also NoZoo. The converse  
is true.


Why would you want it to generate a polymorphic Foobar when it  
definitely is NoZoo?


-Ross

(p.s. the example names in this thread are a bit ridiculous ;-) )

On Jun 23, 2009, at 4:01 PM, Andrew Coppin wrote:


Ross Mellgren wrote:

This works for me:

{-# LANGUAGE EmptyDataDecls, GADTs #-}
module Main where

data NoZoo
data Zoo

newtype X = X Int deriving (Show)
newtype Y = Y Char deriving (Show)

data Foobar a where
   Foo :: X - Y - Foobar NoZoo
   Bar :: X - Y - Foobar NoZoo
   Zoo :: Foobar NoZoo - Foobar Zoo

foobar :: Foobar a - X
foobar f = case f of
Foo x _ - x
Zoo g   - foobar g

main :: IO ()
main = putStrLn . show $ foobar (Zoo $ Foo (X 1) (Y 'a'))


Could you post a test case?


Thinking about this more carefully, I started out with

data Foobar a where
  Foo :: X - Y - Foobar a
  Zoo :: Foobar a - Foobar Zoo

which is no good, because Zoo can be nested arbitrarily deep. So I  
tried to change it to


data Foobar a where
  Foo :: X - Y - Foobar NoZoo
  Zoo :: Foobar NoZoo - Foobar Zoo

But *actually*, changing the second type signature only is  
sufficient. Indeed, it turns out I don't *want* to change the first  
one. I want to use the type system to track whether Zoo may or  
may not be present, not whether it is or is not present. In  
other words, I want Foobar Zoo to mean that there *might* be a Zoo  
in there, but there isn't guaranteed to be one. But I want Foobar  
NoZoo to be guaranteed not to contain Zoo.


So anyway... my program now uses GADTs, I've spent ages chasing down  
all the typechecker errors (and, inevitably, in some places  
clarifying what the code is actually supposed to do), and my program  
now typechecks and does what it did before, except with slightly  
more type safety. (In particular, I've deleted several calls to  
error now, because those case alternatives can never occur).


Thanks to all the people for your help! :-D

___
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] HaRe (the Haskell Refactorer) in action - short screencast

2009-06-23 Thread Mattias Bengtsson
On Tue, 2009-06-23 at 00:02 +0100, Claus Reinke wrote:
 [...] With the recent interest in screencasts, I thought I'd make a little
 demo, for archival purposes. [...]

Impressive!

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


Re: [Haskell-cafe] Generate Fortran 77 parser from a yacc grammar using Happy

2009-06-23 Thread Brandon S. Allbery KF8NH

On Jun 23, 2009, at 07:57 , Cetin Sert wrote:

Why is there some C?/C++? code in that .y file?



It has the look of a production grammar with the reduction actions  
stripped out (but whatever they used didn't strip the %{ initializer  
block).  I would say that, for starters, you want to strip or modify  
the %{ block, and possibly remove/replace the empty { } actions in the  
grammar.  More I can't say; I know yacc, not happy.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to determine if a FilePath is a directory name or regular file?

2009-06-23 Thread Brandon S. Allbery KF8NH

On Jun 23, 2009, at 10:34 , Duncan Coutts wrote:

On Tue, 2009-06-23 at 09:31 -0400, Brandon S. Allbery KF8NH wrote:

Hypothetical?


import System.Posix.Files (getFileStatus, isDirectory)


Yeah, if we could make a standard portable variant of this, that'd be
great.



I've wanted to do that ever since I tripped over it implementing the  
original filetests in pugs; I know it can be done with some  
genericness but don't know enough win32 to do it.


One question is what to do with the non-generic stuff.  For example,  
Win32 doesn't have symbolic links, but does have reparse points which  
are sort of similar if you squint; they're a superset of symlink  
functionality.  (The closest thing Unix (not POSIX) has is  
mountpoints, but those are userspace aside from . and .. being the  
same inode.  POSIX doesn't touch this space, IIRC, because there are  
POSIX implementations for Win32 (no mountpoints, some implementations  
may use reparse points to simulate them) and OpenVMS (no mountpoints).)


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Forward compatibility (was Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature)

2009-06-23 Thread Brandon S. Allbery KF8NH

On Jun 23, 2009, at 05:20 , Luke Palmer wrote:
obsolete now, will your code still work when they are gone?  Will it  
still work when the typeclass resolution algorithm is obsoleted by a  
superior algorithm (I'm looking at you, Oleg! :-)?  When Haskell is  
obsolete, how hard will it be to port?


This is the point at which 99% of programmers throw up their hands at  
the futility of trying to guess what lies 20 years in the future, and  
just writes the fscking code.  I mean, you've just ruled out both  
Haskell98 *and* Haskell-with-extensions.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Re[2]: Re: (fwd) Haskell logo fail

2009-06-23 Thread Benjamin L . Russell
On Thu, 18 Jun 2009 12:13:09 +0400, Bulat Ziganshin
bulat.zigans...@gmail.com wrote:

Hello minh,

Thursday, June 18, 2009, 11:17:07 AM, you wrote:

   Why don't we have a picture of a cool dinosaur instead?

 Something cool because the last heat of life went out of it
 65 million years ago?

 made with secret dinosaur technology

made with dinosaur technology :)))

Let's see how far we can take this idea:

  Haskell.  Avoid success at all costs.  Made with dinosaur
technology.

Wow, we Haskellites must really be going out to lunch ;-).  Speaking
of lunch, it's almost 12:00.  Now I must be going out to lunch, too.
;-

-- Benjamin L. Russell
-- 
Benjamin L. Russell  /   DekuDekuplex at Yahoo dot com
http://dekudekuplex.wordpress.com/
Translator/Interpreter / Mobile:  +011 81 80-3603-6725
Haskell.  Avoid success at all costs.  Made with dinosaur technology.

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


Re: [Haskell-cafe] Type system trickery

2009-06-23 Thread David Menendez
On Tue, Jun 23, 2009 at 9:25 PM, Ross Mellgrenrmm-hask...@z.odi.ac wrote:
 I'm no expert, but it seems like those constructors should return Foobar
 NoZoo, unless you're nesting so there could be a Zoo, in which case the type
 variable a should transit, for example:

 data Foobar a where
    Foo :: X - Y - Foobar NoZoo
    Bar :: X - Y - Foobar NoZoo
    Baz :: Foobar a - Foobar a
    Zoo :: Foobar NoZoo - Foobar Zoo

 value = Zoo $ Foo (X 1) (Y 'a')
 value2 = Zoo $ Baz $ Foo (X 1) (Y 'a')
 -- value3 = Zoo $ Baz $ Zoo $ Foo (X 1) (Y 'a')
 --    Couldn't match expected type `NoZoo' against inferred type `Zoo'
 --      Expected type: Foobar NoZoo
 --      Inferred type: Foobar Zoo
 --    In the second argument of `($)', namely
 --        `Baz $ Zoo $ Foo (X 1) (Y 'a')'
 --    In the expression: Zoo $ Baz $ Zoo $ Foo (X 1) (Y 'a')

 That is, if you construct a Baz with something else that doesn't have a Zoo
 (e.g. NoZoo) then the resultant type is also NoZoo. The converse is true.

 Why would you want it to generate a polymorphic Foobar when it definitely is
 NoZoo?

You might have a higher-arity constructor and want to construct things like,

   Qux (Foo X Y) (Zoo (Bar X Y))

What's the type of Qux?

If Foobar Zoo means might contain a Zoo, then you can just declare

data Foobar a where
Foo :: X - Y - Foobar a
Bar :: X - Y - Foobar a
Zoo :: Foobar NoZoo - Foobar Zoo
Qux :: Foobar a - Foobar a - Foobar a

and everything is fine.

On the other hand, if Foobar Zoo means definitely contains a Zoo,
then you need type families to express the type of Qux.

Qux :: Foobar a - Foobar b - Foobar (EitherZoo a b)

type family EitherZoo a b :: *
type instance EitherZoo Zoo Zoo = Zoo
type instance EitherZoo NoZoo Zoo = Zoo
type instance EitherZoo Zoo NoZoo = Zoo
type instance EitherZoo NoZoo NoZoo = NoZoo

-- 
Dave Menendez d...@zednenem.com
http://www.eyrie.org/~zednenem/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe