News aggregator

($) and ApplicativeDo

haskell-cafe - Thu, 06/16/2016 - 5:08pm
foo :: Applicative f => f String foo = do x <- pure "this works" pure x ... but replace "pure x" with "pure $ x" and it doesn't typecheck: a monad instance is required! Tom
Categories: Offsite Discussion

partial solved problem installing postgreSQL-libpqon Windows?

haskell-cafe - Thu, 06/16/2016 - 12:49pm
Hi Kees, Would It be possible for you to try with GHC 7.10.3 or 8.0.1? A bunch of things have changed with the linker in these two versions which should make linking against packages easier. <command line>: can't load .so/.DLL for: ghc.exe: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq: %1 is not a valid Win32 This seems to be coming from the runtime linker, if indeed d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll can be found then either it's the wrong bitness/image type or libpq.dll has dependencies on other dlls. 7.10.1 is not able to load these then as the search path won't be correct. To test this you can add d:/PROGRA~2/POSTGR~1/9.3/lib\ to your path and try loading it again. If that doesn't work and you want to know what's really going on, you can enable loader snaps in gflags for GHC.exe and GHCi.exe (or runHaskell, what ever it is you're using) and attach a debugger like gdb or windbg. https://msdn.microsoft.com/en-us/library/windows/hardware/ff556886(v=vs.85).aspx You'll then be able to see the OS's trace
Categories: Offsite Discussion

partial solved problem installing postgreSQL-libpqon Windows?

haskell-cafe - Thu, 06/16/2016 - 10:47am
Maybe I've found a part of the solution. I changed in postgresql-libpq.cabal Extra-Libraries: from pq to libpq. Then runHaskell xx configure -ghc, runHaskell xx build and then runHaskell xx install. No errors.. I'am happy. But. if I try to install postgresql-simple or hasql I get this error : .. <command line>: can't load .so/.DLL for: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll (addDLL: could not load DLL) ghc.exe: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq: %1 is not a valid Win32 application. ... dir d:\PROGRA~2\POSTGR~1\9.3\lib\libpq.dll finds the dll, but d:/PROGRA~2/POSTGR~1/9.3/lib/libpq.dll gives: 'Parameter format not correct'. These mangled filenames come from pg_config.exe. Is this a filename mangling problem? Any idea what is going on? Kees --------------------------- I want to install postgreSQL-libpq on Windows 7 64 bits with ghc version 7.10.1 and cabal version 1.22.4.0 This is what I did: Installed mingw From the msys prompt: pexports "d:\program files\postgreSQL\9.3\bin\libp
Categories: Offsite Discussion

base version numbers

haskell-cafe - Thu, 06/16/2016 - 8:58am
Since each version of GHC depends precisely on one version of base, would it not be more clear to name them after their version of GHC, rather than 4.x.y.z? Could this be done? Tom
Categories: Offsite Discussion

problem installing postgreSQL-libpq on Windows

haskell-cafe - Thu, 06/16/2016 - 8:19am
I want to install postgreSQL-libpq on Windows 7 64 bits with ghc version 7.10.1 and cabal version 1.22.4.0 This is what I did: Installed mingw From the msys prompt: pexports "d:\program files\postgreSQL\9.3\bin\libpq.dll" > libpq.def From the msys prompt: dlltool -d libpq.def -l libpq.a The file libpq.a is created. I copied the file to d:\program files\postgreSQL\9.3\bin\ and then from de cmd prompt: cabal install postgreSQL-libpq --extra-include-dirs="d:\program files\postgreSQL\9.3\include" --extra-lib-dirs="d:\program files\postgreSQl\9.3\bin" I get: Resolving dependencies... Configuring postgresql-libpq-0.9.1.1... Failed to install postgresql-libpq-0.9.1.1 Build log ( C:\Users\kees\AppData\Roaming\cabal\logs\postgresql-libpq-0.9.1.1.log ): [1 of 1] Compiling Main ( D:\Temp\cabal-tmp-6140\postgresql-libpq-0.9.1.1\dist\setup\setup.hs, D:\Temp\cabal-tmp-6140\postgresql-libpq-0.9.1.1\dist\setup\Main.o ) Linking D:\Temp\cabal-tmp-6140\postgresql-libpq-0.9.1.1\dist\setup\setup.ex
Categories: Offsite Discussion

ICPE 2017 - 1st Call for Papers

General haskell list - Wed, 06/15/2016 - 10:42pm
ICPE 2017 8th ACM/SPEC International Conference on Performance Engineering Sponsored by ACM SIGMETRICS, SIGSOFT, and SPEC RG L'Aquila, Italy April 22-26, 2017 https://icpe2017.spec.org/ ------------------------------------------------------------------------ IMPORTANT DATES Research and Industrial / Experience Abstracts: Sep 23, 2016 Research and Industrial / Experience Papers: Sep 30, 2016 Research and Industrial / Experience Paper Notification: Nov 18, 2016 Work-in-Progress/Vision Papers: Nov 25, 2016 Workshop Proposals: Nov 05, 2016 Workshop Proposal Notification: Nov 19, 2016 Dates for tutorials, posters and demos will be announced. ------------------------------------------------------------------------ SCOPE AND TOPICS The goal of the International Conference on Performance Engineering (ICPE) is to integrate theory an
Categories: Incoming News

This non-exhaustive pattern match seems exhaustive

haskell-cafe - Wed, 06/15/2016 - 9:33pm
I'm emulating a "closed typeclass" using a closed type family: * {-# LANGUAGE ExistentialQuantification #-}* * {-# LANGUAGE GADTs #-}* * {-# LANGUAGE LambdaCase #-}* * {-# LANGUAGE TypeFamilies #-}* * import GHC.Exts (Constraint)* * -- This is like* * --* * -- class Thing a -- instance Thing Int --* * type family Thing a :: Constraint where* * Thing Int = ()* * data Foo = forall a. Thing a => Foo (Bar a)* * data Bar a where* * Bar1 :: Bar Int* * Bar2 :: Bar Bool* * inspectFoo :: Foo -> ()* * inspectFoo = \case* * Foo Bar1 -> ()* * Foo Bar2 -> () -- This is required to suppress a warning* Here, it's not possible to create a Foo using "Foo Bar2", because there is no "Thing Bool" constraint in scope. Yet, when picking apart a Foo, I must still pattern match on this impossible data. Is there some smarter way to write this code? I thought of using `constraints`, and adding a catch
Categories: Offsite Discussion

SPLASH'16: 2nd Combined Call for Contributions toCollocated Events

General haskell list - Wed, 06/15/2016 - 9:12pm
################################################# ACM Conference on Systems, Programming, Languages, and Applications: Software for Humanity (SPLASH'16) ################################################# Amsterdam, The Netherlands Sun 30th October - Fri 4th November , 2016 http://2016.splashcon.org https://twitter.com/splashcon https://www.facebook.com/SPLASHCon/ Sponsored by ACM SIGPLAN Combined Call for Contributions to SPLASH tracks, collocated conferences, symposia and workshops: - SPLASH-I, SPLASH-E, Doctoral Symposium, Student Research Competition, Programming Languages Mentoring Workshop, Posters - Generative Programming: Concepts & Experiences (GPCE) - Software Language Engineering (SLE) - Scala Symposium - Workshops: AGERE, DSLDI, DSM, FOSD, ITSLE, LWC< at >SLE, META, MOBILE!, NOOL, PLATEAU, Parsing< at >SLE, REBLS, RUMPLE, SA-MDE, SEPS, VMIL, WODA The ACM SIGPLAN conference on Systems, Programming, Languages and Applications: Software for Humanity (SPLASH) embraces all aspects of software construction,
Categories: Incoming News

How to spot Monads, Applicatives ...

haskell-cafe - Wed, 06/15/2016 - 4:54pm
Hello all, I am at a stage, where I can use some of the Monads and Applicatives which are out there. But I hardly ever wrote my own instances. I am curious to learn about the thought processes which lead to the insight "hey that can be written nicely as an Applicative Functor" I suppose you can write everything without these type classes. Is it a promising approach to try without and then spot an element of repetition and factoring out that naturally leads to one of these typeclasses? Paticularly I am having difficulties with the *->* instances. E.g. why is the state "s" in the state monad the fixed type and the "a" the type parameter? When I am writing state code without the State monad the two look like equal candidates. Why not have "State a" monad, which threads an a-typed value and spits out states? While we're at it: would someone be so kind and explain what exactly is meant by an "effect"? I know that in haskell this is not the same as a "side effect" as there are no side-effects in haskell.
Categories: Offsite Discussion

ANN: eccrypto, aka Hecc, hF2

haskell-cafe - Wed, 06/15/2016 - 8:35am
Dear Haskell Community! It was a long~ish time ago I released hecc[1], which had an unfortunate but funny (to me) name, later together with hF2[2]. Since I have neither released hyperelliptic curve crypto support, nor my pairing based crypto, a generalising change in names would be in order. Today I am releasing eccrypto[3], which contains the code of both (to allow easier refactoring of new ideas) and something new: A pure Haskell, timing-attack resistant Ed25519[4] implementation! ...well, a very rough one at least. The code is not "done", gives wrong results, is _very_ slow, but it might serve as reading material as well as a primer what I plan to do in the future. I do not plan to add embedded C or assembler code, but plan to make the code comparatively fast to some common implementations as well as timing attack resistant (see: [5]), even if it will never be as fast as the best code used in contemporary benchmarks. Sadly, due to health issues, I am not able to work on said code and have not been for
Categories: Offsite Discussion

ANN: eccrypto, aka Hecc, hF2

libraries list - Wed, 06/15/2016 - 8:13am
Dear Haskell Community! It was a long~ish time ago I released hecc[1], which had an unfortunate but funny (to me) name, later together with hF2[2]. Since I have neither released hyperelliptic curve crypto support, nor my pairing based crypto, a generalising change in names would be in order. Today I am releasing eccrypto[3], which contains the code of both (to allow easier refactoring of new ideas) and something new: A pure Haskell, timing-attack resistant Ed25519[4] implementation! ...well, a very rough one at least. The code is not "done", gives wrong results, is _very_ slow, but it might serve as reading material as well as a primer what I plan to do in the future. I do not plan to add embedded C or assembler code, but plan to make the code comparatively fast to some common implementations as well as timing attack resistant (see: [5]), even if it will never be as fast as the best code used in contemporary benchmarks. Sadly, due to health issues, I am not able to work on said code and have not been for
Categories: Offsite Discussion

Help with Data.Conduit.List.mapAccum

haskell-cafe - Wed, 06/15/2016 - 6:53am
Hello, I'm trying to use Data.Conduit, but I get stuck with mapAccum as how to get and retrieve the result. If I use it, I get a simple conduit like : testC :: ConduitM () Int IO Int testC = Src =$= cdt where src = CL.sourceList [1..10] cdt = CL.mapAccum (\x s ->(x+s, x) 0 I can get the output with testC $$ CL.consume but how do I retrieve the accumulated sum ? Bruno _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

wren gayle romano: Off to NYC for July 4th and LICS

Planet Haskell - Wed, 06/15/2016 - 1:32am

Over the last few weeks I was interviewed for the Identity Function. The process was quite nice and got me thinking on a number of things. Some of them I may well flesh out into blog posts once I get the time. Of course, that likely won't be until the autumn given everything else going on the next couple months.

I'll be in New York from 28 June through 10 July. The first couple days are for a PI meeting, then I'll get a four-day weekend before LICS, NLCS, and LOLA. Originally the plan was to take a quick trip to Sacramento that weekend for a friend's wedding. (The wedding's still on, but plans changed.) At least this way I'll get a chance to relax, rather than running all over the place. Of course this also means I'll be spending the 4th in NYC. Historically the 4th has been one of my favorite holidays, because it was one I've always spent with friends. I don't know that any of my readers are in NYC, but if you'll be around drop me a line. Or if you used to live there and know fun things to do that weekend, let me know! (Especially any quiet end-of-Pride things.)

Me and L set the date for our final move to the Bay Area: 20 July. And then I start at Google on the 25th. Between now and then: dissertating!!



comments
Categories: Offsite Blogs

[ANN] Budapest Haskell Hackathon 2016, 6-7th Aug 2016

haskell-cafe - Tue, 06/14/2016 - 9:00pm
Hi everybody, I'm happy to announce that our local user group will hold a Haskell Hackathon in Budapest this year (this will be the second)! We will hold it from August 6th to the 7th (Saturday & Sunday). You can find out more on the following link: https://wiki.haskell.org/Budapest_Hackathon_2016 We will reguraly update the site with new information. If you decide to come, please fill out the following Google Form: http://goo.gl/forms/pqgh6fvK8F8a2pAg1 If you have a project, demo, or talk that you want to bring to the event please contact us, and we can talk about the details. You can find our contact info the events wiki site, or you can just contact me directly. The event will be open to people of all experience levels, from beginners to gurus. The only requisite is that you’re interested in the Haskell language, and want to hang out with us, and have a good time! Greetings from Daniel, and the other BP-HUG organizers. _______________________________________________ Haskell-Cafe mailing list Hask
Categories: Offsite Discussion

JTRES 2016, Submission Deadline Extended to July 3

General haskell list - Tue, 06/14/2016 - 8:55pm
******** ******** The paper submission deadline has been extended to ******** July 3, 2016 ******** ====================================================================== CALL FOR PAPERS The 14th Workshop on Java Technologies for Real-Time and Embedded Systems JTRES 2016 Part of the Managed Languages & Runtimes Week 2016 29 August - 2 September 2016 Lugano, Switzerland http://jtres2016.compute.dtu.dk/ ====================================================================== Submission deadline: 3 July, 2016 Submission site: https://easychair.org/conferences/?conf=jtres2016 ====================================================================== Over 90% of all microprocessors are now used for real-time and embedded applications. Embedded devices are deployed on a broad diversity of distinct processor arc
Categories: Incoming News

[ANN] Budapest Haskell Hackathon 2016, 6-7th Aug 2016

General haskell list - Tue, 06/14/2016 - 8:50pm
Hi everybody, I'm happy to announce that our local user group will hold a Haskell Hackathon in Budapest this year (this will be the second)! We will hold it from August 6th to the 7th (Saturday & Sunday). You can find out more on the following link: https://wiki.haskell.org/Budapest_Hackathon_2016 We will reguraly update the site with new information. If you decide to come, please fill out the following Google Form: http://goo.gl/forms/pqgh6fvK8F8a2pAg1 If you have a project, demo, or talk that you want to bring to the event please contact us, and we can talk about the details. You can find our contact info the events wiki site, or you can just contact me directly. The event will be open to people of all experience levels, from beginners to gurus. The only requisite is that you’re interested in the Haskell language, and want to hang out with us, and have a good time! Greetings from Daniel, and the other BP-HUG organizers. _______________________________________________ Haskell mailing list Haskel
Categories: Incoming News

Christopher Allen: How to use UUID values with Persistent and Yesod

Planet Haskell - Tue, 06/14/2016 - 6:00pm

Some people find it trickier to store UUID values in their database with Persistent or to use UUID values in a Yesod web application than is really necessary. Here I’ll share some code from my work that demonstrates some patterns in applications that use Persistent or Yesod which should make it easier.

The context for this post can be found in these two links:

Replying to: Jezen Thomas writing about using UUIDs in Yesod
Prior art: Michael Xavier on UUID columns in Persistent

Alternate title: Same as the original, but with: “and no Control.Lens needed” tacked on.

This code is adapted from stuff we’ve written at work.

Persistent / UUID integration Instances

Radioactive dumping ground for orphan instances. Adding the instances makes Persistent understand how to serialize and deserialize the UUID type. The orphans can be avoided if you use a newtype.

-- Note we're taking advantage of -- PostgreSQL understanding UUID values, -- thus "PersistDbSpecific" instance PersistField UUID where toPersistValue u = PersistDbSpecific . B8.pack . UUID.toString $ u fromPersistValue (PersistDbSpecific t) = case UUID.fromString $ B8.unpack t of Just x -> Right x Nothing -> Left "Invalid UUID" fromPersistValue _ = Left "Not PersistDBSpecific" instance PersistFieldSql UUID where sqlType _ = SqlOther "uuid" Models

This is where we actually use the UUID type in our models.

module MyCompany.DB.Models where share [mkPersist sqlSettings,mkMigrate "migration"] [persistLowerCase| User json sql=users email Email sqltype=text UniqUserEmail email uuid UUID sqltype=uuid default=uuid_generate_v4() UniqUserUuid uuid deriving Show Read Eq Typeable |]

We use the default JSON representation generated so that the format is predictable for the datatypes. I was a little queasy with this initially and it does mean we have to watch what happens to Aeson, but I believe net-net it reduces defects that reach production.

Yesod PathPiece integration

PathPiece is the typeclass Yesod uses to deserialize Text data into a more structured type, so that something like the following:

!/#Subdomain/#NumberedSlug SomeRouteR GET

could work. Here Subdomain and NumberedSlug are domain-specific types we made to represent a concept in our application in a type-safe manner. PathPiece often goes unnoticed by people new to Yesod, but it’s good to understand. For a super simple example:

newtype Subdomain = Subdomain Text deriving (Eq, Show, Read) instance PathPiece Subdomain where toPathPiece (Subdomain t) = t fromPathPiece = Just . Subdomain

The PathPiece class itself isn’t terribly complicated or interesting:

-- https://hackage.haskell.org/package/path-pieces-0.2.1/docs/Web-PathPieces.html -- S for "Strict" class PathPiece s where fromPathPiece :: S.Text -> Maybe s toPathPiece :: s -> S.Text

To address the original post’s code, I wouldn’t have written that myself. I generally keep DB/IO stuff apart from things like forms. Partly this is because our web app repository is separate from our domain types / DB stuff repo, which sort of forces us to refactor things we might need to do more than once, or in a context that isn’t a web app. The use of applicative style and the double-lifting was not idiomatic.

Alternate title rejected for being too snarky: I told the doctor it hurts when I move my arm a certain way. The doctor told me to stop moving my arm like that.

I know this site is a bit of a disaster zone, but if you like my writing or think you could learn something useful from me, please take a look at the book I've been writing with my coauthor Julie. There's a free sample available too!

Posted on June 15, 2016

Categories: Offsite Blogs

Reminder: 10 days to submit talks to CUFP 2016

haskell-cafe - Tue, 06/14/2016 - 4:08pm
This CFP and the form for submitting presentation proposals can be found at: http://cufp.org/2016/call-for-presentations.html ---------------------------------------------------------------------- 2016 Call for Presentations Workshop for Commercial Users of Functional Programming 2016 Sponsored by SIGPLAN CUFP 2016 Co-located with ICFP 2016 Nara, Japan September 22-24 Talk Proposal Submission Deadline: 24 June 2016 The annual CUFP event is a place where people can see how others are using functional programming to solve real world problems; where practitioners meet and collaborate; where language designers and users can share ideas about the future of their favorite language; and where one can learn practical techniques and approaches for putting functional programming to work. ---------------------------------------------------------------------- Giving a CUFP Talk If you have experience using functional languages in a practical setting, we invite you to submit a proposal to give a talk at the event.
Categories: Offsite Discussion