News aggregator

Instances for (->) a (b :: * -> *)?

haskell-cafe - Fri, 06/17/2016 - 6:33am
If one wants to declare instances for a type schema `a -> _`, one writes something like this: instance Context => Class parameters ... ((->) a) where { ... } But what if you want to declare instances for a type schema `a -> b _`, that is, where the slot to be filled is not just the result of (->) a, but rather the composition of that together with another type operation b :: * -> *? I'd like to write something like this: instance Context => Class parameters ... ((->) a (b :: *->*)) where { ...} or: instance Context => Class parameters ... ((->) a (b *)) where { ...} but these don't work. Is it possible to do this? Concretely, here's what I'm trying to achieve. I wrote a typeclass for MonadReaders that are embedded inside (one level) of other MonadReaders, like this: {-# LANGUAGE FunctionalDependencies FlexibleInstances UndecidableInstances #-} class MonadReader w m => DeepMonadReader w r m | m -> r where { deepask :: m r ; deepask = deepreader id ; de
Categories: Offsite Discussion

Trying to test natural transformations, in Haskell.

haskell-cafe - Fri, 06/17/2016 - 4:40am
Got it: {-# LANGUAGE Rank2Types AllowAmbiguousTypes FlexibleContexts #-} type NatTran f f' a = (Functor f, Functor f') => f a -> f' a to_assert :: (Functor f, Functor f', Eq (f' b)) => (a -> b) -> NatTran f f' a -> NatTran f f' b -> f a -> Bool to_assert g h h' f = (fmap g . h) f == (h' . fmap g) f maybe_to_list :: NatTran Maybe [] a maybe_to_list Nothing = [] maybe_to_list (Just x) = [x] test_func :: Num a => a -> (a, a) test_func x = (x, x + 1) success = all (to_assert test_func maybe_to_list maybe_to_list) [Nothing, Just 1] main :: IO () main = do if success then print "Success!" else print "Failure." main Running this code produces: "Success!" ================================================= Hi all, In doing the challenge problems at the end of chapter 10 (Natural Transformations) in Bartosz Milewski’s “Category Theory for Programmers”, I’m trying to write a generic naturality checker: {-# LANGUAGE Rank2Types AllowAmbiguousTypes #-}
Categories: Offsite Discussion

Trying to test natural transformations, in Haskell.

haskell-cafe - Fri, 06/17/2016 - 4:02am
Hi all, In doing the challenge problems at the end of chapter 10 (Natural Transformations) in Bartosz Milewski’s “Category Theory for Programmers”, I’m trying to write a generic naturality checker: {-# LANGUAGE Rank2Types AllowAmbiguousTypes #-} type NatTran a = (Functor f, Functor f') => f a -> f' a to_assert :: (Functor f, Eq b) => (a -> b) -> NatTran a -> NatTran b -> f a -> Bool to_assert g h h' f = (fmap g . h) f == (h' . fmap g) f which is later made specific to a particular natural transformation: maybe_to_list :: Maybe a -> [a] maybe_to_list Nothing = [] maybe_to_list (Just x) = [x] test_func :: Num a => a -> (a, a) test_func x = (x, x + 1) assertions = map (to_assert test_func maybe_to_list) [Nothing, Just 1] but I’m getting this from ghc: Could not deduce (Functor f0) arising from a use of ‘fmap’ from the context (Functor f, Eq b) bound by the type signature for interactive:IHaskell465.to_assert :: (Functor f, Eq b) => (a -> b) -> interactive:IHaskell465.Na
Categories: Offsite Discussion

($) 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