Re: [Haskell-cafe] Deconstructing types
I don't know a thing about SYB, Data.Data, or Data.Typeable, mostly because I'm an efficiency fanatic. Nevertheless, I'd like to know whether or not there's a way to deconstruct a (mostly) arbitrary type, into tuples, unions, etc. using this framework. Any thoughts? You can use the Template Haskell deriving in EMGM to get that structure pretty efficiently. http://www.cs.uu.nl/wiki/GenericProgramming/EMGM http://hackage.haskell.org/package/emgm The obligatory question is: why do you want it? Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: hmatrix on os x
Ben wrote: i've been having a heck of a time installing hmatrix on mac os x. i've seen the help pages including http://mit.edu/harold/Public/easyVisionNotes.html but they haven't helped me. my setup is haskell platform 2009.2.0.2 (ghc 6.10.4) os x 10.5 macports -- i've tried installing gsl and gsl-devel to no avail. i've tried cabal install with various options, to no avail. has anyone else have luck with this? Lapack and Gsl (or something combination thereof, I don't remember) is installed on MacOS X by default, but it's a framework called vecLib . You have to add ld-options: -framework vecLib to the hmatrix.cabal file and possibly remove the other library flags. I suggest nagging the maintainer about this. (Also, I had to remove and Intel specific opcode when compiling on PowerPC.) Regards, apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Looking for a new HWN editor
I'd just like to say a big Thank you to Brent for his service as the HWN editor. I appreciate it very much and always look forward to HWN. Thanks for all your work, Brent. Cheers, John Message: 11 Date: Sat, 5 Sep 2009 17:26:08 -0400 From: Brent Yorgey byor...@seas.upenn.edu Subject: [Haskell-cafe] Looking for a new HWN editor Hi all, As you probably know, I've been the editor of the Haskell Weekly News for a little over a year now, and I've decided that it's time for me to move on to other things. So, I'm looking for someone to volunteer to take over as HWN editor. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Failure to build curl bindings on alpha
Hi all, I am the Debian Maintainer of the haskell curl bindings which is failing to build on the alpha CPU with the following error: [7 of 8] Compiling Network.Curl.Easy ( Network/Curl/Easy.hs, dist/build/Network/Curl/Easy.o ) Network/Curl/Easy.hs:218:0: On Alpha, I can only handle 32 bytes of non-floating-point arguments to foreign export dynamic When checking declaration: foreign import ccall safe wrapper mkProgress :: ProgressFunction - IO (FunPtr ProgressFunction) Network/Curl/Easy.hs:221:0: On Alpha, I can only handle 32 bytes of non-floating-point arguments to foreign export dynamic When checking declaration: foreign import ccall safe wrapper mkDebugFun :: DebugFunctionPrim - IO (FunPtr DebugFunctionPrim) The GHC version is 6.10.4 and the full Debian build log is here: https://buildd.debian.org/fetch.cgi?pkg=haskell-curlver=1.3.5-2arch=alphastamp=1249232593file=log I am correct to suspect that this is a bug in ghc rather than in haskell-curl? Any other useful clues or information? Cheers, Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] High memory consumption of print
The following toy program consumes either 25MB or 70MB, depending on whether the line print done is a comment or code. (Using only 1 OS thread increases memory consumption to 130MB when the print is active vs 25MB when inactive.) What am I doing wrong? - module Main where import Control.Concurrent import Control.Concurrent.STM import Control.Concurrent.STM.TChan import System.Environment import Control.Applicative main = do n - read . head $ getArgs tvar - newTVarIO 0 tchan - newTChanIO tids - sequence [ forkIO (test tchan tvar i) | i - [1..10^n] ] waitForAll tchan $! length tids where waitForAll _ 0 = return () waitForAll tchan len = do atomically $ readTChan tchan waitForAll tchan (len-1) test :: TChan () - TVar Int - Int - IO () test tchan tvar i = do atomically $ do val - readTVar tvar if val+1 == i then do writeTVar tvar i writeTChan tchan () else retry print done - ghc --make -O2 teststm.hs -threaded ./teststm 4 +RTS -sstderr ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] Looking for a new HWN editor
On Sat, 5 Sep 2009 19:34:24 -0400, Brent Yorgey byor...@seas.upenn.edu wrote: On Sat, Sep 05, 2009 at 05:26:08PM -0400, Brent Yorgey wrote: Executive summary: * I'm looking for someone to take over as HWN editor * It is highly automated and doesn't take as much time as you might think (about 3-4 hours/week on average) * You DON'T need to be a Haskell guru * It is far from a thankless job and is a fun way to provide an appreciated service to the community! The position has been filled! More details to come. Wow! That was a quick decision! Most Haskell users probably didn't even have time to read the announcement before the position was filled; I certainly did not. Well, since this position has already been filled, there's probably not much that can be done (other than ask the new editor and hope that he/she is understanding), but just to give a fair opportunity to all Haskell users, if the editor changes again, it may be helpful at least to give everybody an opportunity to read the announcement and apply for the position. Just my two cents -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 Furuike ya, kawazu tobikomu mizu no oto. -- Matsuo Basho^ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Cabal install on Windows 7
I tried the cabal install command on Windows 7, and I had to run it with administrative privileges, otherwise I got access denied (it failed to create the Haskell folder in C:\Program Files) Not sure if this is also the case on Vista. Is this the intended behavior? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal install on Windows 7
On Tue, Sep 8, 2009 at 9:17 AM, Peter Verswyvelenbugf...@gmail.com wrote: Ouch, right, I forgot the default is global. It works fine with cabal install --user. And of course I could have edited the default config file, setting user-install: True Well, maybe for newbies this might be a bit confusing. Yep, I agree. I'm not sure why Cabal defaults to --global on Windows, but I found it quite counter-intuitive having come from a Linux environment. I forgot about the different default for some time. Jeff Wheeler ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal install on Windows 7
Ouch, right, I forgot the default is global. It works fine with cabal install --user. And of course I could have edited the default config file, setting user-install: True Well, maybe for newbies this might be a bit confusing. Typically, under Windows Vista or 7 when you try to install something that requires admin rights, you get a popup window asking if it's okay to do so. Would be great to have this support built into Cabal? On Tue, Sep 8, 2009 at 3:45 PM, John Van Enkvane...@gmail.com wrote: Might it make sense to try and get the concept of global and user working in Windows? (It may already, but I noticed that the default seems to be global.) I don't know what technical challenges there are, but the ApplicationData directory (or AppData, or whatever) seems like a good place to stick user cabal packages. /jve On Tue, Sep 8, 2009 at 9:31 AM, Peter Verswyvelen bugf...@gmail.com wrote: I tried the cabal install command on Windows 7, and I had to run it with administrative privileges, otherwise I got access denied (it failed to create the Haskell folder in C:\Program Files) Not sure if this is also the case on Vista. Is this the intended behavior? ___ 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] Ph.D position, Utrecht University, the Netherlands
Subject: Ph.D position, Utrecht University, the Netherlands === Vacancy PhD student on Realizing Optimal Sharing in the Functional Language Implementations Utrecht University, The Netherlands. === Within the Software Technology group of the Information and Computing Sciences department of Utrecht University there is a vacancy for a PhD student to work on the efficient implementation of functional languages. The position is funded by NWO, the Netherlands Organization for Scientific Research. - Project summary: Lambda-calculus and term rewriting are models of computation lying at the basis of functional programming languages. Both possess syntactic meta-theories based on analyzing rewrite steps. Unfortunately, naive implementations are inefficient, since subterms are frequently copied. To overcome this problem in both theoretical systems and actual implementations, duplicate work is avoided by using graph-based term representations, in which identical subterms can be (but not always are) shared. The question arises whether graph-representations and their reductions that are optimal in a theoretical sense can also be practical from an implementer's point of view. However, so far it is unclear whether nice theoretical ideas combine well with existing implementation methods. The overall-goal of this project is to answer this question in a back-and-forth communication between theoretical concepts and practical realizations. Starting points are the recent work on the optimal Lambdascope implementation based on context sharing, and the Haskell implementation developed at Utrecht University. One of the open problems is whether the Lambdascope framework can be extended to efficiently represent sets of mutually recursive definitions. Another, whether global program analysis can discover where Lambdascope-based approaches solve problems due to insufficient sharing. If both questions can be solved, we want to combine Lambdascope-based implementations with conventional frameworks, and investigate how efficient the resulting implementations become. The unique combination of the theoretical depth from the Logic department and the implementation skills and compiler infrastructure from the Computer Science department make Utrecht University the optimal surroundings for such a project. - Project leaders are Prof.dr. Doaitse Swierstra and dr. Vincent van Oostrom (principal investigator). The project will be executed in close cooperation between * the Software Technology group (http://www.cs.uu.nl/wiki/Center) of the Information and Computing Sciences department (http://www.cs.uu.nl/ ) * and the Theoretical Philosophy group (http://www.uu.nl/EN/faculties/Humanities/research/researchinstitutes/zeno/research/theoreticalphilosophy/Pages/default.aspx ) of the Philosophy department (http://www.phil.uu.nl/), and between * the more practically oriented PhD student and * the more theory oriented postdoc. - Requirements: Master degree in Computer Science, Logic, or equivalent. Good knowledge of functional programming, and several advanced computer science techniques. Knowledge of lambda-calculus implementations, Haskell, and compiler construction will be useful. Both theory and software development based on this should appeal to you. Terms of employment: the PhD student should start as soon as possible, but no later than January 1, 2010. The position is for four years (after one year there will be an evaluation), full-time. Gross salary starts with € 2042,-- per month in the first year and increases to € 2612,-- in the fourth year of employment. The salary is supplemented with a holiday bonus of 8% and an end-of-year bonus of 3%. In addition we offer: a pension scheme, partially paid parental leave, facilities for child care, flexible employment conditions in which you may trade salary for vacation days or vice versa. Conditions are based on the Collective Employment Agreement of the Dutch Universities: http://www.vsnu.nl/Workstudy/Universities-as-employers-/Collective-Labour-Agreement.htm More information: * about the project can be found on http://www.cs.uu.nl/wiki/bin/view/Center/OptimalSharing * about the Software Technology group on http://www.cs.uu.nl/wiki/Center * about the Information and Computing Sciences department on http://www.cs.uu.nl/ * about this vacancy can be obtained from Doaitse Swierstra (doai...@cs.uu.nl , +31 6 4613 6929). Send your application in pdf (or another non-proprietary format) to mailto:sciencep...@uu.nl
[Haskell-cafe] Re: ANNOUNCE: dbmigrations 0.1
Jonathan == Jonathan Daugherty drcyg...@gmail.com writes: Jonathan This package is motivated by the need for a Jonathan framework-independent, solid tool to manage database schema Jonathan changes in a clean way without assuming a linear sequence of Jonathan changes assumed by existing tools. dbmigrations lets you Jonathan manage a forest of schema changes. Thank you for this package! It is something which Haskell community was really missing. Looking forward to make use of it. Sincerely, Gour -- Gour | Hlapičina, Croatia | GPG key: F96FF5F6 --- pgpJMBa0bOcUK.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] Looking for a new HWN editor
On Tue, Sep 8, 2009 at 8:16 AM, Benjamin L.Russelldekudekup...@yahoo.com wrote: On Sat, 5 Sep 2009 19:34:24 -0400, Brent Yorgey byor...@seas.upenn.edu wrote: On Sat, Sep 05, 2009 at 05:26:08PM -0400, Brent Yorgey wrote: Executive summary: * I'm looking for someone to take over as HWN editor * It is highly automated and doesn't take as much time as you might think (about 3-4 hours/week on average) * You DON'T need to be a Haskell guru * It is far from a thankless job and is a fun way to provide an appreciated service to the community! The position has been filled! More details to come. Wow! That was a quick decision! Most Haskell users probably didn't even have time to read the announcement before the position was filled; I certainly did not. Well, since this position has already been filled, there's probably not much that can be done (other than ask the new editor and hope that he/she is understanding), but just to give a fair opportunity to all Haskell users, if the editor changes again, it may be helpful at least to give everybody an opportunity to read the announcement and apply for the position. Just my two cents I don't think that's really necessary. I suppose there's no reason for more people to be editors if the demand is high. It could even eventually have its own articles and perhaps and bigger summaries about the threads. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deconstructing types
Sean, The answer is, I'm working on a recently semi-released package called TrieMap. The objective of this package, building off of the work in this paperhttps://docs.google.com/Doc?docid=0AWuaUF8ZNTNDZHB3emdyaF8zMzNmZmtmcHo2Ywhl=en, is to automatically derive the type of a generalized trie for any algebraic type based on its algebraic representation. (I am working on writing up my methods for publication.) Of course, if I could get automatic access to the mechanisms of a type's constructors, I wouldn't even require users to describe the algebraic representation of their type... Louis Wasserman wasserman.lo...@gmail.com On Tue, Sep 8, 2009 at 2:34 AM, Sean Leather leat...@cs.uu.nl wrote: I don't know a thing about SYB, Data.Data, or Data.Typeable, mostly because I'm an efficiency fanatic. Nevertheless, I'd like to know whether or not there's a way to deconstruct a (mostly) arbitrary type, into tuples, unions, etc. using this framework. Any thoughts? You can use the Template Haskell deriving in EMGM to get that structure pretty efficiently. http://www.cs.uu.nl/wiki/GenericProgramming/EMGM http://hackage.haskell.org/package/emgm The obligatory question is: why do you want it? Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal install on Windows 7
Might it make sense to try and get the concept of global and user working in Windows? (It may already, but I noticed that the default seems to be global.) I don't know what technical challenges there are, but the ApplicationData directory (or AppData, or whatever) seems like a good place to stick user cabal packages. /jve On Tue, Sep 8, 2009 at 9:31 AM, Peter Verswyvelen bugf...@gmail.com wrote: I tried the cabal install command on Windows 7, and I had to run it with administrative privileges, otherwise I got access denied (it failed to create the Haskell folder in C:\Program Files) Not sure if this is also the case on Vista. Is this the intended behavior? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deconstructing types
The answer is, I'm working on a recently semi-released package called TrieMap. The objective of this package, building off of the work in this paperhttps://docs.google.com/Doc?docid=0AWuaUF8ZNTNDZHB3emdyaF8zMzNmZmtmcHo2Ywhl=en, is to automatically derive the type of a generalized trie for any algebraic type based on its algebraic representation. (I am working on writing up my methods for publication.) Of course, if I could get automatic access to the mechanisms of a type's constructors, I wouldn't even require users to describe the algebraic representation of their type... Well, it's relatively easy to use Template Haskell to determine the structure of a datatype. Look in the Generics category on Hackage for a number of examples (e.g. emgm, regular, multirec) or see if the Derive package will do it for you. According to Neil Mitchell, you just need one example: http://www.cogsys.wiai.uni-bamberg.de/aaip09/aaip09_submissions/talk_mitchell.pdf I don't know if it's easy or even possible to capture a sum-of-products view from SYB. Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Deconstructing types
Oh, geez. Wrong link. I meant http://portal.acm.org/citation.cfm?id=967471 . Louis Wasserman wasserman.lo...@gmail.com On Tue, Sep 8, 2009 at 1:06 PM, Louis Wasserman wasserman.lo...@gmail.comwrote: Sean, The answer is, I'm working on a recently semi-released package called TrieMap. The objective of this package, building off of the work in this paperhttps://docs.google.com/Doc?docid=0AWuaUF8ZNTNDZHB3emdyaF8zMzNmZmtmcHo2Ywhl=en, is to automatically derive the type of a generalized trie for any algebraic type based on its algebraic representation. (I am working on writing up my methods for publication.) Of course, if I could get automatic access to the mechanisms of a type's constructors, I wouldn't even require users to describe the algebraic representation of their type... Louis Wasserman wasserman.lo...@gmail.com On Tue, Sep 8, 2009 at 2:34 AM, Sean Leather leat...@cs.uu.nl wrote: I don't know a thing about SYB, Data.Data, or Data.Typeable, mostly because I'm an efficiency fanatic. Nevertheless, I'd like to know whether or not there's a way to deconstruct a (mostly) arbitrary type, into tuples, unions, etc. using this framework. Any thoughts? You can use the Template Haskell deriving in EMGM to get that structure pretty efficiently. http://www.cs.uu.nl/wiki/GenericProgramming/EMGM http://hackage.haskell.org/package/emgm The obligatory question is: why do you want it? Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: ForeignFunPtr
You are right, I forgot about callbacks. freeHaskellFunPtr is only for Haskell functions packaged for usage by the foreign code. Example from the FFI specification, Section 5.4.2: type Compare = Int - Int - Bool foreign import ccall wrapper mkCompare :: Compare - IO (FunPtr Compare) If you, say, x = mkCompare () and at some point decide x is not needed in your foreign code any more, it has to be freed by hand. This is the only case in which you are allowed to use freeHaskellFunPtr. The (much less interesting) case that I was thinking about, where FunPtr is used for foreign C functions, usually requires no finalization. ForeignPtr is used for foreign objects used by Haskell. The garbage collector (gc) can decide whether the object is still in use and, if it's not, finalize it. A Haskell function wrapped in a FunPtr is used in the foreign world. Haskell gc cannot be made responsible for finalizing it. In fact, (unless the foreign world has some gc of its own) there is no way for any compiler of deciding when to finalize at all. The programmer needs to decide this by calling freeHaskellFunPtr, just like she needs to decide when to free mallocked memory in C. Does that make more sense? Please kick me again if you are still not buying it. :-) cheers, matthias On Sun, Sep 06, 2009 at 02:53:52PM -0300, Maur??cio CA wrote: To: haskell-cafe@haskell.org From: Maur??cio CA mauricio.antu...@gmail.com Date: Sun, 06 Sep 2009 14:53:52 -0300 Subject: [Haskell-cafe] Re: ForeignFunPtr Isn't freeHaskellFunPtr a required finalization procedure? Maurício the purpose of ForeignPtr is to attach a finalization procedure to the object behind the pointer. for example, you can have close called aimplicitly whenever the garbage collector finds you don't need a file handle any more. function pointers do not need finalization. We have ForeignPtr. Why isn't there a corresponding ForeignFunPtr? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ** ACCEPT: CRM114 PASS osb unique microgroom Matcher ** CLASSIFY succeeds; success probability: 1. pR: 5.6531 Best match to file #0 (nonspam.css) prob: 1. pR: 5.6531 Total features in input file: 2752 #0 (nonspam.css): features: 758386, hits: 2838587, prob: 1.00e+00, pR: 5.65 #1 (spam.css): features: 1686574, hits: 3088399, prob: 2.22e-06, pR: -5.65 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Takusen: *** Exception: readUTF8Char: illegal UTF-8 character 252
Hi all, I'm trying to use Takusen ODBC on Windows. I'm using a German WinXP Pro and try to connect to an MS Access database. As soon as I try to do some inserts the above mentioned exception shows up. Does anyone know a work around for this? Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: uvector-algorithms 0.2
Greetings, It is my pleasure to announce version 0.2 of the uvector-algorithms package. The package so far has implementations of several sorting and selection algorithms for use on the mutable arrays from the uvector library, as well as combinators for applying them to immutable arrays. New developments in this version include: - A simple benchmarking program for testing the performance of the algorithms (it's what I use to measure them, but I only have one computer to run it on, so perhaps other folks might want to see how it works on their machine) - A testing program, written with quick check to verify properties of the algorithms - Several bugs found and fixed due to the above tests and using HPC to verify good program coverage - Combinators for Schwartzian transform - Reworking radix sort to be more amenable to optimization. It's now around twice as fast. - A Radix instance for strict pairs, and a radix sortBy - Merge sort is now slightly faster due to memcpy in uvector :) The library can be found at hackage: http://hackage.haskell.org/package/uvector-algorithms or in its darcs repository: http://code.haskell.org/~dolio/uvector-algorithms/ As always, I can be notified of any issues. Enjoy. -- Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to understand the 'forall' ?
Eugene Kirpichov wrote: P.S. I tried to write up the difference between datatype and function declarations in this respect, but my explanations turned into a mess, so I erased them in the hope that someone will explain it better than me. Hello Eugene, I'll give it a try. In a non-constructive way: there seems to be nothing in common between those. In a constructive way: Datatype forall is called existential quantification, forall in function signature is called first-class polymorphism, if I'm not mistaken. Existential is a perfect word, because it really is data S = exists a. Show a = S [a]. The meaning is that within a given instance of S there lies some value of some particular type (a type exists). It's not any, it's some particular type. It can be either [Int], or forall a. Show a = [a], for example [], or some other type, but it exists. With first-class polymorphism there's nothing that lies somewhere. Nothing of some particular type. The function whose type is forall ... is applicable to any type within the given bounds. And even this function itself doesn't lie anywhere, since it's a parameter. I think it can be considered just a way to impact the scope of type parameters within the signature, roughly speaking. Not sure it this is useful, but data S = ∃x. S x f :: ∀x. x - (∀y. y - t) - t and just in case, the data constructor S doesn't use first-class polymorphism since its type is just S :: ∀x. x - S I know that you perfectly understand it, I just tried to word it :) -- Daniil Elovkov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: fclabels-0.4.0 - First class accessor labels.
On Fri, 4 Sep 2009, Sebastiaan Visser wrote: Hello all, There are more package around that serve the same purpose (like the Lenses package which was uploaded a few days ago), but I'm convinced the simplicity and elegance of fclabels will strike you all. ;-) How does it compare to data-accessor and data-accessor-template? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] problems with HOC install from svn
I'm unable to build HOC from the svn read-only checkout. Here are some details of what I'm doing. I'm running OS X 10.5.8 on an intel iMac with Xcode is 3.1.3. Haskel and Cabal are from the Haskel platform, haskell-platform-2009.2.0.2-i386.dmg I got Parsec 3.0 from Hackage. I checked out HOC using the svn command at http://code.google.com/p/hoc/source/checkout and checked out revision 411. Configure goes OK except for the complaint: Setup.hs:1:0: Warning: In the use of `defaultUserHooks' (imported from Distribution.Simple): Deprecated: Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2 compatibility in which case you must stick with defaultUserHooks But when I try to build, I get, after a bunch of apparently successful things: --- Loading package binary-0.5.0.1 ... command line: can't load .so/.DLL for: HSbinary-0.5.0.1 (dlopen(libHSbinary-0.5.0.1.dylib, 9): image not found) --- I certainly can't find libHSbinary... of any version on my computer, dylib or not. Tried looking in the /Library/Frameworks/GHC.Framework stuff, also did a find . -iname *libHS* and found libHSGLFW..., libHSparsec-3.0.0. (also tried this in my home directory). What is this, and how do I get it? Best, John Velman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to understand the 'forall' ?
On Tue, Sep 8, 2009 at 12:44 PM, Daniil Elovkovdaniil.elov...@googlemail.com wrote: Existential is a perfect word, because it really is data S = exists a. Show a = S [a]. If you were going to make exists a keyword, I think you would write it like this: data S = ConsS (exists a. Show a = [a]) To contrast: data GhcS = forall a. Show a = ConsGhcS [a] data T = ConsT (forall a. Show a = [a]) This gives these constructors: ConsS :: forall a. (Show a = [a] - S) ConsGhcS :: forall a. (Show a = [a] - S) -- same ConsT :: (forall a. Show a = [a]) - T -- higher-rank type! T isn't very useful, it has to be able to provide a list of *any* instance of Show, so probably [] is all you get. But you can do something similar: data N = ConsN (forall a. Num a = [a]) Now you get ConsN :: (forall a. Num a = [a]) - N and you can legally do n = ConsN [1,2,3] since [1,2,3] == [fromInteger 1, fromInteger 2, fromInteger 3] :: forall a. Num a = [a] Conceptually, an S holds *some* instance of Show, so the user of a constructed S can only use methods of Show; they don't have any further knowledge about what is inside. But a N holds *any* instance of Num, so the user of the data can pick which one they want to use; Integer, Rational, Double, some (Expr Int) instance made by an embedded DSL programmer, etc. Of course, there are some ways to recover information about what types are inside the existential using GADTs or Data.Dynamic. But those need to be held in the structure itself. For example: data Typ a where TBool :: Typ Bool TInt :: Typ Int TFunc :: Typ a - Typ b - Typ (a - b) TList :: Typ a - Typ [a] TPair :: Typ a - Typ b - Typ (a,b) Now you can create an existential type like this: data Something = forall a. Something (Typ a) a and you can extract the value if the type matches: data TEq a b where Refl :: TEq a a extract :: forall a. Typ a - Something - Maybe a extract ta (Something tb vb) = do Refl - eqTyp ta tb return vb This desugars into ] extract ta (Something tb vb) = ]eqTyp ta tb = \x - ] case x of ] Refl - return vb ] _ - fail pattern match failure which, since Refl is the only constructor for TEq, simplifies to ] extract ta (Something tb vb) = eqTyp ta tb = \Refl - Just vb The trick is that the pattern match on Refl proves on the right-hand side that a is the same type as that held in the existential, so we have successfully extracted information from the existential and can return it to the caller without breaking encapsulation. Here's the helper function eqTyp; it's pretty mechanical: eqTyp :: Typ a - Typ b - Maybe (TEq a b) eqTyp TBool TBool = return Refl eqTyp TInt TInt = return Refl eqTyp (TFunc a1 b1) (TFunc a2 b2) = do Refl - eqTyp a1 a2 Refl - eqTyp b1 b2 return Refl eqTyp (TList a1) (TList a2) = do Refl - eqTyp a1 a2 return Refl eqTyp (TPair a1 b1) (TPair a2 b2) = do Refl - eqTyp a1 a2 Refl - eqTyp b1 b2 return Refl eqTyp _ _ = Nothing Here's a simple test: test = Something (TFun TInt TBool) (\x - x == 3) runTest = fromJust (extract (TFun TInt TBool) test) 5 runTest == False, of course. -- ryan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] problems with HOC install from svn
It sounds like it's looking for the binary package -- you should install it using cabal, e.g. private (per-user) install: cabal update cabal install binary global (system-wide) install: sudo cabal update sudo cabal install --global binary -Ross On Sep 8, 2009, at 7:57 PM, John Velman wrote: I'm unable to build HOC from the svn read-only checkout. Here are some details of what I'm doing. I'm running OS X 10.5.8 on an intel iMac with Xcode is 3.1.3. Haskel and Cabal are from the Haskel platform, haskell-platform-2009.2.0.2-i386.dmg I got Parsec 3.0 from Hackage. I checked out HOC using the svn command at http://code.google.com/p/hoc/source/checkout and checked out revision 411. Configure goes OK except for the complaint: Setup.hs:1:0: Warning: In the use of `defaultUserHooks' (imported from Distribution.Simple): Deprecated: Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2 compatibility in which case you must stick with defaultUserHooks But when I try to build, I get, after a bunch of apparently successful things: --- Loading package binary-0.5.0.1 ... command line: can't load .so/.DLL for: HSbinary-0.5.0.1 (dlopen (libHSbinary-0.5.0.1.dylib, 9): image not found) --- I certainly can't find libHSbinary... of any version on my computer, dylib or not. Tried looking in the /Library/Frameworks/GHC.Framework stuff, also did a find . -iname *libHS* and found libHSGLFW..., libHSparsec-3.0.0. (also tried this in my home directory). What is this, and how do I get it? Best, John Velman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] problems with HOC install from svn
Thanks. Now I do have libHSbinary-0.5.0.1.a in /usr/local/lib, but apparently not the dylib version. Tomorrow I'll look further. Perhaps there are some options to produce dylib libraries. I've used Haskell on Linux some time ago (but not Cabal), and have been Xcoding with Objective C for a year or so now, but never tried this before. I am interested in HOC, but I've obviously got a lot to learn. Thanks again, John Velman On Tue, Sep 08, 2009 at 08:35:54PM -0400, Ross Mellgren wrote: It sounds like it's looking for the binary package -- you should install it using cabal, e.g. private (per-user) install: cabal update cabal install binary global (system-wide) install: sudo cabal update sudo cabal install --global binary -Ross On Sep 8, 2009, at 7:57 PM, John Velman wrote: I'm unable to build HOC from the svn read-only checkout. Here are some details of what I'm doing. I'm running OS X 10.5.8 on an intel iMac with Xcode is 3.1.3. Haskel and Cabal are from the Haskel platform, haskell-platform-2009.2.0.2-i386.dmg I got Parsec 3.0 from Hackage. I checked out HOC using the svn command at http://code.google.com/p/hoc/source/checkout and checked out revision 411. Configure goes OK except for the complaint: Setup.hs:1:0: Warning: In the use of `defaultUserHooks' (imported from Distribution.Simple): Deprecated: Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2 compatibility in which case you must stick with defaultUserHooks But when I try to build, I get, after a bunch of apparently successful things: --- Loading package binary-0.5.0.1 ... command line: can't load .so/.DLL for: HSbinary-0.5.0.1 (dlopen(libHSbinary-0.5.0.1.dylib, 9): image not found) --- I certainly can't find libHSbinary... of any version on my computer, dylib or not. Tried looking in the /Library/Frameworks/GHC.Framework stuff, also did a find . -iname *libHS* and found libHSGLFW..., libHSparsec-3.0.0. (also tried this in my home directory). What is this, and how do I get it? Best, John Velman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] problems with HOC install from svn
I have binary-0.5 not binary-0.5.0.1, but it doesn't have any dylibs. Moreover, I was under the impression that GHC does not yet support shared libraries like those, so I'm not sure why it would be looking for one. I can't really speculate, maybe more of the build output might help? -Ross On Sep 8, 2009, at 10:54 PM, John Velman wrote: Thanks. Now I do have libHSbinary-0.5.0.1.a in /usr/local/lib, but apparently not the dylib version. Tomorrow I'll look further. Perhaps there are some options to produce dylib libraries. I've used Haskell on Linux some time ago (but not Cabal), and have been Xcoding with Objective C for a year or so now, but never tried this before. I am interested in HOC, but I've obviously got a lot to learn. Thanks again, John Velman On Tue, Sep 08, 2009 at 08:35:54PM -0400, Ross Mellgren wrote: It sounds like it's looking for the binary package -- you should install it using cabal, e.g. private (per-user) install: cabal update cabal install binary global (system-wide) install: sudo cabal update sudo cabal install --global binary -Ross On Sep 8, 2009, at 7:57 PM, John Velman wrote: I'm unable to build HOC from the svn read-only checkout. Here are some details of what I'm doing. I'm running OS X 10.5.8 on an intel iMac with Xcode is 3.1.3. Haskel and Cabal are from the Haskel platform, haskell-platform-2009.2.0.2-i386.dmg I got Parsec 3.0 from Hackage. I checked out HOC using the svn command at http://code.google.com/p/hoc/source/checkout and checked out revision 411. Configure goes OK except for the complaint: Setup.hs:1:0: Warning: In the use of `defaultUserHooks' (imported from Distribution.Simple): Deprecated: Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2 compatibility in which case you must stick with defaultUserHooks But when I try to build, I get, after a bunch of apparently successful things: --- Loading package binary-0.5.0.1 ... command line: can't load .so/.DLL for: HSbinary-0.5.0.1 (dlopen(libHSbinary-0.5.0.1.dylib, 9): image not found) --- I certainly can't find libHSbinary... of any version on my computer, dylib or not. Tried looking in the /Library/Frameworks/GHC.Framework stuff, also did a find . -iname *libHS* and found libHSGLFW..., libHSparsec-3.0.0. (also tried this in my home directory). What is this, and how do I get it? Best, John Velman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HList and Type signatures / synonyms
Gunther, I've got a little experience with HList - read below. 2009/9/6 Günther Schmidt gue.schm...@web.de: Hi, I keep accumulating values and right now use plain tuples for that. I end up with a 12 element tuple and things are a bit messy. I'd like to use extensible Records from HList instead, thing is I'd like to keep putting type signatures in my code. As it turns out that seems to be where it gets messy with HList. There is a template haskell function called makeLabel that can generate the boilerplate for you. If you are comfortable not seeing all the type definitions, it might do the trick. PS: Does anyone know why there are Label-n modules in HList, and which one to use? I don't but Label4 works for me. Justin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Takusen: *** Exception: readUTF8Char: illegal UTF-8 character 252
Hello Günther, It looks like Access is not using UTF8 as its text encoding. I have Access at work, so I can look into this at some point. The ODBC code assumes the encoding is always UTF8. For some drivers (e.g. PostgreSQL) you must configure the ODBC driver correctly to provide UTF8. Does Takusen work with Access for US7ASCII text? If not, this would suggest that Access is using UTF16 (which is common on Windows). Alistair 2009/9/8 Günther Schmidt gue.schm...@web.de: Hi all, I'm trying to use Takusen ODBC on Windows. I'm using a German WinXP Pro and try to connect to an MS Access database. As soon as I try to do some inserts the above mentioned exception shows up. Does anyone know a work around for this? Günther ___ 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