[Haskell-cafe] help

Ezekiel Smithburg tehgeekmeister at gmail.com
Sun Dec 6 18:12:31 EST 2009


On Sun, Dec 6, 2009 at 4:53 AM, <haskell-cafe-request at haskell.org> wrote:

> Send Haskell-Cafe mailing list submissions to
>        haskell-cafe at haskell.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://www.haskell.org/mailman/listinfo/haskell-cafe
> or, via email, send a message with subject or body 'help' to
>        haskell-cafe-request at haskell.org
>
> You can reach the person managing the list at
>        haskell-cafe-owner at haskell.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Haskell-Cafe digest..."
>
> Today's Topics:
>
>   1. Re: Low Level Audio - Writing bytes to the sound card?
>      (Daniel Fischer)
>   2. Re: HP + Gtk2hs? (M Xyz)
>   3. Re: Low Level Audio - Writing bytes to the sound card? (M Xyz)
>   4. Re: Low Level Audio - Writing bytes to the sound card?
>      (Daniel Fischer)
>   5. RE: Low Level Audio - Writing bytes to the sound card? (john lask)
>   6. Re: New Hackage category: Error Handling (Henning Thielemann)
>   7. Re: Low Level Audio - Writing bytes to the sound card? (M Xyz)
>   8. RE: Low Level Audio - Writing bytes to the sound card? (M Xyz)
>   9. PortAudio library successfully built on Windows (M Xyz)
>  10. When are undecidables ok? (Michael Snoyman)
>  11. Re: When are undecidables ok? (Luke Palmer)
>  12. Re: When are undecidables ok? (Michael Snoyman)
>  13. Re: ANNOUNCE:  error-message (Ariel J. Birnbaum)
>  14. Re: What is the rank of a polymorphic type? (Eugene Kirpichov)
>  15. Re: universal binary version of Haskell Platform?
>      (Benjamin L.Russell)
>  16. Re: What is the rank of a polymorphic type? (Dan Doel)
>  17. Re[2]: [Haskell-cafe] Low Level Audio - Writing bytes to the
>      sound     card? (Bulat Ziganshin)
>  18. Re: universal binary version of Haskell Platform?
>      (Heinrich Apfelmus)
>  19. Re: Low Level Audio - Writing bytes to the sound card?
>      (Andrew Coppin)
>  20. Re: binding to C libraries on Windows was Low Level       Audio -
>      Writing bytes to the sound card? (Andrew Coppin)
>
>
> ---------- Forwarded message ----------
> From: Daniel Fischer <daniel.is.fischer at web.de>
> To: haskell-cafe at haskell.org
> Date: Sun, 6 Dec 2009 01:24:17 +0100
> Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
> Am Sonntag 06 Dezember 2009 00:47:38 schrieb M Xyz:
> > Daniel, Thank you for your thoughtful reply. I didn't know about those
> > flags. The log is fairly long, and as I'm new to Haskell and Cabal it is
> > mostly meaningless to me. I see very many incidences of "searching for
> ___
> > in path. Cannot find ___ on the path" so maybe this is all as simple as
> me
> > not setting my environment correctly.
>
> If you have cpphs, hugs, jhc, greencard etc., it is probably something
> about your
> environment. If you don't have them, it's clear that they aren't found.
>
> On the other hand, that doesn't explain
>
> Using c2hs version 0.16.0 given by user at: C:\Program
> Files\Haskell\bin\c2hs.exe
>
> -- so it finds c2hs, and can apparently run c2hs --version
>
> ("C:\\Program
> Files\\Haskell\\bin\\c2hs.exe",["--include=dist\\build","--cppopts=-
> D__GLASGOW_HASKELL__=610","--cppopts=-IC:
>
> \\A\\install\\programming\\portaudio\\portaudio\\include","--output-dir=dist\\build","--
> output=Sound\\PortAudio\\Base.hs",".\\Sound\\PortAudio\\Base.chs"])
> c2hs.exe: does not exist
> C:\Program Files\Haskell\bin\c2hs.exe returned ExitFailure 1
>
> -- bang
>
> To ascertain whether c2hs works at all, can you try to run it manually?
>
> (cd to an appropriate directory,
>
> cabal unpack portaudio
>
> cd portaudio (or whatever, so that Base.chs is found via
> .\Sound\PortAudio\Base.chs
>
> md dist\build
>
> c2hs.exe  --include=dist\build --cppopts=-D__GLASGOW_HASKELL__=610
> --cppopts=-IC:
> \A\install\programming\portaudio\portaudio\include --output-dir=dist\build
> --
> output=Sound\PortAudio\Base.hs .\Sound\PortAudio\Base.chs
> )
> If that works, the problem is somewhere in cabal, otherwise in c2hs, either
> way, we'll
> know more.
>
>
>
> ---------- Forwarded message ----------
> From: M Xyz <functionallyharmonious at yahoo.com>
> To: haskell-cafe at haskell.org, Andrew Coppin <andrewcoppin at btinternet.com>
> Date: Sat, 5 Dec 2009 16:34:52 -0800 (PST)
> Subject: Re: [Haskell-cafe] HP + Gtk2hs?
>
>
> --- On *Sat, 12/5/09, Andrew Coppin <andrewcoppin at btinternet.com>* wrote:
>
> >> Hell, I even followed a C++ guide to Win32 programming and
> >> managed to translate an "open a blank window" program to Haskell, and it
> >> worked. Maybe somebody just needs to sit down and write a nice binding
> >> for doing native GUI stuff under Win32?
>
> Well there's
> http://haskell.org/ghc/docs/latest/html/libraries/Win32/Graphics-Win32.htmlfor opening blank windows. ;)
>
> This relates to my question a couple days ago about a good cross platform
> 2d library. I wonder why there isnt a Haskell library that follows in the
> footsteps of Java's Swing - by that I mean, just have a very simple low
> level way of opening a window, getting mouse clicks, and an abstracted
> drawing layer... and make the GUIs with that. The GUIs are drawn and not OS
> widgets. That's exactly why I was looking for something like Cairo. My
> interest is in composable fudgets (stealing the word from fudgets).
>
> This way every platform can share the same GUI library and HP can ship with
> the minimal tools to open a window and draw on every system. Plus OS guis
> are the wrong thing for Haskell. You need to retain the power to make better
> abstractions.
>
>
>
>
>
> ---------- Forwarded message ----------
> From: M Xyz <functionallyharmonious at yahoo.com>
> To: haskell-cafe at haskell.org, Daniel Fischer <daniel.is.fischer at web.de>
> Date: Sat, 5 Dec 2009 16:49:49 -0800 (PST)
> Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
>
>
> --- On *Sat, 12/5/09, Daniel Fischer <daniel.is.fischer at web.de>* wrote:
>
>
>
> If you have cpphs, hugs, jhc, greencard etc., it is probably something
> about your
> environment. If you don't have them, it's clear that they aren't found.
>
> I don't know what those things are. I have nothing but what came with HP
> other than installing c2hs today.
>
> If that works, the problem is somewhere in cabal, otherwise in c2hs, either
> way, we'll
> know more.
>
> Alright, I followed the instructions and everything was as you said. I
> still get "c2hs.exe does not exist".
>
> C:\A\install\programming\portaudio\haskell\portaudio-0.0.1>"C:\Program
> Files\Has
> kell\bin\c2hs.exe" --include=dist\build --cppopts=-D__GLASGOW_HASKELL__=610
> --cp
> popts=-IC:\A\install\programming\portaudio\portaudio\include
> --output-dir=dist\b
> uild --output=Sound\PortAudio\Base.hs .\Sound\PortAudio\Base.chs
> c2hs.exe: does not exist
>
> C:\A\install\programming\portaudio\haskell\portaudio-0.0.1>pause
> Press any key to continue . . .
>
> By the way, I have posted this problem to the c2hs mailing list in case
> they have some insight.
>
>
>
>
> ---------- Forwarded message ----------
> From: Daniel Fischer <daniel.is.fischer at web.de>
> To: M Xyz <functionallyharmonious at yahoo.com>
> Date: Sun, 6 Dec 2009 02:34:17 +0100
> Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
> Am Sonntag 06 Dezember 2009 01:49:49 schrieb M Xyz:
>
> I just had another idea.
>
> dafis at linux-mkk1:~> c2hs -o memyself.hs memyself.chs
> c2hs: does not exist
>
> it's not that c2hs isn't found or something, c2hs doesn't find Base.chs!
>
> Try installing from the unpacked sources (cd portaudio; cabal install) or
> the old-
> fashioned way:
>
> cd portaudio-0.0.1
>
> ghc --make Setup
>
> ./Setup configure --help
> (choose your options, prefix, profiling, ...)
>
> ./Setup configure $OPTIONS
> ./Setup build
>
> if all's well,
>
> ./Setup haddock
> ./Setup install
>
> (dies for me with
> dist/build/Sound/PortAudio/Base.chs.h:1:23: error: portaudio.h: Datei oder
> Verzeichnisnicht gefunden
> c2hs: Error during preprocessing custom header file
> cabal: Error: some packages failed to install:
> portaudio-0.0.1 failed during the building phase. The exception was:
> exit: ExitFailure 1
> because I don't have portaudio installed)
>
>
>
> ---------- Forwarded message ----------
> From: john lask <jvlask at hotmail.com>
> To: <daniel.is.fischer at web.de>, <functionallyharmonious at yahoo.com>
> Date: Sun, 6 Dec 2009 02:03:32 +0000
> Subject: RE: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
>
>
> I don't know whether this will help you but I just downloaded an built
> the haskell portaudio package ... (I had a windows msvc build of
> portaudio dll already) the process I used ... ghc 6.10.4, portaudio-19
>
> make an import lib for ghc from dll:
> pexports libpa19.dll > libpa19.def
> dlltool --input-def libpa19.def --output-lib libpa19.a
>
> edit the .cabal file or use command line flags
>
>   extra-Libraries: pa19
>   extra-lib-dirs: c:\portaudio19\lib
>   include-dirs:   c:\portaudio19\include
>
>  runghc setup configure
>
> make sure you have cpp i.e. the c-preprocessor on your exe path,
> otherwise you will get
> 'cpp' is not recognized as an internal or external command,
> operable program or batch file.
> c2hs.exe: Error during preprocessing custom header file
>
> runghc setup build
>
> builds ok ...??
>
>
> > From: daniel.is.fischer at web.de
> > To: functionallyharmonious at yahoo.com
> > Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
> > Date: Sun, 6 Dec 2009 02:34:17 +0100
> > CC: haskell-cafe at haskell.org
> >
> > Am Sonntag 06 Dezember 2009 01:49:49 schrieb M Xyz:
> >
> > I just had another idea.
> >
> > dafis at linux-mkk1:~> c2hs -o memyself.hs memyself.chs
> > c2hs: does not exist
> >
> > it's not that c2hs isn't found or something, c2hs doesn't find Base.chs!
> >
> > Try installing from the unpacked sources (cd portaudio; cabal install) or
> the old-
> > fashioned way:
> >
> > cd portaudio-0.0.1
> >
> > ghc --make Setup
> >
> > ./Setup configure --help
> > (choose your options, prefix, profiling, ...)
> >
> > ./Setup configure $OPTIONS
> > ./Setup build
> >
> > if all's well,
> >
> > ./Setup haddock
> > ./Setup install
> >
> > (dies for me with
> > dist/build/Sound/PortAudio/Base.chs.h:1:23: error: portaudio.h: Datei
> oder
> > Verzeichnisnicht gefunden
> > c2hs: Error during preprocessing custom header file
> > cabal: Error: some packages failed to install:
> > portaudio-0.0.1 failed during the building phase. The exception was:
> > exit: ExitFailure 1
> > because I don't have portaudio installed)
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>
> ------------------------------
> Australia's #1 job site If It Exists, You'll Find it on SEEK<http://clk.atdmt.com/NMN/go/157639755/direct/01/>
>
>
> ---------- Forwarded message ----------
> From: Henning Thielemann <lemming at henning-thielemann.de>
> To: Michael Snoyman <michael at snoyman.com>
> Date: Sun, 06 Dec 2009 03:05:30 +0100 (CET)
> Subject: Re: [Haskell-cafe] New Hackage category: Error Handling
>
> On Sat, 5 Dec 2009, Henning Thielemann wrote:
>
>  On Sun, 6 Dec 2009, Michael Snoyman wrote:
>>
>>  I think there are plenty of examples like web servers. A text editor with
>>> plugins? I
>>> don't want to lose three hours worth of work just because some plugin
>>> wasn't written
>>> correctly. For many classes of programs, the distinction between error
>>> and exception is
>>> not only blurred, it's fully irrelevant. Harping on people every time
>>> they use error in
>>> the "wrong" sense seems unhelpful.
>>>
>>> Hope my commenting on this subject doesn't become my own form of
>>> *pedantry*.
>>>
>>
>> In an earlier thread I have explained that one can consider a software
>> architecture as divided into levels. What is an error in one level (text
>> editor plugin, web server thread, operating system process) is an exception
>> in the next higher level (text editor, web server, shell respectively). This
>> doesn't reduce the importance to distinguish between errors and exceptions
>> within one level. All approaches so far that I have seen in Haskell just mix
>> exceptions and errors in an arbitrary way.
>>
>
>
> I have just written more details on this topic:
>   http://www.haskell.org/haskellwiki/Error_vs._Exception
>
>
>
> ---------- Forwarded message ----------
> From: M Xyz <functionallyharmonious at yahoo.com>
> To: Daniel Fischer <daniel.is.fischer at web.de>
> Date: Sat, 5 Dec 2009 18:08:07 -0800 (PST)
> Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
>
>
> --- On *Sat, 12/5/09, Daniel Fischer <daniel.is.fischer at web.de>* wrote:
>
>
>
> cd portaudio-0.0.1
>
> ghc --make Setup
>
> ./Setup configure --help
> (choose your options, prefix, profiling, ...)
>
> ./Setup configure $OPTIONS
> ./Setup build
>
>
> Everything went well until "Setup build" which yielded our friend "c2hs.exe
> does not exist".
>
>
> C:\A\install\programming\portaudio\haskell\portaudio-0.0.1>ghc --make Setup
> [1 of 1] Compiling Main             ( Setup.hs, Setup.o )
> Linking Setup.exe ...
>
> C:\A\install\programming\portaudio\haskell\portaudio-0.0.1>Setup configure
> --hel
> p
> Usage: Setup configure [FLAGS]
>
> Flags for configure: .......(edited out).................
>
> C:\A\install\programming\portaudio\haskell\portaudio-0..0.1>Setup configure
> --ext
> ra-include-dirs="C:\A\install\programming\portaudio\portaudio\include"
> --extra-l
>
> ib-dirs="C:\A\install\programming\portaudio\portaudio\build\msvc\Win32\Release"
> Configuring portaudio-0.0.1...
>
> C:\A\install\programming\portaudio\haskell\portaudio-0.0.1>Setup build
> Preprocessing library portaudio-0.0.1...
> c2hs.exe: does not exist
>
>
>
>
>
>
> ---------- Forwarded message ----------
> From: M Xyz <functionallyharmonious at yahoo.com>
> To: daniel.is.fischer at web.de, john lask <jvlask at hotmail.com>
> Date: Sat, 5 Dec 2009 18:17:29 -0800 (PST)
> Subject: RE: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
> I am going to give this a try. Thanks.
> Where can I get the pexports and dlltool utilities?
>
> Google yields:
> http://www.emmestech.com/software/pexports-0.43/download_pexports.html
> http://sourceware.org/binutils/
>
> Are those correct?
>
> --- On *Sat, 12/5/09, john lask <jvlask at hotmail.com>* wrote:
>
>
> From: john lask <jvlask at hotmail.com>
> Subject: RE: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
> To: daniel.is.fischer at web.de, functionallyharmonious at yahoo.com
> Cc: haskell-cafe at haskell.org
> Date: Saturday, December 5, 2009, 9:03 PM
>
>
>
> I don't know whether this will help you but I just downloaded an built
> the haskell portaudio package ... (I had a windows msvc build of
> portaudio dll already) the process I used ... ghc 6.10.4, portaudio-19
>
> make an import lib for ghc from dll:
> pexports libpa19.dll > libpa19.def
> dlltool --input-def libpa19.def --output-lib libpa19.a
>
> edit the .cabal file or use command line flags
>
>   extra-Libraries: pa19
>   extra-lib-dirs: c:\portaudio19\lib
>   include-dirs:   c:\portaudio19\include
>
>  runghc setup configure
>
> make sure you have cpp i.e. the c-preprocessor on your exe path,
> otherwise you will get
> 'cpp' is not recognized as an internal or external command,
> operable program or batch file.
> c2hs.exe: Error during preprocessing custom header file
>
> runghc setup build
>
> builds ok ...??
>
>
> > From: daniel.is.fischer at web.de
> > To: functionallyharmonious at yahoo.com
> > Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
> > Date: Sun, 6 Dec 2009 02:34:17 +0100
> > CC: haskell-cafe at haskell.org
> >
> > Am Sonntag 06 Dezember 2009 01:49:49 schrieb M Xyz:
> >
> > I just had another idea.
> >
> > dafis at linux-mkk1:~> c2hs -o memyself.hs memyself.chs
> > c2hs: does not exist
> >
> > it's not that c2hs isn't found or something, c2hs doesn't find Base.chs!
> >
> > Try installing from the unpacked sources (cd portaudio; cabal install) or
> the old-
> > fashioned way:
> >
> > cd portaudio-0.0.1
> >
> > ghc --make Setup
> >
> > ./Setup configure --help
> > (choose your options, prefix, profiling, ...)
> >
> > ./Setup configure $OPTIONS
> > ./Setup build
> >
> > if all's well,
> >
> > ./Setup haddock
> > ./Setup install
> >
> > (dies for me with
> > dist/build/Sound/PortAudio/Base.chs.h:1:23: error: portaudio.h: Datei
> oder
> > Verzeichnisnicht gefunden
> > c2hs: Error during preprocessing custom header file
> > cabal: Error: some packages failed to install:
> > portaudio-0.0.1 failed during the building phase. The exception was:
> > exit: ExitFailure 1
> > because I don't have portaudio installed)
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>
> ------------------------------
> Australia's #1 job site If It Exists, You'll Find it on SEEK<http://clk.atdmt.com/NMN/go/157639755/direct/01/>
>
>
>
>
> ---------- Forwarded message ----------
> From: M Xyz <functionallyharmonious at yahoo.com>
> To: john lask <jvlask at hotmail.com>, vanenkj at gmail.com
> Date: Sat, 5 Dec 2009 19:47:04 -0800 (PST)
> Subject: [Haskell-cafe] PortAudio library successfully built on Windows
>
> John Lask,
> The steps you enumerated below successfully built portaudio for me! Thank
> you!
>
> I wonder though, you said to rename the dll to libpa19.dll from
> portaudio_x86.dll
> and to change the .cabal entry from "extra-Libraries: portaudio" to
> "extra-Libraries: pa19".
> Since my .dll name and .cabal file entry were mismatched, was that what
> could have been wrong all along? Was the creation of a .a file necessary?
> I would delete the .a file and retry with libportaudio.dll but I won't push
> my luck.
>
> Now if I could just get Gtk2hs working now, I could be happy *and*
> productive. :)
>
> --- On *Sat, 12/5/09, john lask <jvlask at hotmail.com>* wrote:
>
>
> From: john lask <jvlask at hotmail.com>
> Subject: RE: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
> To: daniel.is.fischer at web.de, functionallyharmonious at yahoo.com
> Cc: haskell-cafe at haskell.org
> Date: Saturday, December 5, 2009, 9:03 PM
>
>
>
> I don't know whether this will help you but I just downloaded an built
> the haskell portaudio package ... (I had a windows msvc build of
> portaudio dll already) the process I used ... ghc 6.10.4, portaudio-19
>
> make an import lib for ghc from dll:
> pexports libpa19.dll > libpa19.def
> dlltool --input-def libpa19.def --output-lib libpa19.a
>
> edit the .cabal file or use command line flags
>
>   extra-Libraries: pa19
>   extra-lib-dirs: c:\portaudio19\lib
>   include-dirs:   c:\portaudio19\include
>
>  runghc setup configure
>
> make sure you have cpp i.e. the c-preprocessor on your exe path,
> otherwise you will get
> 'cpp' is not recognized as an internal or external command,
> operable program or batch file.
> c2hs.exe: Error during preprocessing custom header file
>
> runghc setup build
>
> builds ok ...??
>
>
> > From: daniel.is.fischer at web.de
> > To: functionallyharmonious at yahoo.com
> > Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
> > Date: Sun, 6 Dec 2009 02:34:17 +0100
> > CC: haskell-cafe at haskell.org
> >
> > Am Sonntag 06 Dezember 2009 01:49:49 schrieb M Xyz:
> >
> > I just had another idea.
> >
> > dafis at linux-mkk1:~> c2hs -o memyself.hs memyself.chs
> > c2hs: does not exist
> >
> > it's not that c2hs isn't found or something, c2hs doesn't find Base.chs!
> >
> > Try installing from the unpacked sources (cd portaudio; cabal install) or
> the old-
> > fashioned way:
> >
> > cd portaudio-0.0.1
> >
> > ghc --make Setup
> >
> > ./Setup configure --help
> > (choose your options, prefix, profiling, ...)
> >
> > ./Setup configure $OPTIONS
> > ./Setup build
> >
> > if all's well,
> >
> > ./Setup haddock
> > ./Setup install
> >
> > (dies for me with
> > dist/build/Sound/PortAudio/Base.chs.h:1:23: error: portaudio.h: Datei
> oder
> > Verzeichnisnicht gefunden
> > c2hs: Error during preprocessing custom header file
> > cabal: Error: some packages failed to install:
> > portaudio-0.0.1 failed during the building phase. The exception was:
> > exit: ExitFailure 1
> > because I don't have portaudio installed)
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>
> ------------------------------
> Australia's #1 job site If It Exists, You'll Find it on SEEK<http://clk.atdmt.com/NMN/go/157639755/direct/01/>
>
>
>
>
> ---------- Forwarded message ----------
> From: Michael Snoyman <michael at snoyman.com>
> To: Haskell Cafe <haskell-cafe at haskell.org>
> Date: Sun, 6 Dec 2009 07:04:46 +0200
> Subject: [Haskell-cafe] When are undecidables ok?
> I know this is basically a rewording of a previous e-mail, but I realized
> this is the question I *really* wanted to ask.
>
> We have this language extension UndecidableInstances (not to mention
> OverlappingInstances), which seem to divide the Haskell camp into two
> factions:
>
> * Hey, GHC said to turn on this flag. Ok!
> * Undecidables are the devil!
>
> I get the feeling the truth lies in the middle. As I understand it (please
> correct me if I am wrong), the problem with undecidables is that they can
> create non-terminating instances. However, for certain cases the programmer
> should be able to prove to him/herself that the instances will terminate. My
> question is: how can you make such a proof?
>
> I've had to cases in particular that made me want undecidables. Both of
> them, IMO, could be solved by creating new extensions to GHC which would not
> require undecidables. Nonetheless, for now we only have undecidables at our
> disposal. The examples are:
>
> * Context synonyms (eg, MonadFailure = Monad + Failure).
> * Subclass function defaulting
>
> For an example of the second, a nifty definition of Monad would be:
>
> class Applicative m => Monad m where
>   >>= ...
>   return ...
>   pure = return
>   (<*>) = ap
>   fmap = liftM
>
> Of course, neither of these is possible in Haskell, so we can use
> undecidables. How can a programmer prove that a set of instances is, in
> fact, safe? And if they make a mistake and right a bad set of
> undecidable/overlapping instances, what's the worst case scenario? Is it a
> compile-time or run-time error*?
>
> Michael
>
> * Yes, I mean error.
>
>
> ---------- Forwarded message ----------
> From: Luke Palmer <lrpalmer at gmail.com>
> To: Michael Snoyman <michael at snoyman.com>
> Date: Sat, 5 Dec 2009 22:36:43 -0700
> Subject: Re: [Haskell-cafe] When are undecidables ok?
> On Sat, Dec 5, 2009 at 10:04 PM, Michael Snoyman <michael at snoyman.com>
> wrote:
> > I know this is basically a rewording of a previous e-mail, but I realized
> > this is the question I *really* wanted to ask.
> >
> > We have this language extension UndecidableInstances (not to mention
> > OverlappingInstances), which seem to divide the Haskell camp into two
> > factions:
> >
> > * Hey, GHC said to turn on this flag. Ok!
> > * Undecidables are the devil!
> >
> > I get the feeling the truth lies in the middle. As I understand it
> (please
> > correct me if I am wrong), the problem with undecidables is that they can
> > create non-terminating instances. However, for certain cases the
> programmer
> > should be able to prove to him/herself that the instances will terminate.
> My
> > question is: how can you make such a proof?
>
> Well, the reasoning for the "devil" camp (which I admit to being
> firmly in[1]) is that such proofs must rely on the algorithm the
> compiler uses to resolve instances.  You might be able to prove it,
> but the proof is necessarily only valid for (possibly current versions
> of) GHC.  The typeclass resolution algorithm is not in the report, and
> there are several conceivable ways of of going about it.
>
> So it is fine to use them if you are okay with making your code
> unportable and future-brittle. I am typically against the mere
> existence of code that that is future-brittle, because it encourages
> compiler authors not to innovate  (and by that token, unportable too,
> because it discourages compiler competition).
>
> Luke
>
> [1]
> http://lukepalmer.wordpress.com/2008/04/08/stop-using-undecidable-instances/
>
>
>
> ---------- Forwarded message ----------
> From: Michael Snoyman <michael at snoyman.com>
> To: Luke Palmer <lrpalmer at gmail.com>
> Date: Sun, 6 Dec 2009 08:20:09 +0200
> Subject: Re: [Haskell-cafe] When are undecidables ok?
>
>
> On Sun, Dec 6, 2009 at 7:36 AM, Luke Palmer <lrpalmer at gmail.com> wrote:
>
>> On Sat, Dec 5, 2009 at 10:04 PM, Michael Snoyman <michael at snoyman.com>
>> wrote:
>> > I know this is basically a rewording of a previous e-mail, but I
>> realized
>> > this is the question I *really* wanted to ask.
>> >
>> > We have this language extension UndecidableInstances (not to mention
>> > OverlappingInstances), which seem to divide the Haskell camp into two
>> > factions:
>> >
>> > * Hey, GHC said to turn on this flag. Ok!
>> > * Undecidables are the devil!
>> >
>> > I get the feeling the truth lies in the middle. As I understand it
>> (please
>> > correct me if I am wrong), the problem with undecidables is that they
>> can
>> > create non-terminating instances. However, for certain cases the
>> programmer
>> > should be able to prove to him/herself that the instances will
>> terminate. My
>> > question is: how can you make such a proof?
>>
>> Well, the reasoning for the "devil" camp (which I admit to being
>> firmly in[1]) is that such proofs must rely on the algorithm the
>> compiler uses to resolve instances.  You might be able to prove it,
>> but the proof is necessarily only valid for (possibly current versions
>> of) GHC.  The typeclass resolution algorithm is not in the report, and
>> there are several conceivable ways of of going about it.
>>
>> So it is fine to use them if you are okay with making your code
>> unportable and future-brittle. I am typically against the mere
>> existence of code that that is future-brittle, because it encourages
>> compiler authors not to innovate  (and by that token, unportable too,
>> because it discourages compiler competition).
>>
>> Luke
>>
>> [1]
>> http://lukepalmer.wordpress.com/2008/04/08/stop-using-undecidable-instances/
>>
>
> So in that case, perhaps the compiler authors can give us some ideas as to
> when it's safe to use undecidables? Seems like we should go straight to the
> horse's mouth.
>
> Michael
>
>
>
> ---------- Forwarded message ----------
> From: "Ariel J. Birnbaum" <valgarv at gmx.net>
> To: Gregory Crosswhite <gcross at phys.washington.edu>
> Date: Sun, 06 Dec 2009 08:34:16 +0200
> Subject: Re: [Haskell-cafe] ANNOUNCE: error-message
> > In particular, the motivation for this package was that I have written
> > a build system, and I wanted to collect as many errors in the build as
> > possible and show them all to the user at once.
>
> YMMV, but at least for me a deluge of errors is less helpful than a
> short list I can fix quickly, then try again. Often by fixing one error
> from the list a sizeable portion of the rest just vanish (I forget the
> English term for that kind of error).
>
> (In before "you can use sth like quickfix to go through the first few
> errors and compile again whenever you feel like it".)
>
> --
> Ariel J. Birnbaum
>
>
>
>
> ---------- Forwarded message ----------
> From: Eugene Kirpichov <ekirpichov at gmail.com>
> To: Stefan Holdermans <stefan at cs.uu.nl>
> Date: Sun, 6 Dec 2009 09:42:34 +0300
> Subject: Re: [Haskell-cafe] What is the rank of a polymorphic type?
> 2009/12/6 Stefan Holdermans <stefan at cs.uu.nl>:
> > Eugene,
> >
> >> 1) Does there exist an authoritative source saying the same? Not that
> >> I'm doubting, just supposing that the source would have other
> >> interesting information, too :)
> >
> > You may want to have a look at the already mentioned JFP-article by
> Peyton
> > Jones et al. and perhaps the work of Kfoury and Wells.
> >
> >> 2) Is it true that rank (forall a . a, forall a . a) == 0 ?
> >
> > No, for pairs one takes the maximum of the constituent types. So, here
> you'd
> > get rank 1.
> >
> > Note that this is an impredicative type, which is yet another extension
> of
> > the standard Hindley-Milner typing discipline.
>
> OK, thanks.
> However, isn't the type (forall a . a) -> String impredicative because
> it instantiates a type variable of the type constructor (->) p q with
> p = forall a . a?
>
> >
> > Cheers,
> >
> >  Stefan
> >>
> >>>
> >
>
>
>
> --
> Eugene Kirpichov
> Web IR developer, market.yandex.ru
>
>
>
> ---------- Forwarded message ----------
> From: Benjamin L.Russell <dekudekuplex at yahoo.com>
> To: haskell-cafe at haskell.org
> Date: Sun, 06 Dec 2009 16:14:06 +0900
> Subject: [Haskell-cafe] Re: universal binary version of Haskell Platform?
> On Thu, 03 Dec 2009 10:52:35 +0000, Duncan Coutts
> <duncan.coutts at googlemail.com> wrote:
>
> >[...]
> >
> >There no binary platform installer for OSX PPC. You'll have to grab
> >ghc-6.10.4 for PPC from the ghc download page and then install the
> >platform from the generic source tarball.
>
> Ah, that's too bad.  That means that I won't be able to invoke GHC
> outside of the Terminal application by default, and that even if I
> create a Darwin shell script and alias to invoke it from Aqua, the
> icon for that shell script will only be generic by default.  I'd
> rather click on an application icon in the Dock.
>
> >
> >If you'd like to help us next time to make a platform binary for PPC
> >then that'd be great. I don't think we have the setup to make universal
> >binaries but it should be possible to make a PPC build if we have a
> >volunteer.
>
> Sure, barring job-related time constraints, I'd be happy to volunteer.
> My Mac just went out of service because of a hardware problem with the
> memory, so I'm order new replacement RAM this weekend.  As soon as
> that arrives and I install it, the problem should be resolved.
>
> What should I do?
>
> -- Benjamin L. Russell
>
>
>
>
> ---------- Forwarded message ----------
> From: Dan Doel <dan.doel at gmail.com>
> To: haskell-cafe at haskell.org
> Date: Sun, 6 Dec 2009 02:48:09 -0500
> Subject: Re: [Haskell-cafe] What is the rank of a polymorphic type?
> On Sunday 06 December 2009 1:42:34 am Eugene Kirpichov wrote:
> > OK, thanks.
> > However, isn't the type (forall a . a) -> String impredicative because
> > it instantiates a type variable of the type constructor (->) p q with
> > p = forall a . a?
>
> There's probably no clear cut answer to this independent of how you think
> of
> (->). For instance, if we explain the Haskell type system by way of a pure
> type system, (->) is a special case of a pi type, which looks like:
>
>  pi x : k. t
>
> where any xs in t are bound by the pi. We then have:
>
>  p -> q          = pi _ : p. q
>  forall a : k. b = pi a : k. b
>
> pi types are given types by sets of rules, which look like triples. If
> (s,t,u)
> is a rule, then:
>
>  G |- k : s    G, a : k |- b : t
>  -------------------------------
>      G |- (pi a : k. b) : u
>
> is the corresponding typing rule. Type systems like Haskell's are commonly
> thought of in terms of the lambda cube, which has constant sorts * and [],
> with * : []. The rule (*,*,*) gives you ordinary functions. (*,[],[]) gives
> you dependent types, so that's out.
>
> ([],*,*) is an impredicative rule for polymorphism. This says that, for
> instance:
>
>  forall a. a -> a = (pi a : *. pi _ : a. a) : *
>
> because (pi _ : a. a) : * if a : *, by the (*,*,*) rule, and then we apply
> the
> impredicative rule for the universal quantification. One could also use the
> predicative rule ([],*,[]), which would result in forall a. a -> a having
> type
> [].
>
> However, Haskell also has arbitrarily higher-order types. This is given by
> the
> rule ([],[],[]), which allows expressions like:
>
>   (* -> *) -> * = pi _ : (pi _ : *. *). *
>
> This type system is called F_omega, while just the ([],*,?) rule is known
> as
> F_2.
>
> However, the F_omega rule also allows for arbitrary rank polymorphism even
> with the predicative universal quantifier rule above (predicative F_2
> allows a
> little, but it's very limited*). For instance, the higher rank type:
>
>  forall a. (forall b. b) -> a
>
> checks thusly:
>
>  (forall b. b)                  : [] via ([],*,[])
>  ((forall b. b) -> a)           : [] via ([],*,[])
>  (forall a. (forall b. b) -> a) : [] via ([],[],[])
>
> Data types, by contrast, have kinds like * -> *, so using say,
>
>  Maybe (forall a. a -> a)
>
> genuinely relies on the impredicative rule. GHC's type system isn't exactly
> set up in this way, but (->) is similarly special in that it somehow isn't
> quite just another type constructor with kind * -> * -> * (or even whatever
> special kinds GHC uses to support unboxed values and such).
>
> Hope that wasn't too confusing. :)
>
> -- Dan
>
> * Predicative F_2 will essentially allow one universal quantifier somewhere
> in
> the type. This can be:
>
>  forall a. a -> a
>
> or it can be:
>
>  (((forall a. a) -> T) -> U) -> V
>
> for T, U and V of kind * (the only kind in F_2), which is a rank-4 type. It
> doesn't allow:
>
>  forall a b. a -> b
>
> even, because the inner (forall b. a -> b) : [], so adding the forall a
> requires the F_omega rule.
>
> Predicative F_2 and F_w also blow up with quantification on the right of an
> arrow, because it looks like the rule for dependent types:
>
>  T -> (forall a. a)
>
>  T : *, (forall a. a) : []
>
> so the rule (*,[],[]) would be invoked.
>
> GHC doesn't have this sort of hierarchy, and so doesn't have these sorts of
> weird cases, despite being predicative of a sort. Instead it distinguishes
> somehow between monotypes ([Float], String -> Int, a -> b) and polytypes
> (forall a. a, ...), although it doesn't really display the difference.
> Quantifiers are only supposed to range over kinds that classify monotypes
> (or
> monotype constructors), which keeps the predicativity (although, even this
> gets fudged some: If I have forall a. a -> a, I can instantiate a to the
> polytype forall a. a -> a with rank-n polymorphism, because it only seems
> to
> worry about the validity of the resulting type, and (->) is special; by
> contrast, the same cannot be said for forall a. Maybe a, because Maybe
> genuinely only accepts monotypes without -XImpredicativeTypes).
>
>
>
> ---------- Forwarded message ----------
> From: Bulat Ziganshin <bulat.ziganshin at gmail.com>
> To: Andrew Coppin <andrewcoppin at btinternet.com>
> Date: Sun, 6 Dec 2009 11:13:21 +0300
> Subject: Re[2]: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
> Hello Andrew,
>
> Sunday, December 6, 2009, 1:09:18 AM, you wrote:
>
> > Maybe once I get hired by some financial modelling consultants and get
> > paid shedloads of money to write Haskell all day, I'll be able to afford
> > a Mac. But until then...
>
> with such attitude you will never be hired by financial sector. try
> instead:
>
> mac? great! windows? i love it! unix? i've used it since 60's
>
>
> --
> Best regards,
>  Bulat                            mailto:Bulat.Ziganshin at gmail.com
>
>
>
>
> ---------- Forwarded message ----------
> From: Heinrich Apfelmus <apfelmus at quantentunnel.de>
> To: haskell-cafe at haskell.org
> Date: Sun, 06 Dec 2009 11:28:25 +0100
> Subject: [Haskell-cafe] Re: universal binary version of Haskell Platform?
> Benjamin L.Russell wrote:
> > Ah, that's too bad.  That means that I won't be able to invoke GHC
> > outside of the Terminal application by default, and that even if I
> > create a Darwin shell script and alias to invoke it from Aqua, the
> > icon for that shell script will only be generic by default.  I'd
> > rather click on an application icon in the Dock.
>
> You can write an applescript similar to
>
>    Open Terminal Here
>    from http://www.entropy.ch/software/applescript/
>
> and endow it with a custom icon.
>
>
> Regards,
> Heinrich Apfelmus
>
> --
> http://apfelmus.nfshost.com
>
>
>
>
> ---------- Forwarded message ----------
> From: Andrew Coppin <andrewcoppin at btinternet.com>
> To: haskell-cafe at haskell.org
> Date: Sun, 06 Dec 2009 13:05:19 +0000
> Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound
> card?
> Bulat Ziganshin wrote:
>
>> Hello Andrew,
>>
>> Sunday, December 6, 2009, 1:09:18 AM, you wrote:
>>
>>
>>
>>> Maybe once I get hired by some financial modelling consultants and get
>>> paid shedloads of money to write Haskell all day, I'll be able to afford
>>> a Mac. But until then...
>>>
>>>
>>
>> with such attitude you will never be hired by financial sector. try
>> instead:
>>
>> mac? great! windows? i love it! unix? i've used it since 60's
>>
>>
>
> That's OK. I'm reasonably sure I will never get hired by the financial
> sector /anyway/. :-(
>
>
>
>
> ---------- Forwarded message ----------
> From: Andrew Coppin <andrewcoppin at btinternet.com>
> To: haskell-cafe at haskell.org
> Date: Sun, 06 Dec 2009 13:18:59 +0000
> Subject: Re: [Haskell-cafe] binding to C libraries on Windows was Low Level
> Audio - Writing bytes to the sound card?
> john lask wrote:
>
>> I think there are some misapprehensions here:-
>>
>> Many haskell packages binding to c libraries will compile with ghc
>> without problems on windows - without cygwin, without mingw/msys system.
>>
>
> OK, well I haven't tried building every C binding on all of Hackage, just a
> few of them. So far none of them have worked. (Including wxHaskell, SDL, one
> of the database packages, etc.) It's got to the point where I've simply
> given up trying. Most such packages just don't seem to work on Windows, and
> nobody on the mailing lists or on IRC has any clue why. (I guess because few
> people in the Haskell community use Windows and understand how it's supposed
> to work.)
>
>  Some such packages build "out of the box" on windows, like the zlib
>> package which contains the c source for the c zlib library. GHC is able
>> to compile and build this packages without any other c
>> compiler/libraries/unix emulators etc because ghc itself contains part
>> of the gcc c compiler tool chain and comes with all c standard headers,
>> c++ headers and c/c++ runtime libraries.
>>
>
> Yes, I realised long ago that GHC uses GCC and other GNU build tools.
> (Presumably this makes porting to Windows far easier.) More recently I
> realised that it also includes a surprisingly large set of header files,
> seemingly including the entire Win32 API, which is interesting.
>
>  There
>> is only one gotch-ya - you need to have a import library for the gcc
>> tool chain (thats what ghc uses) i.e. a ".a" library and not the native
>> windows ".LIB" import library.
>>
>
> They're different?? o_O
>
> Oh. Suddenly several things seem clearer...
>
>  If you don't have ".a" import library
>> but have the dll then the '.a' import library be built for any dll
>> relativley easily.
>>
>
> Any idea how?
>
>  the bigest problem hamperring cleaner builds of haskell packages on
>> windows is the lack of any standardised scheme for the installation of
>> c-libraries and header files (and of course the availability of a
>> suitable build of the library).
>>
>
> Isn't one of Cabal's jobs to figure out where stuff is? Can't we get Cabal
> on Windows to say "hey, I need to find foo.h, you know where that is?" Or
> something like that?
>
>  Another problem hampering the install of haskell packages on windows is
>> the use of the unix autoconf build system (./configure)   - package
>> writters note!
>>
>
> Heh. I found one Wiki page once describing how to set up a Cabal package.
> When it started talking about how to integrate Automake, I hung my head is
> dispair. (I believe the page in question is fixed now. But a lot of package
> authors seem to assume that everybody just uses Unix of some kind...)
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091206/e6dc44d5/attachment-0001.html


More information about the Haskell-Cafe mailing list