[Haskell-cafe] Improved ghc-pkg cache warnings

2013-06-15 Thread Andrew Pennebaker
When ghc-pkg observes your cache is out of date, it displays a helpful
warning, recommending "ghc-pkg recache". However, sometimes running this
command does not fix the problem, because it targets the wrong cache.

For out of date global caches, "ghc-pkg --global recache" successfully
clears the warning. For out of date user caches, "ghc-pkg --user recache"
clears the warning.

In the future, could ghc-pkg display the command more specific to the
problem?

-- 
Cheers,

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


[Haskell-cafe] Automating Hackage accounts

2013-06-13 Thread Andrew Pennebaker
Could we add an HTML form for creating new Hackage accounts? Right now, our
community is small enough that emailing r...@soi.city.ac.uk and waiting for
a manual response isn't too bad of a problem, but as we grow, it would be
nice for these sorts of things to be handled by a server, like with
RubyGems and NPM.

-- 
Cheers,

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


[Haskell-cafe] Haskell Platform's libstdc++-6.dll may be interfering with other applications

2013-05-07 Thread Andrew Pennebaker
I use a number of different programming languages, so I have Haskell
Platform, Strawberry Perl, Node.js, RVM, and Git Bash installed at the same
time.

I've noticed that compiling packages with C dependencies (e.g. using
node-gyp during "npm install node-mhash", or doing "cpan install
PAR::Packer") often crashes during the build process with a popup:

The procedure entry point __gxx_personality_sj0 could not be located in the
dynamic link library libstdc++-6.dll.

As Roderich Schupp points
out<https://rt.cpan.org/Public/Bug/Display.html?id=84949>,
it appears that the different libstdc++-6.dll's are interfering with one
another. Haskell Platform comes with one, Vagrant comes with one, GIMP
comes with one, MinGW comes with one, and Strawberry Perl comes with two!
Objdump seems to indicate that Haskell Platform's DLL is the one to blame.

$ find /c/ -name libstdc++-6.dll 2>/dev/null
/c/DevKit/mingw/bin/libstdc++-6.dll
/c/Program Files/GIMP 2/bin/libstdc++-6.dll
/c/Program Files/Haskell Platform/2012.4.0.0/mingw/bin/libstdc++-6.dll
/c/strawberry/c/bin/libstdc++-6.dll
/c/strawberry/perl/bin/libstdc++-6.dll
/c/vagrant/vagrant/embedded/mingw/bin/libstdc++-6.dll

$ objdump -ax /c/DevKit/mingw/bin/libstdc++-6.dll | ack gxx_personality
[3896] __gxx_personality_sj0
$ objdump -ax /c/Program\ Files/GIMP\ 2/bin/libstdc++-6.dll | ack
gxx_personality
[3499] __gxx_personality_sj0
$ objdump -ax /c/Program\ Files/Haskell\
Platform/2012.4.0.0/mingw/bin/libstdc++-6.dll | ack gxx_personality
[3401] __gxx_personality_v0
$ objdump -ax /c/strawberry/c/bin/libstdc++-6.dll | ack gxx_personality
[3510] __gxx_personality_sj0
$ objdump -ax /c/strawberry/perl/bin/libstdc++-6.dll | ack gxx_personality
[3510] __gxx_personality_sj0
$ objdump -ax /c/vagrant/vagrant/embedded/mingw/bin/libstdc++-6.dll |
ack gxx_personality
[3896] __gxx_personality_sj0


Would updating Haskell Platform's libstdc++-6.dll fix this issue? Is there
some way to cordon Haskell Platform off from the rest of the system, while
still making ghc.exe and friends available on PATH?

Here are my system specs, I figure they're highly relevant.

$ specs haskell perl node ruby git os
Specs:

specs 0.4
https://github.com/mcandre/specs#readme

cabal --version
cabal-install version 0.14.0
using version 1.14.0 of the Cabal library

ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.2

ghc-pkg field haskell-platform version
version: 2012.4.0.0

cpan --version
c:\strawberry\perl\bin/cpan version 1.5902 calling Getopt::Std::getopts
(version 1.07 [paranoid]),
running under Perl version 5.16.2.
  [Now continuing due to backward compatibility and excessive paranoia.
   See 'perldoc Getopt::Std' about $Getopt::Std::STANDARD_HELP_VERSION.]
Nothing to install!

perl --version

This is perl 5, version 16, subversion 2 (v5.16.2) built for
MSWin32-x86-multi-thread

Copyright 1987-2012, Larry Wall

Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.


npm --version
1.2.17

node --version
v0.10.3

bundle --version
Bundler version 1.3.2

gem --version
2.0.3

ruby --version
ruby 1.9.3p374 (2013-01-15) [i386-mingw32]

git --version
git version 1.8.0.msysgit.0

systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:   Microsoft Windows XP Professional
OS Version:5.1.2600 Service Pack 3 Build 2600

-- 
Cheers,

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


Re: [Haskell-cafe] Mobile app development?

2013-01-22 Thread Andrew Pennebaker
Can we un-deprecate GHC's ability to compile to C code? C may be the best
option to bridge to mobile, as Android, iOS, and Windows RT do support
C/C++ apps.
On Jan 22, 2013 2:14 PM, "Dan Choi"  wrote:

>
> What about the option of using Haskell's Parsec or AttoParsec to implement
> a Haskell-ish language that compiles down not to machine code but to
> Objective C or Android Java? Like how CoffeeScript compiles down to
> JavaScript.
>
>
>
> On Saturday, January 19, 2013 1:58:03 PM UTC-5, Casey Hawthorne wrote:
>>
>> You would need native compilers for all the platforms and/or virtual
>> machine technology.
>>
>> Might be easier to have the browser connect to a Haskell app.
>>
>>
>> On Sat, Jan 19, 2013 at 10:42 AM, Andrew Pennebaker
>>  wrote:
>> > There are currently very few options, especially free and open source
>> > options, when it comes to developing cross-platform mobile
>> applications.
>> > It's basically web apps with JavaScript, or C++. If Haskell supported
>> app
>> > development on Android, iOS, and Windows RT, that alone would bring in
>> more
>> > developers.
>> >
>> > Similarly, there are very few languages for mobile development that
>> take
>> > advantage of multiple cores and multiple CPUs. Haskell's `parmap` is an
>> > amazing selling point. Can we please prioritize mobile support? I'd
>> much
>> > rather write everything in ML than PhoneGap.
>> >
>> > --
>> > Cheers,
>> >
>> > Andrew Pennebaker
>> > www.yellosoft.us
>> >
>> > __**_
>> > Haskell-Cafe mailing list
>> > haskel...@haskell.org
>> > http://www.haskell.org/**mailman/listinfo/haskell-cafe<http://www.haskell.org/mailman/listinfo/haskell-cafe>
>> >
>>
>>
>>
>> --
>> --
>> Regards,
>> KC
>>
>> __**_
>> Haskell-Cafe mailing list
>> haskel...@haskell.org
>> http://www.haskell.org/**mailman/listinfo/haskell-cafe<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] Mobile app development?

2013-01-19 Thread Andrew Pennebaker
There are currently very few options, especially free and open source
options, when it comes to developing cross-platform mobile applications.
It's basically web apps with JavaScript, or C++. If Haskell supported app
development on Android, iOS, and Windows RT, that alone would bring in more
developers.

Similarly, there are very few languages for mobile development that take
advantage of multiple cores and multiple CPUs. Haskell's `parmap` is an
amazing selling point. Can we please prioritize mobile support? I'd much
rather write everything in ML than PhoneGap.

-- 
Cheers,

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


Re: [Haskell-cafe] GHC for mobile devices?

2012-11-10 Thread Andrew Pennebaker
ASM for iOS is possible, so GHC mobile should be possible.

www.shervinemami.info/armAssembly.html#howto
On Nov 10, 2012 5:59 PM, "Andrew Pennebaker" 
wrote:

> I've tried porting GHC to Haiku OS, a Unix-like desktop OS, but the state
> of the GHC build system is fairly confusing. The build scripts contain a
> Perl script with a bad shebang, and you can't build GHC without already
> having a working older version.
>
> If someone can point me to the most recent GHC code that doesn't need
> itself to compile, I can work on a Haiku version as practice. I really want
> GHC for every possible system.
> On Nov 10, 2012 5:49 PM, "Kristopher Micinski" 
> wrote:
>
>> On Sat, Nov 10, 2012 at 3:50 PM, Casey Basichis 
>> wrote:
>> > Hi Kris,
>> >
>> > No offense taken, it was an argument that works to shut down
>> constructive
>> > discussion of how to get Haskell running on mobile, a task which has
>> > perplexed me for several long days.  I agree most apps are pretty
>> terrible,
>> > at least on iOS though, despite the percentages being wildly off there
>> are
>> > still a few hundred apps that are very well done and thoughtful, none of
>> > them using Haskell I'm sure.
>> >
>>
>> Yup!  Most of the time apps are merely "translated" versions of rails
>> frontends.  (For better or for worse, I assume that if we were to port
>> haskell to work with Android really it would be mostly to appease my
>> purity.)
>>
>> > I'm looking to pass Haskell lists of musical data and return processed
>> > musical ideas from it (not audio, not realtime).  I was also planning on
>> > handling a database within Haskell as the information contained would be
>> > used by the music processing and from what I have read Haskell
>> interfaces to
>> > SQL far more readily than with a C++ orm type solution.  I was planning
>> on
>> > working with Haskells Euterpea as base to build my ideas off of, my I
>> might
>> > end up rolling my own similar library as my aims are a bit different
>> than
>> > theirs.
>> >
>>
>> I'm not sure I understand completely, but I agree this isn't a bad idea.
>>
>> > Everything else would be C++, including the interface, audio and dsp
>> > processing etc.   I already have the C++ stuff running on my phone.  I
>> have
>> > read about the difficulty of getting Haskell working in real world
>> > scenarios, but as far as I understand my plans for it are fairly well
>> suited
>> > to it.
>> >
>>
>> I don't disagree!
>>
>> > Since much of the documentation online about Haskell seems to be out of
>> > date, its tough to get a general feel for whats working.  I see people
>> > mention that cross-compilation was finished a while back which should
>> allow
>> > for targeting arm but nothing concrete and the website gives conflicting
>> > info.  I've also considered using GHC to generate C to paste into the
>> > project but it seems there have been and may be more integrated ways to
>> get
>> > it running.
>>
>> I am venturing into my embarrassing lack of knowledge about GHC
>> internals here, but how easily would the run time system work on
>> Android..?  I had assumed a large part of the effort into getting
>> OCaml to work on iPhone went into the runtime system, no?
>>
>> If you're (Andrew or anyone) still interested in pursuing this I would
>> be interested in helping out, I have some Android internals knowledge
>> and would be glad to lend a hand.
>>
>> One major thing that seems to be necessary is congealing all the
>> (mis/outdated)information into the wiki article on haskell.org.
>>
>> kris
>>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC for mobile devices?

2012-11-10 Thread Andrew Pennebaker
I've tried porting GHC to Haiku OS, a Unix-like desktop OS, but the state
of the GHC build system is fairly confusing. The build scripts contain a
Perl script with a bad shebang, and you can't build GHC without already
having a working older version.

If someone can point me to the most recent GHC code that doesn't need
itself to compile, I can work on a Haiku version as practice. I really want
GHC for every possible system.
On Nov 10, 2012 5:49 PM, "Kristopher Micinski" 
wrote:

> On Sat, Nov 10, 2012 at 3:50 PM, Casey Basichis 
> wrote:
> > Hi Kris,
> >
> > No offense taken, it was an argument that works to shut down constructive
> > discussion of how to get Haskell running on mobile, a task which has
> > perplexed me for several long days.  I agree most apps are pretty
> terrible,
> > at least on iOS though, despite the percentages being wildly off there
> are
> > still a few hundred apps that are very well done and thoughtful, none of
> > them using Haskell I'm sure.
> >
>
> Yup!  Most of the time apps are merely "translated" versions of rails
> frontends.  (For better or for worse, I assume that if we were to port
> haskell to work with Android really it would be mostly to appease my
> purity.)
>
> > I'm looking to pass Haskell lists of musical data and return processed
> > musical ideas from it (not audio, not realtime).  I was also planning on
> > handling a database within Haskell as the information contained would be
> > used by the music processing and from what I have read Haskell
> interfaces to
> > SQL far more readily than with a C++ orm type solution.  I was planning
> on
> > working with Haskells Euterpea as base to build my ideas off of, my I
> might
> > end up rolling my own similar library as my aims are a bit different than
> > theirs.
> >
>
> I'm not sure I understand completely, but I agree this isn't a bad idea.
>
> > Everything else would be C++, including the interface, audio and dsp
> > processing etc.   I already have the C++ stuff running on my phone.  I
> have
> > read about the difficulty of getting Haskell working in real world
> > scenarios, but as far as I understand my plans for it are fairly well
> suited
> > to it.
> >
>
> I don't disagree!
>
> > Since much of the documentation online about Haskell seems to be out of
> > date, its tough to get a general feel for whats working.  I see people
> > mention that cross-compilation was finished a while back which should
> allow
> > for targeting arm but nothing concrete and the website gives conflicting
> > info.  I've also considered using GHC to generate C to paste into the
> > project but it seems there have been and may be more integrated ways to
> get
> > it running.
>
> I am venturing into my embarrassing lack of knowledge about GHC
> internals here, but how easily would the run time system work on
> Android..?  I had assumed a large part of the effort into getting
> OCaml to work on iPhone went into the runtime system, no?
>
> If you're (Andrew or anyone) still interested in pursuing this I would
> be interested in helping out, I have some Android internals knowledge
> and would be glad to lend a hand.
>
> One major thing that seems to be necessary is congealing all the
> (mis/outdated)information into the wiki article on haskell.org.
>
> kris
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] curl package broken in Windows

2012-11-10 Thread Andrew Pennebaker
Yes, that's a very good point. Did you know that Strawberry Perl includes a
cygwin gcc?

http://strawberryperl.com

Maybe Haskell Platform could do the same.
On Nov 10, 2012 5:28 PM, "Stephen Tetley"  wrote:

> The only short cut would be to have it in the Platform - otherwise it
> is DIY I'm afraid.
>
> This is as much Microsoft's "fault" as Haskell's for not providing a C
> compiler, build tools etc. in the baseline environment.
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC for mobile devices?

2012-11-09 Thread Andrew Pennebaker
Awesome! Jeffrey Scofield has ported OCaml to
iOS<http://psellos.com/ocaml/compile-to-iossim.html>,
so there's also experience there.

On Fri, Nov 9, 2012 at 11:46 PM, Kristopher Micinski  wrote:

> If you have interest in doing this, I have quite a bit of experience
> in Android hacking at the system level and above and would be glad to
> talk about what might need to happen.  (Though I don't know the GHC
> internals / toolchain so well.)
>
> One potential choice is Scala, though from my limited experience
> that's a very rough imitation of the uses for Haskell.  (Though,
> obviously it works mostly out of the box because of the JVM compiler
> target..)
>
> http://www.haskell.org/haskellwiki/Android
>
> I've been writing up some thoughts on the Android activity lifecycle
> already interpreted with respect to FP, apps are quite functional
> already for a variety of reasons.
>
> kris
>
> On Fri, Nov 9, 2012 at 8:51 PM, Andrew Pennebaker
>  wrote:
> > I'd love to use Haskell directly for making mobiles apps. How can we make
> > this happen, porting GHC to Android, iOS, and Windows Phone?
> >
> > --
> > Cheers,
> >
> > Andrew Pennebaker
> > www.yellosoft.us
> >
> > _______
> > Haskell-Cafe mailing list
> > Haskell-Cafe@haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
>

-- 
Cheers,

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


[Haskell-cafe] Motion to unify all the string data types

2012-11-09 Thread Andrew Pennebaker
Frequently when I'm coding in Haskell, the crux of my problem is converting
between all the stupid string formats.

You've got String, ByteString, Lazy ByteString, Text, [Word], and on and
on... I have to constantly lookup how to convert between them, and the
overloaded strings GHC directive doesn't work, and sometimes
ByteString.unpack doesn't work, because it expects [Word8], not [Char].
AAAH!!!

Haskell is a wonderful playground for experimentation. I've started to
notice that many Hackage libraries are simply instances of typeclasses
designed a while ago, and their underlying implementations are free to play
around with various optimizations... But they ideally all expose the same
interface through typeclasses.

Can we do the same with String? Can we pick a good compromise of lazy vs
strict, flexible vs fast, and all use the same data structure? My vote is
for type String = [Char], but I'm willing to switch to another data
structure, just as long as it's consistently used.

-- 
Cheers,

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


[Haskell-cafe] GHC for mobile devices?

2012-11-09 Thread Andrew Pennebaker
I'd love to use Haskell directly for making mobiles apps. How can we make
this happen, porting GHC to Android, iOS, and Windows Phone?

-- 
Cheers,

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


[Haskell-cafe] curl package broken in Windows

2012-11-09 Thread Andrew Pennebaker
When I do "cabal install curl" in Windows, a missing cygwin dll message
pops up, and packages that depend on curl, like shpider, fail to install.

Specs:

* cabal-install 0.14.0
* Cabal 1.14.0
* GHC 7.4.2
* Haskell Platform 2012
* Windows 7 Proffesional x64

-- 
Cheers,

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


[Haskell-cafe] How do I specify language literals in hsparql?

2012-10-21 Thread Andrew Pennebaker
If the raw SPARQL is rdfs:label "D (programming language)"@en, what would
the hsparql <http://hackage.haskell.org/package/hsparql> syntax be?

The docs<https://github.com/robstewart57/hsparql/blob/master/tests/DBPedia.hs>
don't
include any language literal examples.

-- 
Cheers,

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


Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius

2012-09-14 Thread Andrew Pennebaker
>
> Challenge: get someone to have a competition at one of the conferences
> where students all give their
> best "five minute monad talk" and try to find the most comprehensible one!
>

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


Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius

2012-09-14 Thread Andrew Pennebaker
>
> Everyone in the Haskell cafe probably has a secret dream to give the
> best "five minute monad talk."  Challenge: get someone to have a
> competition at one of the conferences where students all give their
> best "five minute monad talk" and try to find the most comprehensible
> one!
>

Haha, maybe that's why I'm writing.

Agree on all points, not just this quotation.

Yeah, IO and Maybe are the first monads most new Haskell programmers
encounter.  Perhaps a tour of RVars or the accelerate library would give a
better impression. I bet a lot of students get the concept of pure
functional programming, and if you shock them with: "So how would you
implement a PRNG?", they would understand the role monads play.

Given that Maybe and Either don't modify state, nor do they communicate
with outside interfaces, nor do they specify computation ordering, I don't
understand why they're implemented as monads. Why not a primitive typeclass
or even datatype declaration?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius

2012-09-14 Thread Andrew Pennebaker
>
> But, Haskell records aren't better than OOP.
>
> I am not trying to be controversial here -- Haskell records would
> "naturally" implement prototype-based OOP, like JavaScript uses, if they
> (Haskell records) weren't so useless.  This is basically why "lenses" were
> designed (i.e., to make consistent syntax for getters and setters)
>

Hey, I don't want the tutorial to be controversial either, especially since
my word choice of words like "better" are highly subjective. I find
it extraordinarily empowering that Haskell's type system allows programmers
to use a wide variety of programming paradigms: functional, declarative,
imperative, lazy, eager, parallel, quantum, matrix, CUDA, multithreaded,
distributed, logical, object oriented...

When I describe Haskell's type system as better than OOP, what I mean is
this: You can code OOP in Haskell, because the type system can adapt to
that. But it's much harder to go the other way, trying to code GADTs in
Java/C++. In order to get the effect, you'll have to code something as
complex as Scala, at which point you might as well just use Haskell (unless
you really really really need the JVM for compatibility). It's the same
with Lisp or JavaScript or Smalltalk or Ruby: Allowing the programmer to
roll his own paradigm, such as OOP, is more powerful than offering only
that paradigm. More to the point, the monad system enables all of this, and
I'm not sure how to reword this tutorial to reflect that; monads themselves
are generally treated as an advanced lesson, and this one tries to hit the
ground running.

Does anyone know of a brief introductory Haskell tutorial that engages
monads? LYAH covers monads, but it does so after a few chapters of simpler,
pure function Haskell coding. I know of some brief tutorials for monads
that explain them in a variety of creative ways, but they all assume the
reader is at least somewhat familiar with Haskell.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius

2012-09-14 Thread Andrew Pennebaker
>
> Experiment #4:
>
> fib :: Int -> Int
> fib n = mem !! n
>
> mem :: [Int]
> mem = map aux [0..]
> -- remark: even [Int] is not a very efficient data structure for this
>
> aux 0 = 0
> aux 1 = 1
> aux n = mem!!(n-1) + mem!!(n-2)
>
> main :: IO ()
> main = mapM_ (print . fib) (replicate 10 30)
>
> Question: How fast is this compared to #1? Why?
>

Final remark: Evil geniuses should use the scientific method, not the
> opinionative method.


Noted and reflected in the new version.

Thank you for taking the time to write out a detailed, practical analysis
of the question. Yes, I should assume less and test more. I tried
these outas
requested, and came up with results demonstrating that Haskell, does
not, as I mistakenly interpreted, automatically memoize all function calls.
Which makes sense, otherwise memory would quickly run out.

I found some useful reference code on the Haskell Wiki and constructed my
own memoized Fibonacci function using the MemoTrie library, which,
fortunately, is builtin with Haskell Platform and therefore does not
require the tutorial reader to install additional code.

The new version of the tutorial includes an ordinary recursive Fibonacci
function (fib1.hs), and the same code but renamed to fib', memoized using
the memo function from the MemoTrie library (fib2.hs), and exposed as fib.
Unix time information provides real numbers for comparison: The memoized
version is clearly much faster.

I rewrote the section, deleting the part that stated memoization was
automatic, and added text describing how Haskell makes memoization easy.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius

2012-09-14 Thread Andrew Pennebaker
A summary of the changes I've included so far:


> Under Declarative, you aren't creating a "named expression, 2 + 2", really.
> You are redefining (+).
>
>
Noted and reflected in the new version.


> Under Lazy, your example of binding fib 30 is not a good example of
> memoization. With memoization you typically call the underlying computation
> the first time, and memoize it for repeated retrieval later, not hardwire
> in
> values at compile time. Here you never ever call the real fib at all. On
> top
> of everything else, it'd be too easy to introduce a typo into one of your
> hardwired constant values.
>
>
Noted and reflected in the new version. After several comments to this
effect, I do not want to misrepresent memoization in the tutorial.
Sometimes it is useful to be slightly inaccurate in a tutorial in order to
help bridge the gap between someone with no experience in a something vs
the wealth of knowledge and complexity in the thing itself. This is not one
of those times, and fortunately, fixing the misrepresentation in my
tutorial is as easy as removing the hardcoded call.

One thing I want to double check is that Haskell does, in fact,
automatically memoize all pure function calls. Is this true?

I would still like to provide a performance comparison of the Fibonacci
code with and without memoization, for readers who enjoy numerical
evidence, using the Unix "time" command, but I don't know how to turn
memoization off. I guess I would have to reimplement the algorithm in a way
that can't make use of memoization. Any suggestions?

Under Infinite, you should use "sieve (n:ns)" pattern matching instead of
> calling head.
>

Thank you! I try to make use of Haskell pattern matching wherever I can.
Since I needed to refer to the whole list, as well as the head and tail, I
originally used "head" instead of pattern matching. Noted and reflected in
the new version.


> Under Type-Safe
> Subtle distinction, but returning () is not the same as returning nothing
> at all.
>

True. Noted and reflected in the new version. What's the Haskell name for
() again? I fear explaining the exact type information of IO () may be too
much for a brief introduction to Haskell to cover.


> s/ommitted/omitted/
>

Noted and reflected in the new version.


> You've got an unusual indentation scheme. Consider adopting a more standard
> one for your tutorial.
>

I'm in the camp of hard tabs rather than soft tabs, and that preference is
probably responsible for much of the difference in indentation scheme.
Unfortunately, HTML is terrible at representing hard tabs in  code
with a custom width preference; they all come out looking like some idiot
pressed space bar eight times. I could use JavaScript to remedy this, but
for now, I like to directly copy and paste my working code from .HS files
into  tags just in case.

If tabs are *not* the issue, then maybe I'm not indenting far enough to the
right for some tastes? Or maybe it's my tendency to put "where" on its own
line, something a Perl obfuscater would detest. I dunno. If someone would
suggest a more idiomatic indentation scheme for my code so that I know
exactly what is different, I can take a look.


> In general, monotonically decreasing is not sufficient to prove you will
> hit
> a base case. For example, decreasing by 5 would still be monotonically
> decreasing, and could jump right over your base cases.
> (Not arguing that the code is incorrect, but rather than your explanation
> is
> a little misleading/incomplete.)
>

Understood. Noted and reflected in the new version.

Incidentally, when will Nat be available in Haskell? The Fibonacci
algorithm is designed to work only over natural numbers, and the best way
to express this in the type system is with Nat. But this type doesn't seem
available out-of-the-box for Haskell users. Unless I'm using my Haskell
Platform (GHC 7.0.3) is slightly outdated. Eh?


> Again, further confusion about what memoization really is.
>
>
> Under Records
>
> "Functions are already defined by their data structures; they are already
> semantically bundled..." doesn't seem to make sense.
>

Noted and reflected... I'm trying to convey to an audience largely composed
of Java and C++ fanatics how Haskell records are much better than OOP, how
GADTs are more intuitive, robust, ... OOP doesn't even compare! That's what
I'm trying to get across in that bit. And it's hard to do this in just a
few sentences, especially when the reader isn't even familiar with GADTs in
the first place.

"... acts on the specific constructor, blasting fools, murdering crowds..."
> makes it sound like fireOn actually has side effects.
>

A truly fair point. Would you like to contribute a monad for blowing up the
moon?

Another comment:


> "As a declarative language, Haskell manipulates expressions, eventually
> reducing expressions to values."


> Huh? In what sense do declarative languages manipulate expressions? Sounds
> like a classic syntax/semantics confusion, especially

[Haskell-cafe] Tutorial: Haskell for the Evil Genius

2012-09-14 Thread Andrew Pennebaker
I've gotten mixed feedback from Reddit for my tutorial. It provides an
overview of how functional and declarative programming in Haskell empower
baddies, increasing the accuracy and efficiency of their atomic
superweapons. What do you guys think of my tutorial, Haskell for the Evil
Genius <http://www.yellosoft.us/evilgenius/>?

Cheers,

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


[Haskell-cafe] How do I generate random numbers using random-fu, with platform-agnostic code?

2012-09-13 Thread Andrew Pennebaker
I can't figure out how to use Data.Random.Source.IO to generate random
numbers in a multiplatform way.

I can generate random numbers in Unix using Data.Random.Source.DevRandom,
and there is an example in the GitHub documentation for Windows using
Data.Random.Source.MWC, but there is no example code for using
Data.Random.Source.IO.

Cheers,

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


Re: [Haskell-cafe] FFI for a beginner

2011-07-14 Thread Andrew Pennebaker
FIXED IT!!!

The problem with charm.hs and its FFI dependency charm.c is that both want
to produce an intermediary charm.o file.

Solution: rename charm.hs to hscharm.hs.

Cheers,

Andrew Pennebaker
www.yellosoft.us



On Tue, Apr 12, 2011 at 5:55 PM, Andrew Pennebaker <
andrew.penneba...@gmail.com> wrote:

> hsc2hs and c2hs are good suggestions, and some of the tutorials I'm
> following use them.
>
> But 1) Many Haskell FFI tutorials don't require them, so they only seem to
> help, or only help in older versions of GHC.
>
> And 2) When I did compile using c2hs, it just produced the same file, but
> with filler comments like {#- LINE 13 #-}. And they still refused to compile
> for the same reason:
>
> ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o
>
> Cheers,
>
> Andrew Pennebaker
> www.yellosoft.us
>
> On Sat, Apr 9, 2011 at 9:50 PM, Jason Dagit  wrote:
>
>> I don't know how to make ghc load them without using either hsc2hs or
>> c2hs. I've had better experiences with hsc, but your mileage may vary.
>>
>> On Apr 8, 2011 3:34 AM, "Andrew Pennebaker" 
>> wrote:
>>
>> ncurses is proving too difficult to setup, so I'm working on a new library
>> called charm. The C code works by itself, but I can't compile a Haskell
>> wrapper for it. While the tutorials at 
>> HaskellWiki<http://www.haskell.org/haskellwiki/FFI_complete_examples>are 
>> helpful, they're outdated. Argh! The
>> docs<http://www.haskell.org/ghc/docs/latest/html/users_guide/ffi-ghc.html#glasgow-foreign-headers>say
>>  that -#include pragmas no longer work, but fail to explain how to load
>> code without them. Suffice to say I have no recourse but trial and error.
>>
>> GitHub: charm <https://github.com/mcandre/charm> and 
>> hscharm<https://github.com/mcandre/hscharm>
>>
>> <https://github.com/mcandre/charm>$ make
>> cp /usr/include/charm.c .
>> ghc --make -fforce-recomp -o hellocharm hellocharm.hs charm.hs charm.c
>> -I/usr/include -dylib-install-name /usr/lib/libcharm.dynlib
>> [1 of 2] Compiling Charm( charm.hs, charm.o )
>> [2 of 2] Compiling Main ( hellocharm.hs, hellocharm.o )
>> Linking hellocharm ...
>> ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o
>> collect2: ld returned 1 exit status
>> make: *** [hellocharm] Error 1
>>
>> Cheers,
>>
>> Andrew Pennebaker
>> www.yellosoft.us
>>
>> ___
>> 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] Cabal uninstall

2011-07-09 Thread Andrew Pennebaker
Please add an automated uninstall option for Cabal packages. It's a pain to
remove them manually, and the user expectation based on other package
managers (Gem, Aptitude, MacPorts, Homebrew, Yum, Emerge) is that "cabal
uninstall"/"cabal remove" does the intuitive thing: remove packages and
their dependencies.

Cheers,

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


[Haskell-cafe] GHC repositories

2011-04-27 Thread Andrew Pennebaker
Now that GHC has a git
repository<http://hackage.haskell.org/trac/ghc/wiki/Repositories>,
could that change be reflected in the docs<http://www.haskell.org/ghc/download>
?

It's hard to work with folks on Trac to debug GHC when I can't find the
latest version (changesets are now git, not svn).

Cheers,

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


Re: [Haskell-cafe] HipmunkPlayground compile error

2011-04-26 Thread Andrew Pennebaker
Thanks for the tip. GHC 7.0.3 does seem to fix a couple bugs, and maybe even
run faster than GHC 7.0.2.

But it doesn't solve the problem.

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.0.3
$ cabal --version
cabal-install version 0.10.2
using version 1.10.1.0 of the Cabal library
$ cabal install hipmunk
(works)
$ cabal install hipmunkplayground
(dozens of GLFW warnings)
...
Updating documentation index /Users/andrew/Library/Haskell/doc/index.html
cabal: Error: some packages failed to install:
GLFW-0.4.2 failed during the building phase. The exception was:
ExitFailure 1
HipmunkPlayground-5.2.0.3 depends on GLFW-0.4.2 which failed to install.
$ cabal install glfw
(dozens of GLFW warnings)
...
cabal: Error: some packages failed to install:
GLFW-0.4.2 failed during the building phase. The exception was:
ExitFailure 1

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Tue, Apr 26, 2011 at 4:49 AM, Jason Dagit  wrote:

>
>
> On Tue, Apr 26, 2011 at 1:38 AM, Andrew Pennebaker <
> andrew.penneba...@gmail.com> wrote:
>
>> $ system_profiler SPSoftwareDataType | grep "System Version"
>>   System Version: Mac OS X 10.6.7 (10J869)
>> $ ghc --version
>> The Glorious Glasgow Haskell Compilation System, version 7.0.2
>> $ cabal --version
>> cabal-install version 0.10.2
>> using version 1.10.1.0 of the Cabal library
>> $ cabal install hipmunkplayground
>> ...
>> Updating documentation index /Users/andrew/Library/Haskell/doc/index.html
>> cabal: Error: some packages failed to install:
>> GLFW-0.4.2 failed during the building phase. The exception was:
>> ExitFailure 1
>> HipmunkPlayground-5.2.0.3 depends on GLFW-0.4.2 which failed to install.
>>
>
> GLFW is the package that failed to install.  The reason for that should be
> in the scroll back somewhere but it can often be hard to find when it's
> buried in a huge list of compilation messages.  If you try with just GLFW,
> eg., cabal install GLFW, then it should be easier to spot the error.
>
> Since you're on a mac, I would highly recommend getting the latest haskell
> platform.  You're on 7.0.2 which has bug fixes that are relevant to build
> failures on OSX, as I understand it.
>
> Jason
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] HipmunkPlayground compile error

2011-04-26 Thread Andrew Pennebaker
$ system_profiler SPSoftwareDataType | grep "System Version"
  System Version: Mac OS X 10.6.7 (10J869)
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.0.2
$ cabal --version
cabal-install version 0.10.2
using version 1.10.1.0 of the Cabal library
$ cabal install hipmunkplayground
...
Updating documentation index /Users/andrew/Library/Haskell/doc/index.html
cabal: Error: some packages failed to install:
GLFW-0.4.2 failed during the building phase. The exception was:
ExitFailure 1
HipmunkPlayground-5.2.0.3 depends on GLFW-0.4.2 which failed to install.

Cheers,

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


[Haskell-cafe] Trac configuration error

2011-04-19 Thread Andrew Pennebaker
Try to visit http://trac.haskell.org/ghc.



Python 2.5.2: /usr/bin/pythonTue Apr 19 15:02:32 2011A problem occurred in a
Python script.


Cheers,

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


[Haskell-cafe] 64 bit generic link warning on every compile

2011-04-15 Thread Andrew Pennebaker
 GHC 7 compiles fine, but there's an additional warning during linking.

$ system_profiler SPSoftwareDataType | grep "System Version"
  System Version: Mac OS X 10.6.7 (10J869)
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.0.2
$ cat hello.hs
#!/usr/bin/env runhaskell

module Main where

main :: IO ()
main = putStrLn "Hello World"
$ ghc --make hello.hs
[1 of 1] Compiling Main ( hello.hs, hello.o )
Linking hello ...
ld: warning: -read_only_relocs cannot be used with x86_64
$ ./hello
Hello World

Cheers,

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


Re: [Haskell-cafe] Experimental 64 bit installer fails

2011-04-14 Thread Andrew Pennebaker
I can confirm that Mark's Haskell 2011.2.0.0-x86_64 Mac OS X installer fix
works :)

cd /Library/Haskell/ghc-7.0.2/lib/registrations
for c in *.conf; do echo == $c ==; ghc-pkg register --force $c; done


My goal is to get Haskell ncurses working. c2hs is required, so I did:

$ cabal --version
cabal-install version 0.10.2
using version 1.10.1.0 of the Cabal library

$ cabal install c2hs
$ c2hs
-bash: c2hs: command not found

It appears Cabal never added ~/Library/Haskell/ghc-7.0.2/lib/c2hs-0.16.3/bin
to PATH. It's easy enough for me personally to fix, but Haskell 2010 didn't
have this problem.

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Thu, Apr 14, 2011 at 7:28 PM, Mark Lentczner 
wrote:

> Well that's no fun! The install looks like it mostly worked, execept that
> the final registration of the installed packages failed because for some
> reason the script has them out of order.
>
> You can "fix up" your install by doing this:
>
> cd /Library/Haskell/ghc-7.0.2/lib/registrations
> for c in *.conf; do echo == $c ==; ghc-pkg register --force $c; done
>
>
> I'll have to look into why that build of the package got the files out of
> order...
>  - Mark
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Experimental 64 bit installer fails

2011-04-14 Thread Andrew Pennebaker
1.2.0.0-x86_64.pkg";\n
   PKInstallPackageIdentifier =
"org.haskell.HaskellPlatform.Libraries.pkg";\n}
Apr 14 17:59:19 wonko Installer[18657]: install:didFailWithError:Error
Domain=PKInstallErrorDomain Code=112 UserInfo=0x1002af810 "An error occurred
while running scripts from the package “Haskell Platform
2011.2.0.0-x86_64.pkg”."
Apr 14 17:59:19 wonko Installer[18657]: Install failed: The Installer
encountered an error that caused the installation to fail. Contact the
software manufacturer for assistance.
Apr 14 17:59:19 wonko Installer[18657]: IFDInstallController 23DC40 state =
7
Apr 14 17:59:19 wonko Installer[18657]: Displaying 'Install Failed' UI.
Apr 14 17:59:19 wonko Installer[18657]: 'Install Failed' UI displayed
message:'The Installer encountered an error that caused the installation to
fail. Contact the software manufacturer for assistance.'.
Apr 14 18:02:50 wonko Installer[24606]: @(#)PROGRAM:Install
 PROJECT:Install-595.1
Apr 14 18:02:50 wonko Installer[24606]: @(#)PROGRAM:Installer
 PROJECT:Installer-430.1
Apr 14 18:02:50 wonko Installer[24606]: Hardware: MacBookPro5,5 @ 2.53 GHz
(x 2), 4096 MB RAM
Apr 14 18:02:50 wonko Installer[24606]: Running OS Build: Mac OS X 10.6.7
(10J869)
Apr 14 18:02:50 wonko Installer[24606]: Env:
PATH=/usr/bin:/bin:/usr/sbin:/sbin
Apr 14 18:02:50 wonko Installer[24606]: Env:
TMPDIR=/var/folders/N-/N-IxaaKuFae5ik1WKxV6wE+++TI/-Tmp-/
Apr 14 18:02:50 wonko Installer[24606]: Env: SHELL=/bin/bash
Apr 14 18:02:50 wonko Installer[24606]: Env: HOME=/Users/andrew
Apr 14 18:02:50 wonko Installer[24606]: Env: USER=andrew
Apr 14 18:02:50 wonko Installer[24606]: Env: LOGNAME=andrew
Apr 14 18:02:50 wonko Installer[24606]: Env:
DISPLAY=/tmp/launch-IvsorY/org.x:0
Apr 14 18:02:50 wonko Installer[24606]: Env:
SSH_AUTH_SOCK=/tmp/launch-kqVUwk/Listeners
Apr 14 18:02:50 wonko Installer[24606]: Env:
Apple_PubSub_Socket_Render=/tmp/launch-dpKpq2/Render
Apr 14 18:02:50 wonko Installer[24606]: Env: COMMAND_MODE=unix2003
Apr 14 18:02:50 wonko Installer[24606]: Env:
__CF_USER_TEXT_ENCODING=0x1F5:0:0

Cheers,

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


Re: [Haskell-cafe] FFI for a beginner

2011-04-12 Thread Andrew Pennebaker
hsc2hs and c2hs are good suggestions, and some of the tutorials I'm
following use them.

But 1) Many Haskell FFI tutorials don't require them, so they only seem to
help, or only help in older versions of GHC.

And 2) When I did compile using c2hs, it just produced the same file, but
with filler comments like {#- LINE 13 #-}. And they still refused to compile
for the same reason:

ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Sat, Apr 9, 2011 at 9:50 PM, Jason Dagit  wrote:

> I don't know how to make ghc load them without using either hsc2hs or c2hs.
> I've had better experiences with hsc, but your mileage may vary.
>
> On Apr 8, 2011 3:34 AM, "Andrew Pennebaker" 
> wrote:
>
> ncurses is proving too difficult to setup, so I'm working on a new library
> called charm. The C code works by itself, but I can't compile a Haskell
> wrapper for it. While the tutorials at 
> HaskellWiki<http://www.haskell.org/haskellwiki/FFI_complete_examples>are 
> helpful, they're outdated. Argh! The
> docs<http://www.haskell.org/ghc/docs/latest/html/users_guide/ffi-ghc.html#glasgow-foreign-headers>say
>  that -#include pragmas no longer work, but fail to explain how to load
> code without them. Suffice to say I have no recourse but trial and error.
>
> GitHub: charm <https://github.com/mcandre/charm> and 
> hscharm<https://github.com/mcandre/hscharm>
>
> <https://github.com/mcandre/charm>$ make
> cp /usr/include/charm.c .
> ghc --make -fforce-recomp -o hellocharm hellocharm.hs charm.hs charm.c
> -I/usr/include -dylib-install-name /usr/lib/libcharm.dynlib
> [1 of 2] Compiling Charm( charm.hs, charm.o )
> [2 of 2] Compiling Main ( hellocharm.hs, hellocharm.o )
> Linking hellocharm ...
> ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o
> collect2: ld returned 1 exit status
> make: *** [hellocharm] Error 1
>
> Cheers,
>
> Andrew Pennebaker
> www.yellosoft.us
>
> ___
> 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] FFI for a beginner

2011-04-08 Thread Andrew Pennebaker
ncurses is proving too difficult to setup, so I'm working on a new library
called charm. The C code works by itself, but I can't compile a Haskell
wrapper for it. While the tutorials at
HaskellWiki<http://www.haskell.org/haskellwiki/FFI_complete_examples>are
helpful, they're outdated. Argh! The
docs<http://www.haskell.org/ghc/docs/latest/html/users_guide/ffi-ghc.html#glasgow-foreign-headers>say
that -#include pragmas no longer work, but fail to explain how to load
code without them. Suffice to say I have no recourse but trial and error.

GitHub: charm <https://github.com/mcandre/charm> and
hscharm<https://github.com/mcandre/hscharm>

<https://github.com/mcandre/charm>$ make
cp /usr/include/charm.c .
ghc --make -fforce-recomp -o hellocharm hellocharm.hs charm.hs charm.c
-I/usr/include -dylib-install-name /usr/lib/libcharm.dynlib
[1 of 2] Compiling Charm( charm.hs, charm.o )
[2 of 2] Compiling Main ( hellocharm.hs, hellocharm.o )
Linking hellocharm ...
ld: duplicate symbol _Charm_getWidth_info in charm.o and charm.o
collect2: ld returned 1 exit status
make: *** [hellocharm] Error 1

Cheers,

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


Re: [Haskell-cafe] ncurses trouble

2011-04-05 Thread Andrew Pennebaker
Also, nanocurses fails to compile on Mac OS X 10.6.6 with GHC 7.0.2.

$ cabal install nanocurses
Resolving dependencies...
Downloading nanocurses-1.5.2...
Configuring nanocurses-1.5.2...
Preprocessing library nanocurses-1.5.2...
In file included from Curses.hsc:42:
cbits/utils.h:7:20: error: config.h: No such file or directory
compiling dist/build/UI/Nanocurses/Curses_hsc_make.c failed (exit code 1)
command was: /usr/bin/gcc -c dist/build/UI/Nanocurses/Curses_hsc_make.c -o
dist/build/UI/Nanocurses/Curses_hsc_make.o -march=i686 -m32 -isysroot
/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5
-fno-stack-protector -march=i686 -m32 -isysroot
/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5
-fno-stack-protector -march=i686 -m32 -isysroot
/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5
-D__GLASGOW_HASKELL__=700 -Ddarwin_BUILD_OS -Ddarwin_HOST_OS
-Di386_BUILD_ARCH -Di386_HOST_ARCH -Icbits
-I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/unix-2.4.2.0/include
-I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/bytestring-0.9.1.10/include
-I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/base-4.3.1.0/include
-I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/include
-I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/include
-I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/include/
cabal: Error: some packages failed to install:
nanocurses-1.5.2 failed during the building phase. The exception was:
ExitFailure 1

Cheers,

Andrew Pennebaker
www.yellosoft.us



On Tue, Apr 5, 2011 at 11:46 PM, Andrew Pennebaker <
andrew.penneba...@gmail.com> wrote:

> I'm having trouble using Haskell and ncurses Mac OS X (10.6.6 to be
> precise).
>
> GHC 6.12.3 gives me a lot of trouble, and GHC 7.0.2 even more.
>
> rogue.hs, is a text adventure game in the works.
>
> $ cat rogue.hs
> {-# LANGUAGE OverloadedStrings #-}
> import Data.Text
> import UI.NCurses
>
> main :: IO ()
> main = runCurses $ do
> win <- defaultWindow
> updateWindow win $ do
> moveCursor 10 10
> drawText "Hello world! Hit 'q' to exit"
> render
> waitForQ win
>
> waitForQ :: Window -> Curses ()
> waitForQ win = do
> ev <- getEvent win Nothing
> case ev of
> Just (EventCharacter 'q') -> return ()
> _ -> waitForQ win
>
> $ sudo port install ncurses ncursesw
> $ cabal install ncurses
> Resolving dependencies...
> Configuring ncurses-0.2...
> cabal: c2hs version >=0.15 is required but it could not be found.
> cabal: Error: some packages failed to install:
> ncurses-0.2 failed during the configure step. The exception was:
> ExitFailure 1
>
> Hmm. Cabal couldn't find a solution to the c2hs dependency. So I install it
> manually.
>
> $ cabal install c2hs
> $ cabal install ncurses
> Resolving dependencies...
> Configuring ncurses-0.2...
> cabal: Missing dependency on a foreign library:
> * Missing C library: ncursesw
> This problem can usually be solved by installing the system package that
> provides this library (you may need the "-dev" version). If the library is
> already installed but in a non-standard location then you can use the flags
> --extra-include-dirs= and --extra-lib-dirs= to specify where it is.
> cabal: Error: some packages failed to install:
> ncurses-0.2 failed during the configure step. The exception was:
> ExitFailure 1
>
> MacPorts' ncurses isn't detected by Haskell, so I use Homebrew's.
>
> $ brew install ncursesw
> $ ghc --make -o rogue rogue.hs
> [2 of 2] Compiling Main ( rogue.hs, rogue.o )
> Linking rogue ...
> ld: warning: in /usr/local/lib/libncursesw.dylib, file was built for
> unsupported file format which is not the architecture being linked (i386)
>
> It appears that the Homebrew ncurses library is x86, and GHC is x86_64, or
> vice-versa.
>
> $ sudo port install ncurses +universal
> $ sudo port install ncursesw +universal
> $ brew install --universal ncursesw
>
> These don't visibly improve compilation in any way.
>
> I thought updating Haskell would fix the problem.
>
> $ wget
> http://lambda.galois.com/hp-tmp/2011.2.0.0/Haskell%20Platform%202011.2.0.0-i386.pkg
> $ sudo installer -pkg "Haskell Platform 2011.2.0.0-i386.pkg" -target /
> $ ghc --version
> The Glorious Glasgow Haskell Compilation System, version 7.0.2
> $ cabal --version
> cabal-install version 0.10.2
> using version 1.10.1.0 of the Cabal library
>
> But it only made the problem worse. Now ncurses won't even build.
>
> $ cabal install ncurses
> Resolving dependencies...
> Configuring

[Haskell-cafe] ncurses trouble

2011-04-05 Thread Andrew Pennebaker
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking curses.h usability... yes
checking curses.h presence... yes
checking for curses.h... yes
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking ncursesw/ncurses.h usability... no
checking ncursesw/ncurses.h presence... yes
configure: WARNING: ncursesw/ncurses.h: present but cannot be compiled
configure: WARNING: ncursesw/ncurses.h: check for missing prerequisite
headers?
configure: WARNING: ncursesw/ncurses.h: see the Autoconf documentation
configure: WARNING: ncursesw/ncurses.h: section "Present But Cannot Be
Compiled"
configure: WARNING: ncursesw/ncurses.h: proceeding with the preprocessor's
result
configure: WARNING: ncursesw/ncurses.h: in the future, the compiler will
take precedence
checking for ncursesw/ncurses.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
configure: creating ./config.status
config.status: creating hscurses.buildinfo
config.status: creating cbits/config.h
configure: WARNING: unrecognized options: --with-gcc
cabal: Missing dependency on a foreign library:
* Missing (or bad) header file: HSCurses.h
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by the
C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
cabal: Error: some packages failed to install:
hscurses-1.4.0.0 failed during the configure step. The exception was:
ExitFailure 1

Cheers,

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


[Haskell-cafe] MissingH won't upgrade

2011-02-10 Thread Andrew Pennebaker
Specs:

   - cabal-install 0.8.2
   - Cabal 1.8.0.6
   - GHC 6.12.3
   - Mac OS X 10.6.6
   - MacBook Pro 5,1

$ cabal upgrade missingh
Resolving dependencies...
Configuring regex-base-0.93.2...
Preprocessing library regex-base-0.93.2...
Building regex-base-0.93.2...
[1 of 4] Compiling Text.Regex.Base.RegexLike ( Text/Regex/Base/RegexLike.hs,
dist/build/Text/Regex/Base/RegexLike.o )
[2 of 4] Compiling Text.Regex.Base.Context ( Text/Regex/Base/Context.hs,
dist/build/Text/Regex/Base/Context.o )
[3 of 4] Compiling Text.Regex.Base  ( Text/Regex/Base.hs,
dist/build/Text/Regex/Base.o )
[4 of 4] Compiling Text.Regex.Base.Impl ( Text/Regex/Base/Impl.hs,
dist/build/Text/Regex/Base/Impl.o )
Registering regex-base-0.93.2...
Installing library in /Users/andrew/.cabal/lib/regex-base-0.93.2/ghc-6.12.3
Registering regex-base-0.93.2...
Configuring regex-posix-0.94.4...
Preprocessing library regex-posix-0.94.4...
Building regex-posix-0.94.4...
[1 of 6] Compiling Text.Regex.Posix.Wrap (
dist/build/Text/Regex/Posix/Wrap.hs, dist/build/Text/Regex/Posix/Wrap.o )
[2 of 6] Compiling Text.Regex.Posix.String ( Text/Regex/Posix/String.hs,
dist/build/Text/Regex/Posix/String.o )
[3 of 6] Compiling Text.Regex.Posix.Sequence ( Text/Regex/Posix/Sequence.hs,
dist/build/Text/Regex/Posix/Sequence.o )
[4 of 6] Compiling Text.Regex.Posix.ByteString (
Text/Regex/Posix/ByteString.hs, dist/build/Text/Regex/Posix/ByteString.o )
[5 of 6] Compiling Text.Regex.Posix.ByteString.Lazy (
Text/Regex/Posix/ByteString/Lazy.hs,
dist/build/Text/Regex/Posix/ByteString/Lazy.o )
[6 of 6] Compiling Text.Regex.Posix ( Text/Regex/Posix.hs,
dist/build/Text/Regex/Posix.o )
Registering regex-posix-0.94.4...
Installing library in /Users/andrew/.cabal/lib/regex-posix-0.94.4/ghc-6.12.3
Registering regex-posix-0.94.4...
Configuring regex-compat-0.93.1...
Preprocessing library regex-compat-0.93.1...
Building regex-compat-0.93.1...
[1 of 1] Compiling Text.Regex   ( Text/Regex.hs, dist/build/Text/Regex.o
)
Registering regex-compat-0.93.1...
Installing library in
/Users/andrew/.cabal/lib/regex-compat-0.93.1/ghc-6.12.3
Registering regex-compat-0.93.1...
Configuring MissingH-1.1.0.3...
Preprocessing library MissingH-1.1.0.3...
Preprocessing executables for MissingH-1.1.0.3...
Building MissingH-1.1.0.3...
[ 1 of 47] Compiling System.Console.GetOpt.Utils (
src/System/Console/GetOpt/Utils.hs, dist/build/System/Console/GetOpt/Utils.o
)
[ 2 of 47] Compiling System.Debian( src/System/Debian.hs,
dist/build/System/Debian.o )
[ 3 of 47] Compiling System.IO.WindowsCompat (
src/System/IO/WindowsCompat.hs, dist/build/System/IO/WindowsCompat.o )
[ 4 of 47] Compiling System.Posix.Consts ( src/System/Posix/Consts.hs,
dist/build/System/Posix/Consts.o )
[ 5 of 47] Compiling System.IO.StatCompat ( src/System/IO/StatCompat.hs,
dist/build/System/IO/StatCompat.o )
[ 6 of 47] Compiling System.IO.PlafCompat ( src/System/IO/PlafCompat.hs,
dist/build/System/IO/PlafCompat.o )
[ 7 of 47] Compiling Data.Compression.Inflate (
src/Data/Compression/Inflate.hs, dist/build/Data/Compression/Inflate.o )
[ 8 of 47] Compiling Data.Hash.MD5.Zord64_HARD (
src/Data/Hash/MD5/Zord64_HARD.lhs, dist/build/Data/Hash/MD5/Zord64_HARD.o )

src/Data/Hash/MD5/Zord64_HARD.lhs:4:2:
Bad interface file:
/Users/andrew/.cabal/lib/haskell98-1.1.0.0/ghc-6.12.3/Word.hi
Something is amiss; requested module  haskell98:Word differs from
name found in the interface file haskell98-1.1.0.0:Word
cabal: Error: some packages failed to install:
MissingH-1.1.0.3 failed during the building phase. The exception was:
ExitFailure 1

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