From allbery.b at gmail.com Sun Mar 1 00:00:15 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 28 Feb 2015 19:00:15 -0500 Subject: [Haskell-cafe] A Question about IO In-Reply-To: References: Message-ID: On Sat, Feb 28, 2015 at 6:40 PM, Zongzhe Yuan wrote: > Sometimes IO do something and return something, i wonder if the return > type, for example is IO Int means it will return an int, could i purely > fetch the int? Conceptually, an IO something is a *program* that can produce, not under your control, a something. You create this program and return it as the value of (main :: IO a); then the runtime executes it. (Actually, what happens in GHC is different. There are ways to get at the value --- but you have to dig into GHC internals and use them to lie to GHC, and it will punish you for it by (among other things) treating it as a pure value and memoizing, sharing (or not sharing when you expect it to), etc. as it sees fit. In short: don't. This is not some thing to force you to jump through hoops for no good reason, with an easy escape hatch to get the behavior you'd get from a random Perl/Java/whatever program; if you go around its back, things *will* break unless you understand how GHC works.) There is nothing in Monad that guarantees that you can go from Monad m => m a -> a. Specific Monad-s (lists, Maybe, etc.) may provide functions to do so, or expose their data constructors so that you can pattern match them; other Monad-s (IO, ST, STM) do not, and you cannot get at "the value inside" --- indeed, there may not be a value inside. (This isn't even specific to Monad; you can't pattern match a Data.Map.Map, either, and it's not a Monad. It does provide toList, though, as well as its own access methods.) -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From lambda.fairy at gmail.com Sun Mar 1 00:01:07 2015 From: lambda.fairy at gmail.com (Chris Wong) Date: Sun, 1 Mar 2015 13:01:07 +1300 Subject: [Haskell-cafe] is it possible to implement Functor for ByteString and Text In-Reply-To: <54F212C9.6040509@gmail.com> References: <54F212C9.6040509@gmail.com> Message-ID: On Sun, Mar 1, 2015 at 8:11 AM, silvio wrote: > I have recently heard that some people want to burn bridges (introducing > Foldable and Traversable to Prelude) and I've been wondering if it was > possible somehow allow Text and Bytestring like containers to make use > of those functions. Something along the lines of > > import qualified Data.ByteString as BS > > newtype ByteString' a = ByteString' BS.ByteString > > type ByteString = ByteString' Word8 > > instance (ByteString' a ~ ByteString' Word8) => Functor (ByteString') > where > fmap f (ByteString' bs) = ByteString' $ BS.map f bs If tweak the definition of Functor a bit, we can get that to work: {-# LANGUAGE ConstraintKinds, TypeFamilies #-} import qualified Data.ByteString as B import Data.Word (Word8) import GHC.Prim (Constraint) newtype ByteString' a = ByteString' B.ByteString deriving (Eq, Ord, Show) class Functor' f where type FunctorConstraint f a :: Constraint fmap' :: (FunctorConstraint f a, FunctorConstraint f b) => (a -> b) -> f a -> f b instance Functor' ByteString' where type FunctorConstraint ByteString' a = a ~ Word8 fmap' f (ByteString' x) = ByteString' $ B.map f x But I don't think it's possible with the original type class. -- https://lambda.xyz From travis.cardwell at extellisys.com Sun Mar 1 00:42:10 2015 From: travis.cardwell at extellisys.com (Travis Cardwell) Date: Sun, 01 Mar 2015 09:42:10 +0900 Subject: [Haskell-cafe] What other prelude to cleanly convert text-files into json In-Reply-To: References: Message-ID: <54F26062.8020007@extellisys.com> On 2015?02?28? 20:23, Bram Neijt wrote: > It quickly became a collection of "import qualified" and "T.unpack, > T.pack" calls that made the whole thing look ugly [1]. > [1] Source can be read here: https://gist.github.com/bneijt/9bdb4b1759790a8463c9 File paths are of type `System.FilePath.Posix.FilePath`, a type alias for `String`. Note that this convention is also followed in `ByteString` and `Text` libraries; they do not use `ByteString` or `Text` types for the file paths. In this code, file paths are packed only to have to unpack them again (twice!), which likely offsets any performance improvements of using the `Text` version of `isSuffixOf`. Here is a version using the same style but without packing file paths: https://gist.github.com/TravisCardwell/fd9981e4968e4af3751d I included a few other changes, which are commented in the code. By the way, I do not think that qualified imports are bad. I like them because they provide an explicit reference to the source module of a function. Cheers, Travis From silvio.frischi at gmail.com Sun Mar 1 01:08:40 2015 From: silvio.frischi at gmail.com (silvio) Date: Sun, 01 Mar 2015 02:08:40 +0100 Subject: [Haskell-cafe] is it possible to implement Functor for ByteString and Text In-Reply-To: References: <54F212C9.6040509@gmail.com> Message-ID: <54F26698.3000207@gmail.com> Wow ConstraintKinds. There's always a new extension to be learned :) Anyway, if changing the Functor declaration were allowed, it would probably make more sense to use something like MonoFunctor. Unfortunately, MPTC or type family stuff is never going to make it into Prelude. Silvio From haskell at nand.wakku.to Sun Mar 1 02:58:15 2015 From: haskell at nand.wakku.to (Niklas Haas) Date: Sun, 1 Mar 2015 03:58:15 +0100 Subject: [Haskell-cafe] is it possible to implement Functor for ByteString and Text In-Reply-To: <54F26698.3000207@gmail.com> References: <54F212C9.6040509@gmail.com> <54F26698.3000207@gmail.com> Message-ID: <20150301035815.GB25080@nanodesu.localdomain> I think it's more realistic to use lens style Setters where possible. Essentially: type Setter s t a b = (a -> b) -> s -> t type Setter' s a = Setter s s a a bytes :: Setter ByteString Word8 bytes = BS.map fmapped :: Functor f => Setter (f a) (f b) a b fmapped = fmap In this framework, you could write a function that can abstract over any setter, eg. changeSomething :: Setter s t Foo Bar -> s -> t changeSomething s = s fooBar where fooBar :: Foo -> Bar It's not quite the same thing as making ByteString or Text an instance of Functor, but for some tasks, it can be a good replacement. On Sun, 01 Mar 2015 02:08:40 +0100, silvio wrote: > Wow ConstraintKinds. There's always a new extension to be learned :) > Anyway, if changing the Functor declaration were allowed, it would > probably make more sense to use something like MonoFunctor. > Unfortunately, MPTC or type family stuff is never going to make it into > Prelude. > > Silvio > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From amindfv at gmail.com Sun Mar 1 04:51:52 2015 From: amindfv at gmail.com (amindfv at gmail.com) Date: Sat, 28 Feb 2015 23:51:52 -0500 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: <20150228185026.GA10871@x60s.casa> References: <20150228172448.0B40EBC942@haskell.org> <20150228185026.GA10871@x60s.casa> Message-ID: <55E30478-64E2-4B76-B049-B42A8EF21074@gmail.com> IIRC hackage doesnt accept AllRightsReserved packages (or at least sdist warns about it strongly) Tom El Feb 28, 2015, a las 13:50, Francesco Ariis escribi?: > On Sat, Feb 28, 2015 at 07:27:16PM +0200, fr33domlover wrote: >> I'd like to make a suggestion: have Hackage accept only packages >> released under free software licenses. This is probably true for >> most/all packages there, but making it official will both send a >> strong message to and from the community, and provide people with >> the security and peace of mind, knowing their software is free as >> in freedom. > > I was pretty sure there was a note somewhere on hackage to only upload > software with open source licences, but alas I cannot find it now... > (maybe I am confusing myself with another package archiver?). > > I agree having a "please use a licence approved by the OSI/FSF" could > prevent problems and seems a sensible choice in any case. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From gershomb at gmail.com Sun Mar 1 05:17:17 2015 From: gershomb at gmail.com (Gershom B) Date: Sun, 1 Mar 2015 00:17:17 -0500 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> Message-ID: For the record, the current behaviour is as follows. A package with AllRightsReserved as a license or a missing license is now rejected by ?cabal check? with the following: == * The 'license' field is missing or specified as AllRightsReserved. Hackage would reject this package. == A package with an unknown license such as ?Foo? is rejected with the following: == * 'license: Foo' is not a recognised license. The known licenses are: GPL, GPL-2, GPL-3, LGPL, LGPL-2.1, LGPL-3, AGPL, AGPL-3, BSD2, BSD3, MIT, MPL-2.0, Apache, Apache-2.0, PublicDomain, AllRightsReserved, OtherLicense Hackage would reject this package. == However, a package with OtherLicense is indeed accepted. It would be good to specify that we ask that OtherLicense indeed be another recognized open-source license. That said, I do not feel strongly about how much care we take to enforce this. We should definitely better document this and other elements of hackage policy, and I know discussions about that have in fact been underway. I agree that being able to filter Hackage packages on license and other considerations (say, build reports on various systems) would be a great feature. Some such improvements have been floated as GSoC projects. I would encourage those that feel strongly about such features to consider getting involved with development of the hackage server. Cheers, Gershom On February 28, 2015 at 4:29:39 PM, Mike Meyer (mwm at mired.org) wrote: > On Sat, Feb 28, 2015 at 2:59 PM, Francesco Ariis wrote: > > > Those restrictions would be, in my opinion, a good idea. Rejecting > > say CC-SA (CC0 is FSF approved), etc. code means rejecting licences > > with clear and documented problems in them, problems which would > > cause quite a lot of headaches down the road. > > > > I don't have a problem if you want to do that. But by disallowing those > licenses on Hackage, you've taken away *MY* ability to decide if those > problems are problems for my use case. > > There are open source projects that are systematically excising GPL'ed > software because of the problems it shares with ShareAlike licenses. Should > we disallow the GPL because some people have problems with it? > > Making Hackage better to help users sort out which licenses they are > willing to accept in their project - which I personally would like to do on > a project-by-project basis! - is a solution to these problems. Restricting > the licenses that are acceptable on Hackage to meet some arbitrary set of > criteria is a knee-jerk. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From sean.seefried at gmail.com Sun Mar 1 06:09:14 2015 From: sean.seefried at gmail.com (Sean Seefried) Date: Sun, 1 Mar 2015 17:09:14 +1100 Subject: [Haskell-cafe] ghci and dynamically linking to Objective-C objects on Mac OS X Message-ID: Hi all, I fear I might be unaware of something I should be. Say I have a file objc_util.m with the following contents: #include void ns_log(const char *s) { NSString *str = [NSString stringWithUTF8String:s]; NSLog(@"%@", str); } I also have a file Main.hs with contents: {-# LANGUAGE ForeignFunctionInterface #-} module Main where import Foreign.C.Types import Foreign.C.String foreign import ccall "ns_log" cNSLog :: CString -> IO () nsLog s = withCString s cNSLog I compile objc_util.m with: gcc -c objc_util.m And then I try to open it up in GHCi. ghci objc_util.o Main.hs -framework Foundation I add the flag '-frame Foundation' in the hopes that symbols in objc_util.o will get resolved dynamically. However I get: GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading object (static) objc_util.o ... ghc: panic! (the 'impossible' happened) (GHC version 7.8.3 for x86_64-apple-darwin): Loading temp shared object failed: dlopen(/var/folders/pv/pfxcyy117v31vt6lsshtgr_w0000gn/T/ghc33546_0/ghc33546_1.dylib, 9): Symbol not found: _OBJC_CLASS_$_NSString Referenced from: /var/folders/pv/pfxcyy1 17v31vt6lsshtgr_w0000gn/T/ghc33546_0/ghc33546_1.dylib Expected in: flat namespace in /var/folders/pv/pfxcyy117v31vt6lsshtgr_w0000gn/T/ghc33546_0/ghc33546_1.dylib Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug However, I have found a work around to this. If I do this: ln -s /System/Library/Frameworks/Foundation.framework/Foundation Foundation.o and then run ghci Foundation.o objc_util.o Main.hs I get this: GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading object (static) Foundation.o ... done Loading object (static) objc_util.o ... done final link ... done Everything has worked! And I can happily run 'nsLog' from GHCi and have it appear in the 'Console' app. However, it doesn't seem like I should have to do this. Where am I going wrong? Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sun Mar 1 07:25:10 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 1 Mar 2015 02:25:10 -0500 Subject: [Haskell-cafe] ghci and dynamically linking to Objective-C objects on Mac OS X In-Reply-To: References: Message-ID: On Sun, Mar 1, 2015 at 1:09 AM, Sean Seefried wrote: > However, it doesn't seem like I should have to do this. Where am I going > wrong? My guess is that the linker used by ghci (which is not the system linker, although there is ongoing work on that front) doesn't know how to deal with frameworks properly. You might have better luck turning your .o into a .dylib and linking *that* against the Foundation framework. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From fr33domlover at riseup.net Sun Mar 1 09:03:10 2015 From: fr33domlover at riseup.net (fr33domlover) Date: Sun, 1 Mar 2015 11:03:10 +0200 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: References: <20150228172446.3CB4EBC986@haskell.org> <54f21a89.ed16460a.1d6a.ffff9ddcSMTPIN_ADDED_MISSING@mx.google.com> Message-ID: Hello Mike, I think there's some confusion here. I wan't talking about GPL compatible licenses, but about *any* free software license! It looks like Creative Commons licenses may apply too, in particular the version 4 ones. CC by 4 is even GPL-compatible. The same for EPL and CDDL! Check out this: http://www.gnu.org/licenses/license-list.html Both are free sofware licenses. GPL compatibility isn't the issue here :) On Sat, 28 Feb 2015 14:18:23 -0600 Mike Meyer wrote: > > And what if I want something like the CDDL or the EPL? Those are both > licenses that the OSI says are popular. > The FSF approves them as well, like I said. > > You're addressing the nits, not the core issue I tried to raise: > placing restrictions on what licenses (or lack thereof) are acceptable > will discourage people from making software available via Hackage. I don't think it will, because people are already making free software. Look at other existing hosting services - they're *full* of free software! This is what people are making anyway. All I suggest is to make it official, providing a guarantee so people know each `cabal install` indeed installs only free software. > > > > This will allow people to upload first, and then think and understand the > > licensing situation. Once they do, they can properly tag their project. > Could > > that work? > > I don't know. I suspect that if you do that, a lot of people would > never bother tagging their packages. Would that work for you? They probably will, actually: There is a huge number of packages - I don't know how many - which have license tags. All the license tags on Hackage except for the all-rights-reserved one are FOSS licenses, so all of these would instantly become available as guaranteed free software packages. How many free software packages on Haskell don't have license tags? > You also talk like free/non-free was a binary decision, when it > isn't. The OSI lists licenses that aren't compatible with the GPL - > like the aforementioned EPL and CDDL. People releasing software under > one of those will want to avoid GPL licensed software, whereas people > releasing GPL licensed software will want to avoid those licenses, but > they are all free. Indeed they are all free, and the FSF approves them officially as well. MIT, BSD, Apache, EPL, CDDL, GPL, AGPL, LGPL... all of these are free software licenses. > Or I may not care. If I build a binary that uses one package that's > GPL-licensed and one that uses an incompatible OSI-approved license, I > can distribute my source under whatever terms I want, because my > source doesn't include source from those packages. I can build and run > binaries myself with no problems, and that may be fine. But I can't > distribute binaries because I can't satisfy both licenses > simultaneously, and that may not be acceptable. > > References: <54F17EFF.7010902@home.nl> <54F1A184.8060800@home.nl> <54F1C524.4060706@home.nl> <54F1FB13.3040206@home.nl> Message-ID: <54F2E745.7050505@home.nl> An HTML attachment was scrubbed... URL: From k-bx at k-bx.com Sun Mar 1 10:25:06 2015 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Sun, 1 Mar 2015 12:25:06 +0200 Subject: [Haskell-cafe] A Question about IO monad In-Reply-To: References: Message-ID: Hi Zongzhe, You can indeed write "Maybe a -> a" function easy, because you have Maybe constructors exported for you. But please note that this will lead to non-total function, e.g. it will have to return an error in case of call with Nothing, so you should avoid writing and using functions like this. IO case is even less safe, since IO is a special monad (its constructor is not exported), and you should want to do something like this even less, but still, you have functions like unsafePerformIO that have type "IO a -> a". But most probably if you need it -- you're doing something wrong. If you got to "IO a" value -- you should continue writing functions that operate in IO, and if you want to apply pure function to inner value, you can do it like this: main = do i <- ioIntVal let newIntVal = myPureIntFunc i putStrLn (show i) 1 ???. 2015 01:44, ?????????? "Zongzhe Yuan" ???????: > Hi > i have a question about IO monad. > Sometimes IO do something and return something, i wonder if the return > type, for example is IO Int means it will return an int, could i purely > fetch the int? > but i fail, i cannot construct a function, i use do notation but i found i > must use something to pass the int to another monad. > But i could write a function has the type of Maybe a -> a and it is easily. > Maybe monad and IO monad both instance monad but why i can?t do that? > > > Zongzhe Yuan > > > > This message and any attachment are intended solely for the addressee > and may contain confidential information. If you have received this > message in error, please send it back to me, and immediately delete it. > > Please do not use, copy or disclose the information contained in this > message or in any attachment. Any views or opinions expressed by the > author of this email do not necessarily reflect the views of the > University of Nottingham. > > This message has been checked for viruses but the contents of an > attachment may still contain software viruses which could damage your > computer system, you are advised to perform your own checks. Email > communications with the University of Nottingham may be monitored as > permitted by UK legislation. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.wobben at home.nl Sun Mar 1 11:18:53 2015 From: r.wobben at home.nl (Roelof Wobben) Date: Sun, 01 Mar 2015 12:18:53 +0100 Subject: [Haskell-cafe] how to make this work recursive ? In-Reply-To: <54F2E745.7050505@home.nl> References: <54F17EFF.7010902@home.nl> <54F1A184.8060800@home.nl> <54F1C524.4060706@home.nl> <54F1FB13.3040206@home.nl> <54F2E745.7050505@home.nl> Message-ID: <54F2F59D.6070901@home.nl> An HTML attachment was scrubbed... URL: From nikita at karetnikov.org Sun Mar 1 11:58:17 2015 From: nikita at karetnikov.org (Nikita Karetnikov) Date: Sun, 01 Mar 2015 14:58:17 +0300 Subject: [Haskell-cafe] A Question about IO monad In-Reply-To: (Konstantine Rybnikov's message of "Sun, 1 Mar 2015 12:25:06 +0200") References: Message-ID: <87r3t9expi.fsf@karetnikov.org> > You can indeed write "Maybe a -> a" function easy, because you have Maybe > constructors exported for you. But please note that this will lead to > non-total function, e.g. it will have to return an error in case of call > with Nothing, so you should avoid writing and using functions like this. A tiny nitpick: you can get a total function if you return a default value instead of erroring out. >> Sometimes IO do something and return something, i wonder if the return >> type, for example is IO Int means it will return an int, could i purely >> fetch the int? The IO in IO Int means that instead of just returning an Int, a computation may produce a side-effect (like writing a string to standard output). Since reasoning about code without side-effects is much simpler, you want to separate it from impure code. That's what IO is for. Once you're inside IO, you're dealing with impure code, so you want to keep track of things that rely on it. You can't* and don't want to escape. * As Konstantine points out, there are legitimate cases for using unsafePerformIO, like writing an FFI binding to a pure function. Haskell type system can't see whether the function in question is pure or not, so it's tagged with IO. However, if you know that it's pure, you can explicitly state that by using unsafePerformIO. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 818 bytes Desc: not available URL: From mwm at mired.org Sun Mar 1 12:19:40 2015 From: mwm at mired.org (Mike Meyer) Date: Sun, 1 Mar 2015 06:19:40 -0600 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: <54f2d5d5.4289460a.3c84.572eSMTPIN_ADDED_MISSING@mx.google.com> References: <20150228172446.3CB4EBC986@haskell.org> <54f21a89.ed16460a.1d6a.ffff9ddcSMTPIN_ADDED_MISSING@mx.google.com> <54f2d5d5.4289460a.3c84.572eSMTPIN_ADDED_MISSING@mx.google.com> Message-ID: On Sun, Mar 1, 2015 at 3:03 AM, fr33domlover wrote: > Hello Mike, > I think there's some confusion here. I wan't talking about GPL compatible > licenses, but about *any* free software license! According to Gershom's letter, it already does that. Or at least "cabal check" does. > It looks like Creative Commons licenses may apply too, in particular the > version 4 ones. CC by 4 is even GPL-compatible. > The same for EPL and CDDL! Check out this: > http://www.gnu.org/licenses/license-list.HTML > Both are free sofware licenses. GPL compatibility isn't the issue here :) That URL gets a 404 error. However, if you look at this page: http://www.gnu.org/licenses/license-list.HTML you'll find that the EPL and CDDL are listed as incompatible. The CC licenses are only mentioned as non-software licenses, and not all of them are listed. Nuts, it's even documented that the CC licenses aren't all compatible with each other! https://wiki.creativecommons.org/Wiki/cc_license_compatibility > > And what if I want something like the CDDL or the EPL? Those are both > > licenses that the OSI says are popular. > The FSF approves them as well, like I said. Well, I found them on a free license list. Of course, some of those include things like "We urge you not to use the CDDL" in them, which hardly sounds like approval to me. 5 > > You're addressing the nits, not the core issue I tried to raise: > > placing restrictions on what licenses (or lack thereof) are acceptable > > will discourage people from making software available via Hackage. > I don't think it will, because people are already making free software. Look at > other existing hosting services - they're *full* of free software! This is what > people are making anyway. All I suggest is to make it official, providing a > guarantee so people know each `cabal install` indeed installs only free > software. As long as you're willing to accept any license that the author thinks of as free, then it won't. But that's such a broad scope as to make this change effectively negligible, even from my nit-picking standpoint. > > Or I may not care. If I build a binary that uses one package that's > > GPL-licensed and one that uses an incompatible OSI-approved license, I > > can distribute my source under whatever terms I want, because my > > source doesn't include source from those packages. I can build and run > > binaries myself with no problems, and that may be fine. But I can't > > distribute binaries because I can't satisfy both licenses > > simultaneously, and that may not be acceptable. > That's true, but eventually you wouldn't want to do that. I mean, if you build > some program, you'd be happy to have it packaged for distros and make binary > releases for people who don't want to build from source. Sure, I may be happy to have the binaries build and packaged for all distros. Then again, I know there are people building software using Haskell - and hence hackage or stackage - that aren't planning on distributing the software in any form, so don't care about this issue. For me personally, the FreeBSD package system allows for adding things that have to be built from source for some reason or another, and make building them as easy as installing the binaries. I'm happy providing FreeBSD ports, but making it possible for people building packages for less flexible systems who actually check all the licenses involved isn't something I'm going to spend a lot of effort on. And you're proposed change - or possibly non-change, given what Gershom reported - won't change that effort. All the licenses involved are free. However, some of them aren't compatible with each other, so the only way to fix this is to use different packages. I suppose I could try and get some of the authors to change their license, but that's probably even more work. > This is essentially the question I'm asking the community: do you care about > the packages being free software, allowing legal distribution of binaries? > Specifically, would you make a step forward and make it official, build-in > into Hackage? Except you can't answer the question "does it allow legal distribution of binaries" by just looking at the license on the package. You also have to consider the licenses on the transitive closure of the libraries it uses, as they will be included in the binary, or at least dynamically linked to it, and thus may be considered a derivative work of the packages it includes. So your binary has to comply with the terms of all those licenses, which may not be possible even if all the licenses are approved by the OSI or on the FSF's list of free licenses. Which is also why even the relatively minor restriction "must allow free redistribution of binaries" isn't one I'd be happy with. Sure, it probably won't affect most people. But it equally won't help most people who want to distribute binaries, because it only removes a minor source of barriers to doing so. Unless, of course, by "must allow free redistribution of binaries", you mean "doesn't place any restrictions whatsoever on the distribution of binaries", which would eliminate the not only many of the CC licenses, but also the GPL and some of the BSD licenses. From s9gf4ult at gmail.com Sun Mar 1 12:30:36 2015 From: s9gf4ult at gmail.com (Alexey Uimanov) Date: Sun, 1 Mar 2015 18:30:36 +0600 Subject: [Haskell-cafe] ANNOUNCE postgresql-query and postgresql-config Message-ID: Hi guys! Here is yet another some-level library to work with PostgreSQL DB. http://hackage.haskell.org/package/postgresql-query This library uses `postgresql-query` and is a list of helpers/workarounds to generate complex queries more safely and parse result. What it contains: 1. interplating quasiquote `sqlExp` which uses instances of `ToField` typeclass to paste values inside query. It looks like this: let val = "'hello'" :: Text q = [sqlExp|SELECT field1 FROM tbl WHERE field2 = #{val}|] where `val` is an arbitrary Haskell expression which type has instance of `ToField` Resulting query will be like: "SELECT field1 FROM tbl WHERE field2 = '''hello'''" Yes, proper string escaping is performed authomatically like using this '?'-like queries with parameters. Resulting type of quasiquote is `SqlBuilder` which uses bytestring builders inside and can be concatenated efficiently. There is also posibility to paste one query inside another like: let q2 = [sqlExp|SELECT field1 f FROM (^{q}) WHERE field1 is not null|] so `q2` will generate nested query. sqlExp also removes SQL comments and removes long sequences of space characters. It also properly handles string literals and quoted identifiers inside quasiquotes. 2. Typeclass `HasPostgres`, simple connection reader `PgMonadT` and functions like `pgQuery` to perform queries. http://hackage.haskell.org/package/postgresql-query-1.0.1/docs/Database-PostgreSQL-Query-Functions.html 3. TH functions to authomatically derive `FromRow` and `ToRow` instances (from postgresql-simple) http://hackage.haskell.org/package/postgresql-query-1.0.1/docs/Database-PostgreSQL-Query-TH.html 4. Some kind of primitive pre-ORM which generates queries for CRUD-ing simple record types. It looks like: data User = User { userName :: !Text , userPasswordEncrypted :: !Text } deriving (Show, Eq, Ord, Typeable) type UserId = EntityId User $(deriveFromRow ''User) $(deriveToRow ''User) instance Entity User where newtype EntityId User = UserId { unUserId :: UUID } -- Note that you can use any type for id deriving (Show, Read, Ord, Eq, FromField, ToField, PathPiece) -- To use with Yesod tableName _ = "users" fieldNames _ = [ "name" , "password_encrypted" ] runPgMonadT con $ do uid <- pgInsertEntity $ User "name" "j27dna74ja784ha7" pgUpdateEntity uid $ MR [("name", mkValue "John")] pgDeleteEntity uid There is also package http://hackage.haskell.org/package/postgresql-config which contains trivial code to make your postgresql-simple connection pool easily configurable. -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Sun Mar 1 13:17:36 2015 From: adam at bergmark.nl (Adam Bergmark) Date: Sun, 1 Mar 2015 14:17:36 +0100 Subject: [Haskell-cafe] A Question about IO monad In-Reply-To: <87r3t9expi.fsf@karetnikov.org> References: <87r3t9expi.fsf@karetnikov.org> Message-ID: On Sun, Mar 1, 2015 at 12:58 PM, Nikita Karetnikov wrote: > > You can indeed write "Maybe a -> a" function easy, because you have Maybe > > constructors exported for you. But please note that this will lead to > > non-total function, e.g. it will have to return an error in case of call > > with Nothing, so you should avoid writing and using functions like this. > > A tiny nitpick: you can get a total function if you return a default > value instead of erroring out. > > What default value would you return for the function `Maybe a -> a`? - Adam > >> Sometimes IO do something and return something, i wonder if the return > >> type, for example is IO Int means it will return an int, could i purely > >> fetch the int? > > The IO in IO Int means that instead of just returning an Int, a > computation may produce a side-effect (like writing a string to standard > output). Since reasoning about code without side-effects is much > simpler, you want to separate it from impure code. That's what IO is > for. Once you're inside IO, you're dealing with impure code, so you > want to keep track of things that rely on it. You can't* and don't want > to escape. > > * As Konstantine points out, there are legitimate cases for using > unsafePerformIO, like writing an FFI binding to a pure function. > Haskell type system can't see whether the function in question is pure > or not, so it's tagged with IO. However, if you know that it's pure, > you can explicitly state that by using unsafePerformIO. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nikita at karetnikov.org Sun Mar 1 14:07:59 2015 From: nikita at karetnikov.org (Nikita Karetnikov) Date: Sun, 01 Mar 2015 17:07:59 +0300 Subject: [Haskell-cafe] A Question about IO monad In-Reply-To: (Adam Bergmark's message of "Sun, 1 Mar 2015 14:17:36 +0100") References: <87r3t9expi.fsf@karetnikov.org> Message-ID: <87mw3wg69s.fsf@karetnikov.org> >> A tiny nitpick: you can get a total function if you return a default >> value instead of erroring out. >> >> > What default value would you return for the function `Maybe a -> a`? You can do it with unsafeCoerce, but there are restrictions. And that's not what I meant, sorry. I mentally substituted an a for an Int: f :: Maybe Int -> Int f (Just x) = x f Nothing = 0 And there's also the maybe function. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 818 bytes Desc: not available URL: From marcin.jan.mrotek at gmail.com Sun Mar 1 14:27:15 2015 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Sun, 1 Mar 2015 15:27:15 +0100 Subject: [Haskell-cafe] A Question about IO monad In-Reply-To: <87mw3wg69s.fsf@karetnikov.org> References: <87r3t9expi.fsf@karetnikov.org> <87mw3wg69s.fsf@karetnikov.org> Message-ID: But this is exactly the point: there can be no total, generic function of type f :: Monad m => m a -> a (though there is for a Comonad ;)) As for Zongzhe Yuan's original question, i thinks it's safe to think of a value of type (IO a) as a program that, when executed, will result in a value of type a. This program can be copied, stored in a variable, passed to another thread, etc. It will only be actually executed when (perhaps after being combined with other IO programs) bound to the main program. Kind regards, Macin Mrotek From bneijt at gmail.com Sun Mar 1 16:47:22 2015 From: bneijt at gmail.com (Bram Neijt) Date: Sun, 1 Mar 2015 17:47:22 +0100 Subject: [Haskell-cafe] What other prelude to cleanly convert text-files into json In-Reply-To: <54F26062.8020007@extellisys.com> References: <54F26062.8020007@extellisys.com> Message-ID: Thank you all for the responses. Qualified imports for a script of less then a page make the code less readable. That is why I want to specifically import subsets of functions and not prefix everything with qualified imports. I've taken the code from Travis (clean up some of the useless pack/unpack), decided to use "NoImplicitPrelude" and then I had this: #!/usr/bin/runghc {-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-} import Prelude (Show, IO, (++), print, String, filter) import Data.List (isSuffixOf) import Data.Text hiding (isSuffixOf, filter) import Data.Text.IO import Control.Monad (mapM_) import qualified Data.ByteString.Lazy as BL import System.Directory (getDirectoryContents) import System.FilePath.Posix ((<.>), FilePath, takeBaseName) import Data.Aeson data Product = Product { image :: Text , description :: Text } deriving Show instance ToJSON Product where toJSON (Product image description) = object ["image" .= image, "description" .= description] encodeToJson :: FilePath -> IO() encodeToJson srcName = do let jsonName = takeBaseName srcName <.> "json" contents <- readFile srcName let contentLines = lines contents case contentLines of -- head is unsafe! try your code on an empty file (firstLine : restLines) -> BL.writeFile jsonName (encode Product { image = firstLine, description = unlines restLines }) _ -> print ("error: invalid source file: " ++ srcName) main = do names <- getDirectoryContents "." let srcNames = filter (isSuffixOf ".src") names mapM_ encodeToJson srcNames What bugs me is that this is a really simple thing to do in any other language, but here I seem to be stuck between Prelude and Text and as a beginner Prelude is king. I tried ClassyPrelude but got stuck at not being able to get the result of getDirectoryContents into the ClassyPrelude version of mapM_. Sorry but I gave up on that. I think that given all this, the above code is as beautiful as Haskell can pull this off at the moment. If somebody can prove me wrong, I would love to still see it. Greetings, Bram On Sun, Mar 1, 2015 at 1:42 AM, Travis Cardwell wrote: > On 2015?02?28? 20:23, Bram Neijt wrote: >> It quickly became a collection of "import qualified" and "T.unpack, >> T.pack" calls that made the whole thing look ugly [1]. > >> [1] Source can be read here: https://gist.github.com/bneijt/9bdb4b1759790a8463c9 > > File paths are of type `System.FilePath.Posix.FilePath`, a type alias for > `String`. Note that this convention is also followed in `ByteString` and > `Text` libraries; they do not use `ByteString` or `Text` types for the > file paths. > > In this code, file paths are packed only to have to unpack them again > (twice!), which likely offsets any performance improvements of using the > `Text` version of `isSuffixOf`. > > Here is a version using the same style but without packing file paths: > https://gist.github.com/TravisCardwell/fd9981e4968e4af3751d > > I included a few other changes, which are commented in the code. > > By the way, I do not think that qualified imports are bad. I like them > because they provide an explicit reference to the source module of a function. > > Cheers, > > Travis > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From michael at snoyman.com Sun Mar 1 16:52:49 2015 From: michael at snoyman.com (Michael Snoyman) Date: Sun, 01 Mar 2015 16:52:49 +0000 Subject: [Haskell-cafe] What other prelude to cleanly convert text-files into json References: <54F26062.8020007@extellisys.com> Message-ID: The trick with ClassyPrelude is to use the system-fileio package instead of straight directory. With that in place, you get: {-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-} import ClassyPrelude import Data.Aeson import Filesystem (listDirectory) data Product = Product { image :: Text , description :: Text } deriving Show instance ToJSON Product where toJSON (Product image description) = object ["image" .= image, "description" .= description] encodeToJson :: FilePath -> IO() encodeToJson srcName = do let jsonName = basename srcName <.> "json" contents <- readFile srcName let contentLines = lines contents case contentLines of -- head is unsafe! try your code on an empty file (firstLine : restLines) -> writeFile jsonName (encode Product { image = firstLine, description = unlines restLines }) _ -> print ("error: invalid source file: " ++ srcName) main = do names <- listDirectory "." let srcNames = filter (flip hasExtension "src") names mapM_ encodeToJson srcNames On Sun, Mar 1, 2015 at 6:47 PM Bram Neijt wrote: > Thank you all for the responses. > > Qualified imports for a script of less then a page make the code less > readable. That is why I want to specifically import subsets of > functions and not prefix everything with qualified imports. > > I've taken the code from Travis (clean up some of the useless > pack/unpack), decided to use "NoImplicitPrelude" and then I had this: > > #!/usr/bin/runghc > {-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-} > import Prelude (Show, IO, (++), print, String, filter) > import Data.List (isSuffixOf) > import Data.Text hiding (isSuffixOf, filter) > import Data.Text.IO > import Control.Monad (mapM_) > > import qualified Data.ByteString.Lazy as BL > import System.Directory (getDirectoryContents) > import System.FilePath.Posix ((<.>), FilePath, takeBaseName) > > import Data.Aeson > > data Product = Product > { image :: Text > , description :: Text > } deriving Show > > instance ToJSON Product where > toJSON (Product image description) = object ["image" .= image, > "description" .= description] > > > encodeToJson :: FilePath -> IO() > encodeToJson srcName = do > let jsonName = takeBaseName srcName <.> "json" > contents <- readFile srcName > let contentLines = lines contents > case contentLines of -- head is unsafe! try your code on an empty > file > (firstLine : restLines) -> BL.writeFile jsonName (encode Product { > image = firstLine, > description = unlines restLines > }) > _ -> print ("error: invalid source file: " ++ srcName) > > > main = do > names <- getDirectoryContents "." > let srcNames = filter (isSuffixOf ".src") names > mapM_ encodeToJson srcNames > > > What bugs me is that this is a really simple thing to do in any other > language, but here I seem to be stuck between Prelude and Text and as > a beginner Prelude is king. > > I tried ClassyPrelude but got stuck at not being able to get the > result of getDirectoryContents into the ClassyPrelude version of > mapM_. Sorry but I gave up on that. > > I think that given all this, the above code is as beautiful as Haskell > can pull this off at the moment. > > If somebody can prove me wrong, I would love to still see it. > > Greetings, > > Bram > > > > > On Sun, Mar 1, 2015 at 1:42 AM, Travis Cardwell > wrote: > > On 2015?02?28? 20:23, Bram Neijt wrote: > >> It quickly became a collection of "import qualified" and "T.unpack, > >> T.pack" calls that made the whole thing look ugly [1]. > > > >> [1] Source can be read here: https://gist.github.com/ > bneijt/9bdb4b1759790a8463c9 > > > > File paths are of type `System.FilePath.Posix.FilePath`, a type alias > for > > `String`. Note that this convention is also followed in `ByteString` and > > `Text` libraries; they do not use `ByteString` or `Text` types for the > > file paths. > > > > In this code, file paths are packed only to have to unpack them again > > (twice!), which likely offsets any performance improvements of using the > > `Text` version of `isSuffixOf`. > > > > Here is a version using the same style but without packing file paths: > > https://gist.github.com/TravisCardwell/fd9981e4968e4af3751d > > > > I included a few other changes, which are commented in the code. > > > > By the way, I do not think that qualified imports are bad. I like them > > because they provide an explicit reference to the source module of a > function. > > > > Cheers, > > > > Travis > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjgtuyl at chello.nl Sun Mar 1 20:01:31 2015 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Sun, 01 Mar 2015 21:01:31 +0100 Subject: [Haskell-cafe] Skolems! In-Reply-To: References: Message-ID: On Sat, 28 Feb 2015 18:02:02 +0100, wrote: > But this complains about a (rigid, skolem) type (and "n" really is just > a string): Remind me, was skolem the one that you must not feed after midnight, or the one that keeps mumbling "My precious"? :) Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From bneijt at gmail.com Sun Mar 1 21:49:01 2015 From: bneijt at gmail.com (Bram Neijt) Date: Sun, 1 Mar 2015 22:49:01 +0100 Subject: [Haskell-cafe] What other prelude to cleanly convert text-files into json In-Reply-To: References: <54F26062.8020007@extellisys.com> Message-ID: Thank you! I think that looks much better then anything I got working. Using another Prelude looks the best in this case, but without your help I would have never found system-fileio. Bram On Sun, Mar 1, 2015 at 5:52 PM, Michael Snoyman wrote: > The trick with ClassyPrelude is to use the system-fileio package instead of > straight directory. With that in place, you get: > > {-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-} > import ClassyPrelude > import Data.Aeson > import Filesystem (listDirectory) > > data Product = Product > { image :: Text > , description :: Text > } deriving Show > > instance ToJSON Product where > toJSON (Product image description) = object ["image" .= image, > "description" .= description] > > > encodeToJson :: FilePath -> IO() > encodeToJson srcName = do > let jsonName = basename srcName <.> "json" > contents <- readFile srcName > let contentLines = lines contents > case contentLines of -- head is unsafe! try your code on an empty file > (firstLine : restLines) -> writeFile jsonName (encode Product { > image = firstLine, > description = unlines restLines > }) > _ -> print ("error: invalid source file: " ++ srcName) > > > main = do > names <- listDirectory "." > let srcNames = filter (flip hasExtension "src") names > mapM_ encodeToJson srcNames > > > On Sun, Mar 1, 2015 at 6:47 PM Bram Neijt wrote: >> >> Thank you all for the responses. >> >> Qualified imports for a script of less then a page make the code less >> readable. That is why I want to specifically import subsets of >> functions and not prefix everything with qualified imports. >> >> I've taken the code from Travis (clean up some of the useless >> pack/unpack), decided to use "NoImplicitPrelude" and then I had this: >> >> #!/usr/bin/runghc >> {-# LANGUAGE NoImplicitPrelude, OverloadedStrings #-} >> import Prelude (Show, IO, (++), print, String, filter) >> import Data.List (isSuffixOf) >> import Data.Text hiding (isSuffixOf, filter) >> import Data.Text.IO >> import Control.Monad (mapM_) >> >> import qualified Data.ByteString.Lazy as BL >> import System.Directory (getDirectoryContents) >> import System.FilePath.Posix ((<.>), FilePath, takeBaseName) >> >> import Data.Aeson >> >> data Product = Product >> { image :: Text >> , description :: Text >> } deriving Show >> >> instance ToJSON Product where >> toJSON (Product image description) = object ["image" .= image, >> "description" .= description] >> >> >> encodeToJson :: FilePath -> IO() >> encodeToJson srcName = do >> let jsonName = takeBaseName srcName <.> "json" >> contents <- readFile srcName >> let contentLines = lines contents >> case contentLines of -- head is unsafe! try your code on an empty >> file >> (firstLine : restLines) -> BL.writeFile jsonName (encode Product { >> image = firstLine, >> description = unlines restLines >> }) >> _ -> print ("error: invalid source file: " ++ srcName) >> >> >> main = do >> names <- getDirectoryContents "." >> let srcNames = filter (isSuffixOf ".src") names >> mapM_ encodeToJson srcNames >> >> >> What bugs me is that this is a really simple thing to do in any other >> language, but here I seem to be stuck between Prelude and Text and as >> a beginner Prelude is king. >> >> I tried ClassyPrelude but got stuck at not being able to get the >> result of getDirectoryContents into the ClassyPrelude version of >> mapM_. Sorry but I gave up on that. >> >> I think that given all this, the above code is as beautiful as Haskell >> can pull this off at the moment. >> >> If somebody can prove me wrong, I would love to still see it. >> >> Greetings, >> >> Bram >> >> >> >> >> On Sun, Mar 1, 2015 at 1:42 AM, Travis Cardwell >> wrote: >> > On 2015?02?28? 20:23, Bram Neijt wrote: >> >> It quickly became a collection of "import qualified" and "T.unpack, >> >> T.pack" calls that made the whole thing look ugly [1]. >> > >> >> [1] Source can be read here: >> >> https://gist.github.com/bneijt/9bdb4b1759790a8463c9 >> > >> > File paths are of type `System.FilePath.Posix.FilePath`, a type alias >> > for >> > `String`. Note that this convention is also followed in `ByteString` >> > and >> > `Text` libraries; they do not use `ByteString` or `Text` types for the >> > file paths. >> > >> > In this code, file paths are packed only to have to unpack them again >> > (twice!), which likely offsets any performance improvements of using the >> > `Text` version of `isSuffixOf`. >> > >> > Here is a version using the same style but without packing file paths: >> > https://gist.github.com/TravisCardwell/fd9981e4968e4af3751d >> > >> > I included a few other changes, which are commented in the code. >> > >> > By the way, I do not think that qualified imports are bad. I like them >> > because they provide an explicit reference to the source module of a >> > function. >> > >> > Cheers, >> > >> > Travis >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From ok at cs.otago.ac.nz Sun Mar 1 23:31:29 2015 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Mon, 2 Mar 2015 12:31:29 +1300 Subject: [Haskell-cafe] how to make this work recursive ? In-Reply-To: <54F17EFF.7010902@home.nl> References: <54F17EFF.7010902@home.nl> Message-ID: On 28/02/2015, at 9:40 pm, Roelof Wobben wrote: > I found out that for 1 item I can do this : node = Node leaf "msg 1" leaf > And for 2 items I can do this : node = Node leaf "msg1" (Node leaf "msg2" leaf) Your subject line says "how to make THIS work recursive(ly)" but the body of your message does not explain what "this" is. It looks as thought you have data BinaryTree x = Leaf | Node (BinaryTree x) x (BinaryTree x) except that you have written a variable name "leaf" instead of a constant name "Leaf" (ok, there are no constant names, it's a constructor name, but a constructor with no arguments is a constant). > > But now I wonder how I can make this work with recursion. Well, you have to START by saying clearly what "THIS" is. It looks as though you want empty :: BinaryTree x insert :: Ord x => x -> BinaryTree x -> BinaryTree x There's only one thing you can put for empty. To make a Node you would have to a value of type t, and you don't. So empty = Leaf What about insert? You have two arguments: an x (and all you know about x values is that they can be compared) and a BinaryTree x. It's going to have to be a case analysis on the two possibilities for the BinaryTree: insert v Leaf = Node Leaf v Leaf insert v (Node lss elt gtr) = ?? Where are we doing to put v? There are three places: lss (the set of things less than elt) elt (the value elt) gtr (the set of things greater than elt). How can we tell where to put v? Answer: by comparing v with elt: case compare v elt of LT -> "insert v in lss" GT -> "insert v in gtr" EQ -> "it's already in elt" Convert the comments to Haskell, and we have insert v Leaf = Node Leaf v Leaf insert v (Node lss elt gtr) = case compare v elt of LT -> Node (insert v lss) elt gtr GT -> Node lss elt (insert v gtr) EQ -> Node lss elt gtr We don't actually *MAKE* this function work recursively, it just *happens* that to insert an element into a big tree, we sometimes want to insert it into a subtree. A first or second year data structure book would do this in C: typedef ???? elem; typedef struct Node *tree; typedef struct Node { tree lss; elem elt; tree gtr; } Node; tree insert(elem v, tree t) { if (t == 0) { /* leaf case */ tree n = malloc(sizeof *n); if (n == 0) abort(); n->lss = n->gtr = 0, n->elt = elt; return n; } else { if (v < t->elt) { t->lss = insert(v, t->lss); } else if (t->elt < v) { t->gtr = insert(v, t->gtr); } return t; } } > It seems that I keep the first 2 items and change the 3th one from leaf to another node You DO NOT CHANGE ANYTHING. Given a tree and a (possibly) new element, you construct a NEW tree which shares most of its structure with the old one. In C, you have to destroy the old tree to make the new one. In Haskell, you not only don't have to, you can't. But the basic pattern: to insert v into t if t is empty return a new tree just containing v if t is not empty if v is less than the top element of t insert v into the left subtree of t if v is greater than the top element of t insert v into the right subtree of t if v is equal to the top element of t there is nothing to do does not depend on which programming language you are using. If you are alert, you will notice a strong similarity between the structure of the DATA (a two-way choice where one choice is simple and the other has three parts) and the structure of the CODE (a two-way choice where one choice is simple and the other has three parts). This is not an accident. > From ok at cs.otago.ac.nz Sun Mar 1 23:49:46 2015 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Mon, 2 Mar 2015 12:49:46 +1300 Subject: [Haskell-cafe] how to make this work recursive ? In-Reply-To: <54F1C524.4060706@home.nl> References: <54F17EFF.7010902@home.nl> <54F1A184.8060800@home.nl> <54F1C524.4060706@home.nl> Message-ID: <72CB7458-8F71-478D-BD71-CE2CE36CDA77@cs.otago.ac.nz> On 1/03/2015, at 2:39 am, Roelof Wobben wrote: > I tried this : > > insert :: LogMessage -> MessageTree -> MessageTree > insert s = > case words s of > (_:_: "This is not the right format") -> MessageTree Leaf > _ -> MessageTree Node LogMessage Leaf This makes no sense. You have declared that insert takes a LogMessage argument and a MessageTree argument and returns a MessageTree result. Then your code DOES NOT ACCEPT A MESSAGETREE ARGUMENT! You want to have insert logmsg msgtree = and the case analysis should be on the message tree, not the log message. src/LogAnalysis.hs at 38:49-38:60 > Not in scope: data constructor > MessageTree > src/LogAnalysis.hs at 39:49-39:60 > Not in scope: data constructor > MessageTree The compiler is telling you, as clearly as it knows how, that you DO NOT HAVE ANY CONSTRUCTOR FUNCTION called "MessageTree". The constructor functions are >> Leaf << and >> Node <<. MessageTree is a *TYPE NAME*. I am about to be offensive. I do not want to be offensive. I want to be helpful. I believe this question needs to be asked. But there is a real risk that I will offend you. Here goes. Is there *any* programming language you know how to use? The reason that I ask is that the problems you keep having aren't really Haskell problems. They are general programming problems: - declaring a name as one kind of thing and using it as if it were another - declaring a function (like 'insert' or 'Node') to have n arguments but trying to define or call it with m arguments where m ~= n. - not starting with a description of your problem - not having a clue what to do when the compiler tells you something. (It's OK not to understand a compiler message. But you should get *some* clue from it, like where exactly to look, and you should be able to try to vary the program to see how the message changes.) I honestly feel that the difficulties you are reporting here aren't really Haskell difficulties, just as the difficulties you were reporting in the Erlang mailing list weren't really Erlang difficulties, but in both cases, something much more fundamental. To restate my possibly offensive question again: Have you ever had a course of instruction in the use of any programming language face to face with a competent teacher? Again, I'm trying to be helpful here. If you run into a problem and can get help within *minutes*, and have someone sit down beside you at the keyboard and *show* you how to find out what a compiler message might mean and what to do about it, you can learn very quickly. If you have to wait hours for responses, you are obviously going to learn much more slowly. I sometimes ask my students: "What's the point of coming here? Why not just buy a textbook?" Sadly, they sometimes do not know the answer. It's "You can ask ME questions, and each other." It is clear that you are working at trying to learn Haskell. It is SMART of you to ask questions. It's just that there are these really basic issues where I think you could learn a lot faster with face-to-face help. From ok at cs.otago.ac.nz Sun Mar 1 23:59:40 2015 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Mon, 2 Mar 2015 12:59:40 +1300 Subject: [Haskell-cafe] how to make this work recursive ? In-Reply-To: <54F2E745.7050505@home.nl> References: <54F17EFF.7010902@home.nl> <54F1A184.8060800@home.nl> <54F1C524.4060706@home.nl> <54F1FB13.3040206@home.nl> <54F2E745.7050505@home.nl> Message-ID: <67EA1046-476D-4D74-B543-CE21D43DF1EF@cs.otago.ac.nz> On 1/03/2015, at 11:17 pm, Roelof Wobben wrote: > > Now I have to find out how I can test if the LogMessage has the text "this is not the right format" in it. Well, the Haskell libraries include regular expression support. At an elementary level, you can always do is_prefix_of :: Eq x => [x] -> [x] -> Bool is_prefix_of (x:xs) (y:ys) = x == y && is_prefix_of xs ys is_prefix_of (x:xs) [] = False is_prefix_of [] _ = True is_infix_of :: Eq x => [x] -> [x] -> Bool is_infix_of xs ys = xs `is_prefix_of` ys || (not (null ys) && xs `is_infix_of` tail ys) "this is not the right format" `is_infix_of` aLogMessage But it would be better if your LogMessage were not a string but something structured where you did not have to go looking for that text because you KNEW where to look for it. From kai at kzhang.org Mon Mar 2 05:37:41 2015 From: kai at kzhang.org (Kai Zhang) Date: Sun, 1 Mar 2015 21:37:41 -0800 Subject: [Haskell-cafe] ANN: clustering-0.1.0 Message-ID: https://hackage.haskell.org/package/clustering This package provides optimal algorithms (O(N^2)) for hierarchical clustering, including single linkage, complete linkage, average linkage, weighted linkage, and Ward's method. Benchmarks of average linkage can be found here: https://github.com/kaizhang/clustering. I hope this would be useful in general. Motivation of this work: I found the "hierarchical-clustering" library cannot handle large input (>10^4) due to its suboptimal algorithms. Best, Kai -------------- next part -------------- An HTML attachment was scrubbed... URL: From zemyla at gmail.com Mon Mar 2 06:06:31 2015 From: zemyla at gmail.com (Zemyla) Date: Mon, 2 Mar 2015 00:06:31 -0600 Subject: [Haskell-cafe] is it possible to implement Functor for ByteString and Text In-Reply-To: <54F212C9.6040509@gmail.com> References: <54F212C9.6040509@gmail.com> Message-ID: What I would do is hold the function to apply in the wrapper type. import qualified Data.ByteString as BS data ByteString' a = ByteString' (Word8 -> a) BS.ByteString wrap :: BS.ByteString -> ByteString' Word8 wrap bs = ByteString' id bs -- The type ensures you can only unwrap with a function Word8 -> Word8. unwrap :: ByteString' Word8 -> ByteString unwrap (ByteString' f bs) = BS.map f bs -- Functor instance just concatenates the fmapped function. instance Functor ByteString' where fmap f (ByteString' g bs) = ByteString' (f . g) bs -- Foldable instance just uses the fmapped function. instance Foldable ByteString' where foldr f z (ByteString' g bs) = BS.foldr (f . g) z bs -- You could define foldr', foldl, etc. based on the ones in Data.ByteString. -- Not strictly necessary, but nice to have. As an added benefit, this doesn't require GADTs. It probably would if you wanted to implement Monad as well, though. On Feb 28, 2015 1:11 PM, "silvio" wrote: > I have recently heard that some people want to burn bridges (introducing > Foldable and Traversable to Prelude) and I've been wondering if it was > possible somehow allow Text and Bytestring like containers to make use > of those functions. Something along the lines of > > import qualified Data.ByteString as BS > > newtype ByteString' a = ByteString' BS.ByteString > > type ByteString = ByteString' Word8 > > instance (ByteString' a ~ ByteString' Word8) => Functor (ByteString') > where > fmap f (ByteString' bs) = ByteString' $ BS.map f bs > > > Or if DataContexts worked as you would expect. > > newtype (Word8 ~ a) => ByteString' a = ByteString' BS.ByteString > > However I couldn't find a solution and I was just wondering if it is > possible. > > P.S. Using GADTS it does actually work for Foldable, but only because it > doesn't have to output any ByteStrings. It doesn't work for Functor for > instance. > > data ByteString' a where > ByteString' :: BS.ByteString -> ByteString' Word8 > > type ByteString = ByteString' Word8 > > instance Foldable ByteString' where > foldr f ini (ByteString' bs) = BS.foldr f ini bs > > > Silvio > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.wobben at home.nl Mon Mar 2 08:22:13 2015 From: r.wobben at home.nl (Roelof Wobben) Date: Mon, 02 Mar 2015 09:22:13 +0100 Subject: [Haskell-cafe] how to make this work recursive ? In-Reply-To: References: <54F17EFF.7010902@home.nl> Message-ID: <54F41DB5.1010500@home.nl> Richard A. O'Keefe schreef op 2-3-2015 om 0:31: > On 28/02/2015, at 9:40 pm, Roelof Wobben wrote: >> I found out that for 1 item I can do this : node = Node leaf "msg 1" leaf >> And for 2 items I can do this : node = Node leaf "msg1" (Node leaf "msg2" leaf) > Your subject line says "how to make THIS work recursive(ly)" but the > body of your message does not explain what "this" is. > > It looks as thought you have > > data BinaryTree x > = Leaf > | Node (BinaryTree x) x (BinaryTree x) > > except that you have written a variable name "leaf" instead of > a constant name "Leaf" (ok, there are no constant names, it's a constructor > name, but a constructor with no arguments is a constant). > >> But now I wonder how I can make this work with recursion. > Well, you have to START by saying clearly what "THIS" is. > > It looks as though you want > > empty :: BinaryTree x > > insert :: Ord x => x -> BinaryTree x -> BinaryTree x > > There's only one thing you can put for empty. To make a Node > you would have to a value of type t, and you don't. So > > empty = Leaf > > What about insert? > You have two arguments: an x (and all you know about x values is that > they can be compared) and a BinaryTree x. It's going to have to be > a case analysis on the two possibilities for the BinaryTree: > > insert v Leaf = Node Leaf v Leaf > insert v (Node lss elt gtr) = ?? > > Where are we doing to put v? There are three places: > lss (the set of things less than elt) > elt (the value elt) > gtr (the set of things greater than elt). > How can we tell where to put v? > > Answer: by comparing v with elt: > > case compare v elt of > LT -> "insert v in lss" > GT -> "insert v in gtr" > EQ -> "it's already in elt" > > Convert the comments to Haskell, and we have > > insert v Leaf = Node Leaf v Leaf > insert v (Node lss elt gtr) = > case compare v elt of > LT -> Node (insert v lss) elt gtr > GT -> Node lss elt (insert v gtr) > EQ -> Node lss elt gtr > > We don't actually *MAKE* this function work recursively, > it just *happens* that to insert an element into a big > tree, we sometimes want to insert it into a subtree. > > A first or second year data structure book would do this > in C: > > typedef ???? elem; > > typedef struct Node *tree; > typedef struct Node { > tree lss; > elem elt; > tree gtr; > } Node; > > tree insert(elem v, tree t) { > if (t == 0) { /* leaf case */ > tree n = malloc(sizeof *n); > if (n == 0) abort(); > n->lss = n->gtr = 0, n->elt = elt; > return n; > } else { > if (v < t->elt) { > t->lss = insert(v, t->lss); > } else > if (t->elt < v) { > t->gtr = insert(v, t->gtr); > } > return t; > } > } > > >> It seems that I keep the first 2 items and change the 3th one from leaf to another node > You DO NOT CHANGE ANYTHING. Given a tree and a (possibly) new element, > you construct a NEW tree which shares most of its structure with the > old one. In C, you have to destroy the old tree to make the new one. > In Haskell, you not only don't have to, you can't. > > But the basic pattern: > > to insert v into t > if t is empty > return a new tree just containing v > if t is not empty > if v is less than the top element of t > insert v into the left subtree of t > if v is greater than the top element of t > insert v into the right subtree of t > if v is equal to the top element of t > there is nothing to do > > does not depend on which programming language you are using. > > If you are alert, you will notice a strong similarity between > the structure of the DATA (a two-way choice where one choice > is simple and the other has three parts) and the structure of > the CODE (a two-way choice where one choice is simple and > the other has three parts). This is not an accident. > > Thanks for the explanation. Roelof From r.wobben at home.nl Mon Mar 2 08:23:09 2015 From: r.wobben at home.nl (Roelof Wobben) Date: Mon, 02 Mar 2015 09:23:09 +0100 Subject: [Haskell-cafe] how to make this work recursive ? In-Reply-To: <72CB7458-8F71-478D-BD71-CE2CE36CDA77@cs.otago.ac.nz> References: <54F17EFF.7010902@home.nl> <54F1A184.8060800@home.nl> <54F1C524.4060706@home.nl> <72CB7458-8F71-478D-BD71-CE2CE36CDA77@cs.otago.ac.nz> Message-ID: <54F41DED.9030802@home.nl> Richard A. O'Keefe schreef op 2-3-2015 om 0:49: > On 1/03/2015, at 2:39 am, Roelof Wobben wrote: > >> I tried this : >> >> insert :: LogMessage -> MessageTree -> MessageTree >> insert s = >> case words s of >> (_:_: "This is not the right format") -> MessageTree Leaf >> _ -> MessageTree Node LogMessage Leaf > This makes no sense. > You have declared that insert takes a LogMessage argument > and a MessageTree argument and returns a MessageTree result. > > Then your code DOES NOT ACCEPT A MESSAGETREE ARGUMENT! > > You want to have > > insert logmsg msgtree = > > and the case analysis should be on the message tree, not the log message. > > src/LogAnalysis.hs at 38:49-38:60 >> Not in scope: data constructor >> MessageTree >> src/LogAnalysis.hs at 39:49-39:60 >> Not in scope: data constructor >> MessageTree > The compiler is telling you, as clearly as it knows how, > that you DO NOT HAVE ANY CONSTRUCTOR FUNCTION called "MessageTree". > The constructor functions are >> Leaf << and >> Node <<. > MessageTree is a *TYPE NAME*. > > > I am about to be offensive. > I do not want to be offensive. > I want to be helpful. > I believe this question needs to be asked. > But there is a real risk that I will offend you. > > Here goes. > > Is there *any* programming language you know how to use? > > The reason that I ask is that the problems you keep having > aren't really Haskell problems. They are general programming > problems: > - declaring a name as one kind of thing > and using it as if it were another > - declaring a function (like 'insert' or 'Node') > to have n arguments but trying to define or call > it with m arguments where m ~= n. > - not starting with a description of your problem > - not having a clue what to do when the compiler tells > you something. (It's OK not to understand a > compiler message. But you should get *some* clue > from it, like where exactly to look, and you should > be able to try to vary the program to see how the > message changes.) > > I honestly feel that the difficulties you are reporting here > aren't really Haskell difficulties, just as the difficulties > you were reporting in the Erlang mailing list weren't really > Erlang difficulties, but in both cases, something much more > fundamental. > > To restate my possibly offensive question again: > > Have you ever had a course of instruction in the use of > any programming language face to face with a competent > teacher? > > Again, I'm trying to be helpful here. If you run into a > problem and can get help within *minutes*, and have someone > sit down beside you at the keyboard and *show* you how to > find out what a compiler message might mean and what to do > about it, you can learn very quickly. If you have to wait > hours for responses, you are obviously going to learn much > more slowly. > > I sometimes ask my students: "What's the point of coming here? > Why not just buy a textbook?" Sadly, they sometimes do not > know the answer. It's "You can ask ME questions, and each other." > > It is clear that you are working at trying to learn Haskell. > It is SMART of you to ask questions. > It's just that there are these really basic issues where I > think you could learn a lot faster with face-to-face help. > > > I have not done any face to face courses. Programming is a hobby for me. Roelof From r.wobben at home.nl Mon Mar 2 08:27:08 2015 From: r.wobben at home.nl (Roelof Wobben) Date: Mon, 02 Mar 2015 09:27:08 +0100 Subject: [Haskell-cafe] how to make this work recursive ? In-Reply-To: <67EA1046-476D-4D74-B543-CE21D43DF1EF@cs.otago.ac.nz> References: <54F17EFF.7010902@home.nl> <54F1A184.8060800@home.nl> <54F1C524.4060706@home.nl> <54F1FB13.3040206@home.nl> <54F2E745.7050505@home.nl> <67EA1046-476D-4D74-B543-CE21D43DF1EF@cs.otago.ac.nz> Message-ID: <54F41EDC.3090506@home.nl> Richard A. O'Keefe schreef op 2-3-2015 om 0:59: > On 1/03/2015, at 11:17 pm, Roelof Wobben wrote: >> Now I have to find out how I can test if the LogMessage has the text "this is not the right format" in it. > > Well, the Haskell libraries include regular expression support. > At an elementary level, you can always do > > is_prefix_of :: Eq x => [x] -> [x] -> Bool > is_prefix_of (x:xs) (y:ys) = x == y && is_prefix_of xs ys > is_prefix_of (x:xs) [] = False > is_prefix_of [] _ = True > > > is_infix_of :: Eq x => [x] -> [x] -> Bool > > is_infix_of xs ys = > xs `is_prefix_of` ys || (not (null ys) && xs `is_infix_of` tail ys) > > > "this is not the right format" `is_infix_of` aLogMessage > > But it would be better if your LogMessage were not a string > but something structured where you did not have to go looking > for that text because you KNEW where to look for it. > > I know where to look. A LogMessage looks like this : data LogMessage = LogMessage MessageType TimeStamp String | Unknown String deriving (Show, Eq) So if it's Unknown with a string then it will not be inserted into the MessageTree The only thing I have to find out if LogMessage contains this. Roelof From ok at cs.otago.ac.nz Mon Mar 2 09:57:42 2015 From: ok at cs.otago.ac.nz (ok at cs.otago.ac.nz) Date: Mon, 2 Mar 2015 22:57:42 +1300 Subject: [Haskell-cafe] how to make this work recursive ? In-Reply-To: <54F41EDC.3090506@home.nl> References: <54F17EFF.7010902@home.nl> <54F1A184.8060800@home.nl> <54F1C524.4060706@home.nl> <54F1FB13.3040206@home.nl> <54F2E745.7050505@home.nl> <67EA1046-476D-4D74-B543-CE21D43DF1EF@cs.otago.ac.nz> <54F41EDC.3090506@home.nl> Message-ID: <31f763ef76effa884626a50f7def1de4.squirrel@chasm.otago.ac.nz> You are still not being clear. You have data LogMessage = LogMessage MessageType TimeStamp String | Unknown String deriving (Show, Eq) > So if it's Unknown with a string then it will not be inserted into the > MessageTree > The only thing I have to find out if LogMessage contains this. Question 1. Your description seems contradictory. The first sentence is talking about the Unknown case. The second sentence appears to be talking about the other case. Do you mean should_discard (LogMessage _ _ _) = False should_discard (Unknown s) = ...s contains magic... or should_discard (LogMessage _ _ s) = ...s contains magic... should_discard (Unknown _) = False or should_discard (LogMessage Error _ s) = ...s contains magic... should_discard _ = False or what? Question 2. What do you mean by "contains"? Do you mean - is exactly equal to - is equal to ignoring leading and trailing white space and treating runs of white space as single spaces - is equal to ignoring alphabetic case - equality up to some other predicate - contains a substring equal to (this is what I first thought you meant) - contains a substring equivalent to up to some predicate or something else? In short, before you can ask how to do "this", you have to say in plain words what "this" IS. The _answer_ will be concerned with Haskell, but _the way you should ask such questions_ is not. In any programming language, whatever code you write is going to have *some* precise meaning. The industry as a whole has a huge problem with differences between what people *want* their program to mean/do and what it *does* mean/do. We haven't a hope of detecting such problems in good time if we aren't clear about what it is that we want. Here's another tip. Some people find it helps. Before you start to write a function, just write a stub (others have shown you examples, using 'undefined' as the body; that's a stub), and write test cases that call it. This may help to clarify your ideas about what you want the function to do with _those_ examples, and thereby about others. From alexander at plaimi.net Mon Mar 2 11:18:43 2015 From: alexander at plaimi.net (Alexander Berntsen) Date: Mon, 02 Mar 2015 12:18:43 +0100 Subject: [Haskell-cafe] Would you use frozen-base In-Reply-To: References: <1424957771.1948.49.camel@joachim-breitner.de> Message-ID: <54F44713.3000701@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 26/02/15 20:50, Bardur Arantsson wrote: > The proper solution to this problem (as with so many things) is > another layer of indirection, namely a proper way to separate API > and implementation. (Aka "Backpack" or similar.) I'd prefer to see work going into Backpack or similar rather than frozen-base. I share the concerns expressed by Bardur and David. (Of course I don't want to discourage work on frozen-base altogether, as I'm sure it could be an interesting experiment if nothing more.) - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREIAAYFAlT0RxEACgkQRtClrXBQc7VZPQD/f/NxeQh4uo2HP/v+oJJ/bMOA T1EGkF1LbBM0/J1Ykk0A/0rosssIfCCYAFuOZgI2BGMei0CSKPt23zweBrqYkfB+ =OymM -----END PGP SIGNATURE----- From sean at functionaljobs.com Mon Mar 2 17:00:01 2015 From: sean at functionaljobs.com (Functional Jobs) Date: Mon, 2 Mar 2015 12:00:01 -0500 Subject: [Haskell-cafe] New Functional Programming Job Opportunities Message-ID: <54f4971337565@functionaljobs.com> Here are some functional programming job opportunities that were posted recently: Senior Software Engineer at McGraw-Hill Education http://functionaljobs.com/jobs/8787-senior-software-engineer-at-mcgraw-hill-education Engineering Manager (OCaml or Haskell under Linux) at FireEye http://functionaljobs.com/jobs/8786-engineering-manager-ocaml-or-haskell-under-linux-at-fireeye Cheers, Sean Murphy FunctionalJobs.com From eir at cis.upenn.edu Mon Mar 2 18:12:33 2015 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Mon, 2 Mar 2015 13:12:33 -0500 Subject: [Haskell-cafe] Skolems! In-Reply-To: References: Message-ID: <4CD633E4-0DE7-4D26-87DC-870B588EE743@cis.upenn.edu> This is admittedly a dark corner of the inference algorithm, but perhaps these examples can shed some light. Post a bug report! Thanks for creating nice, small examples. Richard PS: I offer no strong guarantees that you've found bugs here... but in any case, posting a bug report gets more serious attention than a Haskell-cafe post. On Feb 27, 2015, at 1:23 PM, "evan at evan-borden.com" wrote: > An extension of the message Tom sent a little while back, we've discovered a more in depth example of this possible GHC bug. It is exacerbated by GADTs, but can be fixed with NoMonoLocalBinds. Without GADTs and just leveraging ExistentialQuanitification it works fine. We've included a pretty exhaustive set of examples. > > {-# LANGUAGE ExistentialQuantification, GADTs #-} > > {- removing MonoLocalBinds fixes all of these errors > {-# LANGUAGE ExistentialQuantification, GADTs, NoMonoLocalBinds #-} > -} > > module PossibleGHCBug where > > data SumType = SumFoo | SumBar > > class SomeClass a where > someType :: a -> SumType > > data SomeExistential = forall a. SomeClass a => SomeExistential a > > noError :: String -> [SomeExistential] -> String > noError n st = n ++ concatMap cname st > where cname (SomeExistential p) = d p > > d p = c $ someType p > > c p = case p of > SumFoo -> "foo" > _ -> "asdf" > > noError2 :: String -> [SomeExistential] -> String > noError2 n st = n ++ concatMap cname st > where cname (SomeExistential p) = d p > > d p = c $ someType p > > c :: SumType -> String > c p = case p of > SumFoo -> "foo" > _ -> "asdf" ++ n > > noError3 :: String -> [SomeExistential] -> String > noError3 n st = n ++ concatMap cname st > where cname (SomeExistential p) = d p > > d :: SomeClass a => a -> String > d p = c $ someType p > > c p = case p of > SumFoo -> "foo" > _ -> "asdf" ++ n > > > partialTypedError :: String -> [SomeExistential] -> String > partialTypedError n st = n ++ concatMap cname st > where cname :: SomeExistential -> String > cname (SomeExistential p) = d p > > d p = c $ someType p > > c p = case p of > SumFoo -> "foo" > _ -> "asdf" ++ n > > fullError :: String -> [SomeExistential] -> String > fullError n st = n ++ concatMap cname st > where cname (SomeExistential p) = d p > > d p = c $ someType p > > c p = case p of > SumFoo -> "foo" > _ -> "asdf" ++ n > > justNError :: String -> [SomeExistential] -> String > justNError n st = n ++ concatMap cname st > where cname (SomeExistential p) = d p > > d p = c $ someType p > > c p = case p of > SumFoo -> "foo" > _ -> n > > ignoreNError :: String -> [SomeExistential] -> String > ignoreNError n st = n ++ concatMap cname st > where cname (SomeExistential p) = d p > > d p = c $ someType p > > c p = case p of > SumFoo -> "foo" > _ -> fst ("foo", n) > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From evan at evanrutledgeborden.dreamhosters.com Mon Mar 2 18:49:26 2015 From: evan at evanrutledgeborden.dreamhosters.com (evan@evan-borden.com) Date: Mon, 2 Mar 2015 13:49:26 -0500 Subject: [Haskell-cafe] Skolems! In-Reply-To: <4CD633E4-0DE7-4D26-87DC-870B588EE743@cis.upenn.edu> References: <4CD633E4-0DE7-4D26-87DC-870B588EE743@cis.upenn.edu> Message-ID: Thanks Richard, will do. On Mon, Mar 2, 2015 at 1:12 PM, Richard Eisenberg wrote: > This is admittedly a dark corner of the inference algorithm, but perhaps > these examples can shed some light. Post a bug report! > > Thanks for creating nice, small examples. > > Richard > > PS: I offer no strong guarantees that you've found bugs here... but in any > case, posting a bug report gets more serious attention than a Haskell-cafe > post. > > On Feb 27, 2015, at 1:23 PM, "evan at evan-borden.com" < > evan at evanrutledgeborden.dreamhosters.com> wrote: > > > An extension of the message Tom sent a little while back, we've > discovered a more in depth example of this possible GHC bug. It is > exacerbated by GADTs, but can be fixed with NoMonoLocalBinds. Without GADTs > and just leveraging ExistentialQuanitification it works fine. We've > included a pretty exhaustive set of examples. > > > > {-# LANGUAGE ExistentialQuantification, GADTs #-} > > > > {- removing MonoLocalBinds fixes all of these errors > > {-# LANGUAGE ExistentialQuantification, GADTs, NoMonoLocalBinds #-} > > -} > > > > module PossibleGHCBug where > > > > data SumType = SumFoo | SumBar > > > > class SomeClass a where > > someType :: a -> SumType > > > > data SomeExistential = forall a. SomeClass a => SomeExistential a > > > > noError :: String -> [SomeExistential] -> String > > noError n st = n ++ concatMap cname st > > where cname (SomeExistential p) = d p > > > > d p = c $ someType p > > > > c p = case p of > > SumFoo -> "foo" > > _ -> "asdf" > > > > noError2 :: String -> [SomeExistential] -> String > > noError2 n st = n ++ concatMap cname st > > where cname (SomeExistential p) = d p > > > > d p = c $ someType p > > > > c :: SumType -> String > > c p = case p of > > SumFoo -> "foo" > > _ -> "asdf" ++ n > > > > noError3 :: String -> [SomeExistential] -> String > > noError3 n st = n ++ concatMap cname st > > where cname (SomeExistential p) = d p > > > > d :: SomeClass a => a -> String > > d p = c $ someType p > > > > c p = case p of > > SumFoo -> "foo" > > _ -> "asdf" ++ n > > > > > > partialTypedError :: String -> [SomeExistential] -> String > > partialTypedError n st = n ++ concatMap cname st > > where cname :: SomeExistential -> String > > cname (SomeExistential p) = d p > > > > d p = c $ someType p > > > > c p = case p of > > SumFoo -> "foo" > > _ -> "asdf" ++ n > > > > fullError :: String -> [SomeExistential] -> String > > fullError n st = n ++ concatMap cname st > > where cname (SomeExistential p) = d p > > > > d p = c $ someType p > > > > c p = case p of > > SumFoo -> "foo" > > _ -> "asdf" ++ n > > > > justNError :: String -> [SomeExistential] -> String > > justNError n st = n ++ concatMap cname st > > where cname (SomeExistential p) = d p > > > > d p = c $ someType p > > > > c p = case p of > > SumFoo -> "foo" > > _ -> n > > > > ignoreNError :: String -> [SomeExistential] -> String > > ignoreNError n st = n ++ concatMap cname st > > where cname (SomeExistential p) = d p > > > > d p = c $ someType p > > > > c p = case p of > > SumFoo -> "foo" > > _ -> fst ("foo", n) > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From evan at evanrutledgeborden.dreamhosters.com Mon Mar 2 18:56:09 2015 From: evan at evanrutledgeborden.dreamhosters.com (evan@evan-borden.com) Date: Mon, 2 Mar 2015 13:56:09 -0500 Subject: [Haskell-cafe] Skolems! In-Reply-To: References: <4CD633E4-0DE7-4D26-87DC-870B588EE743@cis.upenn.edu> Message-ID: A quick clarification. It s trac still the location to submit bugs or is Phabricator more appropriate? On Mon, Mar 2, 2015 at 1:49 PM, evan at evan-borden.com < evan at evanrutledgeborden.dreamhosters.com> wrote: > Thanks Richard, will do. > > On Mon, Mar 2, 2015 at 1:12 PM, Richard Eisenberg > wrote: > >> This is admittedly a dark corner of the inference algorithm, but perhaps >> these examples can shed some light. Post a bug report! >> >> Thanks for creating nice, small examples. >> >> Richard >> >> PS: I offer no strong guarantees that you've found bugs here... but in >> any case, posting a bug report gets more serious attention than a >> Haskell-cafe post. >> >> On Feb 27, 2015, at 1:23 PM, "evan at evan-borden.com" < >> evan at evanrutledgeborden.dreamhosters.com> wrote: >> >> > An extension of the message Tom sent a little while back, we've >> discovered a more in depth example of this possible GHC bug. It is >> exacerbated by GADTs, but can be fixed with NoMonoLocalBinds. Without GADTs >> and just leveraging ExistentialQuanitification it works fine. We've >> included a pretty exhaustive set of examples. >> > >> > {-# LANGUAGE ExistentialQuantification, GADTs #-} >> > >> > {- removing MonoLocalBinds fixes all of these errors >> > {-# LANGUAGE ExistentialQuantification, GADTs, NoMonoLocalBinds #-} >> > -} >> > >> > module PossibleGHCBug where >> > >> > data SumType = SumFoo | SumBar >> > >> > class SomeClass a where >> > someType :: a -> SumType >> > >> > data SomeExistential = forall a. SomeClass a => SomeExistential a >> > >> > noError :: String -> [SomeExistential] -> String >> > noError n st = n ++ concatMap cname st >> > where cname (SomeExistential p) = d p >> > >> > d p = c $ someType p >> > >> > c p = case p of >> > SumFoo -> "foo" >> > _ -> "asdf" >> > >> > noError2 :: String -> [SomeExistential] -> String >> > noError2 n st = n ++ concatMap cname st >> > where cname (SomeExistential p) = d p >> > >> > d p = c $ someType p >> > >> > c :: SumType -> String >> > c p = case p of >> > SumFoo -> "foo" >> > _ -> "asdf" ++ n >> > >> > noError3 :: String -> [SomeExistential] -> String >> > noError3 n st = n ++ concatMap cname st >> > where cname (SomeExistential p) = d p >> > >> > d :: SomeClass a => a -> String >> > d p = c $ someType p >> > >> > c p = case p of >> > SumFoo -> "foo" >> > _ -> "asdf" ++ n >> > >> > >> > partialTypedError :: String -> [SomeExistential] -> String >> > partialTypedError n st = n ++ concatMap cname st >> > where cname :: SomeExistential -> String >> > cname (SomeExistential p) = d p >> > >> > d p = c $ someType p >> > >> > c p = case p of >> > SumFoo -> "foo" >> > _ -> "asdf" ++ n >> > >> > fullError :: String -> [SomeExistential] -> String >> > fullError n st = n ++ concatMap cname st >> > where cname (SomeExistential p) = d p >> > >> > d p = c $ someType p >> > >> > c p = case p of >> > SumFoo -> "foo" >> > _ -> "asdf" ++ n >> > >> > justNError :: String -> [SomeExistential] -> String >> > justNError n st = n ++ concatMap cname st >> > where cname (SomeExistential p) = d p >> > >> > d p = c $ someType p >> > >> > c p = case p of >> > SumFoo -> "foo" >> > _ -> n >> > >> > ignoreNError :: String -> [SomeExistential] -> String >> > ignoreNError n st = n ++ concatMap cname st >> > where cname (SomeExistential p) = d p >> > >> > d p = c $ someType p >> > >> > c p = case p of >> > SumFoo -> "foo" >> > _ -> fst ("foo", n) >> > >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.stolarek at p.lodz.pl Mon Mar 2 19:02:26 2015 From: jan.stolarek at p.lodz.pl (Jan Stolarek) Date: Mon, 2 Mar 2015 20:02:26 +0100 Subject: [Haskell-cafe] Skolems! In-Reply-To: References: Message-ID: <201503022002.26378.jan.stolarek@p.lodz.pl> > A quick clarification. It s trac still the location to submit bugs or is > Phabricator more appropriate? Trac is still the place to submit bugs. Once a bug-fix is ready we use Phabricator to code-review the patch. Janek > > On Mon, Mar 2, 2015 at 1:49 PM, evan at evan-borden.com < > > evan at evanrutledgeborden.dreamhosters.com> wrote: > > Thanks Richard, will do. > > > > On Mon, Mar 2, 2015 at 1:12 PM, Richard Eisenberg > > > > wrote: > >> This is admittedly a dark corner of the inference algorithm, but perhaps > >> these examples can shed some light. Post a bug report! > >> > >> Thanks for creating nice, small examples. > >> > >> Richard > >> > >> PS: I offer no strong guarantees that you've found bugs here... but in > >> any case, posting a bug report gets more serious attention than a > >> Haskell-cafe post. > >> > >> On Feb 27, 2015, at 1:23 PM, "evan at evan-borden.com" < > >> > >> evan at evanrutledgeborden.dreamhosters.com> wrote: > >> > An extension of the message Tom sent a little while back, we've > >> > >> discovered a more in depth example of this possible GHC bug. It is > >> exacerbated by GADTs, but can be fixed with NoMonoLocalBinds. Without > >> GADTs and just leveraging ExistentialQuanitification it works fine. > >> We've included a pretty exhaustive set of examples. > >> > >> > {-# LANGUAGE ExistentialQuantification, GADTs #-} > >> > > >> > {- removing MonoLocalBinds fixes all of these errors > >> > {-# LANGUAGE ExistentialQuantification, GADTs, NoMonoLocalBinds #-} > >> > -} > >> > > >> > module PossibleGHCBug where > >> > > >> > data SumType = SumFoo | SumBar > >> > > >> > class SomeClass a where > >> > someType :: a -> SumType > >> > > >> > data SomeExistential = forall a. SomeClass a => SomeExistential a > >> > > >> > noError :: String -> [SomeExistential] -> String > >> > noError n st = n ++ concatMap cname st > >> > where cname (SomeExistential p) = d p > >> > > >> > d p = c $ someType p > >> > > >> > c p = case p of > >> > SumFoo -> "foo" > >> > _ -> "asdf" > >> > > >> > noError2 :: String -> [SomeExistential] -> String > >> > noError2 n st = n ++ concatMap cname st > >> > where cname (SomeExistential p) = d p > >> > > >> > d p = c $ someType p > >> > > >> > c :: SumType -> String > >> > c p = case p of > >> > SumFoo -> "foo" > >> > _ -> "asdf" ++ n > >> > > >> > noError3 :: String -> [SomeExistential] -> String > >> > noError3 n st = n ++ concatMap cname st > >> > where cname (SomeExistential p) = d p > >> > > >> > d :: SomeClass a => a -> String > >> > d p = c $ someType p > >> > > >> > c p = case p of > >> > SumFoo -> "foo" > >> > _ -> "asdf" ++ n > >> > > >> > > >> > partialTypedError :: String -> [SomeExistential] -> String > >> > partialTypedError n st = n ++ concatMap cname st > >> > where cname :: SomeExistential -> String > >> > cname (SomeExistential p) = d p > >> > > >> > d p = c $ someType p > >> > > >> > c p = case p of > >> > SumFoo -> "foo" > >> > _ -> "asdf" ++ n > >> > > >> > fullError :: String -> [SomeExistential] -> String > >> > fullError n st = n ++ concatMap cname st > >> > where cname (SomeExistential p) = d p > >> > > >> > d p = c $ someType p > >> > > >> > c p = case p of > >> > SumFoo -> "foo" > >> > _ -> "asdf" ++ n > >> > > >> > justNError :: String -> [SomeExistential] -> String > >> > justNError n st = n ++ concatMap cname st > >> > where cname (SomeExistential p) = d p > >> > > >> > d p = c $ someType p > >> > > >> > c p = case p of > >> > SumFoo -> "foo" > >> > _ -> n > >> > > >> > ignoreNError :: String -> [SomeExistential] -> String > >> > ignoreNError n st = n ++ concatMap cname st > >> > where cname (SomeExistential p) = d p > >> > > >> > d p = c $ someType p > >> > > >> > c p = case p of > >> > SumFoo -> "foo" > >> > _ -> fst ("foo", n) > >> > > >> > > >> > _______________________________________________ > >> > Haskell-Cafe mailing list > >> > Haskell-Cafe at haskell.org > >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe --- Politechnika ??dzka Lodz University of Technology Tre?? tej wiadomo?ci zawiera informacje przeznaczone tylko dla adresata. Je?eli nie jeste?cie Pa?stwo jej adresatem, b?d? otrzymali?cie j? przez pomy?k? prosimy o powiadomienie o tym nadawcy oraz trwa?e jej usuni?cie. This email contains information intended solely for the use of the individual to whom it is addressed. If you are not the intended recipient or if you have received this message in error, please notify the sender and delete it from your system. From mike at izbicki.me Mon Mar 2 21:14:26 2015 From: mike at izbicki.me (Mike Izbicki) Date: Mon, 2 Mar 2015 13:14:26 -0800 Subject: [Haskell-cafe] A Proposed Law for Foldable? In-Reply-To: References: <06e128af-0094-47d0-b780-065f939adc3d@googlegroups.com> Message-ID: I'd like to throw another law into the ring that is simple and satisfies the issues raised by David Feuer. Using the following definitions: > class Foldable f where > length :: f a -> Int > foldMap :: (a -> b) -> f a -> b > > disjoint :: (Monoid (f a), Foldable f) => f a -> f a -> Bool > disjoint f1 f2 = length f1 + length f2 == length (f1 `mappend` f2) The law is: > disjoint f1 f2 ==> foldMap f f1 + foldMap f f2 == foldMap f (f1 `mappend` f2) The main advantage of the law is that it forces foldMap to consider "every element" of the container, where "every element" is very loosely defined. The Foldable instance that considers only the first element in a list breaks the law. But David Feuer's Team/IP example can be made to work with the law. The inspiration for the law is to treat the Foldable class as a generalization of the Lebesgue integral. If you're familiar with measure theory, foldMap over a set of numbers "should be" the same as integrating over the set using the discrete measure. The generalized definition of disjoint to let us "integrate" over containers other than sets. (For example, every list is disjoint to every other list, but every set is not disjoint to every other set.) On Sat, Feb 28, 2015 at 9:59 AM, Edward Kmett wrote: > The Foldable/Monoid constraints are unrelated in behavior, so not > necessarily. > > Why? > > At first blush you might think you'd get there via the free theorems, but > Monoid is only on *, so you can use the inclusion of the argument in the > Monoid instance to incur further constraints. > > newtype Foo a = Foo a deriving (Monoid, Foldable) > > now Foo has > > instance Foldable Foo > instance Monoid m => Monoid (Foo m) > > it lifts the Monoid to the element inside, but if you fold it you get the > single value contained inside of it, not mempty. > > Now if you want to upgrade this approach all the way to Alternative, rather > than Monoid then the free theorem arguments start getting teeth. > > foldMap f empty = mempty > > should then (almost?) hold. I say almost because you might be able to have > empty be an infinitely large tree which never gets down to values somehow, > in which case that law would require deciding an infinite amount of work. I > haven't sat down to prove if the latter is impossible, so I characterize it > as at least plausible. > > -Edward > > On Fri, Feb 27, 2015 at 6:00 PM, Daniel D?az wrote: >> >> Hi, >> >> Sorry for the slight derail, but I wanted to ask the following doubt: if a >> Foldable type also happens to be a Monoid (say, like Set) does that >> automatically imply that toList mempty = [] ? >> >> On Friday, February 27, 2015 at 8:18:05 PM UTC+1, Gershom B wrote: >>> >>> On February 27, 2015 at 1:39:10 AM, David Feuer (david... at gmail.com) >>> wrote: >>> > I am still struggling to understand why you want this to be a law for >>> > Foldable. It seems an interesting property of some Foldable instances, >>> > but, unlike Edward Kmett's proposed monoid morphism law, it's not >>> > clear to me how you can use this low to prove useful properties of >>> > programs. Could you explain? >>> >>> I think there are a number of purposes for laws. Some can be thought of >>> as "suggested rewrite rules" -- and the monoid morphism law is one such, as >>> are many related free approaches. >>> >>> Note that the monoid morphism law that Edward provides is _not_ a >>> "proposed" law -- it is an "almost free theorem" -- given a monoid morphism, >>> it follows for free for any Foldable. There is no possible foldable instance >>> that can violate this law, assuming you have an actual monoid morphism. >>> >>> So Edward may have proposed adding it to the documentation (which makes >>> sense to me) -- but it provides absolutely no guidance or constraints as to >>> what an "allowable" instance of Foldable is or is not. >>> >>> But there are other reasons for laws than just to provide rewrite rules, >>> even though it is often desirable to express laws in such terms. Consider >>> the first Functor law for example -- fmap id === id. Now clearly we can use >>> it to go eliminate a bunch of "fmap id" calls in our program, should we have >>> had them. But when would that ever be the case? Instead, the law is >>> important because it _restricts_ the range of allowable instances -- and so >>> if you know you have a data type, and you know it has a functor instance, >>> you then know what that functor instance must do, without looking at the >>> source code. >>> >>> >> >> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From fr33domlover at riseup.net Mon Mar 2 21:36:39 2015 From: fr33domlover at riseup.net (fr33domlover) Date: Mon, 2 Mar 2015 23:36:39 +0200 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> Message-ID: On 2015-02-28 Mike Meyer wrote: > > There are open source projects that are systematically excising GPL'ed > software because of the problems it shares with ShareAlike licenses. Should > we disallow the GPL because some people have problems with it? > > Making Hackage better to help users sort out which licenses they are > willing to accept in their project - which I personally would like to do on > a project-by-project basis! - is a solution to these problems. Restricting > the licenses that are acceptable on Hackage to meet some arbitrary set of > criteria is a knee-jerk. The restrictions aren't arbitrary at all. They're based on ethics. On Software freedom. But sure, a package with invalid license tagging should instantly become unavailable. Here's a suggestion: We can talk about this forever, because there seem to be no official guidelines to really discuss. Why don't we put clear guidelines at hackage.haskell.org ? If these guidelines would be "proprietary software allowed", then there's a point to discuss. But if the guideline requires certain tagging - currently all the license tags except all-rights-reserved are free software licenses - maybe the problem is already solved. Who maintains the community hackage instance and the guidelines? Just to make sure these people are aware of this discussion. --- fr33domlover GPG key ID: 63E5E57D (size: 4096) GPG key fingerprint: 6FEE C222 7323 EF85 A49D 5487 5252 C5C8 63E5 E57D -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: From mwm at mired.org Mon Mar 2 22:27:53 2015 From: mwm at mired.org (Mike Meyer) Date: Mon, 2 Mar 2015 16:27:53 -0600 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: <54f4d7f7.079d2a0a.736b.0ec0SMTPIN_ADDED_MISSING@mx.google.com> References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> <54f4d7f7.079d2a0a.736b.0ec0SMTPIN_ADDED_MISSING@mx.google.com> Message-ID: On Mon, Mar 2, 2015 at 3:36 PM, fr33domlover wrote: > On 2015-02-28 > Mike Meyer wrote: > > > > > There are open source projects that are systematically excising GPL'ed > > software because of the problems it shares with ShareAlike licenses. > Should > > we disallow the GPL because some people have problems with it? > > > > Making Hackage better to help users sort out which licenses they are > > willing to accept in their project - which I personally would like to do > on > > a project-by-project basis! - is a solution to these problems. > Restricting > > the licenses that are acceptable on Hackage to meet some arbitrary set of > > criteria is a knee-jerk. > The restrictions aren't arbitrary at all. They're based on ethics. On > Software > freedom. > Until you've got an objective set of ethics - or a definition of "software freedom" - that everyone accepts, that's just a long-winded way of saying "arbitrary". Here's a suggestion: We can talk about this forever, because there seem to > be > no official guidelines to really discuss. Why don't we put clear > guidelines at > hackage.haskell.org ? If these guidelines would be "proprietary software > allowed", then there's a point to discuss. But if the guideline requires > certain tagging - currently all the license tags except > all-rights-reserved are > free software licenses - maybe the problem is already solved. > Not quite. "OtherLicense" is an accepted license tag, and I take it to mean I can use any license I want. If you're going to place a restriction on the license types beyond "use one of our tags" (and if you disallow the otherLicense tag, then I'd say that's an arbitrary restriction), then you should either define the terms in it, or choose terms that are well defined. "free software" is so ill defined that gnu.org has to explain what they mean by "free software" (https://www.gnu.org/philosophy/free-sw.html). They even point out that there are open source software licenses that don't meet their definition of free ( https://www.gnu.org/philosophy/open-source-misses-the-point.html). Their definition of proprietary as "not free" makes software licensed under such licenses proprietary, though that's certainly not common usage. So just saying "only free software licenses" or "no proprietary software" would make matters worse, not better, because those terms have multiple meanings in common use. And that makes them not only arbitrary, but vague. -------------- next part -------------- An HTML attachment was scrubbed... URL: From aditya.siram at gmail.com Tue Mar 3 00:13:31 2015 From: aditya.siram at gmail.com (aditya siram) Date: Mon, 2 Mar 2015 18:13:31 -0600 Subject: [Haskell-cafe] C2HS parse error on Windows ... Message-ID: Hi all, c2hs runs into the following error on all of my .chs files, but only on Windows: c:\\program files\\haskell platform\\2014.2.0.0\\mingw\\bin\\../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/include/stddef.h:20: (column 11) [ERROR] >>> Syntax error ! The symbol `__attribute__' does not fit here. My c2hs version is: C->Haskell Compiler, version 0.23.1 Snowbounder, 31 Oct 2014 build platform is "x86_64-mingw32" <1, True, True, 1> This is the command being run: "c:\Users\deech\AppData\Roaming\cabal\bin\c2hs.exe" "--cpp=c:\Program Files\Haskell Platform\2014.2.0.0\mingw\bin\gcc.exe" "--cppopts=-E" "--cppopts=-D__GLASGOW_HASKELL__=708" "--cppopts=-Dmingw32_BUILD_OS=1" "--cppopts=-Dx86_64_BUILD_ARCH=1" "--cppopts=-Dmingw32_HOST_OS=1" "--cppopts=-Dx86_64_HOST_ARCH=1" "--cppopts=-I./c-src" "--cppopts=-I./" "--cppopts=-IC:/MinGW/include" "--cppopts=-IC:\Users\deech\Downloads\fltkhs-0.1.0.1/c-src" "--cppopts=-IC:\Users\deech\Downloads\fltkhs-0.1.0.1" "--include=dist\build" "--cppopts=-IC:\Program Files\Haskell Platform\2014.2.0.0\lib\process-1.2.0.0\include" "--cppopts=-IC:\Program Files\Haskell Platform\2014.2.0.0\lib\directory-1.2.1.0\include" "--cppopts=-IC:\Program Files\Haskell Platform\2014.2.0.0\lib\time-1.4.2\include" "--cppopts=-IC:\ProgramFiles\Haskell Platform\2014.2.0.0\lib\Win32-2.3.0.2\include" "--cppopts=-IC:\Program Files\Haskell Platform\2014.2.0.0\lib\bytestring-0.10.4.0\include" "--cppopts=-IC:\Program Files\Haskell Platform\2014.2.0.0\lib\base-4.7.0.1\include" "--cppopts=-IC:\Program Files\Haskell Platform\2014.2.0.0\lib\integer-gmp-0.5.1.0\include" "--cppopts=-IC:\Program Files\Haskell Platform\2014.2.0.0\lib/include" "--output-dir=dist\build" "--output=Graphics\UI\FLTK\LowLevel\HorValueSlider.hs" "src\Graphics\UI\FLTK\LowLevel\HorValueSlider.chs" A little Googling turned up this thread: http://haskell.1045720.n5.nabble.com/BUG-string-h-FC4-x86-64-td3196369.html which suggested I pass -D__attribute__(A)= to c2hs's opts. I tried it and it led to other errors. I didn't pursue any further because it's an old thread. I'm not sure what stddef.h is and I'm unfamiliar with Windows. Any help is appreciated. Thanks! -deech -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at proclivis.com Tue Mar 3 06:05:00 2015 From: mike at proclivis.com (Michael Jones) Date: Mon, 2 Mar 2015 23:05:00 -0700 Subject: [Haskell-cafe] Difficulty making a TH template for a monadic expression Message-ID: <4C901F80-4D6A-409A-8967-71A583102C59@proclivis.com> I?m at wits end as to how to express a monadic expression in TH. I?ll give here two ways to express a non TH version, and then a TH expression that does not quite work. It generates code that compiles, but it does not evaluate properly like the non TH version. Fundamentally, the problem is use of a recursive function using quasi quoting similar to what is in the standard Show example. Perhaps someone will have an idea on how to fix it. I have made several attempts and failed. Non TH Example A: Do notation ????????????? let r = BG.runBitGet flags (do let bits = [] v <- BG.getBit bits <- return $ if v then I1_7:bits else bits v <- BG.getBit bits <- return $ if v then I1_6:bits else bits v <- BG.getBit bits <- return $ if v then I1_5:bits else bits v <- BG.getBit bits <- return $ if v then I1_4:bits else bits v <- BG.getBit bits <- return $ if v then I1_3:bits else bits v <- BG.getBit bits <- return $ if v then I1_2:bits else bits v <- BG.getBit bits <- return $ if v then I1_1:bits else bits v <- BG.getBit bits <- return $ if v then I1_0:bits else bits return $! bits) Non TH Example B: Bind notation ?????????????? let r = BG.runBitGet flags ( return [] >>= (\bits -> ifM BG.getBit (return $ I0_7:bits) (return $ bits)) >>= (\bits -> ifM BG.getBit (return $ I0_6:bits) (return $ bits)) >>= (\bits -> ifM BG.getBit (return $ I0_5:bits) (return $ bits)) >>= (\bits -> ifM BG.getBit (return $ I0_4:bits) (return $ bits)) >>= (\bits -> ifM BG.getBit (return $ I0_3:bits) (return $ bits)) >>= (\bits -> ifM BG.getBit (return $ I0_2:bits) (return $ bits)) >>= (\bits -> ifM BG.getBit (return $ I0_1:bits) (return $ bits)) >>= (\bits -> ifM BG.getBit (return $ I0_0:bits) (return $ bits))) A TH for Example B: ???????? let bitsP = varP $ mkName "bits" let bitsE = varE $ mkName "bits" let makeBits [] = [| "" |] makeBits (name:names) = [| (\bits -> ifM BG.getBit (return $ $(conE name) : $bitsE) (return $ $bitsE)) >>= $(makeBits names) |] parse <- [d| $(varP (mkName $ "parse" ++ nameBase name)) = do flags <- G.getByteString 1 let r = BG.runBitGet flags (return [] >>= $(makeBits bitNames)) case r of Left error -> fail error Right x -> return x |] This generates: parseTCA9535_INPUT_PORT_0_BITS = do {flags_0 <- Data.Binary.Strict.Get.getByteString 1; let r_1 = Data.Binary.Strict.BitGet.runBitGet flags_0 (GHC.Base.return [] GHC.Base.>>= ((\bits_2 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_7 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ((\bits_3 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_6 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ((\bits_4 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_5 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ((\bits_5 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_4 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ((\bits_6 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_3 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ((\bits_7 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_2 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ((\bits_8 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_1 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ((\bits_9 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_0 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ""))))))))); Problems with TH ???????? The problem is the () that interferes with the order of evaluation, and the termination at the end ( ?? ). I?m no so worried about the termination. I can put something harmless there. The parens are the main problem. Calling a quasi quoter recursively is the cause, as it nests the evaluation. I tried things like building the bits in a list, but that does not work because the BG.getBit has to run in the BitGit monad. I know I can write a simple evaluation that just returns a list of Bools and only TH for bit names, but in the final version the size of bit fields needs to be dynamic, so I need to dynamically generate code piece by piece. I would prefer to use quasi quoting rather than build the whole thing with data types so that it is more readable. If anyone knows of a module on hackage that does something similar, perhaps you can point me to that so I can study it. Thanks?Mike From fr33domlover at riseup.net Tue Mar 3 09:19:08 2015 From: fr33domlover at riseup.net (fr33domlover) Date: Tue, 3 Mar 2015 11:19:08 +0200 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> <54f4d7f7.079d2a0a.736b.0ec0SMTPIN_ADDED_MISSING@mx.google.com> Message-ID: On Mon, 2 Mar 2015 16:27:53 -0600 Mike Meyer wrote: > Until you've got an objective set of ethics - or a definition of "software > freedom" - that everyone accepts, that's just a long-winded way of saying > "arbitrary". Indeed there is an objective clear definition: http://www.gnu.org/philosophy/free-sw.html > > Not quite. "OtherLicense" is an accepted license tag, and I take it to mean > I can use any license I want. If you're going to place a restriction on the > license types beyond "use one of our tags" (and if you disallow the > otherLicense tag, then I'd say that's an arbitrary restriction), then you > should either define the terms in it, or choose terms that are well > defined. "free software" is so ill defined that gnu.org has to explain what > they mean by "free software" (https://www.gnu.org/philosophy/free-sw.html). > They even point out that there are open source software licenses that don't > meet their definition of free ( > https://www.gnu.org/philosophy/open-source-misses-the-point.html). Their > definition of proprietary as "not free" makes software licensed under such > licenses proprietary, though that's certainly not common usage. "Open source misses the point" talks about the open source movement - it doesn't say the BSD, MIT or Apache are not free software licenses. They are! gnu.org provides a definition of free software, which makes it quite well defined. There's even a list of licenses. There is nothing arbitrary about it - in the same way the law that puts murderers in prison isn't arbitrary. It's based on ethics: the value of human life. Free software is similarly based on the value people's freedom to control their computing, know what they run and be able to adapt and spread it. > So just saying "only free software licenses" or "no proprietary software" > would make matters worse, not better, because those terms have multiple > meanings in common use. And that makes them not only arbitrary, but vague. The FSF's definition is the only definition I know of. If people understand it in a different way, this only strengthens my point: make it official and explain the details and rules, so people do understand what free software is. If hackage.haskell.org explains this, there will be nothing vague anymore. From codygman.consulting at gmail.com Tue Mar 3 10:00:26 2015 From: codygman.consulting at gmail.com (Cody Goodman) Date: Tue, 3 Mar 2015 04:00:26 -0600 Subject: [Haskell-cafe] Am I using Parsec correctly? Message-ID: -- trying to parse the text below using Parsec: -- ACT I. -- SCENE I. An open place. -- [An open place. Thunder and lightning. Enter three Witches.] -- FIRST WITCH. -- When shall we three meet again -- In thunder, lightning, or in rain? -- Here's the code I have import Text.Parsec import Control.Applicative import Data.Traversable (sequenceA) section s = sequenceA [string s, string " ", many1 letter] `endBy` char '.' act = section "ACT" scene = section "SCENE" main = do parseTest act "ACT I.\n" parseTest scene "SCENE I." -- this returns: -- ?> main -- [["ACT"," ","I"]] -- [["SCENE"," ","I"]] -- Am I using Parsec correctly so far? -- After this I want to match acts (many1 act) and scenes (many1 scene) and I believe I see how to do that, just wanting to make sure I'm on the right track. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicola.gigante at gmail.com Tue Mar 3 11:03:50 2015 From: nicola.gigante at gmail.com (Nicola Gigante) Date: Tue, 3 Mar 2015 12:03:50 +0100 Subject: [Haskell-cafe] Lifting Writer to ListT Message-ID: <97D743F0-2B09-483A-AC9A-E32476B8D382@gmail.com> Hi all, Suppose I have this monad stack: type MyMonad = ListT (Writer W) Where ListT is done right (from the list-t package). What I want is a nondeterministic computation where each alternative logs to the same writer, and indeed the type of runWriter . toList is MyMonad a -> ([a], w) so I think I got it right. What I would like to do is to write an instance of MonadWriter for this monad, but I'm stuck with the implementation of listen. Just using lift won't work, and indeed I see that MonadWriter lifting instances for other monads (e.g MaybeT), are a bit convoluted. Could someone explain me a little bit what should I do (what listen should do in a ListT in the first place) Thank you :) Nicola From mwm at mired.org Tue Mar 3 11:53:56 2015 From: mwm at mired.org (Mike Meyer) Date: Tue, 3 Mar 2015 05:53:56 -0600 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: <54f57ce3.e342320a.087c.2f59SMTPIN_ADDED_MISSING@mx.google.com> References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> <54f4d7f7.079d2a0a.736b.0ec0SMTPIN_ADDED_MISSING@mx.google.com> <54f57ce3.e342320a.087c.2f59SMTPIN_ADDED_MISSING@mx.google.com> Message-ID: On Tue, Mar 3, 2015 at 3:19 AM, fr33domlover wrote: > On Mon, 2 Mar 2015 16:27:53 -0600 > Mike Meyer wrote: > > Until you've got an objective set of ethics - or a definition of "software > > freedom" - that everyone accepts, that's just a long-winded way of saying > > "arbitrary". > Indeed there is an objective clear definition: > http://www.gnu.org/philosophy/free-sw.html Applying that definition may be objective, but not everyone agrees that it's a correct definition of free software, which makes it a subjective definition. > > Not quite. "OtherLicense" is an accepted license tag, and I take it to mean > > I can use any license I want. If you're going to place a restriction on the > > license types beyond "use one of our tags" (and if you disallow the > > otherLicense tag, then I'd say that's an arbitrary restriction), then you > > should either define the terms in it, or choose terms that are well > > defined. "free software" is so ill defined that gnu.org has to explain what > > they mean by "free software" ( https://www.gnu.org/philosophy/free-sw.html). > > They even point out that there are open source software licenses that don't > > meet their definition of free ( > > https://www.gnu.org/philosophy/open-source-misses-the-point.html). Their > > definition of proprietary as "not free" makes software licensed under such > > licenses proprietary, though that's certainly not common usage. > "Open source misses the point" talks about the open source movement - it > doesn't say the BSD, MIT or Apache are not free software licenses. They are! > gnu.org provides a definition of free software, which makes it quite well > defined. There's even a list of licenses. While the BSD, MIT and Apache licenses are free, the GNU license list (https://www.gnu.org/philosophy/license-list.html#NonFreeSoftwareLicenses): provides a long list of open source licenses that aren't free. Some of them aren't free because they are truly noxious, some aren't free because they are poorly written, and some aren't free because the developers restrictions they feel are reasonable, but violate that letter if not the spirit of that definition. > There is nothing arbitrary about it - in the same way the law that puts > murderers in prison isn't arbitrary. It's based on ethics: the value of human > life. Free software is similarly based on the value people's freedom to control > their computing, know what they run and be able to adapt and spread it. Yes, but not everyone agrees to something you would think would be clearcut, like the value of a human life. For instance, some cultures feel that giving your own life for the good of your religion is the best thing you can do with it, and think nothing of taking away some non-believers life for that cause. And in other cultures, your life isn't yours but the states, and you don't have the right to end it yourself. Since there's such broad disagreement on the value of a human life, then it should be no surprise that people disagree on an idea as recent as "free software". For instance, I find it a bit ironic that a defintion of "free software" puts restrictions on derived works that the original author doesn't have to abid by. > > So just saying "only free software licenses" or "no proprietary software" > > would make matters worse, not better, because those terms have multiple > > meanings in common use. And that makes them not only arbitrary, but vague. > The FSF's definition is the only definition I know of. If people understand it > in a different way, this only strengthens my point: make it official and > explain the details and rules, so people do understand what free software is. > If hackage.haskell.org explains this, there will be nothing vague anymore. Pointing to an external definition is certainly an acceptable way to clear up the issue of the meaning of the phrase. However, I object to any definition that excludes open source licenses that would otherwise be useable under the otherLicnese tag for reasons I find capricious (i.e - any license with a "no commercial use" clause is excluded, and the lovely "must use for good" clause in the JSON license causes it to be excluded). The OSI's definition of open source doesn't have any of those problems. How about using it: http://opensource.org/definition From hesselink at gmail.com Tue Mar 3 11:59:26 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Tue, 3 Mar 2015 12:59:26 +0100 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> <54f4d7f7.079d2a0a.736b.0ec0SMTPIN_ADDED_MISSING@mx.google.com> Message-ID: On Mon, Mar 2, 2015 at 11:27 PM, Mike Meyer wrote: > Not quite. "OtherLicense" is an accepted license tag, and I take it to mean > I can use any license I want. That's not quite true, since AllRightsReserved is rejected. I think the idea is that hackage only wants to accept licenses where people can at least build and run that one package without any further restrictions. It's true that this is not documented anywhere or fully fleshed out, and it probably should be. Erik From vogt.adam at gmail.com Tue Mar 3 13:03:46 2015 From: vogt.adam at gmail.com (adam vogt) Date: Tue, 3 Mar 2015 08:03:46 -0500 Subject: [Haskell-cafe] Difficulty making a TH template for a monadic expression In-Reply-To: <4C901F80-4D6A-409A-8967-71A583102C59@proclivis.com> References: <4C901F80-4D6A-409A-8967-71A583102C59@proclivis.com> Message-ID: Hi Mike, Is there some reason you decided to use TH, when it looks like you can write: f :: a -> Binary (Maybe a) f con = do v <- BG.getBit return (do guard v; Just con) makeBits :: [a] -> Binary [a] makeBits con = catMaybes <$> mapM f con and have the TH part be much smaller: toCons :: [Name] -> ExpQ toCons = listE . map conE makeBits $(toCons bitNames) If you really do need to generate code, let me suggest combine :: [ExpQ] -> ExpQ combine = foldr1 (\ a b -> [| $a >>= $b |]) together with g :: Name -> ExpQ g name = [| \bits -> ifM getBit ((return $(conE name) : bits) (return bits) |] gets you makeBits = combine . map g Or you could keep the recursion explicit and write the first clause of your makeBits: makeBits [name] = g name -- g as above Regards, Adam On Tue, Mar 3, 2015 at 1:05 AM, Michael Jones wrote: > I?m at wits end as to how to express a monadic expression in TH. I?ll give here two ways to express a non TH version, and then a TH expression that does not quite work. It generates code that compiles, but it does not evaluate properly like the non TH version. Fundamentally, the problem is use of a recursive function using quasi quoting similar to what is in the standard Show example. > > Perhaps someone will have an idea on how to fix it. I have made several attempts and failed. > > Non TH Example A: Do notation > ????????????? > > let r = BG.runBitGet flags (do > let bits = [] > v <- BG.getBit > bits <- return $ if v then I1_7:bits else bits > v <- BG.getBit > bits <- return $ if v then I1_6:bits else bits > v <- BG.getBit > bits <- return $ if v then I1_5:bits else bits > v <- BG.getBit > bits <- return $ if v then I1_4:bits else bits > v <- BG.getBit > bits <- return $ if v then I1_3:bits else bits > v <- BG.getBit > bits <- return $ if v then I1_2:bits else bits > v <- BG.getBit > bits <- return $ if v then I1_1:bits else bits > v <- BG.getBit > bits <- return $ if v then I1_0:bits else bits > > return $! bits) > > > Non TH Example B: Bind notation > ?????????????? > > let r = BG.runBitGet flags ( > return [] >>= > (\bits -> ifM BG.getBit (return $ I0_7:bits) (return $ bits)) >>= > (\bits -> ifM BG.getBit (return $ I0_6:bits) (return $ bits)) >>= > (\bits -> ifM BG.getBit (return $ I0_5:bits) (return $ bits)) >>= > (\bits -> ifM BG.getBit (return $ I0_4:bits) (return $ bits)) >>= > (\bits -> ifM BG.getBit (return $ I0_3:bits) (return $ bits)) >>= > (\bits -> ifM BG.getBit (return $ I0_2:bits) (return $ bits)) >>= > (\bits -> ifM BG.getBit (return $ I0_1:bits) (return $ bits)) >>= > (\bits -> ifM BG.getBit (return $ I0_0:bits) (return $ bits))) > > > A TH for Example B: > ???????? > > let bitsP = varP $ mkName "bits" > let bitsE = varE $ mkName "bits" > let makeBits [] = [| "" |] > makeBits (name:names) = [| (\bits -> ifM BG.getBit (return $ $(conE name) : $bitsE) (return $ $bitsE)) >>= $(makeBits names) |] > parse <- [d| $(varP (mkName $ "parse" ++ nameBase name)) = do > flags <- G.getByteString 1 > let r = BG.runBitGet flags (return [] >>= $(makeBits bitNames)) > case r of > Left error -> fail error > Right x -> return x > |] > > This generates: > > parseTCA9535_INPUT_PORT_0_BITS = do {flags_0 <- Data.Binary.Strict.Get.getByteString 1; > let r_1 = Data.Binary.Strict.BitGet.runBitGet flags_0 > (GHC.Base.return [] GHC.Base.>>= > ((\bits_2 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_7 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > ((\bits_3 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_6 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > ((\bits_4 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_5 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > ((\bits_5 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_4 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > ((\bits_6 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_3 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > ((\bits_7 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_2 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > ((\bits_8 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_1 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > ((\bits_9 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_0 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ""))))))))); > > Problems with TH > ???????? > > The problem is the () that interferes with the order of evaluation, and the termination at the end ( ?? ). I?m no so worried about the termination. I can put something harmless there. The parens are the main problem. Calling a quasi quoter recursively is the cause, as it nests the evaluation. > > I tried things like building the bits in a list, but that does not work because the BG.getBit has to run in the BitGit monad. I know I can write a simple evaluation that just returns a list of Bools and only TH for bit names, but in the final version the size of bit fields needs to be dynamic, so I need to dynamically generate code piece by piece. > > I would prefer to use quasi quoting rather than build the whole thing with data types so that it is more readable. > > If anyone knows of a module on hackage that does something similar, perhaps you can point me to that so I can study it. > > Thanks?Mike > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From fa-ml at ariis.it Tue Mar 3 15:25:54 2015 From: fa-ml at ariis.it (Francesco Ariis) Date: Tue, 3 Mar 2015 16:25:54 +0100 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> Message-ID: <20150303152554.GA30032@x60s.casa> On Sun, Mar 01, 2015 at 12:17:17AM -0500, Gershom B wrote: > For the record, the current behaviour is as follows. > > [..] > > It would be good to specify that we ask that OtherLicense indeed be > another recognized open-source license. That said, I do not feel strongly > about how much care we take to enforce this. We should definitely better > document this and other elements of hackage policy, and I know > discussions about that have in fact been underway. > > I agree that being able to filter Hackage packages on license and other > considerations (say, build reports on various systems) would be a great > feature. Some such improvements have been floated as GSoC projects. I > would encourage those that feel strongly about such features to consider > getting involved with development of the hackage server. Thanks for the explanation Gershom. Hackage hacking is quite a mysterious topic for me now, but I wrote a small cabal patch to encourage devs to pick recognized free/open-source licenses. [1] https://mail.haskell.org/pipermail/cabal-devel/2015-March/010019.html From marcin.jan.mrotek at gmail.com Tue Mar 3 15:58:10 2015 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Tue, 3 Mar 2015 16:58:10 +0100 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: <20150303152554.GA30032@x60s.casa> References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> <20150303152554.GA30032@x60s.casa> Message-ID: Hello, Hackage accepts source packages only anyway. Why would anyone upload propertiary code and risk it being stolen? Noone uploads non-free software to Hackage, it's safe to assume noone will ever do (except perhaps as an act of trolling, and such packages could be just flat out removed), so why fix it when it isn't broken? Also, as it was already pointed out by Mike Meyer, a list of pre-approved licenses doesn't solve the problem of compatibility and permission to actually build and distribute binaries at all, and it would be better solved by providing some tools to view and check licenses of the transitive closure of dependencies of a package (which would, incidentally, make it easy to weed out non-free packages too, for anyone who desires so) Best regards, Marcin Mrotek From mike at proclivis.com Tue Mar 3 16:00:54 2015 From: mike at proclivis.com (Michael Jones) Date: Tue, 3 Mar 2015 09:00:54 -0700 Subject: [Haskell-cafe] Difficulty making a TH template for a monadic expression In-Reply-To: References: <4C901F80-4D6A-409A-8967-71A583102C59@proclivis.com> Message-ID: <4CE1F919-4256-4985-89F3-9AFC70E3881D@proclivis.com> Adam, I used TH because I wanted a non-programmer to write simple statements from data sheets that generated code for a programmer. My ignorance may prove my undoing, but if I learn something by going down a rabbit hole, I can recover. I don?t need to implement g necessarily, as it is part of a larger function generating other TH code, f would be fine. The goal is to have a non-programmer write something like: $(makeCommandData (mkName "RegTCA9535") ["INPUT_PORT_0", "INPUT_PORT_1", "OUTPUT_PORT_0", "OUTPUT_PORT_1", "POLARITY_INVERSION_PORT_0", "POLARITY_INVERSION_PORT_1", "CONFIGURATION_PORT_0", "CONFIGURATION_PORT_1"]) (makeBitData (mkName "TCA9535_INPUT_PORT_0_BITS") [mkName "I0_7", "I0_6", "I0_5", "I0_4", "I0_3", "I0_2", "I0_1", "I0_0?]) MORE REGISTERS HERE and generate a complete API that works off a list of bits, and read/writes SMBus. I have a GSOC project posted here: http://elinux.org/Minnowboard:GSoC2015 The code I am working on here is kind of starter code for that. I already have an SMBus API and impl as well on a MinnowBoardMax running Ubuntu. If any students are interested, follow the link. Mike On Mar 3, 2015, at 6:03 AM, adam vogt wrote: > Hi Mike, > > Is there some reason you decided to use TH, when it looks like you can write: > > f :: a -> Binary (Maybe a) > f con = do > v <- BG.getBit > return (do guard v; Just con) > > makeBits :: [a] -> Binary [a] > makeBits con = catMaybes <$> mapM f con > > and have the TH part be much smaller: > > toCons :: [Name] -> ExpQ > toCons = listE . map conE > > makeBits $(toCons bitNames) > > > > If you really do need to generate code, let me suggest > > combine :: [ExpQ] -> ExpQ > combine = foldr1 (\ a b -> [| $a >>= $b |]) > > together with > > g :: Name -> ExpQ > g name = [| \bits -> ifM getBit ((return $(conE name) : bits) (return bits) |] > > gets you > > makeBits = combine . map g > > > Or you could keep the recursion explicit and write the first clause of > your makeBits: > > makeBits [name] = g name -- g as above > > Regards, > Adam > > > On Tue, Mar 3, 2015 at 1:05 AM, Michael Jones wrote: >> I?m at wits end as to how to express a monadic expression in TH. I?ll give here two ways to express a non TH version, and then a TH expression that does not quite work. It generates code that compiles, but it does not evaluate properly like the non TH version. Fundamentally, the problem is use of a recursive function using quasi quoting similar to what is in the standard Show example. >> >> Perhaps someone will have an idea on how to fix it. I have made several attempts and failed. >> >> Non TH Example A: Do notation >> ????????????? >> >> let r = BG.runBitGet flags (do >> let bits = [] >> v <- BG.getBit >> bits <- return $ if v then I1_7:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_6:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_5:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_4:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_3:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_2:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_1:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_0:bits else bits >> >> return $! bits) >> >> >> Non TH Example B: Bind notation >> ?????????????? >> >> let r = BG.runBitGet flags ( >> return [] >>= >> (\bits -> ifM BG.getBit (return $ I0_7:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_6:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_5:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_4:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_3:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_2:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_1:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_0:bits) (return $ bits))) >> >> >> A TH for Example B: >> ???????? >> >> let bitsP = varP $ mkName "bits" >> let bitsE = varE $ mkName "bits" >> let makeBits [] = [| "" |] >> makeBits (name:names) = [| (\bits -> ifM BG.getBit (return $ $(conE name) : $bitsE) (return $ $bitsE)) >>= $(makeBits names) |] >> parse <- [d| $(varP (mkName $ "parse" ++ nameBase name)) = do >> flags <- G.getByteString 1 >> let r = BG.runBitGet flags (return [] >>= $(makeBits bitNames)) >> case r of >> Left error -> fail error >> Right x -> return x >> |] >> >> This generates: >> >> parseTCA9535_INPUT_PORT_0_BITS = do {flags_0 <- Data.Binary.Strict.Get.getByteString 1; >> let r_1 = Data.Binary.Strict.BitGet.runBitGet flags_0 >> (GHC.Base.return [] GHC.Base.>>= >> ((\bits_2 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_7 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_3 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_6 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_4 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_5 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_5 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_4 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_6 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_3 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_7 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_2 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_8 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_1 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_9 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_0 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ""))))))))); >> >> Problems with TH >> ???????? >> >> The problem is the () that interferes with the order of evaluation, and the termination at the end ( ?? ). I?m no so worried about the termination. I can put something harmless there. The parens are the main problem. Calling a quasi quoter recursively is the cause, as it nests the evaluation. >> >> I tried things like building the bits in a list, but that does not work because the BG.getBit has to run in the BitGit monad. I know I can write a simple evaluation that just returns a list of Bools and only TH for bit names, but in the final version the size of bit fields needs to be dynamic, so I need to dynamically generate code piece by piece. >> >> I would prefer to use quasi quoting rather than build the whole thing with data types so that it is more readable. >> >> If anyone knows of a module on hackage that does something similar, perhaps you can point me to that so I can study it. >> >> Thanks?Mike >> >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From mwm at mired.org Tue Mar 3 16:11:24 2015 From: mwm at mired.org (Mike Meyer) Date: Tue, 3 Mar 2015 10:11:24 -0600 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> <20150303152554.GA30032@x60s.casa> Message-ID: On Tue, Mar 3, 2015 at 9:58 AM, Marcin Mrotek wrote: > Also, as it was > already pointed out by Mike Meyer, a list of pre-approved licenses > doesn't solve the problem of compatibility and permission to actually > build and distribute binaries at all, and it would be better solved by > providing some tools to view and check licenses of the transitive > closure of dependencies of a package (which would, incidentally, make > it easy to weed out non-free packages too, for anyone who desires so) > BTW, part of the tools are already available: the cabal-dependency-licenses package claims to report all your dependencies sorted by license type. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at proclivis.com Tue Mar 3 16:11:40 2015 From: mike at proclivis.com (Michael Jones) Date: Tue, 3 Mar 2015 09:11:40 -0700 Subject: [Haskell-cafe] Difficulty making a TH template for a monadic expression In-Reply-To: <4CE1F919-4256-4985-89F3-9AFC70E3881D@proclivis.com> References: <4C901F80-4D6A-409A-8967-71A583102C59@proclivis.com> <4CE1F919-4256-4985-89F3-9AFC70E3881D@proclivis.com> Message-ID: <31C39186-C771-48D0-9EDF-B7B2AD123FC6@proclivis.com> I failed to strip all the mkNames from the example. They are in the current code but will be moved inside the make functions later. So... > $(makeCommandData ("RegTCA9535") ["INPUT_PORT_0", > "INPUT_PORT_1", > "OUTPUT_PORT_0", > "OUTPUT_PORT_1", > "POLARITY_INVERSION_PORT_0", > "POLARITY_INVERSION_PORT_1", > "CONFIGURATION_PORT_0", > "CONFIGURATION_PORT_1"]) > > (makeBitData ("TCA9535_INPUT_PORT_0_BITS") ["I0_7", > "I0_6", > "I0_5", > "I0_4", > "I0_3", > "I0_2", > "I0_1", > "I0_0?]) On Mar 3, 2015, at 9:00 AM, Michael Jones wrote: > Adam, > > I used TH because I wanted a non-programmer to write simple statements from data sheets that generated code for a programmer. My ignorance may prove my undoing, but if I learn something by going down a rabbit hole, I can recover. > > I don?t need to implement g necessarily, as it is part of a larger function generating other TH code, f would be fine. > > The goal is to have a non-programmer write something like: > > $(makeCommandData (mkName "RegTCA9535") ["INPUT_PORT_0", > "INPUT_PORT_1", > "OUTPUT_PORT_0", > "OUTPUT_PORT_1", > "POLARITY_INVERSION_PORT_0", > "POLARITY_INVERSION_PORT_1", > "CONFIGURATION_PORT_0", > "CONFIGURATION_PORT_1"]) > > (makeBitData (mkName "TCA9535_INPUT_PORT_0_BITS") [mkName "I0_7", > "I0_6", > "I0_5", > "I0_4", > "I0_3", > "I0_2", > "I0_1", > "I0_0?]) > > MORE REGISTERS HERE > > > > and generate a complete API that works off a list of bits, and read/writes SMBus. > > I have a GSOC project posted here: http://elinux.org/Minnowboard:GSoC2015 > > The code I am working on here is kind of starter code for that. I already have an SMBus API and impl as well on a MinnowBoardMax running Ubuntu. > > If any students are interested, follow the link. > > Mike > > On Mar 3, 2015, at 6:03 AM, adam vogt wrote: > >> Hi Mike, >> >> Is there some reason you decided to use TH, when it looks like you can write: >> >> f :: a -> Binary (Maybe a) >> f con = do >> v <- BG.getBit >> return (do guard v; Just con) >> >> makeBits :: [a] -> Binary [a] >> makeBits con = catMaybes <$> mapM f con >> >> and have the TH part be much smaller: >> >> toCons :: [Name] -> ExpQ >> toCons = listE . map conE >> >> makeBits $(toCons bitNames) >> >> >> >> If you really do need to generate code, let me suggest >> >> combine :: [ExpQ] -> ExpQ >> combine = foldr1 (\ a b -> [| $a >>= $b |]) >> >> together with >> >> g :: Name -> ExpQ >> g name = [| \bits -> ifM getBit ((return $(conE name) : bits) (return bits) |] >> >> gets you >> >> makeBits = combine . map g >> >> >> Or you could keep the recursion explicit and write the first clause of >> your makeBits: >> >> makeBits [name] = g name -- g as above >> >> Regards, >> Adam >> >> >> On Tue, Mar 3, 2015 at 1:05 AM, Michael Jones wrote: >>> I?m at wits end as to how to express a monadic expression in TH. I?ll give here two ways to express a non TH version, and then a TH expression that does not quite work. It generates code that compiles, but it does not evaluate properly like the non TH version. Fundamentally, the problem is use of a recursive function using quasi quoting similar to what is in the standard Show example. >>> >>> Perhaps someone will have an idea on how to fix it. I have made several attempts and failed. >>> >>> Non TH Example A: Do notation >>> ????????????? >>> >>> let r = BG.runBitGet flags (do >>> let bits = [] >>> v <- BG.getBit >>> bits <- return $ if v then I1_7:bits else bits >>> v <- BG.getBit >>> bits <- return $ if v then I1_6:bits else bits >>> v <- BG.getBit >>> bits <- return $ if v then I1_5:bits else bits >>> v <- BG.getBit >>> bits <- return $ if v then I1_4:bits else bits >>> v <- BG.getBit >>> bits <- return $ if v then I1_3:bits else bits >>> v <- BG.getBit >>> bits <- return $ if v then I1_2:bits else bits >>> v <- BG.getBit >>> bits <- return $ if v then I1_1:bits else bits >>> v <- BG.getBit >>> bits <- return $ if v then I1_0:bits else bits >>> >>> return $! bits) >>> >>> >>> Non TH Example B: Bind notation >>> ?????????????? >>> >>> let r = BG.runBitGet flags ( >>> return [] >>= >>> (\bits -> ifM BG.getBit (return $ I0_7:bits) (return $ bits)) >>= >>> (\bits -> ifM BG.getBit (return $ I0_6:bits) (return $ bits)) >>= >>> (\bits -> ifM BG.getBit (return $ I0_5:bits) (return $ bits)) >>= >>> (\bits -> ifM BG.getBit (return $ I0_4:bits) (return $ bits)) >>= >>> (\bits -> ifM BG.getBit (return $ I0_3:bits) (return $ bits)) >>= >>> (\bits -> ifM BG.getBit (return $ I0_2:bits) (return $ bits)) >>= >>> (\bits -> ifM BG.getBit (return $ I0_1:bits) (return $ bits)) >>= >>> (\bits -> ifM BG.getBit (return $ I0_0:bits) (return $ bits))) >>> >>> >>> A TH for Example B: >>> ???????? >>> >>> let bitsP = varP $ mkName "bits" >>> let bitsE = varE $ mkName "bits" >>> let makeBits [] = [| "" |] >>> makeBits (name:names) = [| (\bits -> ifM BG.getBit (return $ $(conE name) : $bitsE) (return $ $bitsE)) >>= $(makeBits names) |] >>> parse <- [d| $(varP (mkName $ "parse" ++ nameBase name)) = do >>> flags <- G.getByteString 1 >>> let r = BG.runBitGet flags (return [] >>= $(makeBits bitNames)) >>> case r of >>> Left error -> fail error >>> Right x -> return x >>> |] >>> >>> This generates: >>> >>> parseTCA9535_INPUT_PORT_0_BITS = do {flags_0 <- Data.Binary.Strict.Get.getByteString 1; >>> let r_1 = Data.Binary.Strict.BitGet.runBitGet flags_0 >>> (GHC.Base.return [] GHC.Base.>>= >>> ((\bits_2 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_7 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >>> ((\bits_3 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_6 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >>> ((\bits_4 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_5 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >>> ((\bits_5 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_4 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >>> ((\bits_6 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_3 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >>> ((\bits_7 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_2 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >>> ((\bits_8 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_1 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >>> ((\bits_9 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_0 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ""))))))))); >>> >>> Problems with TH >>> ???????? >>> >>> The problem is the () that interferes with the order of evaluation, and the termination at the end ( ?? ). I?m no so worried about the termination. I can put something harmless there. The parens are the main problem. Calling a quasi quoter recursively is the cause, as it nests the evaluation. >>> >>> I tried things like building the bits in a list, but that does not work because the BG.getBit has to run in the BitGit monad. I know I can write a simple evaluation that just returns a list of Bools and only TH for bit names, but in the final version the size of bit fields needs to be dynamic, so I need to dynamically generate code piece by piece. >>> >>> I would prefer to use quasi quoting rather than build the whole thing with data types so that it is more readable. >>> >>> If anyone knows of a module on hackage that does something similar, perhaps you can point me to that so I can study it. >>> >>> Thanks?Mike >>> >>> >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From nrujac at gmail.com Tue Mar 3 16:22:49 2015 From: nrujac at gmail.com (Arjun Comar) Date: Tue, 3 Mar 2015 11:22:49 -0500 Subject: [Haskell-cafe] Lifting Writer to ListT In-Reply-To: <97D743F0-2B09-483A-AC9A-E32476B8D382@gmail.com> References: <97D743F0-2B09-483A-AC9A-E32476B8D382@gmail.com> Message-ID: You might prefer using the ListT implementation from the Pipes package which has instances for MonadReader, MonadWriter, and MonadState already. Also, the provided source might give you some insight into how to write these instances for the list-t:ListT type. On Tue, Mar 3, 2015 at 6:03 AM, Nicola Gigante wrote: > Hi all, > > Suppose I have this monad stack: > > type MyMonad = ListT (Writer W) > > Where ListT is done right (from the list-t package). > What I want is a nondeterministic computation where each > alternative logs to the same writer, and indeed the type of > > runWriter . toList > > is MyMonad a -> ([a], w) > > so I think I got it right. > > What I would like to do is to write an instance of MonadWriter > for this monad, but I'm stuck with the implementation of listen. > > Just using lift won't work, and indeed I see that MonadWriter > lifting instances for other monads (e.g MaybeT), are a bit convoluted. > > Could someone explain me a little bit what should I do (what > listen should do in a ListT in the first place) > > Thank you :) > Nicola > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cam at uptoisomorphism.net Tue Mar 3 16:31:29 2015 From: cam at uptoisomorphism.net (Casey McCann) Date: Tue, 3 Mar 2015 11:31:29 -0500 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> <54f4d7f7.079d2a0a.736b.0ec0SMTPIN_ADDED_MISSING@mx.google.com> Message-ID: On Tue, Mar 3, 2015 at 6:59 AM, Erik Hesselink wrote: > > On Mon, Mar 2, 2015 at 11:27 PM, Mike Meyer wrote: > > Not quite. "OtherLicense" is an accepted license tag, and I take it to mean > > I can use any license I want. > > That's not quite true, since AllRightsReserved is rejected. I think > the idea is that hackage only wants to accept licenses where people > can at least build and run that one package without any further > restrictions. It's true that this is not documented anywhere or fully > fleshed out, and it probably should be. Yes, although that would require some decision or consensus on what we expect to be able to do with code on Hackage... My personal minimum expectation would be that anyone can always "cabal install" anything and use it as-is without worrying about licensing. Only when modifying code, writing code that pulls in multiple dependencies, or uploading new code to hackage should licensing issues really need to be considered. For specific rules I suppose that would be something like requiring that everything can be: - Redistributed unmodified in source form - Fetched and used locally with no restrictions - Built without modification and distributed in binary form with no restrictions beyond attribution and a link to Hackage - Used and redistributed under the same license as any code it contains FFI bindings to. With all of the above taking into account the licenses of recursive dependencies as well. In particular, I'd personally be willing to accept code on Hackage that restricts redistribution with modifications, but probably not any other kind of significantly "non-free" license. I'd also be okay with Hackage rejecting packages that can't be used/redistributed due to conflicting licenses among its dependencies. - C. From silvio.frischi at gmail.com Tue Mar 3 16:46:46 2015 From: silvio.frischi at gmail.com (silvio) Date: Tue, 03 Mar 2015 17:46:46 +0100 Subject: [Haskell-cafe] is it possible to implement Functor for ByteString and Text In-Reply-To: References: <54F212C9.6040509@gmail.com> Message-ID: <54F5E576.8030706@gmail.com> cool trick. This is by far the best solution yet. Of course it's a bit deceptive in what you are working with. E.g. bs1 <- pack [1..10] print bs1 let bs2 = map (+1) bs1 print bs2 let bs3 = map (+1) bs2 print bs3 ... let bsn = map (+1) bsn_1 print bsn will have quadratic complexity. On the other, hand you will get fusion for free. silvio From mwm at mired.org Tue Mar 3 17:25:08 2015 From: mwm at mired.org (Mike Meyer) Date: Tue, 3 Mar 2015 11:25:08 -0600 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> <54f4d7f7.079d2a0a.736b.0ec0SMTPIN_ADDED_MISSING@mx.google.com> Message-ID: On Tue, Mar 3, 2015 at 10:31 AM, Casey McCann wrote: > Yes, although that would require some decision or consensus on what we > expect to be able to do with code on Hackage... > > My personal minimum expectation would be that anyone can always "cabal > install" anything and use it as-is without worrying about licensing. > Only when modifying code, writing code that pulls in multiple > dependencies, or uploading new code to hackage should licensing issues > really need to be considered. I'd rather that people not have to worry about license issues when uploading new code, either. They're trying to give the community code to use. If they want to attach restrictions on that use, it should be the users problem to comply with those restrictions, not the uploaders problem. At least beyond the permissions implicit in uploading the software in the first place, anyway. > For specific rules I suppose that would be something like requiring > that everything can be: So let's go over your list and see how a few licenses stack up. > - Redistributed unmodified in source form Pretty much the definition of open source. > - Fetched and used locally with no restrictions Softare licensed under the AGPL doesn't meet this requirement. > - Built without modification and distributed in binary form with no > restrictions beyond attribution and a link to Hackage Only if "without modification" means you don't use a library built from the software in an application you are planning on distributing. Because if you do so, then your binary is considered a derived work, and is no different from any other modification. If you want the ability to build a library without modification and then distribute a binary that uses it, then all the GPL licenses but the LGPL fail this requirement, and most licenses on the "not compatible with the GPL" list will fail it as well because the usual reason for incompatibility is adding restrictions to such a distribution. > - Used and redistributed under the same license as any code it > contains FFI bindings to. Well, this depends on the license that the FFI code, not the license of the code on hackage. Those are usually the same license, but it's not a requirement. This touches on a problem I have with the current license field. People may want to dual license something, or dual licensing may be required by code they have used in it. But there's no way to indicate dual licensing except to pick otherLicense and then document it a such. For instance, if you incorporate MPL and GPL code, the resulting code should be dual licensed. It'd be nice if the license field in a cabal file could be a list for these cases. > In particular, I'd personally be willing to accept code on Hackage > that restricts redistribution with modifications, but probably not any > other kind of significantly "non-free" license. I'd also be okay with > Hackage rejecting packages that can't be used/redistributed due to > conflicting licenses among its dependencies. The dependency licensing only kicks in on redistribution if you're distributing binaries. Redistributing source doesn't include any form of the dependencies, so their licenses don't matter. An inability to redistribute binaries because of depencency licenses doesn't bother me much, so long as I can still use them. If I want to redistribute such binaries, then I have a number of options. But that should be my problem, and not something that should impact people who don't want to distribute binaries by, for instance, having the software not be available on Hackage. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rajath_krishna at yahoo.co.in Tue Mar 3 17:36:29 2015 From: rajath_krishna at yahoo.co.in (S J Rajath Krishna) Date: Tue, 3 Mar 2015 17:36:29 +0000 (UTC) Subject: [Haskell-cafe] (no subject) Message-ID: <1882957410.1452873.1425404189194.JavaMail.yahoo@mail.yahoo.com> I would like to create an account with the following user name User name :? "raxerz"? (Without the quotes) Thanks,S J Rajath Krishna -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Tue Mar 3 17:38:21 2015 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Wed, 4 Mar 2015 04:38:21 +1100 Subject: [Haskell-cafe] (no subject) In-Reply-To: <1882957410.1452873.1425404189194.JavaMail.yahoo@mail.yahoo.com> References: <1882957410.1452873.1425404189194.JavaMail.yahoo@mail.yahoo.com> Message-ID: On 4 March 2015 at 04:36, S J Rajath Krishna wrote: > I would like to create an account with the following user name > > User name : "raxerz" (Without the quotes) On Hackage? The Haskell Wiki? > > > Thanks, > S J Rajath Krishna > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From fa-ml at ariis.it Tue Mar 3 17:48:18 2015 From: fa-ml at ariis.it (Francesco Ariis) Date: Tue, 3 Mar 2015 18:48:18 +0100 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: References: <20150228172446.3CB4EBC986@haskell.org> <20150228205938.GA12510@x60s.casa> <20150303152554.GA30032@x60s.casa> Message-ID: <20150303174818.GA3440@x60s.casa> On Tue, Mar 03, 2015 at 04:58:10PM +0100, Marcin Mrotek wrote: > Hackage accepts source packages only anyway. Why would anyone upload > propertiary code and risk it being stolen? Noone uploads non-free > software to Hackage, it's safe to assume noone will ever do (except > perhaps as an act of trolling, and such packages could be just flat > out removed), so why fix it when it isn't broken? As Gershom B's messages states, as now AllRightsReserved would be rejected on hackage. I agree with you nothing is broken with this behaviour and I am not trying to 'fix' it in any way! > Also, as it was already pointed out by Mike Meyer, a list of > pre-approved licenses doesn't solve the problem of compatibility and > permission to actually build and distribute binaries at all, and it > would be better solved by providing some tools to view and check > licenses of the transitive closure of dependencies of a package (which > would, incidentally, make it easy to weed out non-free packages too, > for anyone who desires so) This is not about solving the dependencies problem (kudos to the person coming up with such a package), it's about asking the developer, if s/he doesn't pick a licence known by cabal, to please choose some recognised open-source licence. It seems to me a sensible and straightforward documentation of what is already happening on hackage and I fail to see how this can look controversial. From rajath_krishna at yahoo.co.in Tue Mar 3 18:12:35 2015 From: rajath_krishna at yahoo.co.in (S J Rajath Krishna) Date: Tue, 3 Mar 2015 18:12:35 +0000 (UTC) Subject: [Haskell-cafe] Help needed Message-ID: <1114471092.1454129.1425406355861.JavaMail.yahoo@mail.yahoo.com> I am a newbie to contributing to open source.I need help or the procedure for the following. 1.Replying to a thread2.Creating an account with the forum that will help me get started off for GSOC 2015. I apologize if this is not the right forum to be posting this, please direct me to the right forum. Thanks,S J Rajath Krishna -------------- next part -------------- An HTML attachment was scrubbed... URL: From sumit.sahrawat.apm13 at iitbhu.ac.in Tue Mar 3 18:19:24 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Tue, 3 Mar 2015 23:49:24 +0530 Subject: [Haskell-cafe] Help needed In-Reply-To: <1114471092.1454129.1425406355861.JavaMail.yahoo@mail.yahoo.com> References: <1114471092.1454129.1425406355861.JavaMail.yahoo@mail.yahoo.com> Message-ID: Use the irc #gsoc channel. For connecting to irc, use webchat.freenode.net On 3 March 2015 at 23:42, S J Rajath Krishna wrote: > I am a newbie to contributing to open source. > I need help or the procedure for the following. > > 1.Replying to a thread > 2.Creating an account with the forum that will help me get started off for > GSOC 2015. > > I apologize if this is not the right forum to be posting this, please > direct me to the right forum. > > > Thanks, > S J Rajath Krishna > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at proclivis.com Wed Mar 4 04:30:22 2015 From: mike at proclivis.com (Michael Jones) Date: Tue, 3 Mar 2015 21:30:22 -0700 Subject: [Haskell-cafe] Difficulty making a TH template for a monadic expression In-Reply-To: References: <4C901F80-4D6A-409A-8967-71A583102C59@proclivis.com> Message-ID: Adam, I recoded it like this: let bitsP = varP $ mkName "bits" let bitsE = varE $ mkName "bits" let combine :: [ExpQ] -> ExpQ combine = foldr1 (\ a b -> [| $a >>= $b |]) let g :: Name -> ExpQ g name = [| \bits -> ifM BG.getBit (return $ $(conE name) : $bitsE) (return $bitsE) |] let makeBits = combine . map g parse <- [d| $(varP (mkName $ "parse" ++ nameBase name)) = do flags <- G.getByteString 1 let r = BG.runBitGet flags (do let $bitsP = [] (return [] >>= $(makeBits bitNames)) return $! $bitsE) case r of Left error -> fail error Right x -> return x |] Which generates this: let bits = []; GHC.Base.return [] GHC.Base.>>= ((\bits_2 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_7 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_3 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_6 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_4 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_5 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_5 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_4 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_6 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_3 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_7 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_2 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_8 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_1 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= (\bits_9 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_0 GHC.Types.: bits)) (GHC.Base.return bits))))))))); But it does not compile due to the nesting brackets. The fold nests the functions just like my recursive quasi quoting. So I think the real question is how to connect each function end to end, which is more like composition using the >>= operation. From some previous things I tried, I think the code in the quasi quote must be a complete expression, which makes sense to me. But that is what makes it hard to glue together. Any ideas? Mike On Mar 3, 2015, at 6:03 AM, adam vogt wrote: > Hi Mike, > > Is there some reason you decided to use TH, when it looks like you can write: > > f :: a -> Binary (Maybe a) > f con = do > v <- BG.getBit > return (do guard v; Just con) > > makeBits :: [a] -> Binary [a] > makeBits con = catMaybes <$> mapM f con > > and have the TH part be much smaller: > > toCons :: [Name] -> ExpQ > toCons = listE . map conE > > makeBits $(toCons bitNames) > > > > If you really do need to generate code, let me suggest > > combine :: [ExpQ] -> ExpQ > combine = foldr1 (\ a b -> [| $a >>= $b |]) > > together with > > g :: Name -> ExpQ > g name = [| \bits -> ifM getBit ((return $(conE name) : bits) (return bits) |] > > gets you > > makeBits = combine . map g > > > Or you could keep the recursion explicit and write the first clause of > your makeBits: > > makeBits [name] = g name -- g as above > > Regards, > Adam > > > On Tue, Mar 3, 2015 at 1:05 AM, Michael Jones wrote: >> I?m at wits end as to how to express a monadic expression in TH. I?ll give here two ways to express a non TH version, and then a TH expression that does not quite work. It generates code that compiles, but it does not evaluate properly like the non TH version. Fundamentally, the problem is use of a recursive function using quasi quoting similar to what is in the standard Show example. >> >> Perhaps someone will have an idea on how to fix it. I have made several attempts and failed. >> >> Non TH Example A: Do notation >> ????????????? >> >> let r = BG.runBitGet flags (do >> let bits = [] >> v <- BG.getBit >> bits <- return $ if v then I1_7:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_6:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_5:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_4:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_3:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_2:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_1:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_0:bits else bits >> >> return $! bits) >> >> >> Non TH Example B: Bind notation >> ?????????????? >> >> let r = BG.runBitGet flags ( >> return [] >>= >> (\bits -> ifM BG.getBit (return $ I0_7:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_6:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_5:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_4:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_3:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_2:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_1:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_0:bits) (return $ bits))) >> >> >> A TH for Example B: >> ???????? >> >> let bitsP = varP $ mkName "bits" >> let bitsE = varE $ mkName "bits" >> let makeBits [] = [| "" |] >> makeBits (name:names) = [| (\bits -> ifM BG.getBit (return $ $(conE name) : $bitsE) (return $ $bitsE)) >>= $(makeBits names) |] >> parse <- [d| $(varP (mkName $ "parse" ++ nameBase name)) = do >> flags <- G.getByteString 1 >> let r = BG.runBitGet flags (return [] >>= $(makeBits bitNames)) >> case r of >> Left error -> fail error >> Right x -> return x >> |] >> >> This generates: >> >> parseTCA9535_INPUT_PORT_0_BITS = do {flags_0 <- Data.Binary.Strict.Get.getByteString 1; >> let r_1 = Data.Binary.Strict.BitGet.runBitGet flags_0 >> (GHC.Base.return [] GHC.Base.>>= >> ((\bits_2 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_7 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_3 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_6 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_4 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_5 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_5 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_4 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_6 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_3 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_7 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_2 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_8 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_1 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_9 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_0 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ""))))))))); >> >> Problems with TH >> ???????? >> >> The problem is the () that interferes with the order of evaluation, and the termination at the end ( ?? ). I?m no so worried about the termination. I can put something harmless there. The parens are the main problem. Calling a quasi quoter recursively is the cause, as it nests the evaluation. >> >> I tried things like building the bits in a list, but that does not work because the BG.getBit has to run in the BitGit monad. I know I can write a simple evaluation that just returns a list of Bools and only TH for bit names, but in the final version the size of bit fields needs to be dynamic, so I need to dynamically generate code piece by piece. >> >> I would prefer to use quasi quoting rather than build the whole thing with data types so that it is more readable. >> >> If anyone knows of a module on hackage that does something similar, perhaps you can point me to that so I can study it. >> >> Thanks?Mike >> >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From lemming at henning-thielemann.de Wed Mar 4 08:46:24 2015 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Wed, 4 Mar 2015 09:46:24 +0100 (CET) Subject: [Haskell-cafe] [Haskell] Constraint Satisfaction Problem In-Reply-To: References: Message-ID: On Wed, 4 Mar 2015, K Sai Anirudh wrote: > Hello, > > I tried to solve simple constraint satisfaction problem. This is my code "?http://pastebin.com/VAaRYSEA?" . > This gives solution for present list of domains, but when I change the domain of 'd' in the list 'ld' then I > get error. I think the error is in line 52. I indexed the first value, but I tried filtering the results > where all the variables are assigned and I get error. I think this fits better to Haskell Cafe where I send this reply, too. From acopton at gmail.com Wed Mar 4 10:35:40 2015 From: acopton at gmail.com (Alexander Bernauer) Date: Wed, 4 Mar 2015 11:35:40 +0100 Subject: [Haskell-cafe] ANN: ZuriHac 2015: registration is open Message-ID: Hi everybody, it is my pleasure to announce that the registration for ZuriHac 2015 is open now. If you want to participate in this year's Haskell Hackathon in Zurich, please fill out this form . Make sure to wait for a confirmation email afterwards before booking. The event can only host around 90 participants. We will confirm registrations at a first come first served basis. Please spread the word. Hope to see you soon! Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From benl at ouroborus.net Wed Mar 4 12:33:52 2015 From: benl at ouroborus.net (Ben Lippmeier) Date: Wed, 4 Mar 2015 23:33:52 +1100 Subject: [Haskell-cafe] Haskell 2015: 2nd Call for Papers Message-ID: <10B57E1F-7379-448C-95EF-F23F8A1F81A2@ouroborus.net> ===================================================================== ACM SIGPLAN CALL FOR SUBMISSIONS Haskell Symposium 2015 Vancouver, Canada, 3-4 September 2015, directly after ICFP http://www.haskell.org/haskell-symposium/2015 ===================================================================== ** The Haskell Symposium has an early track this year ** ** See the Submission Timetable for details. ** The ACM SIGPLAN Haskell Symposium 2015 will be co-located with the International Conference on Functional Programming (ICFP 2015) in Vancouver, Canada. The Haskell Symposium aims to present original research on Haskell, discuss practical experience and future development of the language, and to promote other forms of denotative programming. Topics of interest include: * Language Design, with a focus on possible extensions and modifications of Haskell as well as critical discussions of the status quo; * Theory, such as formal semantics of the present language or future extensions, type systems, effects, metatheory, and foundations for program analysis and transformation; * Implementations, including program analysis and transformation, static and dynamic compilation for sequential, parallel, and distributed architectures, memory management, as well as foreign function and component interfaces; * Libraries, that demonstrate new ideas or techniques for functional programming in Haskell; * Tools, such as profilers, tracers, debuggers, preprocessors, and testing tools; * Applications, to scientific and symbolic computing, databases, multimedia, telecommunication, the web, and so forth; * Functional Pearls, being elegant and instructive programming examples; * Experience Reports, to document general practice and experience in education, industry, or other contexts. Papers in the latter three categories need not necessarily report original academic research results. For example, they may instead report reusable programming idioms, elegant ways to approach a problem, or practical experience that will be useful to other users, implementors, or researchers. The key criterion for such a paper is that it makes a contribution from which other Haskellers can benefit. It is not enough simply to describe a standard solution to a standard programming problem, or report on experience where you used Haskell in the standard way and achieved the result you were expecting. More advice is available via the Haskell wiki: (http://wiki.haskell.org/HaskellSymposium/ExperienceReports) Regular papers should explain their research contributions in both general and technical terms, identifying what has been accomplished, explaining why it is significant, and relating it to previous work, and to other languages where appropriate. In addition, we solicit proposals for: * System Demonstrations, based on running software rather than novel research results. These proposals should summarize the system capabilities that would be demonstrated. The proposals will be judged on whether the ensuing session is likely to be important and interesting to the Haskell community at large, whether on grounds academic or industrial, theoretical or practical, technical, social or artistic. Please contact the program chair with any questions about the relevance of a proposal. Travel Support: =============== Student attendees with accepted papers can apply for a SIGPLAN PAC grant to help cover travel expenses. PAC also offers other support, such as for child-care expenses during the meeting or for travel costs for companions of SIGPLAN members with physical disabilities, as well as for travel from locations outside of North America and Europe. For details on the PAC program, see its web page (http://pac.sigplan.org). Proceedings: ============ Accepted papers will be included in the ACM Digital Library. Authors must grant ACM publication rights upon acceptance (http://authors.acm.org/main.html). Authors are encouraged to publish auxiliary material with their paper (source code, test data, etc.); they retain copyright of auxiliary material. Accepted proposals for system demonstrations will be posted on the symposium website, but not formally published in the proceedings. All accepted papers and proposals will be posted on the conference website one week before the meeting. Publication date: The official publication date of accepted papers is the date the proceedings are made available in the ACM Digital Library. This date may be up to two weeks prior to the first day of the conference. The official publication date affects the deadline for any patent filings related to published work. Submission Details: =================== Submitted papers should be in portable document format (PDF), formatted using the ACM SIGPLAN style guidelines (http://www.acm.org/sigs/sigplan/authorInformation.htm). The text should be in a 9-point font in two columns. The length is restricted to 12 pages, except for "Experience Report" papers, which are restricted to 6 pages. Papers need not fill the page limit -- for example, a Functional Pearl may be much shorter than 12 pages. Each paper submission must adhere to SIGPLAN's republication policy, as explained on the web. Demo proposals are limited to 2-page abstracts, in the same ACM format as papers. "Functional Pearls", "Experience Reports", and "Demo Proposals" should be marked as such with those words in the title at time of submission. The paper submission deadline and length limitations are firm. There will be no extensions, and papers violating the length limitations will be summarily rejected. A link to the paper submission system will appear on the Haskell Symposium web site closer to the submission deadline. Submission Timetable: ===================== Early Track Regular Track System Demos ---------------- ------------------- --------------- 13th March Paper Submission 1st May Notification 19th May Abstract Submission 22nd May Paper Submission 5th June Resubmission Demo Submission 26th June Notification Notification Notification 19th July Final papers due Final papers due Deadlines stated are valid anywhere on earth. In this iteration of the Haskell Symposium we are trialling a two-track submission process, so that some papers can gain early feedback. Papers can be submitted to the early track on 13th March. On 1st May, strong papers are accepted outright, and the others will be given their reviews and invited to resubmit. On 5th June early track papers may be resubmitted, and are sent back to the same reviewers. The Haskell Symposium regular track operates as in previous years. Papers accepted via the early and regular tracks are considered of equal value and will not be distinguished in the proceedings. Although all papers may be submitted to the early track, authors of functional pearls and experience reports are particularly encouraged to use this mechanism. The success of these papers depends heavily on the way they are presented, and submitting early will give the program committee a chance to provide feedback and help draw out the key ideas. Program Committee: =================== Mathieu Boespflug - Tweag I/O Edwin Brady - University of St Andrews Atze Dijkstra - Utrecht University Tom DuBuisson - Galois Torsten Grust - University of Tuebingen Patrik Jansson - Chalmers University of Technology Patricia Johann - Appalachian State University Oleg Kiselyov - Tohoku University Edward Kmett - McGraw Hill Financial Neelakantan Krishnaswami - University of Birmingham Ben Lippmeier (chair) - Vertigo Technology Hai (Paul) Liu - Intel Labs Garrett Morris - University of Edinburgh Dominic Orchard - Imperial College London Matt Roberts - Macquarie University Tim Sheard - Portland State University Joel Svensson - Indiana University Edsko de Vries - Well Typed ===================================================================== -------------- next part -------------- An HTML attachment was scrubbed... URL: From rajath_krishna at yahoo.co.in Wed Mar 4 14:59:13 2015 From: rajath_krishna at yahoo.co.in (S J Rajath Krishna) Date: Wed, 4 Mar 2015 14:59:13 +0000 (UTC) Subject: [Haskell-cafe] (no subject) In-Reply-To: References: Message-ID: <1712499703.1946215.1425481153209.JavaMail.yahoo@mail.yahoo.com> >> I would like to create an account with the following user name >> User name :? "raxerz"? (Without the quotes) >On Hackage? The Haskell Wiki? I would like to create an account with the organization that has been accepted for GSOC 2015. Thanks On Wednesday, 4 March 2015 12:12 AM, Ivan Lazar Miljenovic wrote: On 4 March 2015 at 04:36, S J Rajath Krishna wrote: > I would like to create an account with the following user name > > User name :? "raxerz"? (Without the quotes) On Hackage? The Haskell Wiki? > > > Thanks, > S J Rajath Krishna > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From alois.cochard at gmail.com Wed Mar 4 16:10:55 2015 From: alois.cochard at gmail.com (Alois Cochard) Date: Wed, 4 Mar 2015 17:10:55 +0100 Subject: [Haskell-cafe] (no subject) In-Reply-To: <1712499703.1946215.1425481153209.JavaMail.yahoo@mail.yahoo.com> References: <1712499703.1946215.1425481153209.JavaMail.yahoo@mail.yahoo.com> Message-ID: What motivated your original email? why do you expect someone to create an account for you? on which system do you expect to get an account? or for what purpose? About GSOC 2015, it seems like the application for students won't open until a few weeks, according to this thread: http://www.reddit.com/r/haskell/comments/2xp9v2/haskellorg_has_been_accepted_into_gsoc_2015/ In case it's what you are trying to do ... Cheers On 4 March 2015 at 15:59, S J Rajath Krishna wrote: > >> I would like to create an account with the following user name > > >> User name : "raxerz" (Without the quotes) > > >On Hackage? The Haskell Wiki? > > I would like to create an account with the organization that has been > accepted for GSOC 2015. > > Thanks > > > On Wednesday, 4 March 2015 12:12 AM, Ivan Lazar Miljenovic < > ivan.miljenovic at gmail.com> wrote: > > > On 4 March 2015 at 04:36, S J Rajath Krishna > wrote: > > I would like to create an account with the following user name > > > > User name : "raxerz" (Without the quotes) > > On Hackage? The Haskell Wiki? > > > > > > > > Thanks, > > S J Rajath Krishna > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > > > > > -- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- *?\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From rajath_krishna at yahoo.co.in Wed Mar 4 17:09:44 2015 From: rajath_krishna at yahoo.co.in (S J Rajath Krishna) Date: Wed, 4 Mar 2015 17:09:44 +0000 (UTC) Subject: [Haskell-cafe] (no subject) In-Reply-To: References: Message-ID: <247743976.1950530.1425488985078.JavaMail.yahoo@mail.yahoo.com> >What motivated your original email? why do you expect someone to create an account for you? on which system do you expect to get an account? or for what purpose? I was not able to create an account and the instructions on the login page stated that I am supposed to mail the Haskell-cafe mailing list. (Please find the attached screenshot) > About GSOC 2015, it seems like the application for students won't open until a few weeks, according to this thread:?http://www.reddit.com/r/haskell/comments/2xp9v2> /haskellorg_has_been_accepted_into_gsoc_2015/ Thanks for the link Alois. On Wednesday, 4 March 2015 9:40 PM, Alois Cochard wrote: What motivated your original email? why do you expect someone to create an account for you? on which system do you expect to get an account? or for what purpose? About GSOC 2015, it seems like the application for students won't open until a few weeks, according to this thread:?http://www.reddit.com/r/haskell/comments/2xp9v2/haskellorg_has_been_accepted_into_gsoc_2015/ In case it's what you are trying to do ... Cheers On 4 March 2015 at 15:59, S J Rajath Krishna wrote: >> I would like to create an account with the following user name >> User name :? "raxerz"? (Without the quotes) >On Hackage? The Haskell Wiki? I would like to create an account with the organization that has been accepted for GSOC 2015. Thanks On Wednesday, 4 March 2015 12:12 AM, Ivan Lazar Miljenovic wrote: On 4 March 2015 at 04:36, S J Rajath Krishna wrote: > I would like to create an account with the following user name > > User name :? "raxerz"? (Without the quotes) On Hackage? The Haskell Wiki? > > > Thanks, > S J Rajath Krishna > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -- ?\oishttp://twitter.com/aloiscochardhttp://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Haskell.png Type: image/png Size: 31229 bytes Desc: not available URL: From alois.cochard at gmail.com Wed Mar 4 17:36:19 2015 From: alois.cochard at gmail.com (Alois Cochard) Date: Wed, 04 Mar 2015 17:36:19 +0000 Subject: [Haskell-cafe] (no subject) References: <247743976.1950530.1425488985078.JavaMail.yahoo@mail.yahoo.com> Message-ID: Thanks! It's now clear that you're looking to create an account for the wiki. I have cc'ed the other email address listed on that page, you should hopefully get an account soon. Cheers On Wed, 4 Mar 2015 18:12 S J Rajath Krishna wrote: > >What motivated your original email? why do you expect someone to create > an account for you? on which system do you expect to get an account? or for > what purpose? > > I was not able to create an account and the instructions on the login page > stated that I am supposed to mail the Haskell-cafe mailing list. (Please > find the attached screenshot) > > > About GSOC 2015, it seems like the application for students won't open > until a few weeks, according to this thread: > http://www.reddit.com/r/haskell/comments/2xp9v2 > > > /haskellorg_has_been_accepted_into_gsoc_2015/ > > > Thanks for the link Alois. > > > On Wednesday, 4 March 2015 9:40 PM, Alois Cochard < > alois.cochard at gmail.com> wrote: > > > What motivated your original email? why do you expect someone to create an > account for you? on which system do you expect to get an account? or for > what purpose? > > About GSOC 2015, it seems like the application for students won't open > until a few weeks, according to this thread: > http://www.reddit.com/r/haskell/comments/2xp9v2/haskellorg_has_been_accepted_into_gsoc_2015/ > > In case it's what you are trying to do ... > > Cheers > > On 4 March 2015 at 15:59, S J Rajath Krishna > wrote: > > >> I would like to create an account with the following user name > > >> User name : "raxerz" (Without the quotes) > > >On Hackage? The Haskell Wiki? > > I would like to create an account with the organization that has been > accepted for GSOC 2015. > > Thanks > > > On Wednesday, 4 March 2015 12:12 AM, Ivan Lazar Miljenovic < > ivan.miljenovic at gmail.com> wrote: > > > On 4 March 2015 at 04:36, S J Rajath Krishna > wrote: > > I would like to create an account with the following user name > > > > User name : "raxerz" (Without the quotes) > > On Hackage? The Haskell Wiki? > > > > > > > > Thanks, > > S J Rajath Krishna > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > > > > > -- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > > > -- > *?\ois* > http://twitter.com/aloiscochard > http://github.com/aloiscochard > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Wed Mar 4 19:44:55 2015 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Thu, 5 Mar 2015 02:44:55 +0700 Subject: [Haskell-cafe] Haskell Weekly News Message-ID: *Top picks:* Jasper Van der Jeugt shows how you can write an intuitive, obviously correct LRU cache perfectly polymorphic in both the key and value types of the cache lookup function. (Reddit discussion.) Core is broken! Well, no, ticket 9858 reported previously is still open, and it's about translating an exotic species of Haskell into Core. But Javran Cheng found out that the documented specification of Core's operational semantics is incomplete. Neil Mitchell removes the error-prone wart of withSocketsDo in Windows network programming. Moving in for the kill is the triple combo of evaluate, NOINLINE, and unsafePerformIO. (Reddit discussion.) Can you write a sorting algorithm? Can you write a fancy sorting algorithm? Can you write a sorting algorithm so fancy it hides a subtle bug? Can you write a sorting algorithm so fancy that it hides a bug so subtle that it evades even QuickCheck because the smallest testcase is 2^49 big? But the good news is that QuickCheck doesn't see any regression in the bugfix. (Hacker News discussion.) The consequence of misspelling pragmas , Or: when stumped on a compile error, turn on -Werror to see if you aren't missing something obvious. *Quote of the week:*garry__cairns : The trouble with learning #haskell is the more I expose myself to it the more I dislike what I have to work with to pay the bills. *Repo of the week: *Kalium : Turn Pascal into Haskell -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From mblazevic at stilo.com Wed Mar 4 21:01:32 2015 From: mblazevic at stilo.com (=?UTF-8?B?TWFyaW8gQmxhxb5ldmnEhw==?=) Date: Wed, 04 Mar 2015 16:01:32 -0500 Subject: [Haskell-cafe] Haskell on RedHat? Message-ID: <54F772AC.2000207@stilo.com> What is the recommended route for installing a recent GHC on RedHat Enterprise Linux? All I could find on the official haskell.org Web pages is a GHC 7.8.4 repository for Fedora 21. Also, are there any potential difficulties with deploying a Haskell executable compiled on an Ubuntu system to RedHat EL, or vice versa? Thank you. From sean.seefried at gmail.com Wed Mar 4 21:34:57 2015 From: sean.seefried at gmail.com (Sean Seefried) Date: Thu, 5 Mar 2015 08:34:57 +1100 Subject: [Haskell-cafe] ghci and dynamically linking to Objective-C objects on Mac OS X In-Reply-To: References: Message-ID: Sure, but shouldn't we perhaps just fix GHCi so that it does deal with frameworks properly? On 1 March 2015 at 18:25, Brandon Allbery wrote: > On Sun, Mar 1, 2015 at 1:09 AM, Sean Seefried > wrote: > >> However, it doesn't seem like I should have to do this. Where am I going >> wrong? > > > My guess is that the linker used by ghci (which is not the system linker, > although there is ongoing work on that front) doesn't know how to deal with > frameworks properly. You might have better luck turning your .o into a > .dylib and linking *that* against the Foundation framework. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Wed Mar 4 21:39:53 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Wed, 4 Mar 2015 16:39:53 -0500 Subject: [Haskell-cafe] ghci and dynamically linking to Objective-C objects on Mac OS X In-Reply-To: References: Message-ID: On Wed, Mar 4, 2015 at 4:34 PM, Sean Seefried wrote: > Sure, but shouldn't we perhaps just fix GHCi so that it does deal with > frameworks properly? > Maintaining a completely separate linker instead of using the system's linker is a fool's errand that leads to things like this and inability to use ghci or TH on ARM, or having to have someone who does nothing but follow all the changes made to every system linker we care about and porting those changes to ghci's custom linker. The correct fix is the upcoming change to have ghci use the system linker. In the meantime, I offered a workaround. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.seefried at gmail.com Wed Mar 4 21:42:12 2015 From: sean.seefried at gmail.com (Sean Seefried) Date: Thu, 5 Mar 2015 08:42:12 +1100 Subject: [Haskell-cafe] ghci and dynamically linking to Objective-C objects on Mac OS X In-Reply-To: References: Message-ID: Seems like pretty solid reasoning. I was unaware of this upcoming change. Can you tell me more about it? Which GHC release is it slated for? 7.12? On 5 March 2015 at 08:39, Brandon Allbery wrote: > On Wed, Mar 4, 2015 at 4:34 PM, Sean Seefried > wrote: > >> Sure, but shouldn't we perhaps just fix GHCi so that it does deal with >> frameworks properly? >> > > Maintaining a completely separate linker instead of using the system's > linker is a fool's errand that leads to things like this and inability to > use ghci or TH on ARM, or having to have someone who does nothing but > follow all the changes made to every system linker we care about and > porting those changes to ghci's custom linker. The correct fix is the > upcoming change to have ghci use the system linker. In the meantime, I > offered a workaround. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Wed Mar 4 22:10:44 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Wed, 4 Mar 2015 17:10:44 -0500 Subject: [Haskell-cafe] ghci and dynamically linking to Objective-C objects on Mac OS X In-Reply-To: References: Message-ID: On Wed, Mar 4, 2015 at 4:42 PM, Sean Seefried wrote: > Seems like pretty solid reasoning. I was unaware of this upcoming change. > Can you tell me more about it? Which GHC release is it slated for? 7.12? > Well, it was originally scheduled for 7.8. :/ I don't see it in 7.10 offhand, so I presume it got bumped again. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Thu Mar 5 03:44:22 2015 From: vogt.adam at gmail.com (adam vogt) Date: Wed, 4 Mar 2015 22:44:22 -0500 Subject: [Haskell-cafe] Difficulty making a TH template for a monadic expression In-Reply-To: References: <4C901F80-4D6A-409A-8967-71A583102C59@proclivis.com> Message-ID: Hi Mike Use foldl1 then. But I think you're better off not unrolling the loop(s) that the "makeBits $(toCons bitNames)" option does, since that makes your code shorter so there are less things that go wrong. For example, A. thinking >>= is infixr in your "Non TH Example B" (the current issue) B. suspicious things like using $bitsE instead of bits. Depending on what bitsE is defined as, it doesn't have to evaluate to the closest bits-named variable: . Regards, Adam Adam, I recoded it like this: let bitsP = varP $ mkName "bits" let bitsE = varE $ mkName "bits" let combine :: [ExpQ] -> ExpQ combine = foldr1 (\ a b -> [| $a >>= $b |]) let g :: Name -> ExpQ g name = [| \bits -> ifM BG.getBit (return $ $(conE name) : $bitsE) (return $bitsE) |] let makeBits = combine . map g parse <- [d| $(varP (mkName $ "parse" ++ nameBase name)) = do flags <- G.getByteString 1 let r = BG.runBitGet flags (do let $bitsP = [] (return [] >>= $(makeBits bitNames)) return $! $bitsE) case r of Left error -> fail error Right x -> return x |] Which generates this: let bits = []; GHC.Base.return [] GHC.Base.>>= ((\bits_2 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_7 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_3 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_6 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_4 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_5 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_5 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_4 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_6 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_3 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_7 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_2 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= ((\bits_8 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_1 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= (\bits_9 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_0 GHC.Types.: bits)) (GHC.Base.return bits))))))))); But it does not compile due to the nesting brackets. The fold nests the functions just like my recursive quasi quoting. So I think the real question is how to connect each function end to end, which is more like composition using the >>= operation. >From some previous things I tried, I think the code in the quasi quote must be a complete expression, which makes sense to me. But that is what makes it hard to glue together. Any ideas? Mike On Mar 3, 2015, at 6:03 AM, adam vogt wrote: > Hi Mike, > > Is there some reason you decided to use TH, when it looks like you can write: > > f :: a -> Binary (Maybe a) > f con = do > v <- BG.getBit > return (do guard v; Just con) > > makeBits :: [a] -> Binary [a] > makeBits con = catMaybes <$> mapM f con > > and have the TH part be much smaller: > > toCons :: [Name] -> ExpQ > toCons = listE . map conE > > makeBits $(toCons bitNames) > > > > If you really do need to generate code, let me suggest > > combine :: [ExpQ] -> ExpQ > combine = foldr1 (\ a b -> [| $a >>= $b |]) > > together with > > g :: Name -> ExpQ > g name = [| \bits -> ifM getBit ((return $(conE name) : bits) (return bits) |] > > gets you > > makeBits = combine . map g > > > Or you could keep the recursion explicit and write the first clause of > your makeBits: > > makeBits [name] = g name -- g as above > > Regards, > Adam > > > On Tue, Mar 3, 2015 at 1:05 AM, Michael Jones wrote: >> I?m at wits end as to how to express a monadic expression in TH. I?ll give here two ways to express a non TH version, and then a TH expression that does not quite work. It generates code that compiles, but it does not evaluate properly like the non TH version. Fundamentally, the problem is use of a recursive function using quasi quoting similar to what is in the standard Show example. >> >> Perhaps someone will have an idea on how to fix it. I have made several attempts and failed. >> >> Non TH Example A: Do notation >> ????????????? >> >> let r = BG.runBitGet flags (do >> let bits = [] >> v <- BG.getBit >> bits <- return $ if v then I1_7:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_6:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_5:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_4:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_3:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_2:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_1:bits else bits >> v <- BG.getBit >> bits <- return $ if v then I1_0:bits else bits >> >> return $! bits) >> >> >> Non TH Example B: Bind notation >> ?????????????? >> >> let r = BG.runBitGet flags ( >> return [] >>= >> (\bits -> ifM BG.getBit (return $ I0_7:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_6:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_5:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_4:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_3:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_2:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_1:bits) (return $ bits)) >>= >> (\bits -> ifM BG.getBit (return $ I0_0:bits) (return $ bits))) >> >> >> A TH for Example B: >> ???????? >> >> let bitsP = varP $ mkName "bits" >> let bitsE = varE $ mkName "bits" >> let makeBits [] = [| "" |] >> makeBits (name:names) = [| (\bits -> ifM BG.getBit (return $ $(conE name) : $bitsE) (return $ $bitsE)) >>= $(makeBits names) |] >> parse <- [d| $(varP (mkName $ "parse" ++ nameBase name)) = do >> flags <- G.getByteString 1 >> let r = BG.runBitGet flags (return [] >>= $(makeBits bitNames)) >> case r of >> Left error -> fail error >> Right x -> return x >> |] >> >> This generates: >> >> parseTCA9535_INPUT_PORT_0_BITS = do {flags_0 <- Data.Binary.Strict.Get.getByteString 1; >> let r_1 = Data.Binary.Strict.BitGet.runBitGet flags_0 >> (GHC.Base.return [] GHC.Base.>>= >> ((\bits_2 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_7 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_3 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_6 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_4 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_5 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_5 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_4 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_6 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_3 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_7 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_2 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_8 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_1 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= >> ((\bits_9 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_0 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ""))))))))); >> >> Problems with TH >> ???????? >> >> The problem is the () that interferes with the order of evaluation, and the termination at the end ( ?? ). I?m no so worried about the termination. I can put something harmless there. The parens are the main problem. Calling a quasi quoter recursively is the cause, as it nests the evaluation. >> >> I tried things like building the bits in a list, but that does not work because the BG.getBit has to run in the BitGit monad. I know I can write a simple evaluation that just returns a list of Bools and only TH for bit names, but in the final version the size of bit fields needs to be dynamic, so I need to dynamically generate code piece by piece. >> >> I would prefer to use quasi quoting rather than build the whole thing with data types so that it is more readable. >> >> If anyone knows of a module on hackage that does something similar, perhaps you can point me to that so I can study it. >> >> Thanks?Mike >> >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From P.Achten at cs.ru.nl Thu Mar 5 08:09:09 2015 From: P.Achten at cs.ru.nl (Peter Achten) Date: Thu, 05 Mar 2015 09:09:09 +0100 Subject: [Haskell-cafe] [TFPIE 2015] 2nd call for papers Message-ID: <54F80F25.7020809@cs.ru.nl> Trends in Functional Programming in Education (TFPIE 2015) 2nd Call for papers https://wiki.science.ru.nl/tfpie/TFPIE2015 The 4th International Workshop on Trends in Functional Programming in Education, TFPIE 2015, will be held on June 2, 2015 in Sophia-Antipolis in France. It is co-located with the Symposium on Trends in Functional Programming (TFP 2015) which takes place from June 3 - 5. *** Goal *** The goal of TFPIE is to gather researchers, teachers and professionals that use, or are interested in the use of, functional programming in education. TFPIE aims to be a venue where novel ideas, classroom-tested ideas and work-in-progress on the use of functional programming in education are discussed. The one-day workshop will foster a spirit of open discussion by having a review process for publication after the workshop. The program chair of TFPIE 2015 will screen submissions to ensure that all presentations are within scope and are of interest to participants. Potential presenters are invited to submit an extended abstract (4-6 pages) or a draft paper (up to 16 pages) in EPTCS style. The authors of accepted presentations will have their preprints and their slides made available on the workshop's website/wiki. Visitors to the TFPIE 2015 website/wiki will be able to add comments. This includes presenters who may respond to comments and questions as well as provide pointers to improvements and follow-up work. After the workshop, presenters will be invited to submit (a revised version of) their article for review. The PC will select the best articles for publication in the journal Electronic Proceedings in Theoretical Computer Science (EPTCS). Articles rejected for presentation and extended abstracts will not be formally reviewed by the PC. TFPIE workshops have previously been held in St Andrews, Scotland (2012), Provo Utah, USA (2013), and Soesterberg, The Netherlands (2014). *** Program Committee *** Peter Achten, Radboud University Nijmegen, The Netherlands Edwin Brady, University of St Andrews, UK Johan Jeuring, Utrecht University and Open University, The Netherlands (Chair) Shriram Krishnamurthi, Brown University, US Rita Loogen, Philipps-Universit?t Marburg, Germany Marco Morazan, Seton Hall University, US Norman Ramsey, Tufts University, US *** Submission Guidelines *** TFPIE 2015 welcomes submissions describing techniques used in the classroom, tools used in and/or developed for the classroom and any creative use of functional programming (FP) to aid education in or outside Computer Science. Topics of interest include, but are not limited to: - FP and beginning CS students - FP and Computational Thinking - FP and Artificial Intelligence - FP in Robotics - FP and Music - Advanced FP for undergraduates - Tools supporting learning FP - FP in graduate education - Engaging students in research using FP - FP in Programming Languages - FP in the high school curriculum - FP as a stepping stone to other CS topics - FP and Philosophy *** Best Lectures *** In addition to papers, we request ?best lecture? presentations. What is your best lecture topic in an FP related course? Do you have a fun way to present FP concepts to novices or perhaps an especially interesting presentation of a difficult topic? In either case, please consider sharing it. Best lecture topics will be selected for presentation based on a short abstract describing the lecture and its interest to TFPIE attendees. *** Submission *** Papers and abstracts can be submitted via easychair at the following link: https://easychair.org/conferences/?conf=tfpie2015 It is expected at at least one author for each submitted paper will attend the workshop. *** Important Dates *** April 7, 2015: Early Registration for TFP closes April 27, 2015: Submission deadline for draft TFPIE papers and abstracts May 3 2015: Notification of acceptance for presentation ?? (Probably May 22 2015): Registration for TFPIE closes - as does late registration for TFP June 2, 2015: Presentations in Sophia-Antipolis, France July 7, 2015: Full papers for EPTCS proceedings due. September 1, 2015: Notification of acceptance for proceedings September 22, 2015: Camera ready copy due for EPTCS Submission of an abstract implies no obligation to submit a full version; abstracts with no corresponding full versions by the full paper deadline will be considered as withdrawn. From magnus at therning.org Thu Mar 5 10:42:03 2015 From: magnus at therning.org (Magnus Therning) Date: Thu, 5 Mar 2015 11:42:03 +0100 Subject: [Haskell-cafe] Design of protocol implementation? Message-ID: <20150305104203.GA365@mtcomp.evidente.local> By now I've written a couple of implementations of (reply / response) protocols in Haskell. They all basically follow the same pattern: 1. One message type with a constructor for each, e.g. data Message = PingMsg | ... 2. One reply type with a constructor for each, e.g. data Reply = PingReply | ... 3. Any message or reply containing data has a constructor taking an argument of a type for that data, e.g. data Message = ... | SendDataMsg SendDataD | ... data SendDataD = SendDataD ByteString 4. The raw data is received from somewhere and passed through a parser written using attoparsec. 5. The messages are rendered into ByteString using ByteString.Builder. So, in essence something like this: +------+ +----------+ +-------+ +------------+ +------+ | read | --> | parse | --> | stuff | --> | render | --> | send | | raw | | into | +-------+ | to | | raw | +------+ | Messages | | ByteString | +------+ +----------+ +------------+ I'm curious to hear about other ways to handle protocols. Are there any papers written on implementing protocols using FP in particular? The protocols I've faced are rather simple things, what about more complicated ones, e.g. multi-layered protocols (ala IP - TCP)? /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus In order to understand recursion you must first understand recursion. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 163 bytes Desc: not available URL: From chrisdone at gmail.com Thu Mar 5 10:58:29 2015 From: chrisdone at gmail.com (Christopher Done) Date: Thu, 5 Mar 2015 11:58:29 +0100 Subject: [Haskell-cafe] Design of protocol implementation? In-Reply-To: <20150305104203.GA365@mtcomp.evidente.local> References: <20150305104203.GA365@mtcomp.evidente.local> Message-ID: Right, what you have there is the simplest implementation and it seems pretty common to me, for RPC-style services. The only adjustments I like to make is to ensure input and return are matched up. Another way I've taken to is e.g. in Fay: data Returns a = Returns data Command = Procedure Int Char (Returns (Text,Maybe [Int])) call :: (Returns a -> Command) -> IO a call = ? produce :: Returns a -> IO a -> IO a produce _ m = m handle :: Command -> IO () handle (Procedure i c r) = produce r (procedure i c) Another way I've taken was in e.g. ghc-server was to use a GADT: data Command a where LoadTarget :: Text -> Command (Producer Msg (SuccessFlag,Integer)) Eval :: Text -> Command (Duplex Text Text EvalResult) Ping :: Integer -> Command (Returns Integer) TypeOf :: Text -> Command (Returns Text) LocationAt :: FilePath -> Text -> Int -> Int -> Int -> Int -> Command (Returns SrcSpan) TypeAt :: FilePath -> Text -> Int -> Int -> Int -> Int -> Command (Returns Text) UsesAt :: FilePath -> Text -> Int -> Int -> Int -> Int -> Command (Returns Text) KindOf :: Text -> Command (Returns Text) InfoOf :: Text -> Command (Returns [Text]) Set :: Text -> Command (Returns ()) PackageConf :: FilePath -> Command (Returns ()) SetCurrentDir :: FilePath -> Command (Returns ()) My type looks like a pipe or a conduit, but was more involved because it was a duplex: type Duplex i o r = DuplexT IO i o r type Producer o r = Duplex () o r type Returns r = Duplex () () r type Unit = Duplex () () () But in essence the commands could return a result and/or accept incoming input and produce output. E.g. evaluating a line of Haskell lets you send/receive stdin/stdout and eventually return a success/fail result. I wrote a few lines of TH to do the dispatching code. I've also seen an approach using type-level literals to put strings in the types to use dispatching, but I can't remember who wrote it. You can also use e.g. closed type families to express a finite state machine that this-must-happen-before-that-state etc. if you really want to ensure every state change is valid. It's hard to find links to any of these things I've seen, not sure what the keywords are. From amindfv at gmail.com Thu Mar 5 14:23:28 2015 From: amindfv at gmail.com (amindfv at gmail.com) Date: Thu, 5 Mar 2015 09:23:28 -0500 Subject: [Haskell-cafe] Design of protocol implementation? In-Reply-To: References: <20150305104203.GA365@mtcomp.evidente.local> Message-ID: <85714C0B-54BE-41F3-BE2B-4E37EDF4E53B@gmail.com> El Mar 5, 2015, a las 5:58, Christopher Done escribi?: > Right, what you have there is the simplest implementation and it seems > pretty common to me, for RPC-style services. > > The only adjustments I like to make is to ensure input and return are > matched up. > > Another way I've taken to is e.g. in Fay: > > data Returns a = Returns > data Command = > Procedure Int Char (Returns (Text,Maybe [Int])) > > call :: (Returns a -> Command) -> IO a > call = ? > > produce :: Returns a -> IO a -> IO a > produce _ m = m > > handle :: Command -> IO () > handle (Procedure i c r) = produce r (procedure i c) > > Another way I've taken was in e.g. ghc-server was to use a GADT: > > data Command a where > LoadTarget :: Text -> Command (Producer Msg (SuccessFlag,Integer)) > Eval :: Text -> Command (Duplex Text Text EvalResult) > Ping :: Integer -> Command (Returns Integer) > TypeOf :: Text -> Command (Returns Text) > LocationAt :: FilePath -> Text -> Int -> Int -> Int -> Int -> > Command (Returns SrcSpan) > TypeAt :: FilePath -> Text -> Int -> Int -> Int -> Int -> > Command (Returns Text) > UsesAt :: FilePath -> Text -> Int -> Int -> Int -> Int -> > Command (Returns Text) > KindOf :: Text -> Command (Returns Text) > InfoOf :: Text -> Command (Returns [Text]) > Set :: Text -> Command (Returns ()) > PackageConf :: FilePath -> Command (Returns ()) > SetCurrentDir :: FilePath -> Command (Returns ()) > > My type looks like a pipe or a conduit, but was more involved because > it was a duplex: > > type Duplex i o r = DuplexT IO i o r > type Producer o r = Duplex () o r > type Returns r = Duplex () () r > type Unit = Duplex () () () > > But in essence the commands could return a result and/or accept > incoming input and produce output. E.g. evaluating a line of Haskell > lets you send/receive stdin/stdout and eventually return a > success/fail result. > > I wrote a few lines of TH to do the dispatching code. > > I've also seen an approach using type-level literals to put strings in > the types to use dispatching, but I can't remember who wrote it. > > You can also use e.g. closed type families to express a finite state > machine that this-must-happen-before-that-state etc. if you really > want to ensure every state change is valid. > > It's hard to find links to any of these things I've seen, not sure > what the keywords are. The search term for this is "session types" -- iirc there's a nice example in spj's paper "fun with type families" Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From carter.schonwald at gmail.com Thu Mar 5 14:41:10 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Thu, 5 Mar 2015 09:41:10 -0500 Subject: [Haskell-cafe] ghci and dynamically linking to Objective-C objects on Mac OS X In-Reply-To: References: Message-ID: ghci in 7.8 uses the system linker. However, i suspect you'll find that linking to the objective c code works better when you COMPILE the haskell code first, then load in ghci the way to do this directly from GHCI is to invoke ghci with the -fobject-code flag. see https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci-obj.html that may very well resolve your problems (i'm juggling a few other things right now so I can't immediately verify my claims myself) On Wed, Mar 4, 2015 at 5:10 PM, Brandon Allbery wrote: > On Wed, Mar 4, 2015 at 4:42 PM, Sean Seefried > wrote: > >> Seems like pretty solid reasoning. I was unaware of this upcoming change. >> Can you tell me more about it? Which GHC release is it slated for? 7.12? >> > > Well, it was originally scheduled for 7.8. :/ I don't see it in 7.10 > offhand, so I presume it got bumped again. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rajath_krishna at yahoo.co.in Thu Mar 5 15:25:04 2015 From: rajath_krishna at yahoo.co.in (S J Rajath Krishna) Date: Thu, 5 Mar 2015 15:25:04 +0000 (UTC) Subject: [Haskell-cafe] (no subject) In-Reply-To: References: Message-ID: <1073450400.2413152.1425569104256.JavaMail.yahoo@mail.yahoo.com> Thanks a lot Alois. Can you help me get started off on contributing to Haskell starting with any beginner bugs that I can fix? On Wednesday, 4 March 2015 11:06 PM, Alois Cochard wrote: Thanks! It's now clear that you're looking to create an account for the wiki. I have cc'ed the other email address listed on that page, you should hopefully get an account soon. Cheers On Wed, 4 Mar 2015 18:12?S J Rajath Krishna wrote: >What motivated your original email? why do you expect someone to create an account for you? on which system do you expect to get an account? or for what purpose? I was not able to create an account and the instructions on the login page stated that I am supposed to mail the Haskell-cafe mailing list. (Please find the attached screenshot) > About GSOC 2015, it seems like the application for students won't open until a few weeks, according to this thread:?http://www.reddit.com/r/haskell/comments/2xp9v2> /haskellorg_has_been_accepted_into_gsoc_2015/ Thanks for the link Alois. On Wednesday, 4 March 2015 9:40 PM, Alois Cochard wrote: What motivated your original email? why do you expect someone to create an account for you? on which system do you expect to get an account? or for what purpose? About GSOC 2015, it seems like the application for students won't open until a few weeks, according to this thread:?http://www.reddit.com/r/haskell/comments/2xp9v2/haskellorg_has_been_accepted_into_gsoc_2015/ In case it's what you are trying to do ... Cheers On 4 March 2015 at 15:59, S J Rajath Krishna wrote: >> I would like to create an account with the following user name >> User name :? "raxerz"? (Without the quotes) >On Hackage? The Haskell Wiki? I would like to create an account with the organization that has been accepted for GSOC 2015. Thanks On Wednesday, 4 March 2015 12:12 AM, Ivan Lazar Miljenovic wrote: On 4 March 2015 at 04:36, S J Rajath Krishna wrote: > I would like to create an account with the following user name > > User name :? "raxerz"? (Without the quotes) On Hackage? The Haskell Wiki? > > > Thanks, > S J Rajath Krishna > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -- ?\oishttp://twitter.com/aloiscochardhttp://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From tikhon at jelv.is Thu Mar 5 18:17:10 2015 From: tikhon at jelv.is (Tikhon Jelvis) Date: Thu, 5 Mar 2015 10:17:10 -0800 Subject: [Haskell-cafe] Design of protocol implementation? In-Reply-To: <85714C0B-54BE-41F3-BE2B-4E37EDF4E53B@gmail.com> References: <20150305104203.GA365@mtcomp.evidente.local> <85714C0B-54BE-41F3-BE2B-4E37EDF4E53B@gmail.com> Message-ID: Yeah, session types are worth looking at for specifying the protocol in the type system. A good paper to look at for implementing session types in Haskell is "Haskell Session Types with (Almost) No Class" which gives a nice overview of the idea and presents a design that looks reasonably nice to use. On Thu, Mar 5, 2015 at 6:23 AM, wrote: > > > El Mar 5, 2015, a las 5:58, Christopher Done > escribi?: > > > Right, what you have there is the simplest implementation and it seems > > pretty common to me, for RPC-style services. > > > > The only adjustments I like to make is to ensure input and return are > > matched up. > > > > Another way I've taken to is e.g. in Fay: > > > > data Returns a = Returns > > data Command = > > Procedure Int Char (Returns (Text,Maybe [Int])) > > > > call :: (Returns a -> Command) -> IO a > > call = ? > > > > produce :: Returns a -> IO a -> IO a > > produce _ m = m > > > > handle :: Command -> IO () > > handle (Procedure i c r) = produce r (procedure i c) > > > > Another way I've taken was in e.g. ghc-server was to use a GADT: > > > > data Command a where > > LoadTarget :: Text -> Command (Producer Msg (SuccessFlag,Integer)) > > Eval :: Text -> Command (Duplex Text Text EvalResult) > > Ping :: Integer -> Command (Returns Integer) > > TypeOf :: Text -> Command (Returns Text) > > LocationAt :: FilePath -> Text -> Int -> Int -> Int -> Int -> > > Command (Returns SrcSpan) > > TypeAt :: FilePath -> Text -> Int -> Int -> Int -> Int -> > > Command (Returns Text) > > UsesAt :: FilePath -> Text -> Int -> Int -> Int -> Int -> > > Command (Returns Text) > > KindOf :: Text -> Command (Returns Text) > > InfoOf :: Text -> Command (Returns [Text]) > > Set :: Text -> Command (Returns ()) > > PackageConf :: FilePath -> Command (Returns ()) > > SetCurrentDir :: FilePath -> Command (Returns ()) > > > > My type looks like a pipe or a conduit, but was more involved because > > it was a duplex: > > > > type Duplex i o r = DuplexT IO i o r > > type Producer o r = Duplex () o r > > type Returns r = Duplex () () r > > type Unit = Duplex () () () > > > > But in essence the commands could return a result and/or accept > > incoming input and produce output. E.g. evaluating a line of Haskell > > lets you send/receive stdin/stdout and eventually return a > > success/fail result. > > > > I wrote a few lines of TH to do the dispatching code. > > > > I've also seen an approach using type-level literals to put strings in > > the types to use dispatching, but I can't remember who wrote it. > > > > You can also use e.g. closed type families to express a finite state > > machine that this-must-happen-before-that-state etc. if you really > > want to ensure every state change is valid. > > > > It's hard to find links to any of these things I've seen, not sure > > what the keywords are. > > > > The search term for this is "session types" -- iirc there's a nice example > in spj's paper "fun with type families" > > Tom > > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tim at dockerz.net Thu Mar 5 20:47:56 2015 From: tim at dockerz.net (Tim Docker) Date: Fri, 6 Mar 2015 07:47:56 +1100 Subject: [Haskell-cafe] Haskell on RedHat? In-Reply-To: <54F772AC.2000207@stilo.com> References: <54F772AC.2000207@stilo.com> Message-ID: Which version of RHEL are you wanting to use? Some years ago, I wrote this post about getting ghc up and running on RHEL5: https://twdkz.wordpress.com/2011/12/21/installing-ghc-7-0-3-and-the-haskell-platform-on-rhel-5-6/ It was tedious. I expect that the process is unchanged: you need to find the most pre-built ghc binary that will work on your machine, then bootstrap up to the ghc version that you need, compiling every second ghc major release. On Thu, Mar 5, 2015 at 8:01 AM, Mario Bla?evi? wrote: > What is the recommended route for installing a recent GHC on RedHat > Enterprise Linux? All I could find on the official haskell.org Web pages > is a GHC 7.8.4 repository for Fedora 21. > > Also, are there any potential difficulties with deploying a Haskell > executable compiled on an Ubuntu system to RedHat EL, or vice versa? > > Thank you. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mietek at bak.io Thu Mar 5 21:23:57 2015 From: mietek at bak.io (=?iso-8859-1?Q?Mi=EBtek_Bak?=) Date: Thu, 5 Mar 2015 21:23:57 +0000 Subject: [Haskell-cafe] Haskell on RedHat? In-Reply-To: <54F772AC.2000207@stilo.com> References: <54F772AC.2000207@stilo.com> Message-ID: <6A5CB712-6DED-4BD5-9893-01CD11DBB503@bak.io> On 2015-03-04, at 21:01, Mario Bla?evi? wrote: > What is the recommended route for installing a recent GHC on RedHat Enterprise Linux? I can recommend my project, Halcyon, which supports installing official bindists of many GHC versions on a number of platforms, including RHEL 6 and 7. https://halcyon.sh/ Supported GHC versions (plus the unlisted 7.10.1-rc2): https://halcyon.sh/reference/#ghc-options Supported platforms: https://github.com/mietek/halcyon/issues/38 Check out the recent thoughtbot field report on using Halcyon for development, testing, and deployment: https://robots.thoughtbot.com/building-haskell-projects-with-halcyon Let me know if you have any questions, or join us in #haskell-deployment on freenode. -- Mi?tek -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4203 bytes Desc: not available URL: From sarthakshetty1 at gmail.com Thu Mar 5 21:37:06 2015 From: sarthakshetty1 at gmail.com (Sarthak Shetty) Date: Fri, 6 Mar 2015 03:07:06 +0530 Subject: [Haskell-cafe] Beginner Message-ID: Hi everyone, this is Sarthak Shetty from India. I'm a CSE student who is somewhat comfortable with Java, C, Python and R. I would like to learn Haskell and start contributing right away. Can someone help me get started? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mblazevic at stilo.com Thu Mar 5 21:41:18 2015 From: mblazevic at stilo.com (=?UTF-8?B?TWFyaW8gQmxhxb5ldmnEhw==?=) Date: Thu, 05 Mar 2015 16:41:18 -0500 Subject: [Haskell-cafe] Haskell on RedHat? In-Reply-To: References: <54F772AC.2000207@stilo.com> Message-ID: <54F8CD7E.3040609@stilo.com> On 15-03-05 03:47 PM, Tim Docker wrote: > Which version of RHEL are you wanting to use? RHEL 6 now, RHEL7 in foreseeable future. > Some years ago, I wrote this post about getting ghc up and running on RHEL5: > > https://twdkz.wordpress.com/2011/12/21/installing-ghc-7-0-3-and-the-haskell-platform-on-rhel-5-6/ > > It was tedious. I expect that the process is unchanged: you need to find > the most pre-built ghc binary that will work on your machine, then > bootstrap up to the ghc version that you need, compiling every second > ghc major release. Not to belittle your contribution, but I'm surprised if this is the state of the art. I thought Linux was the best-supported Haskell platform, and RedHat is the dominant Haskell distribution in the industry. On what platforms do the commercial Haskell shops deploy their solutions? Don't tell me it's NixOS or Arch Linux. Anyway, it appears that for now we'll probably deploy only GHC-built executables on RedHat, and forgo installing GHC itself. Thank you for your information. > > On Thu, Mar 5, 2015 at 8:01 AM, Mario Bla?evi? > wrote: > > What is the recommended route for installing a recent GHC on RedHat > Enterprise Linux? All I could find on the official haskell.org > Web pages is a GHC 7.8.4 repository for Fedora 21. > > Also, are there any potential difficulties with deploying a Haskell > executable compiled on an Ubuntu system to RedHat EL, or vice versa? > > Thank you. > _________________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-__bin/mailman/listinfo/haskell-__cafe > > > -- Mario Blazevic mblazevic at stilo.com Stilo International This message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, copying, or distribution is strictly prohibited. If you are not the intended recipient(s) please contact the sender by reply email and destroy all copies of the original message and any attachments. From afcowie at gmail.com Thu Mar 5 21:57:32 2015 From: afcowie at gmail.com (Andrew Cowie) Date: Fri, 6 Mar 2015 08:57:32 +1100 Subject: [Haskell-cafe] Beginner In-Reply-To: References: Message-ID: Sarthak, Haskell has a rich and vast ecosystem; there's a lot to learn. Don't worry about "contributing" just yet; concentrate on the basics of functional programming and start exploring the rich libraries and library of papers studying and evolving the language. I'm sure you've already found your way to "Learn You a Haskell"; http://learnyouahaskell.com/ is a fun introduction. "Thinking Functionally in Haskell" by Bird is recently updated and seems quite promising as a text. From there, hunt down "Functional Pearls" conference papers, and enjoy. AfC On Fri, Mar 6, 2015 at 8:37 AM, Sarthak Shetty wrote: > Hi everyone, this is Sarthak Shetty from India. > I'm a CSE student who is somewhat comfortable with Java, C, Python and R. > I would like to learn Haskell and start contributing right away. > Can someone help me get started? > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- Andrew Frederick Cowie -------------- next part -------------- An HTML attachment was scrubbed... URL: From kumoyuki at gmail.com Thu Mar 5 22:23:54 2015 From: kumoyuki at gmail.com (David Rush) Date: Thu, 5 Mar 2015 22:23:54 +0000 (UTC) Subject: [Haskell-cafe] GHCi timing statistics Message-ID: Hi all - Is it my imagination, or are the statistics printed by GHCi when :set +s has been enabled entirely spurious when SMP parallelism is turned on? I'm trying to determine if I am actually getting any improvement, and - both by the wall clock and by the reported statistics I don't seem to be; however, the reported statistics don't seem to line up very well with the wall clock time. An additional oddity that I've noted is that my algorithm's reference implementation - which simply can't run in parallel due to a foolishly introduced data dependency - still seems to kick 16 CPUs well into the 90%+ utilization range when I have +RTS -N. This code has no parallelism primitives in it whatsoever. I realize that I'm not being terribly rigorous in my description here, but that is partly because I am not sure how to report on this yet. I think my next step is going to be to build a standalone executable to check using the Unix time command. For reference I am running Haskell platform from Debian Jessie on a 16- core amd64 system with 29GiB or RAM available. This would appear to be GHC 7.6.3 :( - d From eric at seidel.io Thu Mar 5 22:26:31 2015 From: eric at seidel.io (Eric Seidel) Date: Thu, 05 Mar 2015 14:26:31 -0800 Subject: [Haskell-cafe] GHCi timing statistics In-Reply-To: References: Message-ID: <1425594391.2641416.236174825.2EEBC84E@webmail.messagingengine.com> I believe `:set +s` displays cpu time, not wall-clock time. On Thu, Mar 5, 2015, at 14:23, David Rush wrote: > Hi all - > > Is it my imagination, or are the statistics printed by GHCi when :set +s > has been enabled entirely spurious when SMP parallelism is turned on? I'm > trying to determine if I am actually getting any improvement, and - both > by the wall clock and by the reported statistics I don't seem to be; > however, the reported statistics don't seem to line up very well with the > wall clock time. > > An additional oddity that I've noted is that my algorithm's reference > implementation - which simply can't run in parallel due to a foolishly > introduced data dependency - still seems to kick 16 CPUs well into the > 90%+ utilization range when I have +RTS -N. This code has no parallelism > primitives in it whatsoever. > > I realize that I'm not being terribly rigorous in my description here, > but > that is partly because I am not sure how to report on this yet. I think > my > next step is going to be to build a standalone executable to check using > the Unix time command. > > For reference I am running Haskell platform from Debian Jessie on a 16- > core amd64 system with 29GiB or RAM available. This would appear to be > GHC > 7.6.3 :( > > - d > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From ky3 at atamo.com Thu Mar 5 22:44:44 2015 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Fri, 6 Mar 2015 05:44:44 +0700 Subject: [Haskell-cafe] GHCi timing statistics In-Reply-To: References: Message-ID: > ... still seems to kick 16 CPUs well into the 90%+ utilization range .... This code has no parallelism primitives in it whatsoever. You're probably seeing the parallel garbage collector. This is known to catch the unwary by surprise (see Bryan's comment): http://www.reddit.com/r/haskell/comments/2m0pv6/force_criterion_to_benchmark_sequentially_for/ As an aside: It really would be nice to have some criterion-like ability from ghci. In fact that would be super cool because none of the other languages have that. This is well within the purview of a GSoC and whoever pulls it off bags bragging rights easily convertible into job offers. -- Kim-Ee On Fri, Mar 6, 2015 at 5:23 AM, David Rush wrote: > Hi all - > > Is it my imagination, or are the statistics printed by GHCi when :set +s > has been enabled entirely spurious when SMP parallelism is turned on? I'm > trying to determine if I am actually getting any improvement, and - both > by the wall clock and by the reported statistics I don't seem to be; > however, the reported statistics don't seem to line up very well with the > wall clock time. > > An additional oddity that I've noted is that my algorithm's reference > implementation - which simply can't run in parallel due to a foolishly > introduced data dependency - still seems to kick 16 CPUs well into the > 90%+ utilization range when I have +RTS -N. This code has no parallelism > primitives in it whatsoever. > > I realize that I'm not being terribly rigorous in my description here, but > that is partly because I am not sure how to report on this yet. I think my > next step is going to be to build a standalone executable to check using > the Unix time command. > > For reference I am running Haskell platform from Debian Jessie on a 16- > core amd64 system with 29GiB or RAM available. This would appear to be GHC > 7.6.3 :( > > - d > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From duncan.coutts at googlemail.com Thu Mar 5 23:41:37 2015 From: duncan.coutts at googlemail.com (Duncan Coutts) Date: Thu, 05 Mar 2015 23:41:37 +0000 Subject: [Haskell-cafe] Hackage and Free Software In-Reply-To: <20150228172446.8970EBCA87@haskell.org> References: <20150228172446.8970EBCA87@haskell.org> Message-ID: <1425598897.22820.414.camel@dunky.localdomain> All, Hackage has of course always been for open source Haskell software (and has always rejected "AllRightsReserved" packages). Prompted by this recent discussion, Gershom, SPJ, and the hackage admins have come up with a few changes to make our current implicit open source policy a bit more explicit: * The hackage homepage will say "Hackage is the Haskell community's central package archive of open source software." * The signup and upload pages will have a new blurb on open source licenses. See below. * We will accept a patch along the lines of https://mail.haskell.org/pipermail/cabal-devel/2015-March/010019.html to continue to reject "AllRightsReserved" on hackage (though we may move the check from cabal into hackage). * And on a somewhat related topic: we will finish the discussion on hackage trustee guidelines (mostly about editing package metadata) and post them. https://github.com/haskell/hackage-server/commit/66a7acd125d486e55bb6674358959860efc3c3a5 Here's the new blurb: Open source licenses The code and other material you upload and distribute via this site must be under an open source license. This is a service operated for the benefit of the community and that is our policy. It is also so that we can operate the service in compliance with copyright laws. The hackage operators do not want to be in the business of making judgements on what is and is not a valid open source license, but we retain the right to remove packages that are not under licenses that are open source in spirit, or that conflict with our ability to operate this service. (If you want advice, see the ones Cabal recommends.) The hackage operators do not need and are not asking for any rights beyond those granted by the open source license you choose to use. All normal open source licenses grant enough rights to be able to operate this service. In particular, we expect as a consequence of the license that: 1. we have the right to distribute what you have uploaded to other people 2. we have the right to distribute certain derivatives and format conversions, including but not limited to: * documentation derived from the package * alternative presentations and formats of code (e.g. html markup) * excerpts and presentation of package metadata * modified versions of package metadata Please make sure that you comply with the license of all code and other material that you upload. For example, check that your tarball includes the license files of any 3rd party code that you include. We hope this will be uncontroversial as it is just the status quo. Note that the hackage admins are not getting involved in a license debate, and we are not asking for any grant of rights (implicitly or explicitly) when you upload stuff. The open source license you use grants all the rights we need to be able to run the site. Duncan On Sat, 2015-02-28 at 19:27 +0200, fr33domlover wrote: > Hello haskellers! > > I would like to make a proposal regarding the license of software in Hackage. > > > > One of the major parts of the Haskell community infrastructure in the package > database server Hackage. As far as I know - please correct me if I'm wrong - > Hackage makes no restriction on the license of packages upload to it. But as a > community working in cooperation to make good software, the Haskell community > has embraced licenses like (L)GPL, MIT and BSD, which are free software > licenses. > > Actually the all-rights-reserved tag in Hackage [1] has only two packages > tagged by it - the dummy no-op project HNop, and another package whose COPYING > file contains a broken link and whose README says "BSD style license". > > > > Software freedom is an ethical basis for collaboration on making software > that's truly good and loayl to its users, and providing them control and > freedom to access and use their computing resources. > > It seems to me that the Haskell community is already enbracing this ethical > basis, but Hackage doesn't provide any guarantees and it means that you'd have > to check each package to be sure. By having that all-rights-reserved tag it > also in a way welcomes software that doesn't go by these rules - however it > seems that no packages do that even in the presence of the possibility. > > > > > I'd like to make a suggestion: have Hackage accept only packages released under > free software licenses. This is probably true for most/all packages there, but > making it official will both send a strong message to and from the community, > and provide people with the security and peace of mind, knowing their software > is free as in freedom. > > It is also possible that companies use Haskell to create proprietary software > using permissive-licensed libraries and tools from Hackage. I hope this isn't > true, but even if it is, this software isn't offered by Hackage and I hope its > existence doesn't affect the community's use of Hackage and free software. > > > > Would you consider to embrace free software officially, including in Hackage? > > > > Thanks for reading, > waiting to hear from the community and from haskell.org maintainers, > fr33domlover > > > > [1] http://hackage.haskell.org/packages/tag/all-rights-reserved > > --- > fr33domlover > GPG key ID: 63E5E57D (size: 4096) > GPG key fingerprint: 6FEE C222 7323 EF85 A49D 5487 5252 C5C8 63E5 E57D > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From blamario at ciktel.net Fri Mar 6 02:12:41 2015 From: blamario at ciktel.net (=?UTF-8?B?TWFyaW8gQmxhxb5ldmnEhw==?=) Date: Thu, 05 Mar 2015 21:12:41 -0500 Subject: [Haskell-cafe] Am I using Parsec correctly? In-Reply-To: References: Message-ID: <54F90D19.8090607@ciktel.net> On 03/03/15 05:00 AM, Cody Goodman wrote: > -- trying to parse the text below using Parsec: > > -- ACT I. > > -- SCENE I. An open place. > -- [An open place. Thunder and lightning. Enter three Witches.] > > -- FIRST WITCH. > -- When shall we three meet again > -- In thunder, lightning, or in rain? > > -- Here's the code I have > > import Text.Parsec > import Control.Applicative > import Data.Traversable (sequenceA) > > section s = sequenceA [string s, string " ", many1 letter] `endBy` > char '.' > > act = section "ACT" > scene = section "SCENE" > > main = do > parseTest act "ACT I.\n" > parseTest scene "SCENE I." > > -- this returns: > -- ?> main > -- [["ACT"," ","I"]] > -- [["SCENE"," ","I"]] > > -- Am I using Parsec correctly so far? The act, scene, and section functions are just fine. The main function is probably not, unless you really intend your act and scene to be two different inputs. The parseTest function should generally be used only once, and it should be applied to the entire parser. So what you want is more like > parser = do act > string "\n" > scene > > main = parseTest parser "ACT I.\nSCENE I." Note that the result of the act function is being discarded in this example. You'll probably want to preserve it somehow, but unless you just want to print it you'll need to decide what kind of result you want to construct. It's generally a good idea to do that before setting out to write the parser itself. From jeffbrown.the at gmail.com Fri Mar 6 02:45:36 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Thu, 5 Mar 2015 18:45:36 -0800 Subject: [Haskell-cafe] Imperative graph algorithm, (tail?) recursion, and speed Message-ID: Suppose I have a general (not a tree) directed graph, and I would like to find all the "pure descendents" of a node N -- that is, all nodes M for which (1) N is an ancestor of M, and (2) every partial or maximal sequence of predecessors starting from M either consists entirely of descendents of N, or else includes N itself. I have an imperative algorithm (below) for doing that. I want to know how hard it would be to implement in Haskell. It's complex, but basically it sets up a few lists like "members of this list have had all their descendents processed", "members of this list have been processed but their descendents have not been", "members of this list have not been processed at all", etc. Then I iterate through the graph, moving nodes from one collection to the other until the "to be processed" list is empty. I would like a function Graph -> Graph that does that and does not need to rely on a monad. The only way I can think of involves a few mutually recursive functions, each of which passes not only the original graph of interest, but all the lists described in the previous paragraph, around to the others. I don't understand Haskell's evaluation strategy well enough to anticipate the result, but my vague sense is that a lot of copies of the same data would be floating around, ruining the speed of it. Python code for the algorithm: def descendedOnlyFrom(gset): "All Gnodes n for which every ancestry of n includes a Gnode in gset (which can be a set or a list)." # For efficiency improvement ideas and verbose comments, # see treeSearch/all.py/node.descendedOnlyFrom if 1: # variables # "pure" = "descended only from the calling Glist" pe = set(gset) # determined Pure, yet to Explore children of pf = set() # determined Pure, Finished exploring children of pb = set(gset) # determined Pure, Both kinds: pe | pf ud = set() # purity UnDetermined # descended from root, but might have parents outside of pb udp = {} # "Parents of the UnDetermined" # This is a dictionary, from gnodes to sets of gnodes. # The other four variables are sets. while pe: while pe: k = 1 i = pe.pop(); pf.add(i) for c in set(i._children()): if c in pb | ud: continue # If already handled, do not repeat. if set(c._parents()) <= pb: pe.add(c); pb.add(c) else: ud.add(c); udp[c] = set(c._parents()) - pb for i in ud: ipf = udp[i] & pb # (i)'s (p)arents newly (f)ound in pb if ipf: udp[i] -= ipf if udp[i]==set(): ud.remove(i); del( udp[i] ) pe.add(i); pb.add(i) break return pb -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.franksen at online.de Fri Mar 6 04:47:09 2015 From: ben.franksen at online.de (Ben Franksen) Date: Fri, 06 Mar 2015 05:47:09 +0100 Subject: [Haskell-cafe] is it possible to implement Functor for ByteString and Text References: <54F212C9.6040509@gmail.com> <54F5E576.8030706@gmail.com> Message-ID: silvio wrote: > cool trick. This is by far the best solution yet. Of course it's a bit > deceptive in what you are working with. E.g. > > bs1 <- pack [1..10] > print bs1 > let bs2 = map (+1) bs1 > print bs2 > let bs3 = map (+1) bs2 > print bs3 > ... > let bsn = map (+1) bsn_1 > print bsn > > will have quadratic complexity. One could perhaps replace id with unsafeCoerce in wrap? Cheers Ben From d12frosted at icloud.com Fri Mar 6 07:11:18 2015 From: d12frosted at icloud.com (Boris) Date: Fri, 06 Mar 2015 09:11:18 +0200 Subject: [Haskell-cafe] Beginner In-Reply-To: References: Message-ID: Hey, If you would like to learn haskell I would suggest you to checkout this tutorial:?https://github.com/bitemyapp/learnhaskell This tutorial covers so much questions that might arise while you learning Haskell, that you really should check it.? On March 5, 2015 at 23:37:21, Sarthak Shetty (sarthakshetty1 at gmail.com) wrote: Hi everyone, this is Sarthak Shetty from India. I'm a CSE student who is somewhat comfortable with Java, C, Python and R. I would like to learn Haskell and start contributing right away. Can someone help me get? started? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicola.gigante at gmail.com Fri Mar 6 10:23:02 2015 From: nicola.gigante at gmail.com (Nicola Gigante) Date: Fri, 6 Mar 2015 11:23:02 +0100 Subject: [Haskell-cafe] Lifting Writer to ListT In-Reply-To: References: <97D743F0-2B09-483A-AC9A-E32476B8D382@gmail.com> Message-ID: <24F0E423-476B-41C2-AFCA-2DCD61CD01F3@gmail.com> > Il giorno 03/mar/2015, alle ore 17:22, Arjun Comar ha scritto: > > You might prefer using the ListT implementation from the Pipes package which has instances for MonadReader, MonadWriter, and MonadState already. Also, the provided source might give you some insight into how to write these instances for the list-t:ListT type. > That sounds interesting, but since I don?t know the Pipes ecosystem I don?t understand how to extract the values produced by a ListT action, because runListT returns m () instead of m [a] or something like that. I understand ListT is a ?Producer? but then how to I extract into a list the values produced by a pipes Producer? Thanks, Nicola -------------- next part -------------- An HTML attachment was scrubbed... URL: From edwards.benj at gmail.com Fri Mar 6 10:25:52 2015 From: edwards.benj at gmail.com (Benjamin Edwards) Date: Fri, 06 Mar 2015 10:25:52 +0000 Subject: [Haskell-cafe] Imperative graph algorithm, (tail?) recursion, and speed References: Message-ID: Have you looked at fgl? I would also read the paper that went with the library. It has some nice notions of graph decomposition, and reading the source for bfs et al should give you a good idea of how to mix in state like 'what have I visited'. Ben On Fri, 6 Mar 2015 2:46 am Jeffrey Brown wrote: > Suppose I have a general (not a tree) directed graph, and I would like to > find all the "pure descendents" of a node N -- that is, all nodes M for > which (1) N is an ancestor of M, and (2) every partial or maximal sequence > of predecessors starting from M either consists entirely of descendents of > N, or else includes N itself. > > I have an imperative algorithm (below) for doing that. I want to know how > hard it would be to implement in Haskell. It's complex, but basically it > sets up a few lists like "members of this list have had all their > descendents processed", "members of this list have been processed but their > descendents have not been", "members of this list have not been processed > at all", etc. Then I iterate through the graph, moving nodes from one > collection to the other until the "to be processed" list is empty. > > I would like a function Graph -> Graph that does that and does not need to > rely on a monad. The only way I can think of involves a few mutually > recursive functions, each of which passes not only the original graph of > interest, but all the lists described in the previous paragraph, around to > the others. I don't understand Haskell's evaluation strategy well enough to > anticipate the result, but my vague sense is that a lot of copies of the > same data would be floating around, ruining the speed of it. > > Python code for the algorithm: > def descendedOnlyFrom(gset): > "All Gnodes n for which every ancestry of n includes a Gnode in gset > (which can be a set or a list)." > # For efficiency improvement ideas and verbose comments, > # see treeSearch/all.py/node.descendedOnlyFrom > if 1: # variables > # "pure" = "descended only from the calling Glist" > pe = set(gset) # determined Pure, yet to Explore children of > pf = set() # determined Pure, Finished exploring children of > pb = set(gset) # determined Pure, Both kinds: pe | pf > ud = set() # purity UnDetermined > # descended from root, but might have parents outside of pb > udp = {} # "Parents of the UnDetermined" > # This is a dictionary, from gnodes to sets of gnodes. > # The other four variables are sets. > while pe: > while pe: > k = 1 > i = pe.pop(); pf.add(i) > for c in set(i._children()): > if c in pb | ud: continue # If already handled, do not repeat. > if set(c._parents()) <= pb: > pe.add(c); pb.add(c) > else: > ud.add(c); udp[c] = set(c._parents()) - pb > for i in ud: > ipf = udp[i] & pb # (i)'s (p)arents newly (f)ound in pb > if ipf: > udp[i] -= ipf > if udp[i]==set(): > ud.remove(i); del( udp[i] ) > pe.add(i); pb.add(i) > break > return pb > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From takenobu.hs at gmail.com Fri Mar 6 13:31:29 2015 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Fri, 6 Mar 2015 22:31:29 +0900 Subject: [Haskell-cafe] Beginner In-Reply-To: References: Message-ID: Hi Sarthak, There are many resources:-) As already Boris has been introduced: bitemyapp/learnhaskell https://github.com/bitemyapp/learnhaskell and I like following: What I Wish I Knew When Learning Haskell http://dev.stephendiehl.com/hask/ General portal for newcomers: Haskell web site https://www.haskell.org/ If you are interested in GHC(Glasgow Haskell Compiler): The GHC Commentary https://ghc.haskell.org/trac/ghc/wiki/Commentary enjoy! Takenobu 2015-03-06 6:37 GMT+09:00 Sarthak Shetty : > Hi everyone, this is Sarthak Shetty from India. > I'm a CSE student who is somewhat comfortable with Java, C, Python and R. > I would like to learn Haskell and start contributing right away. > Can someone help me get started? > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lanablack at amok.cc Fri Mar 6 16:56:52 2015 From: lanablack at amok.cc (Lana Black) Date: Fri, 6 Mar 2015 16:56:52 +0000 Subject: [Haskell-cafe] Haskell on RedHat? In-Reply-To: <54F8CD7E.3040609@stilo.com> References: <54F772AC.2000207@stilo.com> <54F8CD7E.3040609@stilo.com> Message-ID: <20150306165652.GA2538@rhea> On 16:41 Thu 05 Mar , Mario Bla?evi? wrote: > On 15-03-05 03:47 PM, Tim Docker wrote: > > Which version of RHEL are you wanting to use? > > RHEL 6 now, RHEL7 in foreseeable future. > Justhub.org has ghc 7.6 built for RHEL6. From jeffbrown.the at gmail.com Fri Mar 6 17:17:26 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Fri, 6 Mar 2015 09:17:26 -0800 Subject: [Haskell-cafe] Imperative graph algorithm, (tail?) recursion, and speed In-Reply-To: References: Message-ID: Indeed, I did look at FGL. It's beautiful. It has a bug that does not permit multiedges in directed graphs, which I need. More importantly, though, I'm just not ready for it. I have hardly written anything bigger than a screenful of text in Haskell. If I try using a lot of things I don't yet understand in addition to the base language I get discouraged. On Fri, Mar 6, 2015 at 2:25 AM, Benjamin Edwards wrote: > Have you looked at fgl? I would also read the paper that went with the > library. It has some nice notions of graph decomposition, and reading the > source for bfs et al should give you a good idea of how to mix in state > like 'what have I visited'. > > Ben > > On Fri, 6 Mar 2015 2:46 am Jeffrey Brown wrote: > >> Suppose I have a general (not a tree) directed graph, and I would like to >> find all the "pure descendents" of a node N -- that is, all nodes M for >> which (1) N is an ancestor of M, and (2) every partial or maximal sequence >> of predecessors starting from M either consists entirely of descendents of >> N, or else includes N itself. >> >> I have an imperative algorithm (below) for doing that. I want to know how >> hard it would be to implement in Haskell. It's complex, but basically it >> sets up a few lists like "members of this list have had all their >> descendents processed", "members of this list have been processed but their >> descendents have not been", "members of this list have not been processed >> at all", etc. Then I iterate through the graph, moving nodes from one >> collection to the other until the "to be processed" list is empty. >> >> I would like a function Graph -> Graph that does that and does not need >> to rely on a monad. The only way I can think of involves a few mutually >> recursive functions, each of which passes not only the original graph of >> interest, but all the lists described in the previous paragraph, around to >> the others. I don't understand Haskell's evaluation strategy well enough to >> anticipate the result, but my vague sense is that a lot of copies of the >> same data would be floating around, ruining the speed of it. >> >> Python code for the algorithm: >> def descendedOnlyFrom(gset): >> "All Gnodes n for which every ancestry of n includes a Gnode in gset >> (which can be a set or a list)." >> # For efficiency improvement ideas and verbose comments, >> # see treeSearch/all.py/node.descendedOnlyFrom >> if 1: # variables >> # "pure" = "descended only from the calling Glist" >> pe = set(gset) # determined Pure, yet to Explore children of >> pf = set() # determined Pure, Finished exploring children of >> pb = set(gset) # determined Pure, Both kinds: pe | pf >> ud = set() # purity UnDetermined >> # descended from root, but might have parents outside of pb >> udp = {} # "Parents of the UnDetermined" >> # This is a dictionary, from gnodes to sets of gnodes. >> # The other four variables are sets. >> while pe: >> while pe: >> k = 1 >> i = pe.pop(); pf.add(i) >> for c in set(i._children()): >> if c in pb | ud: continue # If already handled, do not repeat. >> if set(c._parents()) <= pb: >> pe.add(c); pb.add(c) >> else: >> ud.add(c); udp[c] = set(c._parents()) - pb >> for i in ud: >> ipf = udp[i] & pb # (i)'s (p)arents newly (f)ound in pb >> if ipf: >> udp[i] -= ipf >> if udp[i]==set(): >> ud.remove(i); del( udp[i] ) >> pe.add(i); pb.add(i) >> break >> return pb >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at redivi.com Fri Mar 6 17:29:45 2015 From: bob at redivi.com (Bob Ippolito) Date: Fri, 6 Mar 2015 09:29:45 -0800 Subject: [Haskell-cafe] Imperative graph algorithm, (tail?) recursion, and speed In-Reply-To: References: Message-ID: For the most part you shouldn't worry much about having "copies of the same data". Since nearly everything in Haskell is immutable, copying is a pretty rare operation. Even something like updating a Set, it seems like now you have two distinct Sets but in fact they will share a lot of the same internal structure. Here are my go-to intro references for Haskell's evaluation strategy: * http://chimera.labs.oreilly.com/books/1230000000929/ch02.html#sec_par-eval-whnf * https://hackhands.com/lazy-evaluation-works-haskell/ If it did turn out to be one of those situations where the cost of doing those allocations is just too high, Haskell has mutable data structures available, and you can hide their usage with ST. I wouldn't start there though. On Thu, Mar 5, 2015 at 6:45 PM, Jeffrey Brown wrote: > Suppose I have a general (not a tree) directed graph, and I would like to > find all the "pure descendents" of a node N -- that is, all nodes M for > which (1) N is an ancestor of M, and (2) every partial or maximal sequence > of predecessors starting from M either consists entirely of descendents of > N, or else includes N itself. > > I have an imperative algorithm (below) for doing that. I want to know how > hard it would be to implement in Haskell. It's complex, but basically it > sets up a few lists like "members of this list have had all their > descendents processed", "members of this list have been processed but their > descendents have not been", "members of this list have not been processed > at all", etc. Then I iterate through the graph, moving nodes from one > collection to the other until the "to be processed" list is empty. > > I would like a function Graph -> Graph that does that and does not need to > rely on a monad. The only way I can think of involves a few mutually > recursive functions, each of which passes not only the original graph of > interest, but all the lists described in the previous paragraph, around to > the others. I don't understand Haskell's evaluation strategy well enough to > anticipate the result, but my vague sense is that a lot of copies of the > same data would be floating around, ruining the speed of it. > > Python code for the algorithm: > def descendedOnlyFrom(gset): > "All Gnodes n for which every ancestry of n includes a Gnode in gset > (which can be a set or a list)." > # For efficiency improvement ideas and verbose comments, > # see treeSearch/all.py/node.descendedOnlyFrom > if 1: # variables > # "pure" = "descended only from the calling Glist" > pe = set(gset) # determined Pure, yet to Explore children of > pf = set() # determined Pure, Finished exploring children of > pb = set(gset) # determined Pure, Both kinds: pe | pf > ud = set() # purity UnDetermined > # descended from root, but might have parents outside of pb > udp = {} # "Parents of the UnDetermined" > # This is a dictionary, from gnodes to sets of gnodes. > # The other four variables are sets. > while pe: > while pe: > k = 1 > i = pe.pop(); pf.add(i) > for c in set(i._children()): > if c in pb | ud: continue # If already handled, do not repeat. > if set(c._parents()) <= pb: > pe.add(c); pb.add(c) > else: > ud.add(c); udp[c] = set(c._parents()) - pb > for i in ud: > ipf = udp[i] & pb # (i)'s (p)arents newly (f)ound in pb > if ipf: > udp[i] -= ipf > if udp[i]==set(): > ud.remove(i); del( udp[i] ) > pe.add(i); pb.add(i) > break > return pb > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwm at mired.org Fri Mar 6 21:41:36 2015 From: mwm at mired.org (Mike Meyer) Date: Fri, 6 Mar 2015 15:41:36 -0600 Subject: [Haskell-cafe] SPDX and hackage Message-ID: I stumbled across the SPDX (https://spdx.org/). Possibly the hackage license list should be expanded to incorporate this in some way? Or at least the OSI-approved entries? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Fri Mar 6 23:04:04 2015 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Sat, 7 Mar 2015 10:04:04 +1100 Subject: [Haskell-cafe] Imperative graph algorithm, (tail?) recursion, and speed In-Reply-To: References: Message-ID: On 7 March 2015 at 04:17, Jeffrey Brown wrote: > Indeed, I did look at FGL. It's beautiful. It has a bug that does not permit > multiedges in directed graphs, which I need. What do you mean by "multiedges"? Multiple edges between two nodes? If that's the case, PatriciaTree used to have this problem, but I fixed that way back in 2010 when I first took over maintainership of fgl. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From fa-ml at ariis.it Fri Mar 6 23:11:09 2015 From: fa-ml at ariis.it (Francesco Ariis) Date: Sat, 7 Mar 2015 00:11:09 +0100 Subject: [Haskell-cafe] SPDX and hackage In-Reply-To: References: Message-ID: <20150306231109.GA17530@x60s.casa> On Fri, Mar 06, 2015 at 03:41:36PM -0600, Mike Meyer wrote: > I stumbled across the SPDX (https://spdx.org/). Possibly the hackage > license list should be expanded to incorporate this in some way? Or at > least the OSI-approved entries? Hackage admin decided to go for the 'soft' (as no-list) approach [1]. Relevant quote: " The hackage operators do not want to be in the business of making judgements on what is and is not a valid open source license, but we retain the right to remove packages that are not under licenses that are open source in spirit, or that conflict with our ability to operate this service. (If you want advice, see the ones Cabal recommends.) But I am willing to write the necessary bits to add relevant and used free/open-source licences which are now missing from cabal. Today I was talking with dcoutts on freenode/#hackage and he made me realise that, apart from licence coverage, there is a problem with dual licences. This has to be addressed, otherwise we will never manage to 'tame' the Licence datatype (which would be quite important to, e.g. to autocheck whether licence dependencies are satisfied). [1] https://mail.haskell.org/pipermail/haskell-cafe/2015-March/118526.html From jeffbrown.the at gmail.com Sat Mar 7 00:18:16 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Fri, 6 Mar 2015 16:18:16 -0800 Subject: [Haskell-cafe] Imperative graph algorithm, (tail?) recursion, and speed In-Reply-To: References: Message-ID: Cool! I was referring to the bug declared at the top of this page [1]. Is that warning obsolete? [1] https://web.engr.oregonstate.edu/~erwig/fgl/haskell/ On Fri, Mar 6, 2015 at 3:04 PM, Ivan Lazar Miljenovic < ivan.miljenovic at gmail.com> wrote: > On 7 March 2015 at 04:17, Jeffrey Brown wrote: > > Indeed, I did look at FGL. It's beautiful. It has a bug that does not > permit > > multiedges in directed graphs, which I need. > > What do you mean by "multiedges"? Multiple edges between two nodes? > If that's the case, PatriciaTree used to have this problem, but I > fixed that way back in 2010 when I first took over maintainership of > fgl. > > -- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Sat Mar 7 00:32:20 2015 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Sat, 7 Mar 2015 11:32:20 +1100 Subject: [Haskell-cafe] Imperative graph algorithm, (tail?) recursion, and speed In-Reply-To: References: Message-ID: On 7 March 2015 at 11:18, Jeffrey Brown wrote: > Cool! I was referring to the bug declared at the top of this page [1]. Is > that warning obsolete? > > [1] https://web.engr.oregonstate.edu/~erwig/fgl/haskell/ Apart from the theory that whole website is pretty much obsolete. > > > > On Fri, Mar 6, 2015 at 3:04 PM, Ivan Lazar Miljenovic > wrote: >> >> On 7 March 2015 at 04:17, Jeffrey Brown wrote: >> > Indeed, I did look at FGL. It's beautiful. It has a bug that does not >> > permit >> > multiedges in directed graphs, which I need. >> >> What do you mean by "multiedges"? Multiple edges between two nodes? >> If that's the case, PatriciaTree used to have this problem, but I >> fixed that way back in 2010 when I first took over maintainership of >> fgl. >> >> -- >> Ivan Lazar Miljenovic >> Ivan.Miljenovic at gmail.com >> http://IvanMiljenovic.wordpress.com > > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From aditya.siram at gmail.com Sat Mar 7 15:29:30 2015 From: aditya.siram at gmail.com (aditya siram) Date: Sat, 7 Mar 2015 09:29:30 -0600 Subject: [Haskell-cafe] C2HS parse error on Windows ... In-Reply-To: References: Message-ID: Hi all, I could still use some help here. Thanks! -deech On Mon, Mar 2, 2015 at 6:13 PM, aditya siram wrote: > Hi all, > c2hs runs into the following error on all of my .chs files, but only on > Windows: > c:\\program files\\haskell > platform\\2014.2.0.0\\mingw\\bin\\../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/include/stddef.h:20: > (column 11) > [ERROR] >>> Syntax error ! > The symbol `__attribute__' does not fit here. > > My c2hs version is: > C->Haskell Compiler, version 0.23.1 Snowbounder, 31 Oct 2014 > build platform is "x86_64-mingw32" <1, True, True, 1> > > This is the command being run: > "c:\Users\deech\AppData\Roaming\cabal\bin\c2hs.exe" > "--cpp=c:\Program Files\Haskell Platform\2014.2.0.0\mingw\bin\gcc.exe" > "--cppopts=-E" "--cppopts=-D__GLASGOW_HASKELL__=708" > "--cppopts=-Dmingw32_BUILD_OS=1" > "--cppopts=-Dx86_64_BUILD_ARCH=1" > "--cppopts=-Dmingw32_HOST_OS=1" > "--cppopts=-Dx86_64_HOST_ARCH=1" > "--cppopts=-I./c-src" > "--cppopts=-I./" > "--cppopts=-IC:/MinGW/include" > "--cppopts=-IC:\Users\deech\Downloads\fltkhs-0.1.0.1/c-src" > "--cppopts=-IC:\Users\deech\Downloads\fltkhs-0.1.0.1" > "--include=dist\build" > "--cppopts=-IC:\Program Files\Haskell > Platform\2014.2.0.0\lib\process-1.2.0.0\include" > "--cppopts=-IC:\Program Files\Haskell > Platform\2014.2.0.0\lib\directory-1.2.1.0\include" > "--cppopts=-IC:\Program Files\Haskell > Platform\2014.2.0.0\lib\time-1.4.2\include" > "--cppopts=-IC:\ProgramFiles\Haskell > Platform\2014.2.0.0\lib\Win32-2.3.0.2\include" > "--cppopts=-IC:\Program Files\Haskell > Platform\2014.2.0.0\lib\bytestring-0.10.4.0\include" > "--cppopts=-IC:\Program Files\Haskell > Platform\2014.2.0.0\lib\base-4.7.0.1\include" > "--cppopts=-IC:\Program Files\Haskell > Platform\2014.2.0.0\lib\integer-gmp-0.5.1.0\include" > "--cppopts=-IC:\Program Files\Haskell Platform\2014.2.0.0\lib/include" > "--output-dir=dist\build" > "--output=Graphics\UI\FLTK\LowLevel\HorValueSlider.hs" > "src\Graphics\UI\FLTK\LowLevel\HorValueSlider.chs" > > A little Googling turned up this thread: > http://haskell.1045720.n5.nabble.com/BUG-string-h-FC4-x86-64-td3196369.html > which suggested I pass -D__attribute__(A)= to c2hs's opts. I tried it and > it led to other errors. I didn't pursue any further because it's an old > thread. I'm not sure what stddef.h is and I'm unfamiliar with Windows. > > Any help is appreciated. > Thanks! > -deech > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alois.cochard at gmail.com Sat Mar 7 15:33:03 2015 From: alois.cochard at gmail.com (Alois Cochard) Date: Sat, 7 Mar 2015 16:33:03 +0100 Subject: [Haskell-cafe] C2HS parse error on Windows ... In-Reply-To: References: Message-ID: Hi deech, If I were you I would try to report the issue directly on c2hs issue tracker: https://github.com/haskell/c2hs/issues The developer is very reactive there! Cheers On 7 March 2015 at 16:29, aditya siram wrote: > Hi all, > I could still use some help here. > Thanks! > -deech > > On Mon, Mar 2, 2015 at 6:13 PM, aditya siram > wrote: > >> Hi all, >> c2hs runs into the following error on all of my .chs files, but only on >> Windows: >> c:\\program files\\haskell >> platform\\2014.2.0.0\\mingw\\bin\\../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/include/stddef.h:20: >> (column 11) >> [ERROR] >>> Syntax error ! >> The symbol `__attribute__' does not fit here. >> >> My c2hs version is: >> C->Haskell Compiler, version 0.23.1 Snowbounder, 31 Oct 2014 >> build platform is "x86_64-mingw32" <1, True, True, 1> >> >> This is the command being run: >> "c:\Users\deech\AppData\Roaming\cabal\bin\c2hs.exe" >> "--cpp=c:\Program Files\Haskell Platform\2014.2.0.0\mingw\bin\gcc.exe" >> "--cppopts=-E" "--cppopts=-D__GLASGOW_HASKELL__=708" >> "--cppopts=-Dmingw32_BUILD_OS=1" >> "--cppopts=-Dx86_64_BUILD_ARCH=1" >> "--cppopts=-Dmingw32_HOST_OS=1" >> "--cppopts=-Dx86_64_HOST_ARCH=1" >> "--cppopts=-I./c-src" >> "--cppopts=-I./" >> "--cppopts=-IC:/MinGW/include" >> "--cppopts=-IC:\Users\deech\Downloads\fltkhs-0.1.0.1/c-src" >> "--cppopts=-IC:\Users\deech\Downloads\fltkhs-0.1.0.1" >> "--include=dist\build" >> "--cppopts=-IC:\Program Files\Haskell >> Platform\2014.2.0.0\lib\process-1.2.0.0\include" >> "--cppopts=-IC:\Program Files\Haskell >> Platform\2014.2.0.0\lib\directory-1.2.1.0\include" >> "--cppopts=-IC:\Program Files\Haskell >> Platform\2014.2.0.0\lib\time-1.4.2\include" >> "--cppopts=-IC:\ProgramFiles\Haskell >> Platform\2014.2.0.0\lib\Win32-2.3.0.2\include" >> "--cppopts=-IC:\Program Files\Haskell >> Platform\2014.2.0.0\lib\bytestring-0.10.4.0\include" >> "--cppopts=-IC:\Program Files\Haskell >> Platform\2014.2.0.0\lib\base-4.7.0.1\include" >> "--cppopts=-IC:\Program Files\Haskell >> Platform\2014.2.0.0\lib\integer-gmp-0.5.1.0\include" >> "--cppopts=-IC:\Program Files\Haskell Platform\2014.2.0.0\lib/include" >> "--output-dir=dist\build" >> "--output=Graphics\UI\FLTK\LowLevel\HorValueSlider.hs" >> "src\Graphics\UI\FLTK\LowLevel\HorValueSlider.chs" >> >> A little Googling turned up this thread: >> http://haskell.1045720.n5.nabble.com/BUG-string-h-FC4-x86-64-td3196369.html >> which suggested I pass -D__attribute__(A)= to c2hs's opts. I tried it and >> it led to other errors. I didn't pursue any further because it's an old >> thread. I'm not sure what stddef.h is and I'm unfamiliar with Windows. >> >> Any help is appreciated. >> Thanks! >> -deech >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- *?\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From aditya.siram at gmail.com Sat Mar 7 15:33:47 2015 From: aditya.siram at gmail.com (aditya siram) Date: Sat, 7 Mar 2015 09:33:47 -0600 Subject: [Haskell-cafe] C2HS parse error on Windows ... In-Reply-To: References: Message-ID: Done. Thanks! On Sat, Mar 7, 2015 at 9:33 AM, Alois Cochard wrote: > Hi deech, > > If I were you I would try to report the issue directly on c2hs issue > tracker: > https://github.com/haskell/c2hs/issues > > The developer is very reactive there! > > Cheers > > On 7 March 2015 at 16:29, aditya siram wrote: > >> Hi all, >> I could still use some help here. >> Thanks! >> -deech >> >> On Mon, Mar 2, 2015 at 6:13 PM, aditya siram >> wrote: >> >>> Hi all, >>> c2hs runs into the following error on all of my .chs files, but only on >>> Windows: >>> c:\\program files\\haskell >>> platform\\2014.2.0.0\\mingw\\bin\\../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/include/stddef.h:20: >>> (column 11) >>> [ERROR] >>> Syntax error ! >>> The symbol `__attribute__' does not fit here. >>> >>> My c2hs version is: >>> C->Haskell Compiler, version 0.23.1 Snowbounder, 31 Oct 2014 >>> build platform is "x86_64-mingw32" <1, True, True, 1> >>> >>> This is the command being run: >>> "c:\Users\deech\AppData\Roaming\cabal\bin\c2hs.exe" >>> "--cpp=c:\Program Files\Haskell >>> Platform\2014.2.0.0\mingw\bin\gcc.exe" >>> "--cppopts=-E" "--cppopts=-D__GLASGOW_HASKELL__=708" >>> "--cppopts=-Dmingw32_BUILD_OS=1" >>> "--cppopts=-Dx86_64_BUILD_ARCH=1" >>> "--cppopts=-Dmingw32_HOST_OS=1" >>> "--cppopts=-Dx86_64_HOST_ARCH=1" >>> "--cppopts=-I./c-src" >>> "--cppopts=-I./" >>> "--cppopts=-IC:/MinGW/include" >>> "--cppopts=-IC:\Users\deech\Downloads\fltkhs-0.1.0.1/c-src" >>> "--cppopts=-IC:\Users\deech\Downloads\fltkhs-0.1.0.1" >>> "--include=dist\build" >>> "--cppopts=-IC:\Program Files\Haskell >>> Platform\2014.2.0.0\lib\process-1.2.0.0\include" >>> "--cppopts=-IC:\Program Files\Haskell >>> Platform\2014.2.0.0\lib\directory-1.2.1.0\include" >>> "--cppopts=-IC:\Program Files\Haskell >>> Platform\2014.2.0.0\lib\time-1.4.2\include" >>> "--cppopts=-IC:\ProgramFiles\Haskell >>> Platform\2014.2.0.0\lib\Win32-2.3.0.2\include" >>> "--cppopts=-IC:\Program Files\Haskell >>> Platform\2014.2.0.0\lib\bytestring-0.10.4.0\include" >>> "--cppopts=-IC:\Program Files\Haskell >>> Platform\2014.2.0.0\lib\base-4.7.0.1\include" >>> "--cppopts=-IC:\Program Files\Haskell >>> Platform\2014.2.0.0\lib\integer-gmp-0.5.1.0\include" >>> "--cppopts=-IC:\Program Files\Haskell >>> Platform\2014.2.0.0\lib/include" >>> "--output-dir=dist\build" >>> "--output=Graphics\UI\FLTK\LowLevel\HorValueSlider.hs" >>> "src\Graphics\UI\FLTK\LowLevel\HorValueSlider.chs" >>> >>> A little Googling turned up this thread: >>> http://haskell.1045720.n5.nabble.com/BUG-string-h-FC4-x86-64-td3196369.html >>> which suggested I pass -D__attribute__(A)= to c2hs's opts. I tried it and >>> it led to other errors. I didn't pursue any further because it's an old >>> thread. I'm not sure what stddef.h is and I'm unfamiliar with Windows. >>> >>> Any help is appreciated. >>> Thanks! >>> -deech >>> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > > > -- > *?\ois* > http://twitter.com/aloiscochard > http://github.com/aloiscochard > -------------- next part -------------- An HTML attachment was scrubbed... URL: From K.Bleijenberg at lijbrandt.nl Sat Mar 7 15:56:27 2015 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Sat, 7 Mar 2015 16:56:27 +0100 Subject: [Haskell-cafe] ghc -O2 out of memory Message-ID: <000001d058ef$45451e10$cfcf5a30$@lijbrandt.nl> I've written a program that reads a Excel file, parses the contents and generates a haskell module. Every cell in the xls has it's own function in the module. This worked fine. Now I have a bigger xls. The resulting module Xls.hs contains 30000 lines haskell code (without comment). I created a testprogram test.hs that calculates and prints one cell. I did ghc --make test.hs and everything works fine. The generated execuatable is very slow. I did ghc --make -O2 test.hs. The compilations takes 15 minutes and aborts with 'ghc: out of memory'. I'am working on Win 7 64 bits , ghc version = 7.8.3. What can I do to fix this? I do need -O2. I found with smaller xls's that optimization speeds up the executable dramatically. Before I start experimenting, does it help to split up the xls .hs in seperate files? I.e. the cells that refer to other cells and cells that don't refer to other cells. Or will I still get 'out of memory' because the optimization is global? Kees -------------- next part -------------- An HTML attachment was scrubbed... URL: From amindfv at gmail.com Sat Mar 7 17:17:08 2015 From: amindfv at gmail.com (amindfv at gmail.com) Date: Sat, 7 Mar 2015 12:17:08 -0500 Subject: [Haskell-cafe] ghc -O2 out of memory In-Reply-To: <000001d058ef$45451e10$cfcf5a30$@lijbrandt.nl> References: <000001d058ef$45451e10$cfcf5a30$@lijbrandt.nl> Message-ID: <0713659C-442F-484C-89D4-4C923D839253@gmail.com> You definitely don't want 30,000 lines in a single module. You should split this into separate modules, but be aware that the way you split them can affect how your program is e.g. inlined -- there can be performance implications. Tom El Mar 7, 2015, a las 10:56, "Kees Bleijenberg" escribi?: > I?ve written a program that reads a Excel file, parses the contents and generates a haskell module. Every cell in the xls has it?s own function in the module. This worked fine. > Now I have a bigger xls. The resulting module Xls.hs contains 30000 lines haskell code (without comment). I created a testprogram test.hs that calculates and prints one cell. > I did ghc --make test.hs and everything works fine. The generated execuatable is very slow. > I did ghc --make ?O2 test.hs. The compilations takes 15 minutes and aborts with ?ghc: out of memory?. I?am working on Win 7 64 bits , ghc version = 7.8.3. > > What can I do to fix this? I do need ?O2. I found with smaller xls?s that optimization speeds up the executable dramatically. > Before I start experimenting, does it help to split up the xls .hs in seperate files? I.e. the cells that refer to other cells and cells that don?t refer to other cells. Or will I still get ?out of memory? because the optimization is global? > > Kees > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at proclivis.com Sat Mar 7 17:33:29 2015 From: mike at proclivis.com (Michael Jones) Date: Sat, 7 Mar 2015 10:33:29 -0700 Subject: [Haskell-cafe] ghc -O2 out of memory In-Reply-To: <0713659C-442F-484C-89D4-4C923D839253@gmail.com> References: <000001d058ef$45451e10$cfcf5a30$@lijbrandt.nl> <0713659C-442F-484C-89D4-4C923D839253@gmail.com> Message-ID: I have some code generation from xml producing files this big. Not going well :-( I?m make TH functions and will generate much smaller files. Hopefully the compiler expansion the templates is better than a big file full of source code. On Mar 7, 2015, at 10:17 AM, amindfv at gmail.com wrote: > You definitely don't want 30,000 lines in a single module. You should split this into separate modules, but be aware that the way you split them can affect how your program is e.g. inlined -- there can be performance implications. > > Tom > > > El Mar 7, 2015, a las 10:56, "Kees Bleijenberg" escribi?: > >> I?ve written a program that reads a Excel file, parses the contents and generates a haskell module. Every cell in the xls has it?s own function in the module. This worked fine. >> Now I have a bigger xls. The resulting module Xls.hs contains 30000 lines haskell code (without comment). I created a testprogram test.hs that calculates and prints one cell. >> I did ghc --make test.hs and everything works fine. The generated execuatable is very slow. >> I did ghc --make ?O2 test.hs. The compilations takes 15 minutes and aborts with ?ghc: out of memory?. I?am working on Win 7 64 bits , ghc version = 7.8.3. >> >> What can I do to fix this? I do need ?O2. I found with smaller xls?s that optimization speeds up the executable dramatically. >> Before I start experimenting, does it help to split up the xls .hs in seperate files? I.e. the cells that refer to other cells and cells that don?t refer to other cells. Or will I still get ?out of memory? because the optimization is global? >> >> Kees >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From erkokl at gmail.com Sat Mar 7 18:18:23 2015 From: erkokl at gmail.com (Levent Erkok) Date: Sat, 7 Mar 2015 10:18:23 -0800 Subject: [Haskell-cafe] [Announce] New release of SBV is out Message-ID: A new release of SBV is out (v4.1): http://hackage.haskell.org/package/sbv-4.1 The main change in this release is the connection to Berkeley's ABC system, which is an industrial strength synthesis and verification system. SBV can now generate proof goals that are discharged by ABC, using state-of-the-art SAT based techniques. ABC is especially extremely well-tuned for dealing with problems in the bit-vector theory, and is heavily used in the hardware industry as a backend verification tool. Also included in this release is better support for IEEE-floats, and a reworked implementation of the connection to the Boolector solver. Thanks to Adam Foltzer of Galois for contributing the connection to ABC, and Alan Mischenko from Berkeley to add the necessary infrastructure to ABC to allow for this bridge to be built. Full release notes: https://github.com/LeventErkok/sbv/blob/master/CHANGES.md SBV web page: http://leventerkok.github.io/sbv/ -Levent. -------------- next part -------------- An HTML attachment was scrubbed... URL: From spam at scientician.net Sat Mar 7 18:26:19 2015 From: spam at scientician.net (Bardur Arantsson) Date: Sat, 07 Mar 2015 19:26:19 +0100 Subject: [Haskell-cafe] ghc -O2 out of memory In-Reply-To: <000001d058ef$45451e10$cfcf5a30$@lijbrandt.nl> References: <000001d058ef$45451e10$cfcf5a30$@lijbrandt.nl> Message-ID: On 07-03-2015 16:56, Kees Bleijenberg wrote: > I've written a program that reads a Excel file, parses the contents and > generates a haskell module. Every cell in the xls has it's own function in > the module. This worked fine. > > Now I have a bigger xls. The resulting module Xls.hs contains 30000 lines > haskell code (without comment). I created a testprogram test.hs that > calculates and prints one cell. > > I did ghc --make test.hs and everything works fine. The generated > execuatable is very slow. > > I did ghc --make -O2 test.hs. The compilations takes 15 minutes and aborts > with 'ghc: out of memory'. I'am working on Win 7 64 bits , ghc version = > 7.8.3. > > > > What can I do to fix this? I do need -O2. I found with smaller xls's that > optimization speeds up the executable dramatically. > > Before I start experimenting, does it help to split up the xls .hs in > seperate files? I.e. the cells that refer to other cells and cells that > don't refer to other cells. Or will I still get 'out of memory' because the > optimization is global? > Just out of curiousity, are you adding explicit type annotations? I imagine that type inference (rather than just checking) would add considerable overhead in pathological cases, especially if GHC is using a SAT-solver based approach (which I believe it is, these days). Regards, From K.Bleijenberg at lijbrandt.nl Sat Mar 7 18:58:25 2015 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Sat, 7 Mar 2015 19:58:25 +0100 Subject: [Haskell-cafe] ghc -O2 out of memory In-Reply-To: References: <000001d058ef$45451e10$cfcf5a30$@lijbrandt.nl> Message-ID: <000001d05908$b123aca0$136b05e0$@lijbrandt.nl> Bardur, -----Oorspronkelijk bericht----- Van: Haskell-Cafe [mailto:haskell-cafe-bounces at haskell.org] Namens Bardur Arantsson Verzonden: zaterdag 7 maart 2015 19:26 Aan: haskell-cafe at haskell.org Onderwerp: Re: [Haskell-cafe] ghc -O2 out of memory On 07-03-2015 16:56, Kees Bleijenberg wrote: > I've written a program that reads a Excel file, parses the contents > and generates a haskell module. Every cell in the xls has it's own > function in the module. This worked fine. Just out of curiousity, are you adding explicit type annotations? I imagine that type inference (rather than just checking) would add considerable overhead in pathological cases, especially if GHC is using a SAT-solver based approach (which I believe it is, these days). ---------------- Yes. Every cell is a top level function with a type annotation. All cells have the same type. I was afraid that splitting the module doesn't help. Kees _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From michael at orlitzky.com Sun Mar 8 02:37:11 2015 From: michael at orlitzky.com (Michael Orlitzky) Date: Sat, 07 Mar 2015 21:37:11 -0500 Subject: [Haskell-cafe] ghc -O2 out of memory In-Reply-To: <000001d05908$b123aca0$136b05e0$@lijbrandt.nl> References: <000001d058ef$45451e10$cfcf5a30$@lijbrandt.nl> <000001d05908$b123aca0$136b05e0$@lijbrandt.nl> Message-ID: <54FBB5D7.2000807@orlitzky.com> On 03/07/2015 01:58 PM, Kees Bleijenberg wrote: > > Yes. Every cell is a top level function with a type annotation. All cells > have the same type. > I was afraid that splitting the module doesn't help. > > Kees You don't even have to try very hard. Try compiling a module with a hard-coded list of a million integers. Boom. From vigalchin at gmail.com Sun Mar 8 07:24:32 2015 From: vigalchin at gmail.com (Vasili I. Galchin) Date: Sat, 7 Mar 2015 23:24:32 -0800 Subject: [Haskell-cafe] raspberrypi and ghci Message-ID: Hello, I have a B++ pi. I did a "apt-get install haskell-platform. No " ghci"!. So I did a google on this issue. Circa 2013 ghci seemed to be an issue with raspberrypi/arm. What is the current status of "ghci" on the pi/arm??. Vasili -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at proclivis.com Sun Mar 8 14:15:50 2015 From: mike at proclivis.com (Michael Jones) Date: Sun, 8 Mar 2015 08:15:50 -0600 Subject: [Haskell-cafe] Difficulty making a TH template for a monadic expression In-Reply-To: References: <4C901F80-4D6A-409A-8967-71A583102C59@proclivis.com> Message-ID: <53F3F285-0B8A-4C88-86BD-71F86473FA48@proclivis.com> Adam, Attached is a working function. I have not followed up on your final suggestions, because I am still considering the best way to represent bit fields, empty bits, mixed read/write only bits, etc. I?ll optimize when I find a final structure. But at least I was able to get a prototype working that could twiddle bits on an I2C device and I know how to build expressions with >>=. Many many thanks. Mike. let bitsP = varP $ mkName "bits" let bitsE = varE $ mkName "bits" let combine :: [ExpQ] -> ExpQ combine = foldl1 (\ a b -> [| $a >>= $b |]) let g :: Name -> ExpQ g regName' = [| \bits -> ifM BG.getBit (return $ (((fromIntegral . fromEnum) $(conE regName'))::Word16) : $bitsE) (return $bitsE) |] let h = [| return [] |] let makeBits names = combine (h : map g names) parse <- [d| $(varP (mkName $ "parse" ++ nameBase regName')) = do flags <- G.getByteString 1 let r = BG.runBitGet flags (do let $bitsP = [] $(makeBits (reverse bitNames')) return $! $bitsE) case r of Left error -> fail error Right x -> return x |] On Mar 4, 2015, at 8:44 PM, adam vogt wrote: > Hi Mike > > Use foldl1 then. > > But I think you're better off not unrolling the loop(s) that the "makeBits $(toCons bitNames)" option does, since that makes your code shorter so there are less things that go wrong. For example, > > A. thinking >>= is infixr in your "Non TH Example B" (the current issue) > > B. suspicious things like using $bitsE instead of bits. Depending on what bitsE is defined as, it doesn't have to evaluate to the closest bits-named variable: . > > Regards, > > Adam > > Adam, > > I recoded it like this: > > let bitsP = varP $ mkName "bits" > let bitsE = varE $ mkName "bits" > let combine :: [ExpQ] -> ExpQ > combine = foldr1 (\ a b -> [| $a >>= $b |]) > let g :: Name -> ExpQ > g name = [| \bits -> ifM BG.getBit (return $ $(conE name) : $bitsE) (return $bitsE) |] > > let makeBits = combine . map g > parse <- [d| $(varP (mkName $ "parse" ++ nameBase name)) = do > flags <- G.getByteString 1 > let r = BG.runBitGet flags (do > let $bitsP = [] > (return [] >>= $(makeBits bitNames)) > return $! $bitsE) > case r of > Left error -> fail error > Right x -> return x > |] > > Which generates this: > > let bits = []; > GHC.Base.return [] GHC.Base.>>= > ((\bits_2 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_7 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= > ((\bits_3 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_6 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= > ((\bits_4 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_5 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= > ((\bits_5 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_4 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= > ((\bits_6 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_3 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= > ((\bits_7 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_2 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= > ((\bits_8 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_1 GHC.Types.: bits)) (GHC.Base.return bits)) GHC.Base.>>= > (\bits_9 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_0 GHC.Types.: bits)) > (GHC.Base.return bits))))))))); > > But it does not compile due to the nesting brackets. The fold nests the functions just like my recursive quasi quoting. So I think the real question is how to connect each function end to end, which is more like composition using the >>= operation. > > From some previous things I tried, I think the code in the quasi quote must be a complete expression, which makes sense to me. But that is what makes it hard to glue together. > > Any ideas? > > Mike > > > On Mar 3, 2015, at 6:03 AM, adam vogt wrote: > > > Hi Mike, > > > > Is there some reason you decided to use TH, when it looks like you can write: > > > > f :: a -> Binary (Maybe a) > > f con = do > > v <- BG.getBit > > return (do guard v; Just con) > > > > makeBits :: [a] -> Binary [a] > > makeBits con = catMaybes <$> mapM f con > > > > and have the TH part be much smaller: > > > > toCons :: [Name] -> ExpQ > > toCons = listE . map conE > > > > makeBits $(toCons bitNames) > > > > > > > > If you really do need to generate code, let me suggest > > > > combine :: [ExpQ] -> ExpQ > > combine = foldr1 (\ a b -> [| $a >>= $b |]) > > > > together with > > > > g :: Name -> ExpQ > > g name = [| \bits -> ifM getBit ((return $(conE name) : bits) (return bits) |] > > > > gets you > > > > makeBits = combine . map g > > > > > > Or you could keep the recursion explicit and write the first clause of > > your makeBits: > > > > makeBits [name] = g name -- g as above > > > > Regards, > > Adam > > > > > > On Tue, Mar 3, 2015 at 1:05 AM, Michael Jones wrote: > >> I?m at wits end as to how to express a monadic expression in TH. I?ll give here two ways to express a non TH version, and then a TH expression that does not quite work. It generates code that compiles, but it does not evaluate properly like the non TH version. Fundamentally, the problem is use of a recursive function using quasi quoting similar to what is in the standard Show example. > >> > >> Perhaps someone will have an idea on how to fix it. I have made several attempts and failed. > >> > >> Non TH Example A: Do notation > >> ????????????? > >> > >> let r = BG.runBitGet flags (do > >> let bits = [] > >> v <- BG.getBit > >> bits <- return $ if v then I1_7:bits else bits > >> v <- BG.getBit > >> bits <- return $ if v then I1_6:bits else bits > >> v <- BG.getBit > >> bits <- return $ if v then I1_5:bits else bits > >> v <- BG.getBit > >> bits <- return $ if v then I1_4:bits else bits > >> v <- BG.getBit > >> bits <- return $ if v then I1_3:bits else bits > >> v <- BG.getBit > >> bits <- return $ if v then I1_2:bits else bits > >> v <- BG.getBit > >> bits <- return $ if v then I1_1:bits else bits > >> v <- BG.getBit > >> bits <- return $ if v then I1_0:bits else bits > >> > >> return $! bits) > >> > >> > >> Non TH Example B: Bind notation > >> ?????????????? > >> > >> let r = BG.runBitGet flags ( > >> return [] >>= > >> (\bits -> ifM BG.getBit (return $ I0_7:bits) (return $ bits)) >>= > >> (\bits -> ifM BG.getBit (return $ I0_6:bits) (return $ bits)) >>= > >> (\bits -> ifM BG.getBit (return $ I0_5:bits) (return $ bits)) >>= > >> (\bits -> ifM BG.getBit (return $ I0_4:bits) (return $ bits)) >>= > >> (\bits -> ifM BG.getBit (return $ I0_3:bits) (return $ bits)) >>= > >> (\bits -> ifM BG.getBit (return $ I0_2:bits) (return $ bits)) >>= > >> (\bits -> ifM BG.getBit (return $ I0_1:bits) (return $ bits)) >>= > >> (\bits -> ifM BG.getBit (return $ I0_0:bits) (return $ bits))) > >> > >> > >> A TH for Example B: > >> ???????? > >> > >> let bitsP = varP $ mkName "bits" > >> let bitsE = varE $ mkName "bits" > >> let makeBits [] = [| "" |] > >> makeBits (name:names) = [| (\bits -> ifM BG.getBit (return $ $(conE name) : $bitsE) (return $ $bitsE)) >>= $(makeBits names) |] > >> parse <- [d| $(varP (mkName $ "parse" ++ nameBase name)) = do > >> flags <- G.getByteString 1 > >> let r = BG.runBitGet flags (return [] >>= $(makeBits bitNames)) > >> case r of > >> Left error -> fail error > >> Right x -> return x > >> |] > >> > >> This generates: > >> > >> parseTCA9535_INPUT_PORT_0_BITS = do {flags_0 <- Data.Binary.Strict.Get.getByteString 1; > >> let r_1 = Data.Binary.Strict.BitGet.runBitGet flags_0 > >> (GHC.Base.return [] GHC.Base.>>= > >> ((\bits_2 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_7 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > >> ((\bits_3 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_6 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > >> ((\bits_4 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_5 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > >> ((\bits_5 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_4 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > >> ((\bits_6 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_3 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > >> ((\bits_7 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_2 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > >> ((\bits_8 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_1 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= > >> ((\bits_9 -> Control.Conditional.ifM Data.Binary.Strict.BitGet.getBit (GHC.Base.return GHC.Base.$ (I0_0 GHC.Types.: bits)) (GHC.Base.return GHC.Base.$ bits)) GHC.Base.>>= ""))))))))); > >> > >> Problems with TH > >> ???????? > >> > >> The problem is the () that interferes with the order of evaluation, and the termination at the end ( ?? ). I?m no so worried about the termination. I can put something harmless there. The parens are the main problem. Calling a quasi quoter recursively is the cause, as it nests the evaluation. > >> > >> I tried things like building the bits in a list, but that does not work because the BG.getBit has to run in the BitGit monad. I know I can write a simple evaluation that just returns a list of Bools and only TH for bit names, but in the final version the size of bit fields needs to be dynamic, so I need to dynamically generate code piece by piece. > >> > >> I would prefer to use quasi quoting rather than build the whole thing with data types so that it is more readable. > >> > >> If anyone knows of a module on hackage that does something similar, perhaps you can point me to that so I can study it. > >> > >> Thanks?Mike > >> > >> > >> > >> > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From devnull1999 at yahoo.com Sun Mar 8 16:11:48 2015 From: devnull1999 at yahoo.com (Eric) Date: Sun, 8 Mar 2015 16:11:48 +0000 (UTC) Subject: [Haskell-cafe] Is there a name for this? Message-ID: <53086272.774795.1425831108021.JavaMail.yahoo@mail.yahoo.com> Given a class Foo: > class Foo f where> ? ? bar :: f -> Bool> ? ? baz :: f -> Char -> Int does the record type Foo' > ?data Foo' = Foo' {> ? ? ?bar' :: Bool,> ? ? ?baz' :: Char -> Int> ? ? ?}> ?> ?instance Foo Foo' where> ? ? ?bar = bar'> ? ? ?baz = baz' where the fields of the record Foo' are just implementations of the functions of Foo have any special name? In some sense it's a canonical instance of Foo; we could trivially write a universal > toFoo' :: Foo f => f -> Foo' function. I ran across this pattern and wondered whether it was useful enough to have received a name. ?It vaguely resembles a typeclass dictionary or a vtable in an OOP language. --Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From trebla at vex.net Sun Mar 8 16:35:14 2015 From: trebla at vex.net (Albert Y. C. Lai) Date: Sun, 08 Mar 2015 12:35:14 -0400 Subject: [Haskell-cafe] Is there a name for this? In-Reply-To: <53086272.774795.1425831108021.JavaMail.yahoo@mail.yahoo.com> References: <53086272.774795.1425831108021.JavaMail.yahoo@mail.yahoo.com> Message-ID: <54FC7A42.2000100@vex.net> On 2015-03-08 12:11 PM, Eric wrote: > In some sense it's a canonical instance of Foo; we could trivially > write a universal > > > toFoo' :: Foo f => f -> Foo' > > function. Choose one: Foo' is a free Foo Foo' is a limit of the diagram of Foo Foo' is a terminal object of the [sub]category of Foo From ben at smart-cactus.org Sun Mar 8 16:43:48 2015 From: ben at smart-cactus.org (Ben Gamari) Date: Sun, 08 Mar 2015 12:43:48 -0400 Subject: [Haskell-cafe] raspberrypi and ghci In-Reply-To: References: Message-ID: <8761abh22j.fsf@gmail.com> "Vasili I. Galchin" writes: > Hello, > > I have a B++ pi. I did a "apt-get install haskell-platform. No " > ghci"!. So I did a google on this issue. Circa 2013 ghci seemed to be > an issue with raspberrypi/arm. What is the current status of "ghci" on > the pi/arm??. > With dynamic linking and the LLVM backend GHC 7.8 is quite usable on ARM. Unfortunately, much of the distributions' packaging hasn't been updated to reflect this. Debian builds in experimental (starting with 7.8.20141119-8) now build GHCi on ARM; it may take a while for this to propagate to Raspbian. When I have more bandwidth I'll see if we might be able to start providing some unofficial Debian builds for ARM platforms. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From J.T.Jeuring at uu.nl Sun Mar 8 17:08:08 2015 From: J.T.Jeuring at uu.nl (Johan Jeuring) Date: Sun, 8 Mar 2015 18:08:08 +0100 Subject: [Haskell-cafe] CFP: TFPIE 2015 In-Reply-To: References: Message-ID: <459FDFEB-6FF2-4260-A17E-F0E2492FC635@uu.nl> Hi Alfredo, Sorry for my slow response, your email ended up n a folder that I don't read very often. > I was just looking at the Wiki and it seems quite interesting, even though I would like to ask you something as this passage is open to multiple interpretations: > > "TFPIE 2015 welcomes submissions describing techniques used in the classroom, tools used in and/or developed for the classroom and any creative use of functional programming (FP) to aid education in or outside Computer Science." > > What I would like to understand is if the focus of the Workshop is on "Teaching students FP" or is rather "Using FP to built products to aid teaching/learning". Or perhaps is a sprinkle of both? Teaching students FP, or using FP in teaching other subjects are the primary fields of interest. The headline says: TFPIE 2015 welcomes submissions describing techniques used in the classroom, tools used in and/or developed for the classroom and any creative use of functional programming (FP) to aid education in or outside Computer Science. I interpret this to cover also the kind of content you to describe, provided it describes `creative use' of FP. So it might be worthwhile to draw up an abstract, in which you explain how the use of FP has contributed to interesting aspects of tools being used in education. All the best, Johan > We (Iris Connect Ltd - www.irisconnect.co.uk) are a company which have recently rebuilt all our backend systems in Haskell, and we do sell a product which is basically a web platform for teachers to share, collaborate and develop best practices. > > So, technically speaking, we indeed have developed a tool/product using FP and we are in the education market, but we do not certainly teach functional programming to students. > > Speaking hypothetically, would we be accepted to the workshop is this is just too "out of focus"? > > I hope I have conveyed my ideas clearly enough. > > My best regards, > > Alfredo Di Napoli > > On 18 December 2014 at 08:32, Johan Jeuring wrote: > Trends in Functional Programming in Education (TFPIE 2015) > Call for papers > https://wiki.science.ru.nl/tfpie/TFPIE2015 > > The 4th International Workshop on Trends in Functional Programming in Education, > TFPIE 2015, will be held on June 2, 2015 in Sophia-Antipolis in France. It is > co-located with the Symposium on Trends in Functional Programming (TFP 2015) > which takes place from June 3 - 5. > > *** Goal *** > > The goal of TFPIE is to gather researchers, teachers and professionals that use, > or are interested in the use of, functional programming in education. TFPIE aims > to be a venue where novel ideas, classroom-tested ideas and work-in-progress on > the use of functional programming in education are discussed. The one-day > workshop will foster a spirit of open discussion by having a review process for > publication after the workshop. The program chair of TFPIE 2015 will screen > submissions to ensure that all presentations are within scope and are of > interest to participants. Potential presenters are invited to submit an extended > abstract (4-6 pages) or a draft paper (up to 16 pages) in EPTCS style. The > authors of accepted presentations will have their preprints and their slides > made available on the workshop's website/wiki. Visitors to the TFPIE 2015 > website/wiki will be able to add comments. This includes presenters who may > respond to comments and questions as well as provide pointers to improvements > and follow-up work. After the workshop, presenters will be invited to submit (a > revised version of) their article for review. The PC will select the best > articles for publication in the journal Electronic Proceedings in Theoretical > Computer Science (EPTCS). Articles rejected for presentation and extended > abstracts will not be formally reviewed by the PC. TFPIE workshops have > previously been held in St Andrews, Scotland (2012), Provo Utah, USA (2013), and > Soesterberg, The Netherlands (2014). > > *** Program Committee *** > > Peter Achten, Radboud University Nijmegen, The Netherlands > Edwin Brady, University of St Andrews, UK > Johan Jeuring, Utrecht University and Open University, The Netherlands (Chair) > Shriram Krishnamurthi, Brown University, US > Rita Loogen, Philipps-Universit?t Marburg, Germany > Marco Morazan, Seton Hall University, US > Norman Ramsey, Tufts University, US > > *** Submission Guidelines *** > > TFPIE 2015 welcomes submissions describing techniques used in the classroom, > tools used in and/or developed for the classroom and any creative use of > functional programming (FP) to aid education in or outside Computer Science. > Topics of interest include, but are not limited to: > > - FP and beginning CS students > - FP and Computational Thinking > - FP and Artificial Intelligence > - FP in Robotics > - FP and Music > - Advanced FP for undergraduates > - Tools supporting learning FP > - FP in graduate education > - Engaging students in research using FP > - FP in Programming Languages > - FP in the high school curriculum > - FP as a stepping stone to other CS topics > - FP and Philosophy > > *** Best Lectures *** > > In addition to papers, we request ?best lecture? presentations. What is your > best lecture topic in an FP related course? Do you have a fun way to present FP > concepts to novices or perhaps an especially interesting presentation of a > difficult topic? In either case, please consider sharing it. Best lecture topics > will be selected for presentation based on a short abstract describing the > lecture and its interest to TFPIE attendees. > > *** Submission *** > > Papers and abstracts can be submitted via easychair at the following link: > https://easychair.org/conferences/?conf=tfpie2015 > It is expected at at least one author for each submitted paper will attend the > workshop. > > *** Important Dates *** > > April 7, 2015: Early Registration for TFP closes > April 27, 2015: Submission deadline for draft TFPIE papers and abstracts > May 3 2015: Notification of acceptance for presentation > ?? (Probably May 22 2015): Registration for TFPIE closes - as does late registration for TFP > June 2, 2015: Presentations in Sophia-Antipolis, France > July 7, 2015: Full papers for EPTCS proceedings due. > September 1, 2015: Notification of acceptance for proceedings > September 22, 2015: Camera ready copy due for EPTCS > > Submission of an abstract implies no obligation to submit a full version; > abstracts with no corresponding full versions by the full paper deadline will be > considered as withdrawn. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From martin.drautzburg at web.de Sun Mar 8 20:52:50 2015 From: martin.drautzburg at web.de (martin) Date: Sun, 08 Mar 2015 21:52:50 +0100 Subject: [Haskell-cafe] How to abstract away set representation Message-ID: <54FCB6A2.3010302@web.de> Hello all, I was trying to construct a data type "Profile" which allows some set-like behavior. I started with functions to count, add and filter profiles. type Count = Int data Prof a = P { pCount :: Count, pFilter :: (a -> Bool) -> Prof a, pAdd :: (Prof a) -> (Prof a) } | NoProfile When I tried to actually implement a Profile, the first two functions were easy: exProfile :: [Int] -> Prof Int exProfile xs = P { pCount = length xs, pFilter = \p -> exProfile [x | x<-xs, p x], } But I didn't know how to implement pAdd. I was tempted to write something like pAdd = exProfile (xs ++ ys) But I wouldn't know where to take the ys from. I also hesitate to declare a toList function (which would solve the problem) in Prof. I would only do this *because* it is handy in exProfile, not because it is an intrinsic feature of Prof. What would be a good way to work with set-like behavior without being tied to one particular implementation? From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sun Mar 8 21:01:59 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sun, 8 Mar 2015 21:01:59 +0000 Subject: [Haskell-cafe] How to abstract away set representation In-Reply-To: <54FCB6A2.3010302@web.de> References: <54FCB6A2.3010302@web.de> Message-ID: <20150308210158.GA4176@weber> On Sun, Mar 08, 2015 at 09:52:50PM +0100, martin wrote: > Hello all, > > I was trying to construct a data type "Profile" which allows some set-like > behavior. I started with functions to count, add and filter profiles. > > type Count = Int > > > data Prof a = P { > pCount :: Count, > pFilter :: (a -> Bool) -> Prof a, > pAdd :: (Prof a) -> (Prof a) > } | > NoProfile [...] > What would be a good way to work with set-like behavior without being tied > to one particular implementation? How about data ProfOps prof = P { pCount :: prof -> Count pFilter :: (a -> Bool) -> prof -> prof pAdd :: prof -> prof } Then you can instantiate this package of operations at different types, for example listProf :: ProfOps [a] listProf = P { pCount = length, pFilter = filter, pAdd = (++) } If you really want the type parameter to be exposed you can use data ProfOps prof = P { pCount :: forall a. prof a -> Count pFilter :: forall a. (a -> Bool) -> prof a -> prof a pAdd :: forall a. prof a -> prof a } Tom From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sun Mar 8 21:05:54 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sun, 8 Mar 2015 21:05:54 +0000 Subject: [Haskell-cafe] How to abstract away set representation In-Reply-To: <20150308210158.GA4176@weber> References: <54FCB6A2.3010302@web.de> <20150308210158.GA4176@weber> Message-ID: <20150308210554.GB4176@weber> On Sun, Mar 08, 2015 at 09:01:59PM +0000, Tom Ellis wrote: > On Sun, Mar 08, 2015 at 09:52:50PM +0100, martin wrote: > > Hello all, > > > > I was trying to construct a data type "Profile" which allows some set-like > > behavior. I started with functions to count, add and filter profiles. > > > > type Count = Int > > > > > > data Prof a = P { > > pCount :: Count, > > pFilter :: (a -> Bool) -> Prof a, > > pAdd :: (Prof a) -> (Prof a) > > } | > > NoProfile > [...] > > What would be a good way to work with set-like behavior without being tied > > to one particular implementation? > > If you really want the type parameter to be exposed you can use > > data ProfOps prof = P { > pCount :: forall a. prof a -> Count > pFilter :: forall a. (a -> Bool) -> prof a -> prof a > pAdd :: forall a. prof a -> prof a > } Actually the above is the only version which works because pFilter mentions a. In that case you need the following package listProf :: ProfOps [] listProf = P { pCount = length, pFilter = filter, pAdd = (++) } I also made a mistake with the type of pAdd. It should be pAdd :: forall a. prof a -> prof a -> prof a From gershomb at gmail.com Sun Mar 8 23:05:36 2015 From: gershomb at gmail.com (Gershom B) Date: Sun, 8 Mar 2015 19:05:36 -0400 Subject: [Haskell-cafe] Haskell.org Committee Financial Statement 2014 Message-ID: Dear Haskellers,? The Haskell.org Committee [1] manages funds for haskell.org and oversees haskell.org infrastructure. ? The funds available to Haskell.org generally come from two sources: 1) Mentor payments from the Google Summer of Code program. 2) Since the end of 2013, occasional donations [2] from the Haskell community at large. Our funds are held by Software in the Public Interest, a 501(c)3 US non-profit, through which we also accept donations. In return for its services, SPI receives 5% of donations to Haskell.org.? According to our charter, "Each year, the committee will post a statement of the haskell.org assets, and the transactions for that year.? We apologize for having been delinquent in this regard.? Included in this message is a brief statement of Haskell.org assets over the period 31 December 2013 - 31 December 2014, as well as an approximate breakdown of expenses. The statements we receive from the SPI are not in the most usable format [3], and we hope to provide more accurate accounting in the future. Note that this statement does not reflect 2014 GSoC income, as that had not posted as of 31 December 2014. Thus the fact that we are in the black this year is entirely due to your generous donations. Thank you all so much!? 1. Income and Expenses? ? Total income over 2014: 5,187.00? ? Total expenses over 2014: 2,523.22? ? ----? ? Net income over 2014: 2,663.78? 2. Expense breakdown? ? ? Approximate monthly hosting fees (Hetzner): 160.00? ? ? Total approximate hosting fees: 1920.00? ? ? Other approximate expenses: 603.22? ? ? (Other expenses consist of A] payment processing fees for received funds and? ? ? ? B] the 5% of donated funds transferred to the SPI).? 3. Total Balance? Balance as of 31 December 2013: 23,759.13? Balance as of 31 December 2014: 26,422.91? [1] https://wiki.haskell.org/Haskell.org_committee? [2] https://wiki.haskell.org/Donate_to_Haskell.org? [3] Those wishing to examine further for themselves can find the reports posted to the spi-general list: http://lists.spi-inc.org/pipermail/spi-general/? Best,? Gershom Bazerman? for the Haskell.org Committee? From andrew at operationaldynamics.com Mon Mar 9 04:04:08 2015 From: andrew at operationaldynamics.com (Andrew Cowie) Date: Mon, 9 Mar 2015 15:04:08 +1100 Subject: [Haskell-cafe] Building documentation only? Message-ID: I've got a sandbox set up to build a local copy of Haddock documentation for various packages I'm using. Is there a way to get Cabal to just run Haddock and not actually build the packages in question? If the haddock program needs the compiled definitions then no, but I'm getting the impression it just runs over the raw sources. The config file I'm using at the moment is a very simple: $ cat cabal.config Documentation: True $ which is doing the trick to get Haddock run, I'm just wondering if there's ActualBuild: False equivalent? AfC -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Mon Mar 9 04:10:28 2015 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Mon, 9 Mar 2015 15:10:28 +1100 Subject: [Haskell-cafe] Building documentation only? In-Reply-To: References: Message-ID: On 9 March 2015 at 15:04, Andrew Cowie wrote: > I've got a sandbox set up to build a local copy of Haddock documentation for > various packages I'm using. > > Is there a way to get Cabal to just run Haddock and not actually build the > packages in question? If the haddock program needs the compiled definitions > then no, but I'm getting the impression it just runs over the raw sources. > > The config file I'm using at the moment is a very simple: > > $ cat cabal.config > Documentation: True > $ > > which is doing the trick to get Haddock run, I'm just wondering if there's > ActualBuild: False equivalent? cabal configure && cabal haddock && cp -r dist/doc/html/ /path/to/destination/ ? > > AfC > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From andrew at operationaldynamics.com Mon Mar 9 04:18:54 2015 From: andrew at operationaldynamics.com (Andrew Cowie) Date: Mon, 9 Mar 2015 15:18:54 +1100 Subject: [Haskell-cafe] Building documentation only? In-Reply-To: References: Message-ID: On Mon, Mar 9, 2015 at 3:10 PM, Ivan Lazar Miljenovic < ivan.miljenovic at gmail.com> wrote: > > cabal configure && cabal haddock && ... > > That'll build documentation for the current pwd's project (if there even is one), but that doesn't install and build the haddocks for dependencies. Well, unless you do `cabal install --only-dependencies` first, which brings us back to the original question. I'm trying to get a local version of the documentation of all the packages I tend to use so I don't need to keep reaching out to hackage.haskell.org while developing [offline]. Easily enough done; I'm just trying to skip building the code which, in this sandbox, I don't need. AfC -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Mon Mar 9 04:43:10 2015 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Mon, 9 Mar 2015 15:43:10 +1100 Subject: [Haskell-cafe] ANNOUNCE: fgl 5.5.1.0 Message-ID: I'm pleased to announce that - after being pestered about it for the past few months ;-) - I've released a new version of the Functional Graph Library that should* now be compatible with GHC 7.10. fgl is now developed on GitHub: https://github.com/haskell/fgl * In that I can't test it on my own machines -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From roma at ro-che.info Mon Mar 9 06:32:12 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Mon, 09 Mar 2015 02:32:12 -0400 Subject: [Haskell-cafe] Building documentation only? In-Reply-To: References: Message-ID: <54FD3E6C.90703@ro-che.info> That's not possible; haddock uses the ghc api so it needs to be able to load the dependencies. If the packages in question never use template haskell, you could try to install them with -fno-code -fwrite-interface. Otherwise, the next best thing is to pass -O0. On 09/03/15 00:18, Andrew Cowie wrote: > On Mon, Mar 9, 2015 at 3:10 PM, Ivan Lazar Miljenovic > > wrote: > > > cabal configure && cabal haddock && ... > > > That'll build documentation for the current pwd's project (if there even > is one), but that doesn't install and build the haddocks for > dependencies. Well, unless you do `cabal install --only-dependencies` > first, which brings us back to the original question. > > I'm trying to get a local version of the documentation of all the > packages I tend to use so I don't need to keep reaching out to > hackage.haskell.org while developing > [offline]. Easily enough done; I'm just trying to skip building the code > which, in this sandbox, I don't need. > > AfC > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From K.Bleijenberg at lijbrandt.nl Mon Mar 9 08:13:20 2015 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Mon, 9 Mar 2015 09:13:20 +0100 Subject: [Haskell-cafe] ghc -O2 out of memory In-Reply-To: References: <000001d058ef$45451e10$cfcf5a30$@lijbrandt.nl> Message-ID: <006c01d05a40$e800fcd0$b802f670$@lijbrandt.nl> Thanks for your answer. I also use ghc to create 32 bits dll?s. 7.8.4 is 64 bits GHC and can?t create 32 bits dll?s (?). This means I have to install 7.8.3 and 7.8.4 on the same Windows machine. Is this possible? Kees Van: Carter Schonwald [mailto:carter.schonwald at gmail.com] Verzonden: zaterdag 7 maart 2015 20:02 Aan: Kees Bleijenberg Onderwerp: Re: [Haskell-cafe] ghc -O2 out of memory Upgrade to ghc 7.8.4, theres some known bugs in O2 optimization that resulted in excessive memory usage that are fixed in 7.8.4 You'll still have painful compilation times with a 30kloc module , but memory usage should be physically possible after the upgrade. On Mar 7, 2015 10:58 AM, "Kees Bleijenberg" wrote: I?ve written a program that reads a Excel file, parses the contents and generates a haskell module. Every cell in the xls has it?s own function in the module. This worked fine. Now I have a bigger xls. The resulting module Xls.hs contains 30000 lines haskell code (without comment). I created a testprogram test.hs that calculates and prints one cell. I did ghc --make test.hs and everything works fine. The generated execuatable is very slow. I did ghc --make ?O2 test.hs. The compilations takes 15 minutes and aborts with ?ghc: out of memory?. I?am working on Win 7 64 bits , ghc version = 7.8.3. What can I do to fix this? I do need ?O2. I found with smaller xls?s that optimization speeds up the executable dramatically. Before I start experimenting, does it help to split up the xls .hs in seperate files? I.e. the cells that refer to other cells and cells that don?t refer to other cells. Or will I still get ?out of memory? because the optimization is global? Kees _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe No virus found in this message. Checked by AVG - www.avg.com Version: 2015.0.5751 / Virus Database: 4299/9258 - Release Date: 03/09/15 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.franksen at online.de Mon Mar 9 15:26:42 2015 From: ben.franksen at online.de (Ben Franksen) Date: Mon, 09 Mar 2015 16:26:42 +0100 Subject: [Haskell-cafe] Is there a name for this? References: <53086272.774795.1425831108021.JavaMail.yahoo@mail.yahoo.com> <54FC7A42.2000100@vex.net> Message-ID: Albert Y. C. Lai wrote: > On 2015-03-08 12:11 PM, Eric wrote: >> In some sense it's a canonical instance of Foo; we could trivially >> write a universal >> >> > toFoo' :: Foo f => f -> Foo' >> >> function. > > Choose one: > > Foo' is a free Foo > > Foo' is a limit of the diagram of Foo > > Foo' is a terminal object of the [sub]category of Foo Interesting. Is the last variant how "free " is usually defined? Or is it a coincidence that the two, well, coincide here? I remember I have seen other definitions that looked a lot less easy to understand. Cheers Ben From sean at functionaljobs.com Mon Mar 9 16:00:01 2015 From: sean at functionaljobs.com (Functional Jobs) Date: Mon, 9 Mar 2015 12:00:01 -0400 Subject: [Haskell-cafe] New Functional Programming Job Opportunities Message-ID: <54fdc382b60df@functionaljobs.com> Here are some functional programming job opportunities that were posted recently: Hacker (Node.js, NOSQL, Data Science) at Mobitrans http://functionaljobs.com/jobs/8793-hacker-nodejs-nosql-data-science-at-mobitrans Full-Stack Senior Functional Web Engineer at Front Row Education http://functionaljobs.com/jobs/8792-full-stack-senior-functional-web-engineer-at-front-row-education Cheers, Sean Murphy FunctionalJobs.com From martin.drautzburg at web.de Mon Mar 9 20:30:27 2015 From: martin.drautzburg at web.de (martin) Date: Mon, 09 Mar 2015 21:30:27 +0100 Subject: [Haskell-cafe] How to abstract away set representation In-Reply-To: <20150308210554.GB4176@weber> References: <54FCB6A2.3010302@web.de> <20150308210158.GA4176@weber> <20150308210554.GB4176@weber> Message-ID: <54FE02E3.5050001@web.de> Am 03/08/2015 um 10:05 PM schrieb Tom Ellis: >> >> If you really want the type parameter to be exposed you can use >> >> data ProfOps prof = P { >> pCount :: forall a. prof a -> Count >> pFilter :: forall a. (a -> Bool) -> prof a -> prof a >> pAdd :: forall a. prof a -> prof a >> } > > Actually the above is the only version which works because pFilter mentions > a. In that case you need the following package > > listProf :: ProfOps [] > listProf = P { > pCount = length, > pFilter = filter, > pAdd = (++) > } How would I use this? If I have a listProf and I want to perform pCount, must I then choose the pCount from listProf? Something like pCount listProf aProfile But then my code knows that I am using a list representation, which is the thing I wanted to avoid. I tried to pair the ops with the representation, but this also got me into trouble, because when I e.g. do a pAdd then it gets strange when the two operands do not use the same Ops. From rustompmody at gmail.com Tue Mar 10 02:33:02 2015 From: rustompmody at gmail.com (Rustom Mody) Date: Tue, 10 Mar 2015 08:03:02 +0530 Subject: [Haskell-cafe] [] == [] Message-ID: My impression is that earlier [] == [] used to give a type error. Now it gives True. So 1. Which instance of == is being used? 2. Is there some option controlling this behavior? -------------- next part -------------- An HTML attachment was scrubbed... URL: From maydwell at gmail.com Tue Mar 10 02:37:32 2015 From: maydwell at gmail.com (Lyndon Maydwell) Date: Tue, 10 Mar 2015 13:37:32 +1100 Subject: [Haskell-cafe] [] == [] In-Reply-To: References: Message-ID: This looks like a great opportunity to try out the new holes functionality: [Prelude] ? [] == _what :3:7: Found hole ?_what? with type: [t0] Where: ?t0? is an ambiguous type variable Relevant bindings include it :: Bool (bound at :3:1) In the second argument of ?(==)?, namely ?_what? In the expression: [] == _what In an equation for ?it?: it = [] == _what Looks like it defaults to [Bool]! Correct me if I'm wrong :) - Lyndon On Tue, Mar 10, 2015 at 1:33 PM, Rustom Mody wrote: > My impression is that earlier > [] == [] > used to give a type error. Now it gives True. > > So > 1. Which instance of == is being used? > 2. Is there some option controlling this behavior? > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Tue Mar 10 02:42:44 2015 From: rustompmody at gmail.com (Rustom Mody) Date: Tue, 10 Mar 2015 08:12:44 +0530 Subject: [Haskell-cafe] [] == [] In-Reply-To: References: Message-ID: On Tue, Mar 10, 2015 at 8:07 AM, Lyndon Maydwell wrote: > This looks like a great opportunity to try out the new holes functionality: > > [Prelude] ? [] == _what > > :3:7: > Found hole ?_what? with type: [t0] > Where: ?t0? is an ambiguous type variable > Relevant bindings include it :: Bool (bound at :3:1) > In the second argument of ?(==)?, namely ?_what? > In the expression: [] == _what > In an equation for ?it?: it = [] == _what > > > Looks like it defaults to [Bool]! > > Correct me if I'm wrong :) > Thanks Lyndon. But on my (debian testing) ghc I get: Prelude> [] == _what :2:7: Not in scope: `_what' [ghc 7.6.3] And my main question is the second one : For pedagogic purposes I want to get the error -- Whats the (family of) related options? -------------- next part -------------- An HTML attachment was scrubbed... URL: From whosekiteneverfly at gmail.com Tue Mar 10 02:48:30 2015 From: whosekiteneverfly at gmail.com (Yuji Yamamoto) Date: Tue, 10 Mar 2015 11:48:30 +0900 Subject: [Haskell-cafe] [] == [] In-Reply-To: References: Message-ID: > And my main question is the second one : For pedagogic purposes I want to get the error -- Whats the (family of) related options? This feature is called "type holes" introduced by GHC 7.8.1. see https://wiki.haskell.org/GHC/Typed_holes in details. 2015-03-10 11:42 GMT+09:00 Rustom Mody : > > > On Tue, Mar 10, 2015 at 8:07 AM, Lyndon Maydwell > wrote: > >> This looks like a great opportunity to try out the new holes >> functionality: >> >> [Prelude] ? [] == _what >> >> :3:7: >> Found hole ?_what? with type: [t0] >> Where: ?t0? is an ambiguous type variable >> Relevant bindings include it :: Bool (bound at :3:1) >> In the second argument of ?(==)?, namely ?_what? >> In the expression: [] == _what >> In an equation for ?it?: it = [] == _what >> >> >> Looks like it defaults to [Bool]! >> >> Correct me if I'm wrong :) >> > > Thanks Lyndon. > But on my (debian testing) ghc I get: > > Prelude> [] == _what > > :2:7: Not in scope: `_what' > > [ghc 7.6.3] > > And my main question is the second one : > For pedagogic purposes I want to get the error -- Whats the (family of) > related options? > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- ???? twitter: @igrep Facebook: http://www.facebook.com/igrep Google+: https://plus.google.com/u/0/+YujiYamamoto_igrep -------------- next part -------------- An HTML attachment was scrubbed... URL: From maydwell at gmail.com Tue Mar 10 02:51:36 2015 From: maydwell at gmail.com (Lyndon Maydwell) Date: Tue, 10 Mar 2015 13:51:36 +1100 Subject: [Haskell-cafe] [] == [] In-Reply-To: References: Message-ID: GHC 7.8.3 here. Hmm, on second inspection I believe that the Bool reference is to the top-level expression, not the list items after all. I don't seem to get any defaulting behaviour either when not using GHCi. This seems to indicate that the extended interactive type defaulting is coming into play: https://downloads.haskell.org/~ghc/7.8.2/docs/html/users_guide/interactive-evaluation.html I'd guess that this means that the () default is being used. -Wall seems to indicate that this is in-fact the case: [Prelude] ? [] == [] :2:4: Warning: Defaulting the following constraint(s) to type ?()? (Eq t0) arising from a use of ?==? In the expression: [] == [] In an equation for ?it?: it = [] == [] True Hope this helps. - Lyndon On Tue, Mar 10, 2015 at 1:42 PM, Rustom Mody wrote: > > > On Tue, Mar 10, 2015 at 8:07 AM, Lyndon Maydwell > wrote: > >> This looks like a great opportunity to try out the new holes >> functionality: >> >> [Prelude] ? [] == _what >> >> :3:7: >> Found hole ?_what? with type: [t0] >> Where: ?t0? is an ambiguous type variable >> Relevant bindings include it :: Bool (bound at :3:1) >> In the second argument of ?(==)?, namely ?_what? >> In the expression: [] == _what >> In an equation for ?it?: it = [] == _what >> >> >> Looks like it defaults to [Bool]! >> >> Correct me if I'm wrong :) >> > > Thanks Lyndon. > But on my (debian testing) ghc I get: > > Prelude> [] == _what > > :2:7: Not in scope: `_what' > > [ghc 7.6.3] > > And my main question is the second one : > For pedagogic purposes I want to get the error -- Whats the (family of) > related options? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Tue Mar 10 03:20:03 2015 From: rustompmody at gmail.com (Rustom Mody) Date: Tue, 10 Mar 2015 08:50:03 +0530 Subject: [Haskell-cafe] [] == [] In-Reply-To: References: Message-ID: On Tue, Mar 10, 2015 at 8:21 AM, Lyndon Maydwell wrote: > GHC 7.8.3 here. > > Hmm, on second inspection I believe that the Bool reference is to the > top-level expression, not the list items after all. > > I don't seem to get any defaulting behaviour either when not using GHCi. > This seems to indicate that the extended interactive type defaulting is > coming into play: > > > https://downloads.haskell.org/~ghc/7.8.2/docs/html/users_guide/interactive-evaluation.html > > I'd guess that this means that the () default is being used. -Wall seems > to indicate that this is in-fact the case: > > > [Prelude] ? [] == [] > > :2:4: Warning: > Defaulting the following constraint(s) to type ?()? > (Eq t0) arising from a use of ?==? > In the expression: [] == [] > In an equation for ?it?: it = [] == [] > True > > > Hope this helps. > > Thats better -- thanks Lyndon! So after some fishing around I find the more pointed warning I am after is -fwarn-type-defaults The docs seem confusing though: https://downloads.haskell.org/~ghc/7.4.1/docs/html/users_guide/options-sanity.html Under -fwarn-type-defaults: says *Have the compiler warn/inform you where in your source the Haskell defaulting mechanism for numeric types kicks in.* Wheres the numeric here? -------------- next part -------------- An HTML attachment was scrubbed... URL: From t at tmh.cc Tue Mar 10 03:25:41 2015 From: t at tmh.cc (Taylor Hedberg) Date: Mon, 9 Mar 2015 20:25:41 -0700 Subject: [Haskell-cafe] [] == [] In-Reply-To: References: Message-ID: On Mon, Mar 9, 2015 at 8:20 PM, Rustom Mody wrote: > > Under -fwarn-type-defaults: > says > > *Have the compiler warn/inform you where in your source the Haskell > defaulting mechanism for numeric types kicks in.* > > Wheres the numeric here? > In GHCi, the type defaulting mechanism is extended beyond numerics. See https://downloads.haskell.org/~ghc/7.8.2/docs/html/users_guide/interactive-evaluation.html#extended-default-rules . In this case, the list is defaulting to type [()]. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vigalchin at gmail.com Tue Mar 10 03:34:27 2015 From: vigalchin at gmail.com (Vasili I. Galchin) Date: Mon, 9 Mar 2015 20:34:27 -0700 Subject: [Haskell-cafe] Fwd: Freelance and full-time Haskell development jobs in tech startups In-Reply-To: <0000014bf051f7e8-92fd91ee-a9b1-4b28-ba09-004cb77e2203-000000@email.amazonses.com> References: <0000014bf051f7e8-92fd91ee-a9b1-4b28-ba09-004cb77e2203-000000@email.amazonses.com> Message-ID: Hello, Was this posted on this mail list? I am afraid of phishing. Vasili ---------- Forwarded message ---------- From: Vassili van der Mersch Date: Fri, Mar 6, 2015 at 10:21 AM Subject: Freelance and full-time Haskell development jobs in tech startups To: "biohaskell at biohaskell.org" Hi BioHaskell, I'm a co-founder at Sevendays - it's a website where tech startups can find quality programmers and designers (amongst other jobs): https://www.sevendays.co We're looking for great programmers and designers who like to work at startups, either on freelance or permanent basis, on site or remotely. We're growing fast and we're constantly looking for talented developers - in particular, Haskell dev skills are highly demanded at the moment. We never take a cut - you'll keep 100% of your earnings. I'd be grateful if you could have a look and tell me what you think. Have a great day! Vassili ------------------------------------------------------------------------------- Co-founder at Sevendays - https://www.sevendays.co Customer support: info at sevendays.co Follow us on Twitter: https://twitter.com/sevendaysapp -------------- next part -------------- An HTML attachment was scrubbed... URL: From vigalchin at gmail.com Tue Mar 10 05:14:42 2015 From: vigalchin at gmail.com (Vasili I. Galchin) Date: Mon, 9 Mar 2015 22:14:42 -0700 Subject: [Haskell-cafe] raspberrypi and ghci In-Reply-To: <8761abh22j.fsf@gmail.com> References: <8761abh22j.fsf@gmail.com> Message-ID: Hi Ben, Cabal also doesn't seem to be supported on raspberrypi?? What is the URL of your group that is porting Haskell to the raspberrypi? Vasili On Sunday, March 8, 2015, Ben Gamari wrote: > "Vasili I. Galchin" > writes: > > > Hello, > > > > I have a B++ pi. I did a "apt-get install haskell-platform. No " > > ghci"!. So I did a google on this issue. Circa 2013 ghci seemed to be > > an issue with raspberrypi/arm. What is the current status of "ghci" on > > the pi/arm??. > > > With dynamic linking and the LLVM backend GHC 7.8 is quite usable on > ARM. Unfortunately, much of the distributions' packaging hasn't been > updated to reflect this. Debian builds in experimental (starting with > 7.8.20141119-8) now build GHCi on ARM; it may take a while for this to > propagate to Raspbian. When I have more bandwidth I'll see if we might > be able to start providing some unofficial Debian builds for ARM > platforms. > > Cheers, > > - Ben > -------------- next part -------------- An HTML attachment was scrubbed... URL: From K.Bleijenberg at lijbrandt.nl Tue Mar 10 07:44:05 2015 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Tue, 10 Mar 2015 08:44:05 +0100 Subject: [Haskell-cafe] ghc -O2 out of memory In-Reply-To: References: <000001d058ef$45451e10$cfcf5a30$@lijbrandt.nl> <006c01d05a40$e800fcd0$b802f670$@lijbrandt.nl> Message-ID: <000001d05b05$fbdc0950$f3941bf0$@lijbrandt.nl> Carter, Thank you. My assumption was that 7.8.3 is 32 bits and 7.8.4 is 64 bits. I got this idea from reading https://github.com/fpco/minghc#readme Kees Van: Carter Schonwald [mailto:carter.schonwald at gmail.com] Verzonden: dinsdag 10 maart 2015 3:10 Aan: Kees Bleijenberg CC: ghc-devs at haskell.org Onderwerp: Re: [Haskell-cafe] ghc -O2 out of memory there SHOULD be a 32bit 7.8.4 build available somewhere for windows, and if not , thats a real problem! I'm gonna shift this thread to ghc-devs, because that *should* get addressed @ghc-devs, how can we help this user get ahold of a 32bit windows 7.8.4 build? (eg, why do we not have one available yet?) -Carter On Mon, Mar 9, 2015 at 4:13 AM, Kees Bleijenberg wrote: Thanks for your answer. I also use ghc to create 32 bits dll?s. 7.8.4 is 64 bits GHC and can?t create 32 bits dll?s (?). This means I have to install 7.8.3 and 7.8.4 on the same Windows machine. Is this possible? -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue Mar 10 08:33:01 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 10 Mar 2015 04:33:01 -0400 Subject: [Haskell-cafe] [] == [] In-Reply-To: References: Message-ID: On Mon, Mar 9, 2015 at 10:33 PM, Rustom Mody wrote: > My impression is that earlier > [] == [] > used to give a type error. Now it gives True. > > So > 1. Which instance of == is being used? > 2. Is there some option controlling this behavior? > The instance being used is (), and it's controlled by -XExtendedDefaultRules. https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/interactive-evaluation.html#extended-default-rules -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From noteed at gmail.com Tue Mar 10 09:51:54 2015 From: noteed at gmail.com (Vo Minh Thu) Date: Tue, 10 Mar 2015 10:51:54 +0100 Subject: [Haskell-cafe] Fwd: Freelance and full-time Haskell development jobs in tech startups In-Reply-To: References: <0000014bf051f7e8-92fd91ee-a9b1-4b28-ba09-004cb77e2203-000000@email.amazonses.com> Message-ID: Hi, I didn't see this posted to -caf? but I know about that company for some time now (they're from Belgium where I live but I never registered on their site). They look like they're trying to grow their list of r?sum?s but I have no idea about the important part: do any respectable company hire through them or not. HTH, Thu 2015-03-10 4:34 GMT+01:00 Vasili I. Galchin : > Hello, > > Was this posted on this mail list? I am afraid of phishing. > > Vasili > > > ---------- Forwarded message ---------- > From: Vassili van der Mersch > Date: Fri, Mar 6, 2015 at 10:21 AM > Subject: Freelance and full-time Haskell development jobs in tech startups > To: "biohaskell at biohaskell.org" > > > Hi BioHaskell, > > I'm a co-founder at Sevendays - it's a website where tech startups can find > quality programmers and designers (amongst other jobs): > https://www.sevendays.co > > We're looking for great programmers and designers who like to work at > startups, either on freelance or permanent basis, on site or remotely. > > We're growing fast and we're constantly looking for talented developers - in > particular, Haskell dev skills are highly demanded at the moment. > > We never take a cut - you'll keep 100% of your earnings. I'd be grateful if > you could have a look and tell me what you think. > > Have a great day! > > Vassili > > ------------------------------------------------------------------------------- > > Co-founder at Sevendays - https://www.sevendays.co > > Customer support: info at sevendays.co > > Follow us on Twitter: https://twitter.com/sevendaysapp > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From tom.schrijvers at cs.kuleuven.be Tue Mar 10 09:53:03 2015 From: tom.schrijvers at cs.kuleuven.be (Tom Schrijvers) Date: Tue, 10 Mar 2015 10:53:03 +0100 Subject: [Haskell-cafe] Leuven Haskell User Group meeting March 17 @ 19:00 Message-ID: Dear all, Our next Leuven Haskell User Group meeting will take place on Tuesday, March 17 at 19h00. For details see here: https://groups.google.com/d/msg/leuven-haskell/q863tfr2Na4/Yp6AKMVzMcIJ Everyone is welcome! Tom -- prof. dr. ir. Tom Schrijvers Research Professor KU Leuven Department of Computer Science Celestijnenlaan 200A 3001 Leuven Belgium Phone: +32 16 327 830 http://people.cs.kuleuven.be/~tom.schrijvers/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From alois.cochard at gmail.com Tue Mar 10 11:38:57 2015 From: alois.cochard at gmail.com (Alois Cochard) Date: Tue, 10 Mar 2015 12:38:57 +0100 Subject: [Haskell-cafe] Fwd: Freelance and full-time Haskell development jobs in tech startups In-Reply-To: References: <0000014bf051f7e8-92fd91ee-a9b1-4b28-ba09-004cb77e2203-000000@email.amazonses.com> Message-ID: Hi Vasili, If you want to know if it was cross posted on the mailing list, you can directly consult the archive and check the same date: https://mail.haskell.org/pipermail/haskell-cafe/ An other great archive for the haskell cafe is at gmane.org, where there is even a search field where you can run specific queries: http://news.gmane.org/gmane.comp.lang.haskell.general As you can see, searching for the name of that company return no result: http://search.gmane.org/search.php?group=gmane.comp.lang.haskell.general&query=Sevendays Hope that helps Cheers On 10 March 2015 at 04:34, Vasili I. Galchin wrote: > Hello, > > Was this posted on this mail list? I am afraid of phishing. > > Vasili > > > ---------- Forwarded message ---------- > From: Vassili van der Mersch > Date: Fri, Mar 6, 2015 at 10:21 AM > Subject: Freelance and full-time Haskell development jobs in tech startups > To: "biohaskell at biohaskell.org" > > > Hi BioHaskell, > > I'm a co-founder at Sevendays - it's a website where tech startups can > find quality programmers and designers (amongst other jobs): > https://www.sevendays.co > > > We're looking for great programmers and designers who like to work at > startups, either on freelance or permanent basis, on site or remotely. > > We're growing fast and we're constantly looking for talented developers - > in particular, Haskell dev skills are highly demanded at the moment. > > We never take a cut - you'll keep 100% of your earnings. I'd be grateful > if you could have a look and tell me what you think. > > Have a great day! > > Vassili > > > ------------------------------------------------------------------------------- > > Co-founder at Sevendays - https://www.sevendays.co > > Customer support: info at sevendays.co > > Follow us on Twitter: https://twitter.com/sevendaysapp > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- *?\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue Mar 10 12:44:24 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 10 Mar 2015 08:44:24 -0400 Subject: [Haskell-cafe] Fwd: Freelance and full-time Haskell development jobs in tech startups In-Reply-To: References: <0000014bf051f7e8-92fd91ee-a9b1-4b28-ba09-004cb77e2203-000000@email.amazonses.com> Message-ID: On Tue, Mar 10, 2015 at 5:51 AM, Vo Minh Thu wrote: > I didn't see this posted to -caf? but I know about that company for > > 2015-03-10 4:34 GMT+01:00 Vasili I. Galchin : > > Was this posted on this mail list? I am afraid of phishing. > > > > ---------- Forwarded message ---------- > > From: Vassili van der Mersch > > Date: Fri, Mar 6, 2015 at 10:21 AM > > Subject: Freelance and full-time Haskell development jobs in tech > startups > > To: "biohaskell at biohaskell.org" > As shown in the quoted header, it was not posted to -cafe, it was posted to the biohaskell list. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Tue Mar 10 13:18:46 2015 From: rustompmody at gmail.com (Rustom Mody) Date: Tue, 10 Mar 2015 18:48:46 +0530 Subject: [Haskell-cafe] [] == [] In-Reply-To: References: Message-ID: On Tue, Mar 10, 2015 at 2:03 PM, Brandon Allbery wrote: > On Mon, Mar 9, 2015 at 10:33 PM, Rustom Mody > wrote: > >> My impression is that earlier >> [] == [] >> used to give a type error. Now it gives True. >> >> So >> 1. Which instance of == is being used? >> 2. Is there some option controlling this behavior? >> > > The instance being used is (), and it's controlled by > -XExtendedDefaultRules. > > > https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/interactive-evaluation.html#extended-default-rules > Thats what I first thought Tried starting ghci with -XNoExtendedDefaultRules but it does not turn it off -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue Mar 10 13:24:12 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 10 Mar 2015 09:24:12 -0400 Subject: [Haskell-cafe] [] == [] In-Reply-To: References: Message-ID: On Tue, Mar 10, 2015 at 9:18 AM, Rustom Mody wrote: > On Tue, Mar 10, 2015 at 2:03 PM, Brandon Allbery > wrote: > >> On Mon, Mar 9, 2015 at 10:33 PM, Rustom Mody >> wrote: >> >>> 1. Which instance of == is being used? >>> 2. Is there some option controlling this behavior? >>> >> >> The instance being used is (), and it's controlled by >> -XExtendedDefaultRules. >> >> >> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/interactive-evaluation.html#extended-default-rules >> > > Thats what I first thought > Tried starting ghci with -XNoExtendedDefaultRules > but it does not turn it off > Looks like -X only affects compiler flags: Prelude> :showi language base language is: Haskell2010 with the following modifiers: -XNoMonomorphismRestriction -XNoDatatypeContexts -XNondecreasingIndentation -XExtendedDefaultRules Probably need to use :seti inside of ghci, or in a .ghci / ghci.ini file. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at smart-cactus.org Tue Mar 10 13:38:01 2015 From: ben at smart-cactus.org (Ben Gamari) Date: Tue, 10 Mar 2015 09:38:01 -0400 Subject: [Haskell-cafe] raspberrypi and ghci In-Reply-To: References: <8761abh22j.fsf@gmail.com> Message-ID: <87siddezwm.fsf@gmail.com> "Vasili I. Galchin" writes: > Hi Ben, > Hi Vasili! > > Cabal also doesn't seem to be supported on raspberrypi?? > Cabal should run perfectly well on as should most pure Haskell libraries found on Hackage. Cabal is packaged for Debian under the name `cabal-install`. > What is the URL of your group that is porting Haskell to the raspberrypi? > It's not so much an organized group as a few loosely-coupled individual GHC developers interested in ensuring GHC is well-supported on ARM (Cc'd; apologies if I have forgotten someone). While the Raspberry Pi should work, I don't know of any developers who actively test on it due to its quite anemic specifications; even on my four-core Odroid XU a GHC build takes much of the day. There have been a few issues [1,2] specific to the pre-ARMv6 (e.g. quite old) ARM core that the Raspberry Pi uses but I believe these have been sorted out (unfortunately #9125 will still be present in GHC 7.10 as it is apparentlly an LLVM bug). The GHC-on-ARM effort doesn't have a website per-se. I occassionally write around related issues on my blog [3,4]. The GHC Wiki has some relevant material, although it can be difficult to tell what is out-of-date. The mailing lists and issue tracker are good repositories for knowledge when things go awry. I think it is fair to say that much of the compiler engineering work is done and stable; the GHC 7.8 builds on my ARM boxes are just as functional as my x86_64-based laptop. Most of the issues we have encountered arose from bugs in external components of the compilation process (linkers, in particular, are problematic) and maintaining the LLVM backend (which should improve notably with GHC 7.12 which will support only one LLVM release). All of the developers mentioned above are available on IRC (#ghc on Freenode) and the ghc-devs mailing list. If you run in to trouble don't hesitate to contact me. Cheers, - Ben [1] https://ghc.haskell.org/trac/ghc/ticket/9125 [2] https://ghc.haskell.org/trac/ghc/ticket/8951 [3] http://smart-cactus.org/~ben/posts/2014-03-06-compiling-ghc-7.8-on-arm.html [4] http://smart-cactus.org/~ben/posts/2014-11-28-state-of-llvm-backend.html -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From creswick at gmail.com Tue Mar 10 13:45:39 2015 From: creswick at gmail.com (Rogan Creswick) Date: Tue, 10 Mar 2015 06:45:39 -0700 Subject: [Haskell-cafe] How to abstract away set representation In-Reply-To: <54FE02E3.5050001@web.de> References: <54FCB6A2.3010302@web.de> <20150308210158.GA4176@weber> <20150308210554.GB4176@weber> <54FE02E3.5050001@web.de> Message-ID: On Mon, Mar 9, 2015 at 1:30 PM, martin wrote: > How would I use this? If I have a listProf and I want to perform pCount, must I then choose the pCount from listProf? > Something like > > pCount listProf aProfile > > But then my code knows that I am using a list representation, which is the thing I wanted to avoid. > > I tried to pair the ops with the representation, but this also got me into trouble, because when I e.g. do a pAdd then > it gets strange when the two operands do not use the same Ops. > You could possibly hide the details by using GADTs, adding a new data constructor for each underlying type (which could also be abstracted as in the suggestion from Tom), but you still have to deal with an unavoidable issue -- you'll have to encode how to add collections of disparate types at some point. E.g., how do you add a `Prof Int` that's backed by a `Set a` to a `Prof Int` backed by a `[Int]` ? (at least I think that's unavoidable -- you may be able to solve it with a type class that moves the combination logic elsewhere.) --Rogan From rustompmody at gmail.com Tue Mar 10 13:52:22 2015 From: rustompmody at gmail.com (Rustom Mody) Date: Tue, 10 Mar 2015 19:22:22 +0530 Subject: [Haskell-cafe] [] == [] In-Reply-To: References: Message-ID: On Tue, Mar 10, 2015 at 6:54 PM, Brandon Allbery wrote: > On Tue, Mar 10, 2015 at 9:18 AM, Rustom Mody > wrote: > >> On Tue, Mar 10, 2015 at 2:03 PM, Brandon Allbery >> wrote: >> >>> On Mon, Mar 9, 2015 at 10:33 PM, Rustom Mody >>> wrote: >>> >>>> 1. Which instance of == is being used? >>>> 2. Is there some option controlling this behavior? >>>> >>> >>> The instance being used is (), and it's controlled by >>> -XExtendedDefaultRules. >>> >>> >>> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/interactive-evaluation.html#extended-default-rules >>> >> >> Thats what I first thought >> Tried starting ghci with -XNoExtendedDefaultRules >> but it does not turn it off >> > > Looks like -X only affects compiler flags: > > > Prelude> :showi language > base language is: Haskell2010 > with the following modifiers: > -XNoMonomorphismRestriction > -XNoDatatypeContexts > -XNondecreasingIndentation > -XExtendedDefaultRules > > Probably need to use :seti inside of ghci, or in a .ghci / ghci.ini file. > Ok that did it -- Thanks Brandon. Also thanks Taylor for the exact pointer to the divergence between ghc and ghci semantics -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Tue Mar 10 14:54:00 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 10 Mar 2015 14:54:00 +0000 Subject: [Haskell-cafe] Basic question about recursive data type... Message-ID: a long time since I did some Haskell and my brain has reverted to its OO dogma... > {-# LANGUAGE GADTs, TypeFamilies, TypeOperators, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances, FlexibleContexts #-} consider > data Next input output where > End :: Next () () > Next :: (input -> output) -> Next input output this is a bit like curried function... I can construct > y :: Next Integer (Next String (Next () ())) > y = Next (\x -> > if (x == 1) then > Next (\y -> > if (y == "s") then > End > else > End) > else > Next (\y -> > if (y == "t") then > End > else > End)) which is a bit like "Integer->String->()" I can execute it... > exe :: Next input output -> input -> output > exe (Next f) i = f i > exe End () = () > p :: Next String (Next () ()) > p = exe y 1 ok.... but how do I constrain all the outputs to be of type Next? I don't want this to be valid > z :: Next Integer Integer > z = Next (\x -> x + 1) CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alan.zimm at gmail.com Tue Mar 10 16:01:05 2015 From: alan.zimm at gmail.com (Alan & Kim Zimmerman) Date: Tue, 10 Mar 2015 18:01:05 +0200 Subject: [Haskell-cafe] Layout rules for if then else Message-ID: I am working on ghc-exactprint, and need to flag points where layout must be preserved, and considering the `if` statement. My understanding of the layout rules for if then else is that the `then` has to start more to the right than the `if`. Using GHC 7.10 RC2, ghci cheerfully loads the following ``` f = if True then 1 else 2 ``` Is this valid? Have the rules been relaxed? Alan -------------- next part -------------- An HTML attachment was scrubbed... URL: From noteed at gmail.com Tue Mar 10 16:04:11 2015 From: noteed at gmail.com (Vo Minh Thu) Date: Tue, 10 Mar 2015 17:04:11 +0100 Subject: [Haskell-cafe] Layout rules for if then else In-Reply-To: References: Message-ID: What you state is true within a `do` expression. What you wrote is a single if_then_else_ expression on the rhs of the function definition. Cheers, Thu 2015-03-10 17:01 GMT+01:00 Alan & Kim Zimmerman : > I am working on ghc-exactprint, and need to flag points where layout must be > preserved, and considering the `if` statement. > > My understanding of the layout rules for if then else is that the `then` has > to start more to the right than the `if`. > > Using GHC 7.10 RC2, ghci cheerfully loads the following > > ``` > f = > if True > then 1 > else 2 > > ``` > > Is this valid? Have the rules been relaxed? > > Alan > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From allbery.b at gmail.com Tue Mar 10 16:06:43 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 10 Mar 2015 12:06:43 -0400 Subject: [Haskell-cafe] Layout rules for if then else In-Reply-To: References: Message-ID: On Tue, Mar 10, 2015 at 12:01 PM, Alan & Kim Zimmerman wrote: > I am working on ghc-exactprint, and need to flag points where layout must > be preserved, and considering the `if` statement. > > My understanding of the layout rules for if then else is that the `then` > has to start more to the right than the `if`. > I believe you are looking for DoAndIfThenElse. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Tue Mar 10 16:22:19 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Tue, 10 Mar 2015 16:22:19 +0000 Subject: [Haskell-cafe] How to abstract away set representation In-Reply-To: <54FE02E3.5050001@web.de> References: <54FCB6A2.3010302@web.de> <20150308210158.GA4176@weber> <20150308210554.GB4176@weber> <54FE02E3.5050001@web.de> Message-ID: <20150310162219.GB8845@weber> On Mon, Mar 09, 2015 at 09:30:27PM +0100, martin wrote: > Am 03/08/2015 um 10:05 PM schrieb Tom Ellis: > How would I use this? If I have a listProf and I want to perform pCount, must I then choose the pCount from listProf? > Something like > > pCount listProf aProfile > > But then my code knows that I am using a list representation, which is the thing I wanted to avoid. > > I tried to pair the ops with the representation, but this also got me into trouble, because when I e.g. do a pAdd then > it gets strange when the two operands do not use the same Ops. You use it like this. You can write operations on your Prof without having to know its concrete type. If you don't like threading the dictionary `p` around then you could use a reader monad or a typeclass. {-# LANGUAGE Rank2Types #-} type Count = Int data ProfOps prof = P { pCount :: forall a. prof a -> Count, pFilter :: forall a. (a -> Bool) -> prof a -> prof a, pAdd :: forall a. prof a -> prof a -> prof a } listProf :: ProfOps [] listProf = P { pCount = length, pFilter = filter, pAdd = (++) } example :: ProfOps prof -> prof Integer -> prof Integer -> Count example p profs1 profs2 = pCount p (pAdd p (pFilter p even profs1) profs2) Tom From alan.zimm at gmail.com Tue Mar 10 16:25:44 2015 From: alan.zimm at gmail.com (Alan & Kim Zimmerman) Date: Tue, 10 Mar 2015 18:25:44 +0200 Subject: [Haskell-cafe] Layout rules for if then else In-Reply-To: References: Message-ID: Ok, adding a do does make a difference. More complexity. Thanks Alan On Tue, Mar 10, 2015 at 6:06 PM, Brandon Allbery wrote: > On Tue, Mar 10, 2015 at 12:01 PM, Alan & Kim Zimmerman < > alan.zimm at gmail.com> wrote: > >> I am working on ghc-exactprint, and need to flag points where layout must >> be preserved, and considering the `if` statement. >> >> My understanding of the layout rules for if then else is that the `then` >> has to start more to the right than the `if`. >> > > I believe you are looking for DoAndIfThenElse. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Tue Mar 10 17:16:47 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 10 Mar 2015 17:16:47 +0000 Subject: [Haskell-cafe] Basic question about recursive data type... In-Reply-To: References: Message-ID: It?s coming back to me??my OO brain is trying to tell me to constrain the types?. > {-# LANGUAGE GADTs, TypeFamilies, TypeOperators, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances, FlexibleContexts #-} This works > data Next input output where > End :: Next () () > Next :: (input -> (Next input2 output2)) -> Next input (Next input2 output2) From: Haskell-Cafe [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Nicholls, Mark Sent: 10 March 2015 2:54 PM To: Haskell Cafe Subject: [Haskell-cafe] Basic question about recursive data type... a long time since I did some Haskell and my brain has reverted to its OO dogma... > {-# LANGUAGE GADTs, TypeFamilies, TypeOperators, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances, FlexibleContexts #-} consider > data Next input output where > End :: Next () () > Next :: (input -> output) -> Next input output this is a bit like curried function... I can construct > y :: Next Integer (Next String (Next () ())) > y = Next (\x -> > if (x == 1) then > Next (\y -> > if (y == "s") then > End > else > End) > else > Next (\y -> > if (y == "t") then > End > else > End)) which is a bit like "Integer->String->()" I can execute it... > exe :: Next input output -> input -> output > exe (Next f) i = f i > exe End () = () > p :: Next String (Next () ()) > p = exe y 1 ok.... but how do I constrain all the outputs to be of type Next? I don't want this to be valid > z :: Next Integer Integer > z = Next (\x -> x + 1) CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.gibiansky at gmail.com Tue Mar 10 18:05:41 2015 From: andrew.gibiansky at gmail.com (Andrew Gibiansky) Date: Tue, 10 Mar 2015 11:05:41 -0700 Subject: [Haskell-cafe] Layout rules for if then else In-Reply-To: References: Message-ID: Just to be clear, I *think* layout rules don't apply here at all, actually. If I understand correctly, "layout" has to do with turning spacing into braces and semicolons. A new line is a semicolon. A brace group is inserted around things that are aligned where a brace group actually makes sense. e.g. let x = y y = z in ... gets turned into roughly let { x = y ; y = z } in ... if-then-else however is just an expression, like a ternary operator, so it doesn't need any semicolons or braces. So layout is unrelated, except for the issue of `do` blocks inserting semicolons into `if-then-else` groups (and that's what DoAndIfThenElse fixes). -- Andrew PS. I am very glad someone is working on ghc-exactprint. It's a really important step in developing better Haskell tooling, imho. Doing that sort of thing right now with haskell-src-exts right now is a real pain (see half of the closed issues on hindent... about how it doesn't preserve formatting in many places.) On Tue, Mar 10, 2015 at 9:25 AM, Alan & Kim Zimmerman wrote: > Ok, adding a do does make a difference. More complexity. > > Thanks > Alan > > On Tue, Mar 10, 2015 at 6:06 PM, Brandon Allbery > wrote: > >> On Tue, Mar 10, 2015 at 12:01 PM, Alan & Kim Zimmerman < >> alan.zimm at gmail.com> wrote: >> >>> I am working on ghc-exactprint, and need to flag points where layout >>> must be preserved, and considering the `if` statement. >>> >>> My understanding of the layout rules for if then else is that the `then` >>> has to start more to the right than the `if`. >>> >> >> I believe you are looking for DoAndIfThenElse. >> >> -- >> brandon s allbery kf8nh sine nomine >> associates >> allbery.b at gmail.com >> ballbery at sinenomine.net >> unix, openafs, kerberos, infrastructure, xmonad >> http://sinenomine.net >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alan.zimm at gmail.com Tue Mar 10 18:14:12 2015 From: alan.zimm at gmail.com (Alan & Kim Zimmerman) Date: Tue, 10 Mar 2015 20:14:12 +0200 Subject: [Haskell-cafe] Layout rules for if then else In-Reply-To: References: Message-ID: Thanks, I interpret layout as you say, but with the aim of preserving valid spacing if syntax elements are moved around as a result of AST modifications. My implementation flags those points, such as the contents of a let .. in, or a do expression. In terms of ghc-exactprint, I actually think the technique I am using of converting all the original absolute locations to relative ones, editing the AST and then outputting it should be transferrable to haskell-src-exts too. Alan On Tue, Mar 10, 2015 at 8:05 PM, Andrew Gibiansky < andrew.gibiansky at gmail.com> wrote: > Just to be clear, I *think* layout rules don't apply here at all, > actually. > > If I understand correctly, "layout" has to do with turning spacing into > braces and semicolons. A new line is a semicolon. A brace group is inserted > around things that are aligned where a brace group actually makes sense. > > e.g. > > let x = y > y = z > in ... > > gets turned into roughly > > let { x = y > ; y = z > } in ... > > if-then-else however is just an expression, like a ternary operator, so it > doesn't need any semicolons or braces. So layout is unrelated, except for > the issue of `do` blocks inserting semicolons into `if-then-else` groups > (and that's what DoAndIfThenElse fixes). > > -- Andrew > > PS. I am very glad someone is working on ghc-exactprint. It's a really > important step in developing better Haskell tooling, imho. Doing that sort > of thing right now with haskell-src-exts right now is a real pain (see half > of the closed issues on hindent... about how it doesn't preserve formatting > in many places.) > > On Tue, Mar 10, 2015 at 9:25 AM, Alan & Kim Zimmerman > wrote: > >> Ok, adding a do does make a difference. More complexity. >> >> Thanks >> Alan >> >> On Tue, Mar 10, 2015 at 6:06 PM, Brandon Allbery >> wrote: >> >>> On Tue, Mar 10, 2015 at 12:01 PM, Alan & Kim Zimmerman < >>> alan.zimm at gmail.com> wrote: >>> >>>> I am working on ghc-exactprint, and need to flag points where layout >>>> must be preserved, and considering the `if` statement. >>>> >>>> My understanding of the layout rules for if then else is that the >>>> `then` has to start more to the right than the `if`. >>>> >>> >>> I believe you are looking for DoAndIfThenElse. >>> >>> -- >>> brandon s allbery kf8nh sine nomine >>> associates >>> allbery.b at gmail.com >>> ballbery at sinenomine.net >>> unix, openafs, kerberos, infrastructure, xmonad >>> http://sinenomine.net >>> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dwc at cs.yale.edu Tue Mar 10 23:29:37 2015 From: dwc at cs.yale.edu (Daniel Winograd-Cort) Date: Tue, 10 Mar 2015 19:29:37 -0400 Subject: [Haskell-cafe] ANNOUNCE: Euterpea 1.0.0 Message-ID: We are happy to announce the official release of Euterpea! Euterpea is a library for computer music research, education, and development, providing both note-level and signal-level abstractions. It is a descendant of Haskore and HasSound and is intended for both educational purposes as well as serious computer music applications. Euterpea is suitable for high-level music representation, algorithmic composition, and analysis; mid-level concepts such as MIDI; and low-level audio processing, sound synthesis, and instrument design. It also includes an extensible system for building musical user interfaces using UISF, a new AFRP UI library. Euterpea's performance is sufficient for most real-time midi applications and some basic real-time audio synthesis. Try it out with cabal install Euterpea You can find more at... euterpea.com - a site for a quick start, tutorials, and working examples haskell.cs.yale.edu/euterpea - more detailed info and help, including an in-progress textbook (Haskell School of Music) hackage.haskell.org/package/Euterpea - the hackage page with some docs -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdl at 60hz.org Wed Mar 11 05:45:32 2015 From: mdl at 60hz.org (Mark Laws) Date: Wed, 11 Mar 2015 14:45:32 +0900 Subject: [Haskell-cafe] Deriving Show for non-regular data types Message-ID: Hi, As part of studying Okasaki's PFDS book, I wanted to add Show support for each of the data structures, and some have proven to be challenging, as some of the types are non-regular and automatic derivation of Show doesn't work. I've been able to add some code that introduces a supplementary type class that serves as a way to pass "proof" that the wrapping data type supports traversal for Show-ability, but the solution seems unsatisfactory. I would greatly appreciate any suggestions for improvements. I've attached the code; the relevant bits are in BankersDeque.hs, Example.hs, NestedShowable.hs, and SimpleCatenableDeque.hs. The same code is available here: https://gist.github.com/drvink/30fb2a2b257fc99af281 Thanks, Mark Laws -- |v\ /\ |\ |< |_ /\ \^| // -------------- next part -------------- A non-text attachment was scrubbed... Name: pfds-haskell.tar.gz Type: application/x-gzip Size: 2288 bytes Desc: not available URL: From david.feuer at gmail.com Wed Mar 11 05:59:58 2015 From: david.feuer at gmail.com (David Feuer) Date: Wed, 11 Mar 2015 01:59:58 -0400 Subject: [Haskell-cafe] Deriving Show for non-regular data types In-Reply-To: References: Message-ID: You may want to look at the Show1 class, which may or may not help you any. You also may or may not find Ralf Hinze's paper "Numerical Representations as Higher-Order Nested Datatypes" helpful. Nested types can be extremely efficient in certain situations, and it's not *usually* too terribly hard to read code that uses them, but writing it is an entirely different story. In some cases, you can get good results using GADTs to enforce your shape invariants, and they tend to be a lot easier to work with. On Mar 11, 2015 1:45 AM, "Mark Laws" wrote: > Hi, > > As part of studying Okasaki's PFDS book, I wanted to add Show support > for each of the data structures, and some have proven to be challenging, > as some of the types are non-regular and automatic derivation of Show > doesn't work. I've been able to add some code that introduces a > supplementary type class that serves as a way to pass "proof" that the > wrapping data type supports traversal for Show-ability, but the solution > seems unsatisfactory. I would greatly appreciate any suggestions for > improvements. I've attached the code; the relevant bits are in > BankersDeque.hs, Example.hs, NestedShowable.hs, and > SimpleCatenableDeque.hs. The same code is available here: > > https://gist.github.com/drvink/30fb2a2b257fc99af281 > > Thanks, > Mark Laws > > -- > |v\ /\ |\ |< |_ /\ \^| // > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From K.Bleijenberg at lijbrandt.nl Wed Mar 11 07:26:08 2015 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Wed, 11 Mar 2015 08:26:08 +0100 Subject: [Haskell-cafe] missing rseq? Message-ID: <000001d05bcc$a4774400$ed65cc00$@lijbrandt.nl> In the book Parallel and Concurrent Programming in Haskell http://chimera.labs.oreilly.com/books/1230000000929/ch02.html#sec_par-eval-s udoku2 a list of sudokus is solved in parallel. In version 2 (sudoku2.hs) the program splits the list of sudokus in 2 seperate lists and solves these lists in parallel. In version3 (sudoku3.hs) parMap is used. What I don't understand is why in sudoku2 the program has to wait until the parallel computations are finished with rseqs while in sudoku3.hs there is no rseq (not in the main program nor in parMap)? Why can't program sudoku3.hs terminate before all parallel calculations are finished as in Example 2-1. rpar/rpar? Kees -------------- next part -------------- An HTML attachment was scrubbed... URL: From neto at netowork.me Wed Mar 11 09:39:11 2015 From: neto at netowork.me (Ernesto Rodriguez) Date: Wed, 11 Mar 2015 10:39:11 +0100 Subject: [Haskell-cafe] Multiple compiles with cabal Message-ID: Dear Cafe, I have a program [1] which half of the code is meant to be compiled with GHCJS and the other half with GHC (Or any other Haskell compiler). Currently I do the compilation separately and simply include the compiled JS as a static resource for the regular project. Has anyone run into a similar scenario? Can Cabal handle this? Is there some way of having multiple compiles w/o requiring a shell script to initialize them? Thank you & Cheers N. [1] https://github.com/netogallo/Cryptographer (annoying bc Github now believes my project is like 99% JS since the GHCJS runtime is bundled as a static resource) -- Ernesto Rodriguez Masters Student Computer Science Utrecht University www.netowork.me github.com/netogallo -------------- next part -------------- An HTML attachment was scrubbed... URL: From shumovichy at gmail.com Wed Mar 11 14:07:12 2015 From: shumovichy at gmail.com (Yuras Shumovich) Date: Wed, 11 Mar 2015 17:07:12 +0300 Subject: [Haskell-cafe] missing rseq? In-Reply-To: <000001d05bcc$a4774400$ed65cc00$@lijbrandt.nl> References: <000001d05bcc$a4774400$ed65cc00$@lijbrandt.nl> Message-ID: <1426082832.3012.11.camel@gmail.com> On Wed, 2015-03-11 at 08:26 +0100, Kees Bleijenberg wrote: > In the book Parallel and Concurrent Programming in Haskell > http://chimera.labs.oreilly.com/books/1230000000929/ch02.html#sec_par-eval-s > udoku2 a list of sudokus is solved in parallel. > > In version 2 (sudoku2.hs) the program splits the list of sudokus in 2 > seperate lists and solves these lists in parallel. > > In version3 (sudoku3.hs) parMap is used. > > What I don't understand is why in sudoku2 the program has to wait until the > parallel computations are finished with rseqs while in sudoku3.hs there is > no rseq (not in the main program nor in parMap)? Why can't program > sudoku3.hs terminate before all parallel calculations are finished as in > Example 2-1. rpar/rpar? I believe `rseq` is omitted in `sudoku3` for a reason. In `sudoku2` we spawn two relatively heavy sparks, and the results of them are immediately consumed. So if we don't wait for the sparks, the main thread will start evaluating one of the thunks. Most likely the thunk will be evaluated twice -- by the main thread and the spark. That is called `fizzled` spark. In `sudoku3` we have a lot of light sparks. When we spawn the last spark, the first one most like is already evaluated (aka `converted`), and its result can be immediately consumed by `length`. Thanks, Yuras -- Haskell Exists http://blog.haskell-exists.com/yuras From shumovichy at gmail.com Wed Mar 11 14:11:51 2015 From: shumovichy at gmail.com (Yuras Shumovich) Date: Wed, 11 Mar 2015 17:11:51 +0300 Subject: [Haskell-cafe] missing rseq? In-Reply-To: <1426082832.3012.11.camel@gmail.com> References: <000001d05bcc$a4774400$ed65cc00$@lijbrandt.nl> <1426082832.3012.11.camel@gmail.com> Message-ID: <1426083111.3012.14.camel@gmail.com> On Wed, 2015-03-11 at 17:07 +0300, Yuras Shumovich wrote: > On Wed, 2015-03-11 at 08:26 +0100, Kees Bleijenberg wrote: > > In the book Parallel and Concurrent Programming in Haskell > > http://chimera.labs.oreilly.com/books/1230000000929/ch02.html#sec_par-eval-s > > udoku2 a list of sudokus is solved in parallel. > > > > In version 2 (sudoku2.hs) the program splits the list of sudokus in 2 > > seperate lists and solves these lists in parallel. > > > > In version3 (sudoku3.hs) parMap is used. > > > > What I don't understand is why in sudoku2 the program has to wait until the > > parallel computations are finished with rseqs while in sudoku3.hs there is > > no rseq (not in the main program nor in parMap)? Why can't program > > sudoku3.hs terminate before all parallel calculations are finished as in > > Example 2-1. rpar/rpar? > > I believe `rseq` is omitted in `sudoku3` for a reason. > > In `sudoku2` we spawn two relatively heavy sparks, and the results of > them are immediately consumed. So if we don't wait for the sparks, the > main thread will start evaluating one of the thunks. Most likely the > thunk will be evaluated twice -- by the main thread and the spark. That > is called `fizzled` spark. > > In `sudoku3` we have a lot of light sparks. When we spawn the last > spark, the first one most like is already evaluated (aka `converted`), > and its result can be immediately consumed by `length`. Also I should note that `rseq` seems to be broken now, because it always produces one `converted` and one `fizzled` spark for `sudoku2` in my experience. > > Thanks, > Yuras > -- Haskell Exists http://blog.haskell-exists.com/yuras From voldermort at hotmail.com Wed Mar 11 15:25:18 2015 From: voldermort at hotmail.com (Jeremy) Date: Wed, 11 Mar 2015 08:25:18 -0700 (MST) Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? Message-ID: <1426087518070-5766854.post@n5.nabble.com> Haskell Weekly News used to be syndicated on http://contemplatecode.blogspot.com/ and http://sequence.complete.org/hwn. sequence only has HWN up to March 2010, while contemplatecode goes up to the beginning of February. Is there any way that I can subscribe to HWN (preferably as RSS/Atom), and not other stuff that doesn't interest me? -- View this message in context: http://haskell.1045720.n5.nabble.com/Where-is-Haskell-Weekly-News-syndicated-tp5766854.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. From alexispraga at mailoo.org Wed Mar 11 16:21:10 2015 From: alexispraga at mailoo.org (Alexis Praga) Date: Wed, 11 Mar 2015 17:21:10 +0100 Subject: [Haskell-cafe] References on haskellwiki Message-ID: <20150311162110.GA44822@alex.alexdebian> Hi, I've begun to do some formatting on old Monad Readers editions on Haskell Wiki. Unfortunately, there is no support for proper references support. Can the admin add the "Cite" extension ? It would help a lot. Thanks -- Alexis Praga, PhD Student (CERFACS) GPG key : AD4A AF6D BB5C 042F 9422 1223 06E1 C1BF E287 65D0 From ky3 at atamo.com Wed Mar 11 16:21:56 2015 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Wed, 11 Mar 2015 23:21:56 +0700 Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? In-Reply-To: <1426087518070-5766854.post@n5.nabble.com> References: <1426087518070-5766854.post@n5.nabble.com> Message-ID: On Wed, Mar 11, 2015 at 10:25 PM, Jeremy wrote: > Is there any way that I can subscribe to HWN (preferably as RSS/Atom), and > not other stuff that doesn't interest me? > At this time, no, unless someone would like to step up and volunteer scraping the news and auto-pasting it into some RSS-enabled web journal. As editor, I can assure you that the news will always have the subject "Haskell Weekly News" and will always be published on the low-volume haskell@ list, so setting your email filters is the best bet for now. p.s. Is Tumblr a possibility? If anyone has any experience with it, please email me. I might try out their post by email feature here: https://www.tumblr.com/docs/en/posting#emailpostheader -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Wed Mar 11 17:50:35 2015 From: adam at bergmark.nl (Adam Bergmark) Date: Wed, 11 Mar 2015 18:50:35 +0100 Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? In-Reply-To: References: <1426087518070-5766854.post@n5.nabble.com> Message-ID: You can get RSS from tumblr at least so that would qualify :-) I haven't tried the e-mail feature, but I think you don't have to configure anything else to get it working. On Wed, Mar 11, 2015 at 5:21 PM, Kim-Ee Yeoh wrote: > > On Wed, Mar 11, 2015 at 10:25 PM, Jeremy wrote: > >> Is there any way that I can subscribe to HWN (preferably as RSS/Atom), and >> not other stuff that doesn't interest me? >> > > At this time, no, unless someone would like to step up and volunteer > scraping the news and auto-pasting it into some RSS-enabled web journal. > > As editor, I can assure you that the news will always have the subject > "Haskell Weekly News" and will always be published on the low-volume > haskell@ list, so setting your email filters is the best bet for now. > > p.s. Is Tumblr a possibility? If anyone has any experience with it, please > email me. I might try out their post by email feature here: > > https://www.tumblr.com/docs/en/posting#emailpostheader > > -- Kim-Ee > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Wed Mar 11 17:57:18 2015 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Thu, 12 Mar 2015 00:57:18 +0700 Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? In-Reply-To: References: <1426087518070-5766854.post@n5.nabble.com> Message-ID: > You can get RSS from tumblr at least so that would qualify :-) > Yes, my thoughts precisely. > I haven't tried the e-mail feature, but I think you don't have to > configure anything else to get it working. > Let's see how it turns out. -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From trebla at vex.net Wed Mar 11 18:22:54 2015 From: trebla at vex.net (Albert Y. C. Lai) Date: Wed, 11 Mar 2015 14:22:54 -0400 Subject: [Haskell-cafe] Is there a name for this? In-Reply-To: References: <53086272.774795.1425831108021.JavaMail.yahoo@mail.yahoo.com> <54FC7A42.2000100@vex.net> Message-ID: <550087FE.5070502@vex.net> On 2015-03-09 11:26 AM, Ben Franksen wrote: > Albert Y. C. Lai wrote: >> Choose one: >> >> Foo' is a free Foo >> >> Foo' is a limit of the diagram of Foo >> >> Foo' is a terminal object of the [sub]category of Foo > > Interesting. Is the last variant how "free " is usually defined? > Or is it a coincidence that the two, well, coincide here? I remember I have > seen other definitions that looked a lot less easy to understand. I have not checked, and too lazy to. The usual "free" is the less-easy-to-understand one: you need a forgetful functor, then you need its left adjoint, and you call it your free functor. Then the target objects hit by the free functor are the free things. From sumit.sahrawat.apm13 at iitbhu.ac.in Wed Mar 11 21:45:03 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Thu, 12 Mar 2015 03:15:03 +0530 Subject: [Haskell-cafe] Mathematical functions with multiple arguments Message-ID: Hi everybody, I have a function of type plot :: ([Double] -> Double) -- A function to plot -> [(Double, Double)] -- Range for all arguments -> IO () I want to enforce the fact that ranges for all arguments should be provided. Is there a way to make the type system enforce it? -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Wed Mar 11 21:56:16 2015 From: adam at bergmark.nl (Adam Bergmark) Date: Wed, 11 Mar 2015 22:56:16 +0100 Subject: [Haskell-cafe] Mathematical functions with multiple arguments In-Reply-To: References: Message-ID: If I understand you correctly you seem to want dependent types, this article uses the same example you need, promoting the length of a vector/list to the type level: https://www.fpcomplete.com/user/konn/prove-your-haskell-for-great-safety/dependent-types-in-haskell You'd end up with `plot :: (Vector n Double -> Double) -> Vector n (Double, Double) -> IO ()' where `n' is the length of the vector. HTH, Adam On Wed, Mar 11, 2015 at 10:45 PM, Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote: > Hi everybody, > > I have a function of type > > plot :: ([Double] -> Double) -- A function to plot > -> [(Double, Double)] -- Range for all arguments > -> IO () > > I want to enforce the fact that ranges for all arguments should be > provided. > Is there a way to make the type system enforce it? > > -- > Regards > > Sumit Sahrawat > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sumit.sahrawat.apm13 at iitbhu.ac.in Wed Mar 11 21:58:51 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Thu, 12 Mar 2015 03:28:51 +0530 Subject: [Haskell-cafe] Mathematical functions with multiple arguments In-Reply-To: References: Message-ID: I was wondering whether it was possible using fixed-vector, ut dependent types seem to be a new thing I can experiment with. Thanks for the quick reply. On 12 March 2015 at 03:26, Adam Bergmark wrote: > If I understand you correctly you seem to want dependent types, this > article uses the same example you need, promoting the length of a > vector/list to the type level: > https://www.fpcomplete.com/user/konn/prove-your-haskell-for-great-safety/dependent-types-in-haskell > > You'd end up with `plot :: (Vector n Double -> Double) -> Vector n > (Double, Double) -> IO ()' where `n' is the length of the vector. > > HTH, > Adam > > > On Wed, Mar 11, 2015 at 10:45 PM, Sumit Sahrawat, Maths & Computing, IIT > (BHU) wrote: > >> Hi everybody, >> >> I have a function of type >> >> plot :: ([Double] -> Double) -- A function to plot >> -> [(Double, Double)] -- Range for all arguments >> -> IO () >> >> I want to enforce the fact that ranges for all arguments should be >> provided. >> Is there a way to make the type system enforce it? >> >> -- >> Regards >> >> Sumit Sahrawat >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Thu Mar 12 02:36:30 2015 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Thu, 12 Mar 2015 09:36:30 +0700 Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? In-Reply-To: References: <1426087518070-5766854.post@n5.nabble.com> Message-ID: An update on the Tumblr for HWN experiment: Tumblr's email gateway is supposed to support markdown, although the latter already requires additional work on my part. However, their parsing doesn't understand links mangled by mail agents that enforce the 70-character wraparound rule. I've even tried using a *nix command-line mail that allows arbitrarily long lines. I now discover that Tumblr chokes on anchor tags like this: http://some.where/link#anchor and parses #anchor as a Tumblr-specific entry-classification tag. Why oh why can't Tumblr take in HTML-ized email and Do The Right Thing. The short of it is that I've blown my HWN time budget trying to make rss work via Tumblr. I ask that you and anyone else inconvenienced by the absence of syndication to use workarounds for now. If I find more spare time next month, I'll experiment further. p.s. Any assistance on HWN is always welcome. -- Kim-Ee On Thu, Mar 12, 2015 at 12:57 AM, Kim-Ee Yeoh wrote: > > You can get RSS from tumblr at least so that would qualify :-) >> > > Yes, my thoughts precisely. > > >> I haven't tried the e-mail feature, but I think you don't have to >> configure anything else to get it working. >> > > Let's see how it turns out. > > -- Kim-Ee > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spopejoy at panix.com Thu Mar 12 02:56:33 2015 From: spopejoy at panix.com (Stuart Popejoy) Date: Wed, 11 Mar 2015 22:56:33 -0400 Subject: [Haskell-cafe] ANNOUNCE: Euterpea 1.0.0 In-Reply-To: References: Message-ID: <55010061.2090201@panix.com> A blocker for me using Euterpea in the past is it being largely broken on OS X (vs Windows, didn't try on Linux). Does this release improve on that situation? On 3/10/15, 7:29 PM, Daniel Winograd-Cort wrote: > We are happy to announce the official release of Euterpea! Euterpea is > a library for computer music research, education, and development, > providing both note-level and signal-level abstractions. It is a > descendant of Haskore and HasSound and is intended for both > educational purposes as well as serious computer music applications. > Euterpea is suitable for high-level music representation, algorithmic > composition, and analysis; mid-level concepts such as MIDI; and > low-level audio processing, sound synthesis, and instrument design. It > also includes an extensible system for building musical user > interfaces using UISF, a new AFRP UI library. Euterpea's performance > is sufficient for most real-time midi applications and some basic > real-time audio synthesis. > > Try it out with > cabal install Euterpea > > You can find more at... > euterpea.com - a site for a quick start, > tutorials, and working examples > haskell.cs.yale.edu/euterpea - > more detailed info and help, including an in-progress textbook > (Haskell School of Music) > hackage.haskell.org/package/Euterpea > - the hackage page with > some docs > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From vogt.adam at gmail.com Thu Mar 12 02:58:31 2015 From: vogt.adam at gmail.com (adam vogt) Date: Wed, 11 Mar 2015 22:58:31 -0400 Subject: [Haskell-cafe] Mathematical functions with multiple arguments In-Reply-To: References: Message-ID: On Wed, Mar 11, 2015 at 5:56 PM, Adam Bergmark wrote: > If I understand you correctly you seem to want dependent types, this > article uses the same example you need, promoting the length of a > vector/list to the type level: > https://www.fpcomplete.com/user/konn/prove-your-haskell-for-great-safety/dependent-types-in-haskell > > You'd end up with `plot :: (Vector n Double -> Double) -> Vector n > (Double, Double) -> IO ()' where `n' is the length of the vector. > It seems like tuples are more straightforward: class Plot x where plot :: (x -> Double) -> x -- ^ lower bound -> x -- ^ upper bound -> IO () instance Plot Double where plot = plot2d instance Plot (Double,Double) where plot = plot3d And then that lets you do something like: instance Plot (Double, Shingle Double) where plot = plot2d_faceted -- | https://stat.ethz.ch/R-manual/R-devel/library/lattice/html/shingles.html data Shingle a = Shingle [(a,a)] a Regards, Adam Vogt -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Thu Mar 12 03:25:18 2015 From: vogt.adam at gmail.com (adam vogt) Date: Wed, 11 Mar 2015 23:25:18 -0400 Subject: [Haskell-cafe] Deriving Show for non-regular data types In-Reply-To: References: Message-ID: Hi Mark, This combination seems to work: instance (Show a, Show1 d) => Show (d a) where showsPrec = showsPrec1 deriving instance (Show (d a), Show1 d) => Show (SimpleCatDeque d a) But it needs overlapping instances. I don't see another way to express (Show (d a), Show (d (d a)), Show (d (d (d a))), ... ) in a way that ghc will lazily evaluate the ... Regards, Adam On Wed, Mar 11, 2015 at 1:59 AM, David Feuer wrote: > You may want to look at the Show1 class, which may or may not help you > any. You also may or may not find Ralf Hinze's paper "Numerical > Representations as Higher-Order Nested Datatypes" helpful. Nested types can > be extremely efficient in certain situations, and it's not *usually* too > terribly hard to read code that uses them, but writing it is an entirely > different story. In some cases, you can get good results using GADTs to > enforce your shape invariants, and they tend to be a lot easier to work > with. > On Mar 11, 2015 1:45 AM, "Mark Laws" wrote: > >> Hi, >> >> As part of studying Okasaki's PFDS book, I wanted to add Show support >> for each of the data structures, and some have proven to be challenging, >> as some of the types are non-regular and automatic derivation of Show >> doesn't work. I've been able to add some code that introduces a >> supplementary type class that serves as a way to pass "proof" that the >> wrapping data type supports traversal for Show-ability, but the solution >> seems unsatisfactory. I would greatly appreciate any suggestions for >> improvements. I've attached the code; the relevant bits are in >> BankersDeque.hs, Example.hs, NestedShowable.hs, and >> SimpleCatenableDeque.hs. The same code is available here: >> >> https://gist.github.com/drvink/30fb2a2b257fc99af281 >> >> Thanks, >> Mark Laws >> >> -- >> |v\ /\ |\ |< |_ /\ \^| // >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From c.lopez at kmels.net Thu Mar 12 03:41:55 2015 From: c.lopez at kmels.net (=?UTF-8?Q?Carlos_L=C3=B3pez=2DCamey?=) Date: Wed, 11 Mar 2015 21:41:55 -0600 Subject: [Haskell-cafe] Multiple compiles with cabal In-Reply-To: References: Message-ID: Hi Ernesto, cool project! Have you considered shake as an alternative to a shell script? There is I believe "a frontend for the build" written for cabal https://github.com/samplecount/shake-cabal-build It'd be possible to split your build in two cabal packages, i.e. make the GHC build depend on the GHCJS build, by writing two shakefile.hs build files. Or, you could write one shakefile.hs so that you can compile everything with one "cabal install". 2015-03-11 3:39 GMT-06:00 Ernesto Rodriguez : > Dear Cafe, > > I have a program [1] which half of the code is meant to be compiled with > GHCJS and the other half with GHC (Or any other Haskell compiler). Currently > I do the compilation separately and simply include the compiled JS as a > static resource for the regular project. > > Has anyone run into a similar scenario? Can Cabal handle this? Is there some > way of having multiple compiles w/o requiring a shell script to initialize > them? > > Thank you & Cheers > > N. > > [1] https://github.com/netogallo/Cryptographer (annoying bc Github now > believes my project is like 99% JS since the GHCJS runtime is bundled as a > static resource) > > -- > Ernesto Rodriguez > > Masters Student > Computer Science > Utrecht University > > www.netowork.me > github.com/netogallo > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From rustompmody at gmail.com Thu Mar 12 04:57:56 2015 From: rustompmody at gmail.com (Rustom Mody) Date: Thu, 12 Mar 2015 10:27:56 +0530 Subject: [Haskell-cafe] David Turner quote on lisp and FP Message-ID: There is this quote: *It needs to be said very firmly that LISP is not a functional language at all. My suspicion is that the success of Lisp set back the development of a properly functional style of programming by at least ten years.* David Turner found here and there on the net eg http://dis.4chan.org/read/prog/1376090701 Does anyone have/know the original reference? Thanks Rusi -- http://blog.languager.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at proclivis.com Thu Mar 12 06:07:31 2015 From: mike at proclivis.com (Michael Jones) Date: Thu, 12 Mar 2015 00:07:31 -0600 Subject: [Haskell-cafe] TH not compiling when writing the code directly does Message-ID: <5CA73E98-7D2E-44A2-AAC8-FF0F1EB3354A@proclivis.com> I?m stuck getting a TH expansion to compile. When I take the generated code and compile it directly, it is fine. But when expanding and compiling, it fails. The problem seems related to instanceD, where I provide the type as: (appT (appT (conT devName') (varT $ mkName "Word8")) (varT $ mkName "BV?)) which expands to: IDENTIFICATION__MODEL_ID Word8 BV No matter what I put for the second type (BV), it generates the compile error. For example, Word8 or Word16 gives the same error. But if I take the resulting expression and just put it into the file and compile, it compiles fine. So something about expansion is causing the problem. Is there some more correct way to make the expression rather than nesting two appT? Any ideas? Note: the generation of the functions with (map (\f -> returnQ f) (concat funs)) is ugly in my opinion. I could not find the right way to express this. So all ideas welcome. Mike GEN DEC -------------- makeInstance :: String -> [String] -> Q [Dec] makeInstance devName regNames = do let devName' = mkName devName let regNames' = map mkName regNames let ctx = return [] :: Q [Pred] funs <- mapM (\regName -> [d| $(varP regName) = $(varE $ mkName "writeReadField") $(stringE $ nameBase regName)(get fi) (set fi) where fi = $(conE $ mkName "FieldInfo") 3 1 get info = $(varE $ mkName "getValue") info set info = $(varE $ mkName "setValue") info |]) regNames' instance_ <- instanceD ctx (appT (appT (conT devName') (varT $ mkName "Word8")) (varT $ mkName "BV")) (map (\f -> returnQ f) (concat funs)) return [instance_] COMPILE ERROR ------------------------- src/TestFields.hs:175:3: Illegal type variable name: ?BV? When splicing a TH declaration: instance IDENTIFICATION__MODEL_ID Word8 BV where id = writeReadField "id" (get_0 fi_1) (set_2 fi_1) where fi_1 = FieldInfo 3 1 get_0 info_3 = getValue info_3 set_2 info_4 = setValue info_4 ids = writeReadField "ids" (get_5 fi_6) (set_7 fi_6) where fi_6 = FieldInfo 3 1 get_5 info_8 = getValue info_8 set_7 info_9 = setValue info_9 From sean.leather at gmail.com Thu Mar 12 06:22:54 2015 From: sean.leather at gmail.com (Sean Leather) Date: Thu, 12 Mar 2015 08:22:54 +0200 Subject: [Haskell-cafe] David Turner quote on lisp and FP In-Reply-To: References: Message-ID: On Thu, Mar 12, 2015 at 6:57 AM, Rustom Mody wrote: > There is this quote: > > *It needs to be said very firmly that LISP is not a functional language at > all. My suspicion is that the success of Lisp set back the development of a > properly functional style of programming by at least ten years.* David > Turner > > > found here and there on the net > eg http://dis.4chan.org/read/prog/1376090701 > > Does anyone have/know the original reference? > As the 10th entry on my version of Google, I found: Michael J C Gordon Programming Language Theory and its Implementation: Applicative and Imperative Paradigms http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.132.5717&rep=rep1&type=pdf Gordon provides a more complete version of the quote on p. 148: Here , for example, is a quotation by David Turner from the discussion after his paper in the book Mathematical Logic and Programming Languages: It needs to be said very firmly that LISP, at least as represented by the dialects in common use, is not a functional language at all. LISP does have a functional subset, but that is a rather inconvenient programming language and there exists no significant body of programs written in it. Almost all serious programming in LISP makes heavy use of side effects and other referentially opaque features. I think that the historical importance of LISP is that it was the fi rst language to provide ?garbage- collected? heap storage. This was a very important step forward. For the development of functional programming , however, I feel that the contribution of LISP has been a negative one. My suspicion is that the success of LISP set back the development of a properly functional style of programming by at least ten years. The cited paper for the quote is: Turner , DA. Functional programs as executable specifications, in Hoare CAR and Shepherdson JC ( eds.) Mathematical Logic and Programming Languages Prentice Hall, 1985. http://rsta.royalsocietypublishing.org/content/312/1522/363 The quote is the discussion for the paper, found on p. 387. Regards, Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Thu Mar 12 07:20:19 2015 From: rustompmody at gmail.com (Rustom Mody) Date: Thu, 12 Mar 2015 12:50:19 +0530 Subject: [Haskell-cafe] David Turner quote on lisp and FP In-Reply-To: References: Message-ID: On Thu, Mar 12, 2015 at 11:52 AM, Sean Leather wrote: > On Thu, Mar 12, 2015 at 6:57 AM, Rustom Mody wrote: > >> There is this quote: >> >> *It needs to be said very firmly that LISP is not a functional language >> at all. My suspicion is that the success of Lisp set back the development >> of a properly functional style of programming by at least ten years.* >> David Turner >> >> >> found here and there on the net >> eg http://dis.4chan.org/read/prog/1376090701 >> >> Does anyone have/know the original reference? >> > > As the 10th entry on my version of Google, I found: > > Michael J C Gordon > Programming Language Theory and its Implementation: Applicative and > Imperative Paradigms > > http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.132.5717&rep=rep1&type=pdf > > Gordon provides a more complete version of the quote on p. 148: > > Here , for example, is a quotation by David Turner from the discussion > after his paper in the book Mathematical Logic and Programming Languages: > > It needs to be said very firmly that LISP, at least as represented by the > dialects in common use, is not a functional language at all. LISP does have > a functional subset, but that is a rather inconvenient programming language > and there exists no significant body of programs written in it. Almost all > serious programming in LISP makes heavy use of side effects and other > referentially opaque features. > > I think that the historical importance of LISP is that it was the fi rst > language to provide ?garbage- collected? heap storage. This was a very > important step forward. For the development of functional programming , > however, I feel that the contribution of LISP has been a negative one. My > suspicion is that the success of LISP set back the development of a > properly functional style of programming by at least ten years. > > > The cited paper for the quote is: > > Turner , DA. Functional programs as executable specifications, in Hoare > CAR and Shepherdson JC ( eds.) Mathematical Logic and Programming Languages > Prentice Hall, 1985. > http://rsta.royalsocietypublishing.org/content/312/1522/363 > > The quote is the discussion for the paper, found on p. 387. > > Regards, > Sean > Thanks Sean for the very thorough search-n-time-travel For those who may be interested here is another curiosity: http://www.infoq.com/interviews/Steele-Interviews-John-McCarthy wherein McCarthy attributes the idea of functional programming to Fortran and Backus -- I must say I find that striking -- how things have turned in 50 years! All this is towards a lecture on programming paradigms that I am preparing. If there are other such juicy nuggets, I'll be pleased to receive them Rusi -- http://blog.languager.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.leather at gmail.com Thu Mar 12 07:46:37 2015 From: sean.leather at gmail.com (Sean Leather) Date: Thu, 12 Mar 2015 09:46:37 +0200 Subject: [Haskell-cafe] David Turner quote on lisp and FP In-Reply-To: References: Message-ID: On Thu, Mar 12, 2015 at 9:20 AM, Rustom Mody wrote: > For those who may be interested here is another curiosity: > http://www.infoq.com/interviews/Steele-Interviews-John-McCarthy > > wherein McCarthy attributes the idea of functional programming to Fortran > and Backus -- I must say I find that striking -- how things have turned in > 50 years! > That makes sense. See Backus's language ?FP? and ?Can Programming Be Liberated from the von Neumann Style? A Functional Style and Its Algebra of Programs? (http://web.stanford.edu/class/cs242/readings/backus.pdf ). > All this is towards a lecture on programming paradigms that I am preparing. > Good luck! :) Regards, Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Thu Mar 12 07:49:57 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Thu, 12 Mar 2015 00:49:57 -0700 Subject: [Haskell-cafe] Bad recursion? When can something be on both sides of an equation? Message-ID: Dear Haskellers, In another thread [1], I talked about computing what I've been lately calling the "total descendents" of a subset S of a graph: that is, the set of nodes t for which every maximal sequence of predecessors intersects S. I got it done, functionally [2]. But in the process I wrote something that hangs, and I can't figure out why. The problem arose in the following passage. (Glab stands for Graph Label, a synonym for Int.) totalDescendents :: S.Set Glab -> Graph -> S.Set Glab totalDescendents roots graph = b where (a,b,c,graph) = totalDescendentsCtrlr -- tricky (roots, S.empty, M.empty, graph) totalDescendentsCtrlr :: TotalDescendentsData -> TotalDescendentsData totalDescendentsCtrlr (a,b,c,gr) = if S.null a' -- fails, as does a == a' -- a == a' is one iteration slower but should have same effect then (a',b',c',gr') else totalDescendentsCtrlr (a',b',c',gr') where (a',b',c',gr') = visitUndetPrds $ visitTdSnvSucs (a,b,c,gr) Notice that in the equation marked "tricky", the object "graph" appears on both sides. I thought that was the problem, so I rewrote that line as the following: where (_,b,_,_) = totalDescendentsCtrlr and sure enough, the problem vanished. So I tried to distill that problem to something tiny, and came up with this: f (a) = a' where (a',b) = fBackend (a,b) -- tricky fBackend (a,b) = if a' < 1 then (a',b) else fBackend (a',b) where a' = a - 1 I see no substantive difference between the problem with the first body of code and the problem I expected f and fBackend to have -- but f and fBackend work fine! Any idea what might be happening? Thanks, Jeff [1] http://permalink.gmane.org/gmane.comp.lang.haskell.cafe/115353 [2] https://github.com/JeffreyBenjaminBrown/digraphs-on-text/blob/master/TotalDescendents.hs -------------- next part -------------- An HTML attachment was scrubbed... URL: From i.vysniauskas at gmail.com Thu Mar 12 09:20:43 2015 From: i.vysniauskas at gmail.com (=?UTF-8?Q?Ignas_Vy=C5=A1niauskas?=) Date: Thu, 12 Mar 2015 11:20:43 +0200 Subject: [Haskell-cafe] David Turner quote on lisp and FP In-Reply-To: References: Message-ID: Hi, As an extra reference, if you read through Turner's paper "Some History of Functional Programming Languages"[1], there is a bit of LISP history and explanations why it was not really a functional programming language at least until Scheme came out. -- Ignas [1]: www.cs.kent.ac.uk/people/staff/dat/tfp12/tfp12.pdf From Andrew.Butterfield at scss.tcd.ie Thu Mar 12 09:43:18 2015 From: Andrew.Butterfield at scss.tcd.ie (Andrew Butterfield) Date: Thu, 12 Mar 2015 09:43:18 +0000 Subject: [Haskell-cafe] David Turner quote on lisp and FP In-Reply-To: References: Message-ID: The 1986 IFIP World Congress was held in Trinity College Dublin in 1986, when I was a young postgrad. John McCarthy was one of the many distinguished speakers that visited at that time. I was writing a "silicon compiler" as a DSL in a strict subset of ML, and was keen to understand these (for me, new/strange) functional languages a little better. So I asked him was the use of the LAMBDA notation in Lisp because the language was functional, or was it just a convenient notation for anonymous functions? His answer was short and very definitive: he said it was a convenient notation - he didn't consider LISP to be a functional language. Cheers, Andrew > On 12 Mar 2015, at 04:57, Rustom Mody wrote: > > There is this quote: > It needs to be said very firmly that LISP is not a functional language at all. My suspicion is that the success of Lisp set back the development of a properly functional style of programming by at least ten years. David Turner > > found here and there on the net > eg http://dis.4chan.org/read/prog/1376090701 > > Does anyone have/know the original reference? > > Thanks > Rusi > -- > > http://blog.languager.org > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Andrew Butterfield School of Computer Science & Statistics Trinity College Dublin 2, Ireland -------------- next part -------------- An HTML attachment was scrubbed... URL: From voldermort at hotmail.com Thu Mar 12 09:46:36 2015 From: voldermort at hotmail.com (Jeremy) Date: Thu, 12 Mar 2015 02:46:36 -0700 (MST) Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? In-Reply-To: References: <1426087518070-5766854.post@n5.nabble.com> Message-ID: <1426153596537-5766901.post@n5.nabble.com> https://wiki.haskell.org/Haskell_Weekly_News needs some updating. -- View this message in context: http://haskell.1045720.n5.nabble.com/Where-is-Haskell-Weekly-News-syndicated-tp5766854p5766901.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Mar 12 09:46:45 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 12 Mar 2015 09:46:45 +0000 Subject: [Haskell-cafe] Bad recursion? When can something be on both sides of an equation? In-Reply-To: References: Message-ID: <20150312094645.GS8845@weber> On Thu, Mar 12, 2015 at 12:49:57AM -0700, Jeffrey Brown wrote: > totalDescendents :: S.Set Glab -> Graph -> S.Set Glab > totalDescendents roots graph = b > where (a,b,c,graph) = totalDescendentsCtrlr -- tricky > (roots, S.empty, M.empty, graph) > > totalDescendentsCtrlr :: TotalDescendentsData -> TotalDescendentsData > totalDescendentsCtrlr (a,b,c,gr) = > if S.null a' -- fails, as does a == a' > -- a == a' is one iteration slower but should have same effect > then (a',b',c',gr') > else totalDescendentsCtrlr (a',b',c',gr') > where (a',b',c',gr') = visitUndetPrds $ visitTdSnvSucs (a,b,c,gr) > > Notice that in the equation marked "tricky", the object "graph" appears on > both sides. I thought that was the problem, so I rewrote that line as the > following: > where (_,b,_,_) = totalDescendentsCtrlr > and sure enough, the problem vanished. It's somewhat bizarre to write where (a,b,c,graph) = totalDescendentsCtrlr -- tricky (roots, S.empty, M.empty, graph) if where (_,b,_,_) = totalDescendentsCtrlr works, but it's a fair question from a desire to understand what's going on. When you write where (a,b,c,graph) = totalDescendentsCtrlr -- tricky (roots, S.empty, M.empty, graph) you are introducing a new name `graph` which shadows the old one. The result `graph` is "fed back in" as the input. You are saying that the value of `graph` depends on itself, which in general can lead to looping. You probably meant where (a,b,c,graph') = totalDescendentsCtrlr (roots, S.empty, M.empty, graph) or, since many of those variables are unused, as you said where (_,b,_,_) = totalDescendentsCtrlr (roots, S.empty, M.empty, graph) > So I tried to distill that problem to something tiny, and came up with this: > > f (a) = a' > where (a',b) = fBackend (a,b) -- tricky > > fBackend (a,b) = > if a' < 1 > then (a',b) > else fBackend (a',b) > where a' = a - 1 > > I see no substantive difference between the problem with the first body of > code and the problem I expected f and fBackend to have -- but f and > fBackend work fine! `fBackend` never does anything with the value of `b` whereas presumably `visitUndetPrds` and `visitTdSnvSucs` do do something with the value of `graph`. Tom From voldermort at hotmail.com Thu Mar 12 10:26:41 2015 From: voldermort at hotmail.com (Jeremy) Date: Thu, 12 Mar 2015 03:26:41 -0700 (MST) Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? In-Reply-To: References: <1426087518070-5766854.post@n5.nabble.com> Message-ID: <1426156001184-5766904.post@n5.nabble.com> Maybe the good folks who maintain GHC weekly news can help you out? Perhaps they can be share the same publishing channel? -- View this message in context: http://haskell.1045720.n5.nabble.com/Where-is-Haskell-Weekly-News-syndicated-tp5766854p5766904.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. From adam at sandbergericsson.se Thu Mar 12 10:30:02 2015 From: adam at sandbergericsson.se (Adam Sandberg Eriksson) Date: Thu, 12 Mar 2015 11:30:02 +0100 Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? In-Reply-To: <1426156001184-5766904.post@n5.nabble.com> References: <1426087518070-5766854.post@n5.nabble.com> <1426156001184-5766904.post@n5.nabble.com> Message-ID: <1426156202.1603106.239316689.1315E9A1@webmail.messagingengine.com> The GHC news are syndicated through https://blog.haskell.org/ , but perhaps https://blog.haskell.org/ is a reasonable place? -- Adam Sandberg Eriksson On Thu, 12 Mar 2015, at 11:26 AM, Jeremy wrote: > Maybe the good folks who maintain GHC weekly news can help you out? > Perhaps > they can be share the same publishing channel? > > > > -- > View this message in context: > http://haskell.1045720.n5.nabble.com/Where-is-Haskell-Weekly-News-syndicated-tp5766854p5766904.html > Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From bertram.felgenhauer at googlemail.com Thu Mar 12 11:05:44 2015 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Thu, 12 Mar 2015 12:05:44 +0100 Subject: [Haskell-cafe] TH not compiling when writing the code directly does In-Reply-To: <5CA73E98-7D2E-44A2-AAC8-FF0F1EB3354A@proclivis.com> References: <5CA73E98-7D2E-44A2-AAC8-FF0F1EB3354A@proclivis.com> Message-ID: <20150312110544.GA3321@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Dear Michael, Michael Jones wrote: > I?m stuck getting a TH expansion to compile. When I take the generated > code and compile it directly, it is fine. But when expanding and > compiling, it fails. > > The problem seems related to instanceD, where I provide the type as: > > (appT (appT (conT devName') (varT $ mkName "Word8")) (varT $ mkName "BV?)) > [...] > Illegal type variable name: ?BV? Indeed BV is the name of a type *constructor*, not a type *variable*, so you need to use `conT` instead of `varT`: (appT (appT (conT devName') (conT $ mkName "Word8")) (conT $ mkName "BV?)) HTH, Bertram From voldermort at hotmail.com Thu Mar 12 12:01:05 2015 From: voldermort at hotmail.com (Jeremy) Date: Thu, 12 Mar 2015 05:01:05 -0700 (MST) Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? In-Reply-To: <1426156202.1603106.239316689.1315E9A1@webmail.messagingengine.com> References: <1426087518070-5766854.post@n5.nabble.com> <1426156001184-5766904.post@n5.nabble.com> <1426156202.1603106.239316689.1315E9A1@webmail.messagingengine.com> Message-ID: <1426161665932-5766907.post@n5.nabble.com> Did you mean https://ghc.haskell.org/trac/ghc/blog/? -- View this message in context: http://haskell.1045720.n5.nabble.com/Where-is-Haskell-Weekly-News-syndicated-tp5766854p5766907.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. From mike at proclivis.com Thu Mar 12 13:15:09 2015 From: mike at proclivis.com (Michael Jones) Date: Thu, 12 Mar 2015 07:15:09 -0600 Subject: [Haskell-cafe] TH not compiling when writing the code directly does In-Reply-To: <20150312110544.GA3321@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: <5CA73E98-7D2E-44A2-AAC8-FF0F1EB3354A@proclivis.com> <20150312110544.GA3321@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: <4E59E390-D21C-4258-A221-6A8A508013AA@proclivis.com> Bertram, Oh I see. The items passed to the devName? constructor must be constructors too. I guess I did not think of that way. I thought of them as filling holes in constructor, thus values. Too much OO in my past :-( I?m slowly rebuilding those old neurons into something better. Mike On Mar 12, 2015, at 5:05 AM, Bertram Felgenhauer wrote: > Dear Michael, > > Michael Jones wrote: >> I?m stuck getting a TH expansion to compile. When I take the generated >> code and compile it directly, it is fine. But when expanding and >> compiling, it fails. >> >> The problem seems related to instanceD, where I provide the type as: >> >> (appT (appT (conT devName') (varT $ mkName "Word8")) (varT $ mkName "BV?)) >> > [...] >> Illegal type variable name: ?BV? > > Indeed BV is the name of a type *constructor*, not a type *variable*, > so you need to use `conT` instead of `varT`: > > (appT (appT (conT devName') (conT $ mkName "Word8")) (conT $ mkName "BV?)) > > HTH, > > Bertram > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From mdl at 60hz.org Thu Mar 12 13:36:46 2015 From: mdl at 60hz.org (Mark Laws) Date: Thu, 12 Mar 2015 22:36:46 +0900 Subject: [Haskell-cafe] Deriving Show for non-regular data types In-Reply-To: References: Message-ID: On Thu, Mar 12, 2015 at 12:25 PM, adam vogt wrote: > This combination seems to work: > > instance (Show a, Show1 d) => Show (d a) where > showsPrec = showsPrec1 > > deriving instance (Show (d a), Show1 d) > => Show (SimpleCatDeque d a) > > But it needs overlapping instances. I don't see another way to express > > (Show (d a), Show (d (d a)), Show (d (d (d a))), ... ) > > in a way that ghc will lazily evaluate the ... Hi Adam and David, Thanks for the tips. This works, but there's another issue now: > :load SimpleCatenableDeque.hs BankersDeque.hs > import BankersDeque > cons 1 (cons 2 empty ++ (cons 3 (cons 7 (cons 123 empty)))) ++ (cons 4 (cons 5 (empty) ++ (cons 6 (cons (-1) (cons 99 empty) ++ (cons 72 empty))) ++ (cons 44 empty ++ (cons 7 (cons 8 (cons 9 (cons 10 (cons 11 empty))))))) ++ cons 9 (cons 10 (cons 123 (empty :: SimpleCatDeque BankersDeque Int) ++ (cons 83 empty)))) :28:1-315: No instance for (Show1 BankersDeque) arising from a use of 'print' In a stmt of an interactive GHCi command: print it What would the necessary instance look like for BankersDeque? Thanks, Mark -- |v\ /\ |\ |< |_ /\ \^| // From vogt.adam at gmail.com Thu Mar 12 13:52:24 2015 From: vogt.adam at gmail.com (adam vogt) Date: Thu, 12 Mar 2015 09:52:24 -0400 Subject: [Haskell-cafe] Deriving Show for non-regular data types In-Reply-To: References: Message-ID: Hi Mark, Adding this instance lets your example work: instance Show1 BankersDeque where showsPrec1 = showsPrec Regards, Adam On Thu, Mar 12, 2015 at 9:36 AM, Mark Laws wrote: > On Thu, Mar 12, 2015 at 12:25 PM, adam vogt wrote: > > This combination seems to work: > > > > instance (Show a, Show1 d) => Show (d a) where > > showsPrec = showsPrec1 > > > > deriving instance (Show (d a), Show1 d) > > => Show (SimpleCatDeque d a) > > > > But it needs overlapping instances. I don't see another way to express > > > > (Show (d a), Show (d (d a)), Show (d (d (d a))), ... ) > > > > in a way that ghc will lazily evaluate the ... > > Hi Adam and David, > > Thanks for the tips. This works, but there's another issue now: > > > :load SimpleCatenableDeque.hs BankersDeque.hs > > import BankersDeque > > cons 1 (cons 2 empty ++ (cons 3 (cons 7 (cons 123 empty)))) ++ (cons 4 > (cons 5 (empty) ++ (cons 6 (cons (-1) (cons 99 empty) ++ (cons 72 empty))) > ++ (cons 44 empty ++ (cons 7 (cons 8 (cons 9 (cons 10 (cons 11 empty))))))) > ++ cons 9 (cons 10 (cons 123 (empty :: SimpleCatDeque BankersDeque Int) ++ > (cons 83 empty)))) > > :28:1-315: > No instance for (Show1 BankersDeque) arising from a use of 'print' > In a stmt of an interactive GHCi command: print it > > What would the necessary instance look like for BankersDeque? > > Thanks, > Mark > > -- > |v\ /\ |\ |< |_ /\ \^| // > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sybilsleaf05 at gmail.com Thu Mar 12 14:28:11 2015 From: sybilsleaf05 at gmail.com (Sybils Leaf) Date: Thu, 12 Mar 2015 14:28:11 +0000 Subject: [Haskell-cafe] Monadic/sequential migration implementation for data in acid-state Message-ID: Full description of my problem is on Stack Overflow: http://stackoverflow.com/questions/29011479/how-can-a-monadic-sequential-migration-be-implemented-for-data-in-acid-state Any comments or suggestions would be greatly appreciated! -------------- next part -------------- An HTML attachment was scrubbed... URL: From sumit.sahrawat.apm13 at iitbhu.ac.in Thu Mar 12 16:39:52 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Thu, 12 Mar 2015 22:09:52 +0530 Subject: [Haskell-cafe] Additional functionality using cabal configure flags Message-ID: Hi everybody, I am looking for the correct way to provide additional functionality using cabal configure flags. Even though the developer faq [1] says that it is not recommended, I don't see any downsides for an executable package. Is it 'not recommended' even for executable packages? If not, then how can I do it? [1]: https://wiki.haskell.org/Cabal/Developer-FAQ -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From trebla at vex.net Thu Mar 12 17:01:08 2015 From: trebla at vex.net (Albert Y. C. Lai) Date: Thu, 12 Mar 2015 13:01:08 -0400 Subject: [Haskell-cafe] Layout rules for if then else In-Reply-To: References: Message-ID: <5501C654.3070505@vex.net> To torment you further, I and others have legal (Haskell 2010), bizzare examples at http://lpaste.net/81623 (Most of them were illegal in Haskell 98.) From alan.zimm at gmail.com Thu Mar 12 17:44:57 2015 From: alan.zimm at gmail.com (Alan & Kim Zimmerman) Date: Thu, 12 Mar 2015 19:44:57 +0200 Subject: [Haskell-cafe] Layout rules for if then else In-Reply-To: <5501C654.3070505@vex.net> References: <5501C654.3070505@vex.net> Message-ID: Wow. Thanks, will put them in as test cases Alan On Thu, Mar 12, 2015 at 7:01 PM, Albert Y. C. Lai wrote: > To torment you further, I and others have legal (Haskell 2010), bizzare > examples at > > http://lpaste.net/81623 > > (Most of them were illegal in Haskell 98.) > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Thu Mar 12 18:15:47 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Thu, 12 Mar 2015 11:15:47 -0700 Subject: [Haskell-cafe] Bad recursion? When can something be on both sides of an equation? In-Reply-To: <20150312094645.GS8845@weber> References: <20150312094645.GS8845@weber> Message-ID: That makes sense! I did not realize the shadowing a where clauses causes happens within the where clause itself; I thought it only applied outside. Thanks, Tom! On Thu, Mar 12, 2015 at 2:46 AM, Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Thu, Mar 12, 2015 at 12:49:57AM -0700, Jeffrey Brown wrote: > > totalDescendents :: S.Set Glab -> Graph -> S.Set Glab > > totalDescendents roots graph = b > > where (a,b,c,graph) = totalDescendentsCtrlr -- tricky > > (roots, S.empty, M.empty, graph) > > > > totalDescendentsCtrlr :: TotalDescendentsData -> TotalDescendentsData > > totalDescendentsCtrlr (a,b,c,gr) = > > if S.null a' -- fails, as does a == a' > > -- a == a' is one iteration slower but should have same effect > > then (a',b',c',gr') > > else totalDescendentsCtrlr (a',b',c',gr') > > where (a',b',c',gr') = visitUndetPrds $ visitTdSnvSucs (a,b,c,gr) > > > > Notice that in the equation marked "tricky", the object "graph" appears > on > > both sides. I thought that was the problem, so I rewrote that line as the > > following: > > where (_,b,_,_) = totalDescendentsCtrlr > > and sure enough, the problem vanished. > > It's somewhat bizarre to write > > where (a,b,c,graph) = totalDescendentsCtrlr -- tricky > (roots, S.empty, M.empty, graph) > > if > > where (_,b,_,_) = totalDescendentsCtrlr > > works, but it's a fair question from a desire to understand what's going > on. > > When you write > > where (a,b,c,graph) = totalDescendentsCtrlr -- tricky > (roots, S.empty, M.empty, graph) > > you are introducing a new name `graph` which shadows the old one. The > result `graph` is "fed back in" as the input. You are saying that the > value > of `graph` depends on itself, which in general can lead to looping. You > probably meant > > where (a,b,c,graph') = totalDescendentsCtrlr (roots, S.empty, > M.empty, graph) > > or, since many of those variables are unused, as you said > > where (_,b,_,_) = totalDescendentsCtrlr (roots, S.empty, M.empty, > graph) > > > So I tried to distill that problem to something tiny, and came up with > this: > > > > f (a) = a' > > where (a',b) = fBackend (a,b) -- tricky > > > > fBackend (a,b) = > > if a' < 1 > > then (a',b) > > else fBackend (a',b) > > where a' = a - 1 > > > > I see no substantive difference between the problem with the first body > of > > code and the problem I expected f and fBackend to have -- but f and > > fBackend work fine! > > `fBackend` never does anything with the value of `b` whereas presumably > `visitUndetPrds` and `visitTdSnvSucs` do do something with the value of > `graph`. > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdl at 60hz.org Thu Mar 12 18:57:53 2015 From: mdl at 60hz.org (Mark Laws) Date: Fri, 13 Mar 2015 03:57:53 +0900 Subject: [Haskell-cafe] Deriving Show for non-regular data types In-Reply-To: References: Message-ID: On Thu, Mar 12, 2015 at 10:52 PM, adam vogt wrote: > Adding this instance lets your example work: > > instance Show1 BankersDeque where showsPrec1 = showsPrec Ah, now it makes sense. Thank you very much for your help! Cheers, Mark Laws -- |v\ /\ |\ |< |_ /\ \^| // From k-bx at k-bx.com Thu Mar 12 20:53:12 2015 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Thu, 12 Mar 2015 22:53:12 +0200 Subject: [Haskell-cafe] Additional functionality using cabal configure flags In-Reply-To: References: Message-ID: Hi Sumit, Documentation clearly mentions it is related to API, so don't worry with executable and feel free to use the flags (still, depending on what are you doing, flags might not be the best solution). 12 ???. 2015 18:40, ?????????? "Sumit Sahrawat, Maths & Computing, IIT (BHU)" ???????: > Hi everybody, > > I am looking for the correct way to provide additional functionality using > cabal configure flags. > Even though the developer faq [1] says that it is not recommended, I don't > see any downsides for an executable package. > > Is it 'not recommended' even for executable packages? If not, then how can > I do it? > > [1]: https://wiki.haskell.org/Cabal/Developer-FAQ > > -- > Regards > > Sumit Sahrawat > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Thu Mar 12 21:23:30 2015 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Thu, 12 Mar 2015 22:23:30 +0100 Subject: [Haskell-cafe] Is there a name for this? In-Reply-To: References: Message-ID: On 2015-03-09 11:26 AM, Ben Franksen wrote: >> Albert Y. C. Lai wrote: >>> Choose one: >>> >>> Foo' is a free Foo >>> >>> Foo' is a limit of the diagram of Foo >>> >>> Foo' is a terminal object of the [sub]category of Foo >> >> Interesting. Is the last variant how "free " is usually defined? >> Or is it a coincidence that the two, well, coincide here? I remember I have >> seen other definitions that looked a lot less easy to understand. > > I have not checked, and too lazy to. > > The usual "free" is the less-easy-to-understand one: you need a > forgetful functor, then you need its left adjoint, and you call it your > free functor. Then the target objects hit by the free functor are the > free things. In general when talking about free things and adjunctions one must pay attention to what the functions are. The original definition of class Foo was coalgebraic: class Foo f where bar :: f -> Bool baz :: f -> Char -> Int meaning that the functions take an f and make something else rather than taking something and constructing an f (like e.g. the (:) of lists does). With the definition data Foo' = { bar' :: Bool, baz' :: Char -> Int} one can re-write class Foo f where barbaz :: f -> Foo? Objects of our category Foo are instances of Foo, that are pairs where f is a Haskell type and barbaz is a function f -> Foo?. What are the morphisms? Well, we can consider Foo? as a phantom type data F a = F Foo? that is, a constant functor. Then instances of Foo are coalgebras for the functor F, and the right notion of function between coalgebras requires that some equations hold, namely: any h :: f -> f? that wants to be a Foo-function must have barbaz . h = barbaz. Now we can see that Foo? is indeed terminal: More precisely, the Foo-instance is terminal. Indeed, if we have some h :: f -> Foo? with id . h = barbaz then h must be barbaz, so there is precisely one Foo-function from the Foo-instance to . I can?t see how Foo? would be the free Foo in this category, however. Things change if we let Foo-functions be arbitrary functions. Then the documentation of the free package tells us that the free Foo over type t is the instance <(Foo?,t),barbaz=fst>. Olaf From sumit.sahrawat.apm13 at iitbhu.ac.in Thu Mar 12 21:43:22 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Fri, 13 Mar 2015 03:13:22 +0530 Subject: [Haskell-cafe] Additional functionality using cabal configure flags In-Reply-To: References: Message-ID: Hi Konstantine, thanks for the reply I decide to use flags, but then the trouble is that I will need some mechanism to flag parts of the code, possibly using the CPP extension. I wanted to know whether there is a better way. Also, does CPP allow checking cabal configure flags? The user-guide did not mention such usecases. On 13 March 2015 at 02:23, Konstantine Rybnikov wrote: > Hi Sumit, > > Documentation clearly mentions it is related to API, so don't worry with > executable and feel free to use the flags (still, depending on what are you > doing, flags might not be the best solution). > 12 ???. 2015 18:40, ?????????? "Sumit Sahrawat, Maths & Computing, IIT > (BHU)" ???????: > >> Hi everybody, >> >> I am looking for the correct way to provide additional functionality >> using cabal configure flags. >> Even though the developer faq [1] says that it is not recommended, I >> don't see any downsides for an executable package. >> >> Is it 'not recommended' even for executable packages? If not, then how >> can I do it? >> >> [1]: https://wiki.haskell.org/Cabal/Developer-FAQ >> >> -- >> Regards >> >> Sumit Sahrawat >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From semen at trygub.com Fri Mar 13 05:40:40 2015 From: semen at trygub.com (Semen Trygubenko / =?utf-8?B?0KHQtdC80LXQvSDQotGA0LjQs9GD0LHQtdC9?= =?utf-8?B?0LrQvg==?=) Date: Fri, 13 Mar 2015 05:40:40 +0000 Subject: [Haskell-cafe] Haskell Weekly News: Issue 320 Message-ID: <20150313054040.GA7313@inanna.trygub.com> New Releases The sbv package SBV can now generate proof goals that are discharged by ABC, using state-of-the-art SAT based techniques, has better support for IEEE-floats, and a reworked implementation of the connection to the Boolector solver. http://hackage.haskell.org/package/sbv-4.1 Talks Stop Treading Water: Learning to Learn A talk about the alternative to Feynman's algorithm (that can be taught), the total cost of using wrong solutions (integrated over your entire career), the dual of "How to be a Genius" (and how to become a Genius Consultant), and how to beat the exponential decay of human memory (using Spaced Repetition and Going Deeper When You Come Back strategies)! https://yow.eventer.com/yow-2014-1222/stop-treading-water-learning-to-learn-by-edward-kmett-1750 Discussion Solutions in search of problems and problems in search of solutions A comment by Edward Kmett. http://www.reddit.com/r/haskell/comments/2yfris/stop_treading_water_learning_to_learn_by_edward/cp9vh1b Once you've seen the beautiful, you don't want to go back to the ugly Discussion of which Haskell ways can benefit what other languages and how to stay employed and satisfied. http://www.reddit.com/r/haskell/comments/2y47rf/once_youve_seen_the_beautiful_you_dont_want_to_go/ Learning Haskell ? A Racket programmer's documentation of her foray into the land of Haskell (inspired by Learning Racket) Days 0 through 2 are documented so far. http://lexi-lambda.github.io/learning-haskell/ What imperative languages do Haskellers like? Haskell is at the top of the list, followed by C++. http://www.reddit.com/r/haskell/comments/2yqnst/what_imperative_languages_do_haskellers_like/ Quotes of the Week "Practically every modern human has at least half an hour of spare time a day. If you want to fill that with textbooks or Better Call Saul is up to you." (kqr) "Fritz Henglein's work on discrimination gives you linear time versions of almost everything." (edwardkmett) http://www.reddit.com/r/haskell/comments/2yfris/stop_treading_water_learning_to_learn_by_edward/ "I think learning C is just as enlightening as learning Haskell. It forces you to get intimate with your machine in ways other languages (including C++) actively discourage or even forbid." (TheManaKnight) "It seems that after trying haskell not only you can not write anything in other languages, but also you can not solve any problem without going to the deep of it and discover something that truly solves the problem in the deeper sense." (agocorona) http://www.reddit.com/r/haskell/comments/2y47rf/once_youve_seen_the_beautiful_you_dont_want_to_go/cp66b1w "How do I use lens confusing?" "You mean 'it's confusing'" "No, I mean Control.Lens.Traversal.confusing" (cocharles) http://hackage.haskell.org/package/lens-4.8/docs/Control-Lens-Traversal.html#v:confusing -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: not available URL: From k-bx at k-bx.com Fri Mar 13 07:35:15 2015 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Fri, 13 Mar 2015 09:35:15 +0200 Subject: [Haskell-cafe] Additional functionality using cabal configure flags In-Reply-To: References: Message-ID: Sumit, Here's an example: ``` flag production default: False Executable Foo if flag(production) cpp-options: -DPRODUCTION ``` I should note that while I have this mechanism in my code, I think that overall it wasn't a good choice, and I'd rather prefer parsing a command-line argument and passing it through my code in stead of having a flag like this. It makes code much harder to write, because each usage has heavy syntax of: ``` #ifdef PRODUCTION something #else somethingElse #endif ``` while instead you could just write: ``` if production then something else somethingElse ``` On Thu, Mar 12, 2015 at 11:43 PM, Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote: > Hi Konstantine, thanks for the reply > > I decide to use flags, but then the trouble is that I will need some > mechanism to flag parts of the code, possibly using the CPP extension. > I wanted to know whether there is a better way. Also, does CPP allow > checking cabal configure flags? The user-guide did not mention such > usecases. > > On 13 March 2015 at 02:23, Konstantine Rybnikov wrote: > >> Hi Sumit, >> >> Documentation clearly mentions it is related to API, so don't worry with >> executable and feel free to use the flags (still, depending on what are you >> doing, flags might not be the best solution). >> 12 ???. 2015 18:40, ?????????? "Sumit Sahrawat, Maths & Computing, IIT >> (BHU)" ???????: >> >>> Hi everybody, >>> >>> I am looking for the correct way to provide additional functionality >>> using cabal configure flags. >>> Even though the developer faq [1] says that it is not recommended, I >>> don't see any downsides for an executable package. >>> >>> Is it 'not recommended' even for executable packages? If not, then how >>> can I do it? >>> >>> [1]: https://wiki.haskell.org/Cabal/Developer-FAQ >>> >>> -- >>> Regards >>> >>> Sumit Sahrawat >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> > > > -- > Regards > > Sumit Sahrawat > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sumit.sahrawat.apm13 at iitbhu.ac.in Fri Mar 13 07:59:22 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Fri, 13 Mar 2015 13:29:22 +0530 Subject: [Haskell-cafe] Additional functionality using cabal configure flags In-Reply-To: References: Message-ID: Thanks. That's just what I needed. As much as I want to avoid it, it seems that I don't have much choice. I'm building a calculator-ish repl that also allows plotting. I don't want the users to have to install gtk and all that stuff if they don't require it. I'll try and refactor my code to see what I can do, but that would mean less extensibility. I started out with the expression problem, and now I might have to work against what I built. On 13 March 2015 at 13:05, Konstantine Rybnikov wrote: > Sumit, > > Here's an example: > > ``` > flag production > default: False > > Executable Foo > if flag(production) > cpp-options: -DPRODUCTION > ``` > > I should note that while I have this mechanism in my code, I think that > overall it wasn't a good choice, and I'd rather prefer parsing a > command-line argument and passing it through my code in stead of having a > flag like this. It makes code much harder to write, because each usage has > heavy syntax of: > > ``` > #ifdef PRODUCTION > something > #else > somethingElse > #endif > ``` > > while instead you could just write: > > ``` > if production then something else somethingElse > ``` > > > > On Thu, Mar 12, 2015 at 11:43 PM, Sumit Sahrawat, Maths & Computing, IIT > (BHU) wrote: > >> Hi Konstantine, thanks for the reply >> >> I decide to use flags, but then the trouble is that I will need some >> mechanism to flag parts of the code, possibly using the CPP extension. >> I wanted to know whether there is a better way. Also, does CPP allow >> checking cabal configure flags? The user-guide did not mention such >> usecases. >> >> On 13 March 2015 at 02:23, Konstantine Rybnikov wrote: >> >>> Hi Sumit, >>> >>> Documentation clearly mentions it is related to API, so don't worry with >>> executable and feel free to use the flags (still, depending on what are you >>> doing, flags might not be the best solution). >>> 12 ???. 2015 18:40, ?????????? "Sumit Sahrawat, Maths & Computing, IIT >>> (BHU)" ???????: >>> >>>> Hi everybody, >>>> >>>> I am looking for the correct way to provide additional functionality >>>> using cabal configure flags. >>>> Even though the developer faq [1] says that it is not recommended, I >>>> don't see any downsides for an executable package. >>>> >>>> Is it 'not recommended' even for executable packages? If not, then how >>>> can I do it? >>>> >>>> [1]: https://wiki.haskell.org/Cabal/Developer-FAQ >>>> >>>> -- >>>> Regards >>>> >>>> Sumit Sahrawat >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>>> >> >> >> -- >> Regards >> >> Sumit Sahrawat >> > > -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From k-bx at k-bx.com Fri Mar 13 08:59:21 2015 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Fri, 13 Mar 2015 10:59:21 +0200 Subject: [Haskell-cafe] Additional functionality using cabal configure flags In-Reply-To: References: Message-ID: In this case flags for gtk plotting support on/off do seem like a normal choice On Fri, Mar 13, 2015 at 9:59 AM, Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote: > Thanks. That's just what I needed. > > As much as I want to avoid it, it seems that I don't have much choice. > I'm building a calculator-ish repl that also allows plotting. I don't want > the users to have to install gtk and all that stuff if they don't require > it. > I'll try and refactor my code to see what I can do, but that would mean > less extensibility. > I started out with the expression problem, and now I might have to work > against what I built. > > On 13 March 2015 at 13:05, Konstantine Rybnikov wrote: > >> Sumit, >> >> Here's an example: >> >> ``` >> flag production >> default: False >> >> Executable Foo >> if flag(production) >> cpp-options: -DPRODUCTION >> ``` >> >> I should note that while I have this mechanism in my code, I think that >> overall it wasn't a good choice, and I'd rather prefer parsing a >> command-line argument and passing it through my code in stead of having a >> flag like this. It makes code much harder to write, because each usage has >> heavy syntax of: >> >> ``` >> #ifdef PRODUCTION >> something >> #else >> somethingElse >> #endif >> ``` >> >> while instead you could just write: >> >> ``` >> if production then something else somethingElse >> ``` >> >> >> >> On Thu, Mar 12, 2015 at 11:43 PM, Sumit Sahrawat, Maths & Computing, IIT >> (BHU) wrote: >> >>> Hi Konstantine, thanks for the reply >>> >>> I decide to use flags, but then the trouble is that I will need some >>> mechanism to flag parts of the code, possibly using the CPP extension. >>> I wanted to know whether there is a better way. Also, does CPP allow >>> checking cabal configure flags? The user-guide did not mention such >>> usecases. >>> >>> On 13 March 2015 at 02:23, Konstantine Rybnikov wrote: >>> >>>> Hi Sumit, >>>> >>>> Documentation clearly mentions it is related to API, so don't worry >>>> with executable and feel free to use the flags (still, depending on what >>>> are you doing, flags might not be the best solution). >>>> 12 ???. 2015 18:40, ?????????? "Sumit Sahrawat, Maths & Computing, IIT >>>> (BHU)" ???????: >>>> >>>>> Hi everybody, >>>>> >>>>> I am looking for the correct way to provide additional functionality >>>>> using cabal configure flags. >>>>> Even though the developer faq [1] says that it is not recommended, I >>>>> don't see any downsides for an executable package. >>>>> >>>>> Is it 'not recommended' even for executable packages? If not, then how >>>>> can I do it? >>>>> >>>>> [1]: https://wiki.haskell.org/Cabal/Developer-FAQ >>>>> >>>>> -- >>>>> Regards >>>>> >>>>> Sumit Sahrawat >>>>> >>>>> _______________________________________________ >>>>> Haskell-Cafe mailing list >>>>> Haskell-Cafe at haskell.org >>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>> >>>>> >>> >>> >>> -- >>> Regards >>> >>> Sumit Sahrawat >>> >> >> > > > -- > Regards > > Sumit Sahrawat > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark.santolucito at yale.edu Fri Mar 13 12:03:38 2015 From: mark.santolucito at yale.edu (Mark Santolucito) Date: Fri, 13 Mar 2015 08:03:38 -0400 Subject: [Haskell-cafe] ANNOUNCE: Euterpea 1.0.0 In-Reply-To: <55010061.2090201@panix.com> References: <55010061.2090201@panix.com> Message-ID: Yes, it is working on Mac! One caveat is that you will need to use ghc (rather than ghci) for programs using the graphical library. For more information check out the sites listed. We are also pretty responsive to posts on the haskell.cs.yale.edu site or individual emails. Mark Santolucito On Wed, Mar 11, 2015 at 10:56 PM, Stuart Popejoy wrote: > A blocker for me using Euterpea in the past is it being largely broken on > OS X (vs Windows, didn't try on Linux). Does this release improve on that > situation? > > On 3/10/15, 7:29 PM, Daniel Winograd-Cort wrote: > >> We are happy to announce the official release of Euterpea! Euterpea is a >> library for computer music research, education, and development, providing >> both note-level and signal-level abstractions. It is a descendant of >> Haskore and HasSound and is intended for both educational purposes as well >> as serious computer music applications. Euterpea is suitable for high-level >> music representation, algorithmic composition, and analysis; mid-level >> concepts such as MIDI; and low-level audio processing, sound synthesis, and >> instrument design. It also includes an extensible system for building >> musical user interfaces using UISF, a new AFRP UI library. Euterpea's >> performance is sufficient for most real-time midi applications and some >> basic real-time audio synthesis. >> >> Try it out with >> cabal install Euterpea >> >> You can find more at... >> euterpea.com > 3A__euterpea.com&d=AwICAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r= >> ATPJswkQd7haCOwDyElhQhPkIDW1hmjT409M-wdnc_Y&m= >> Xuw4MTl2A90lJMHwZ3Ntp54OPmuyywLttMJ2VzUlaKY&s= >> d5LTKnKx1OZRNECEEKHj571aPpRPYg4RSU_oit1ePoI&e= > - a site for a quick >> start, tutorials, and working examples >> haskell.cs.yale.edu/euterpea - >> more detailed info and help, including an in-progress textbook (Haskell >> School of Music) >> hackage.haskell.org/package/Euterpea > proofpoint.com/v2/url?u=http-3A__hackage.haskell.org_ >> package_Euterpea&d=AwICAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r= >> ATPJswkQd7haCOwDyElhQhPkIDW1hmjT409M-wdnc_Y&m= >> Xuw4MTl2A90lJMHwZ3Ntp54OPmuyywLttMJ2VzUlaKY&s= >> W7FWrLaL3ZP2oQT4PvgFvaWvvfZ4kC22ZNRfFtI-1UI&e= > - the hackage page with >> some docs >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> https://urldefense.proofpoint.com/v2/url?u=http-3A__mail. >> haskell.org_cgi-2Dbin_mailman_listinfo_haskell-2Dcafe&d=AwICAg&c=- >> dg2m7zWuuDZ0MUcV7Sdqw&r=ATPJswkQd7haCOwDyElhQhPkIDW1hmjT409M-wdnc_Y&m= >> Xuw4MTl2A90lJMHwZ3Ntp54OPmuyywLttMJ2VzUlaKY&s=1JznJK3vxTm_ >> qy8uGK1nLlUvTFWeI0N6LqaqRalnp_0&e= >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > https://urldefense.proofpoint.com/v2/url?u=http-3A__mail. > haskell.org_cgi-2Dbin_mailman_listinfo_haskell-2Dcafe&d=AwICAg&c=- > dg2m7zWuuDZ0MUcV7Sdqw&r=ATPJswkQd7haCOwDyElhQhPkIDW1hmjT409M-wdnc_Y&m= > Xuw4MTl2A90lJMHwZ3Ntp54OPmuyywLttMJ2VzUlaKY&s=1JznJK3vxTm_ > qy8uGK1nLlUvTFWeI0N6LqaqRalnp_0&e= -------------- next part -------------- An HTML attachment was scrubbed... URL: From K.Bleijenberg at lijbrandt.nl Fri Mar 13 16:25:55 2015 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Fri, 13 Mar 2015 17:25:55 +0100 Subject: [Haskell-cafe] install 7.8.4 64 bits on arch linux Message-ID: <000001d05daa$61655a00$24300e00$@lijbrandt.nl> I want to upgrade from 7.8.3 32 bits to 7.8.4 64 bits on Arch Linux. So I removed ghc, cabal etc and followed the instruction at: http://sapiengames.com/2014/04/05/install-haskell-platform-arch-linux/ Added the lines [haskell-core] Server = http://xsounds.org/~haskell/core/$arch to pacman.conf added the pacman-key as described updated pacman and finally the fun parts should start.. $ sudo pacman -S ghc cabal-install happy alex looking for inter-conflicts... error: failed to prepare transaction (could not satisfy dependencies) :: haddock: requires ghc=7.8.3-2 :: haskell-ghc-paths: requires ghc=7.8.3-1 What is wrong and what can I do? Kees -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars at hupel.info Fri Mar 13 16:39:55 2015 From: lars at hupel.info (Lars Hupel) Date: Fri, 13 Mar 2015 17:39:55 +0100 Subject: [Haskell-cafe] install 7.8.4 64 bits on arch linux In-Reply-To: <000001d05daa$61655a00$24300e00$@lijbrandt.nl> References: <000001d05daa$61655a00$24300e00$@lijbrandt.nl> Message-ID: <550312DB.5060300@hupel.info> > I want to upgrade from 7.8.3 32 bits to 7.8.4 64 bits on Arch Linux. So I > removed ghc, cabal etc and followed the instruction at: Arch user here. Did you try without the additional repository? As far as I can tell, all required packages are already in [extra] and [community] (even 'haddock' is there). > http://sapiengames.com/2014/04/05/install-haskell-platform-arch-linux/ I would advise to not follow this article. You should not 'sudo cabal install' anything. Cheers Lars From aeyakovenko at gmail.com Fri Mar 13 17:23:55 2015 From: aeyakovenko at gmail.com (Anatoly Yakovenko) Date: Fri, 13 Mar 2015 10:23:55 -0700 Subject: [Haskell-cafe] repa parallelization results Message-ID: https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 so i am seeing basically results with N4 that are as good as using sequential computation on my macbook for the matrix multiply algorithm. any idea why? Thanks, Anatoly From lars at hupel.info Fri Mar 13 19:21:03 2015 From: lars at hupel.info (Lars Hupel) Date: Fri, 13 Mar 2015 20:21:03 +0100 Subject: [Haskell-cafe] install 7.8.4 64 bits on arch linux In-Reply-To: <000001d05dbe$205846d0$6108d470$@lijbrandt.nl> References: <000001d05daa$61655a00$24300e00$@lijbrandt.nl> <550312DB.5060300@hupel.info> <000001d05dbe$205846d0$6108d470$@lijbrandt.nl> Message-ID: <5503389F.1000606@hupel.info> > sudo pacman -S ghc > And I get the same errormessage. > Even sudo pacman -R ghc gives the same error. Odd. Before installing 'ghc', please try this: $ sudo pacman -Rucs ghc haddock haskell-ghc-paths '-Rucs' will recursively remove all existing dependencies. Please double-check the list of packages pacman prints, because they will all be removed. Cheers Lars PS: Please CC the list when you reply to messages. There might be more competent people than me lurking there :-) From K.Bleijenberg at lijbrandt.nl Fri Mar 13 20:35:16 2015 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Fri, 13 Mar 2015 21:35:16 +0100 Subject: [Haskell-cafe] install 7.8.4 64 bits on arch linux In-Reply-To: <5503389F.1000606@hupel.info> References: <000001d05daa$61655a00$24300e00$@lijbrandt.nl> <550312DB.5060300@hupel.info> <000001d05dbe$205846d0$6108d470$@lijbrandt.nl> <5503389F.1000606@hupel.info> Message-ID: <000301d05dcd$371a6560$a54f3020$@lijbrandt.nl> Lars, This did it! pacman complained that it couldn't completely finish it's job. But pacman removed packages like haskell-ghc-paths and haddock. After that, ghc installed without problems. Thanks! Kees -----Oorspronkelijk bericht----- Van: Lars Hupel [mailto:lars at hupel.info] Verzonden: vrijdag 13 maart 2015 20:21 Aan: Kees Bleijenberg CC: haskell-cafe at haskell.org Onderwerp: Re: [Haskell-cafe] install 7.8.4 64 bits on arch linux > sudo pacman -S ghc > And I get the same errormessage. > Even sudo pacman -R ghc gives the same error. Odd. Before installing 'ghc', please try this: $ sudo pacman -Rucs ghc haddock haskell-ghc-paths '-Rucs' will recursively remove all existing dependencies. Please double-check the list of packages pacman prints, because they will all be removed. Cheers Lars PS: Please CC the list when you reply to messages. There might be more competent people than me lurking there :-) ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2015.0.5751 / Virus Database: 4306/9293 - Release Date: 03/13/15 From kc1956 at gmail.com Fri Mar 13 23:58:22 2015 From: kc1956 at gmail.com (KC) Date: Fri, 13 Mar 2015 16:58:22 -0700 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: How is the LLVM? -- -- Sent from an expensive device which will be obsolete in a few months! :D Casey On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" wrote: > https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 > > > so i am seeing basically results with N4 that are as good as using > sequential computation on my macbook for the matrix multiply > algorithm. any idea why? > > Thanks, > Anatoly > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aeyakovenko at gmail.com Sat Mar 14 01:03:09 2015 From: aeyakovenko at gmail.com (Anatoly Yakovenko) Date: Fri, 13 Mar 2015 18:03:09 -0700 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: you think the backed would make any difference? this seems like a runtime issue to me, how are the threads scheduled by the ghc runtime? On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: > How is the LLVM? > > -- > -- > > Sent from an expensive device which will be obsolete in a few months! :D > > Casey > > > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" wrote: >> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 >> >> >> so i am seeing basically results with N4 that are as good as using >> sequential computation on my macbook for the matrix multiply >> algorithm. any idea why? >> >> Thanks, >> Anatoly >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From magnus at therning.org Sat Mar 14 08:33:48 2015 From: magnus at therning.org (Magnus Therning) Date: Sat, 14 Mar 2015 09:33:48 +0100 Subject: [Haskell-cafe] install 7.8.4 64 bits on arch linux In-Reply-To: <000301d05dcd$371a6560$a54f3020$@lijbrandt.nl> References: <000001d05daa$61655a00$24300e00$@lijbrandt.nl> <550312DB.5060300@hupel.info> <000001d05dbe$205846d0$6108d470$@lijbrandt.nl> <5503389F.1000606@hupel.info> <000301d05dcd$371a6560$a54f3020$@lijbrandt.nl> Message-ID: <20150314083348.GB29646@tatooine> On Fri, Mar 13, 2015 at 09:35:16PM +0100, Kees Bleijenberg wrote: > Lars, > > This did it! pacman complained that it couldn't completely finish > it's job. But pacman removed packages like haskell-ghc-paths and > haddock. After that, ghc installed without problems. Please feel free to use the ArchHaskell mailing list [1] if you run into any issues in the future. /M [1]: https://mail.haskell.org/mailman/listinfo/arch-haskell -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus Code as if whoever maintains your program is a violent psychopath who knows where you live. -- Anonymous -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 163 bytes Desc: not available URL: From hjgtuyl at chello.nl Sat Mar 14 10:23:41 2015 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Sat, 14 Mar 2015 11:23:41 +0100 Subject: [Haskell-cafe] =?utf-8?b?z4AtZGF5?= Message-ID: Happy super pi day everybody! Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From carter.schonwald at gmail.com Sat Mar 14 16:21:43 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sat, 14 Mar 2015 12:21:43 -0400 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: dense matrix product is not an algorithm that makes sense in repa's execution model, in square matrix multiply of two N x N matrices, each result entry depends on 2n values total across the two input matrices. even then, thats actually the wrong way to parallelize dense matrix product! its worth reading the papers about goto blas and the more recent blis project. a high performance dense matrix multipy winds up needing to do some nested array parallelism with mutable updates to have efficient sharing of sub computations! On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko wrote: > you think the backed would make any difference? this seems like a > runtime issue to me, how are the threads scheduled by the ghc runtime? > > On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: > > How is the LLVM? > > > > -- > > -- > > > > Sent from an expensive device which will be obsolete in a few months! :D > > > > Casey > > > > > > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" > wrote: > >> > >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 > >> > >> > >> so i am seeing basically results with N4 that are as good as using > >> sequential computation on my macbook for the matrix multiply > >> algorithm. any idea why? > >> > >> Thanks, > >> Anatoly > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sat Mar 14 16:24:21 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sat, 14 Mar 2015 12:24:21 -0400 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf this paper (among many others by the blis project) articulates some of the ideas i allude to pretty well (with pictures!) On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald < carter.schonwald at gmail.com> wrote: > dense matrix product is not an algorithm that makes sense in repa's > execution model, > in square matrix multiply of two N x N matrices, each result entry depends > on 2n values total across the two input matrices. > even then, thats actually the wrong way to parallelize dense matrix > product! its worth reading the papers about goto blas and the more recent > blis project. a high performance dense matrix multipy winds up needing to > do some nested array parallelism with mutable updates to have efficient > sharing of sub computations! > > > > On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko > wrote: > >> you think the backed would make any difference? this seems like a >> runtime issue to me, how are the threads scheduled by the ghc runtime? >> >> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: >> > How is the LLVM? >> > >> > -- >> > -- >> > >> > Sent from an expensive device which will be obsolete in a few months! :D >> > >> > Casey >> > >> > >> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" >> wrote: >> >> >> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 >> >> >> >> >> >> so i am seeing basically results with N4 that are as good as using >> >> sequential computation on my macbook for the matrix multiply >> >> algorithm. any idea why? >> >> >> >> Thanks, >> >> Anatoly >> >> _______________________________________________ >> >> Haskell-Cafe mailing list >> >> Haskell-Cafe at haskell.org >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marcin.jan.mrotek at gmail.com Sat Mar 14 20:08:57 2015 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Sat, 14 Mar 2015 21:08:57 +0100 Subject: [Haskell-cafe] Wrong .hsc file paths on Windows Message-ID: Hello, I was trying to port some of my code to Windows. I've installed GHC with MinGHC (https://github.com/fpco/minghc). Unfortunately some packages, namely zlib and network, won't install, with the same error: getModificationTime cannot locate a file like CodecCompressionZlibStream.hsc or NetworkSocketTypes.hsc. With zlib, I figured out I just need to change mentions of "Codec/Compression/(...)" adding two slashes instead of one. Now with network I'm stuck, I can't find where the path was set at all. Is there some step I should have done prior to installation that would get the paths right? Best regards, Marcin Mrotek From voldermort at hotmail.com Sun Mar 15 08:31:59 2015 From: voldermort at hotmail.com (Jeremy) Date: Sun, 15 Mar 2015 01:31:59 -0700 (MST) Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? In-Reply-To: References: <1426087518070-5766854.post@n5.nabble.com> Message-ID: <1426408319367-5767017.post@n5.nabble.com> Kim-Ee Yeoh-2 wrote > As editor, I can assure you that the news will always have the subject > "Haskell Weekly News" and will always be published on the low-volume > haskell@ list, so setting your email filters is the best bet for now. Issue 320 appears to be on cafe, but not the top-level haskell list. If this was an oversight, it underscores the need to post to a more capable publishing platform (such as a blog), which can then email to the lists. -- View this message in context: http://haskell.1045720.n5.nabble.com/Where-is-Haskell-Weekly-News-syndicated-tp5766854p5767017.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. From marcin.jan.mrotek at gmail.com Sun Mar 15 11:02:10 2015 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Sun, 15 Mar 2015 12:02:10 +0100 Subject: [Haskell-cafe] Wrong .hsc file paths on Windows In-Reply-To: References: Message-ID: Okay, for what it's worth, I found a solution: I reinstalled MinGHC and left the default 1.20 version of Cabal, and now everything is fine. (I had installed the newest version previously because I somehow managed to botch setup-simple execs, and I thought this would solve the problem. It actually did, but at a cost.) Best regards, Marcin Mrotek From eknath2k at gmail.com Sun Mar 15 14:00:43 2015 From: eknath2k at gmail.com (Kattamuri Ekanadham) Date: Sun, 15 Mar 2015 10:00:43 -0400 Subject: [Haskell-cafe] package ParsecToken Message-ID: I am new to the community and learning Parsec, reading the tutorial "Parsec, a fast combinator Parse" by Daan Leijen. In the tutorial, the examples import the package called "ParsecToken" and I could not find this package any where (I found many variants like Text.Parsec.Token, Text.ParseCombinators.Parsec.Token etc.) So I was unable to execute those examples given there. Q1. How do I find the package name for "ParsecToken" so that I can do cabal import? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sun Mar 15 14:03:58 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 15 Mar 2015 10:03:58 -0400 Subject: [Haskell-cafe] package ParsecToken In-Reply-To: References: Message-ID: On Sun, Mar 15, 2015 at 10:00 AM, Kattamuri Ekanadham wrote: > I am new to the community and learning Parsec, reading the tutorial > "Parsec, a fast combinator Parse" by Daan Leijen. > > In the tutorial, the examples import the package called "ParsecToken" and > The tutorial is for Parsec version 1 for Haskell98, which only had flat package names. It is no longer 1998. :) Text.ParserCombinators.Parsec.Token is probably closest to the flat module, but even that is out of date; it's a compatibility shim for Parsec 2, whereas the Text.Parsec modules are Parsec 3. I don't know if there are any updated tutorials for Parsec 3. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From sumit.sahrawat.apm13 at iitbhu.ac.in Sun Mar 15 14:43:02 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Sun, 15 Mar 2015 20:13:02 +0530 Subject: [Haskell-cafe] package ParsecToken In-Reply-To: References: Message-ID: A tutorial for Parsec 3 lives here: https://github.com/JakeWheat/intro_to_parsing HTH On 15 March 2015 at 19:33, Brandon Allbery wrote: > On Sun, Mar 15, 2015 at 10:00 AM, Kattamuri Ekanadham > wrote: > >> I am new to the community and learning Parsec, reading the tutorial >> "Parsec, a fast combinator Parse" by Daan Leijen. >> >> In the tutorial, the examples import the package called "ParsecToken" and >> > > The tutorial is for Parsec version 1 for Haskell98, which only had flat > package names. It is no longer 1998. :) > > Text.ParserCombinators.Parsec.Token is probably closest to the flat > module, but even that is out of date; it's a compatibility shim for Parsec > 2, whereas the Text.Parsec modules are Parsec 3. I don't know if there are > any updated tutorials for Parsec 3. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From semen at trygub.com Sun Mar 15 14:55:24 2015 From: semen at trygub.com (Semen Trygubenko / =?utf-8?B?0KHQtdC80LXQvSDQotGA0LjQs9GD0LHQtdC9?= =?utf-8?B?0LrQvg==?=) Date: Sun, 15 Mar 2015 14:55:24 +0000 Subject: [Haskell-cafe] Where is Haskell Weekly News syndicated? In-Reply-To: <1426408319367-5767017.post@n5.nabble.com> References: <1426087518070-5766854.post@n5.nabble.com> <1426408319367-5767017.post@n5.nabble.com> Message-ID: <20150315145524.GA73677@inanna.trygub.com> On Sun, Mar 15, 2015 at 01:31:59AM -0700, Jeremy wrote: > Kim-Ee Yeoh-2 wrote > > As editor, I can assure you that the news will always have the subject > > "Haskell Weekly News" and will always be published on the low-volume > > haskell@ list, so setting your email filters is the best bet for now. > > Issue 320 appears to be on cafe, but not the top-level haskell list. If this > was an oversight, It went to both. However, I was not subscribed to haskell at haskell.org at that time and mailer rejected it. > it underscores the need to post to a more capable > publishing platform (such as a blog), which can then email to the lists. Please bear with us ? we are spinning the tools up. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: not available URL: From johan.g.larson at gmail.com Sun Mar 15 17:35:03 2015 From: johan.g.larson at gmail.com (Johan Larson) Date: Sun, 15 Mar 2015 13:35:03 -0400 Subject: [Haskell-cafe] is build breakage data about the main Haskell platform projects available? Message-ID: Dan Luu recently dug up some build performance data about various open source projects, and found that many such projects have broken builds more than half the time. http://danluu.com/broken-builds/ Unfortunately Luu's data set doesn't include Haskell. Does anyone have the facts on this? (A brief search didn't turn up anything.) -- Johan Larson -- Toronto, Canada From aeyakovenko at gmail.com Sun Mar 15 18:44:00 2015 From: aeyakovenko at gmail.com (Anatoly Yakovenko) Date: Sun, 15 Mar 2015 11:44:00 -0700 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: I am not really focusing on matrix multiply specifically. So the real problem is that the implementation using parallelized functions is slower then the sequential one, and adding more threads makes it barely as fast as the sequential one. So why would i ever use the parallelized versions? On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald wrote: > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf this paper > (among many others by the blis project) articulates some of the ideas i > allude to pretty well (with pictures!) > > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald > wrote: >> >> dense matrix product is not an algorithm that makes sense in repa's >> execution model, >> in square matrix multiply of two N x N matrices, each result entry depends >> on 2n values total across the two input matrices. >> even then, thats actually the wrong way to parallelize dense matrix >> product! its worth reading the papers about goto blas and the more recent >> blis project. a high performance dense matrix multipy winds up needing to do >> some nested array parallelism with mutable updates to have efficient sharing >> of sub computations! >> >> >> >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko >> wrote: >>> >>> you think the backed would make any difference? this seems like a >>> runtime issue to me, how are the threads scheduled by the ghc runtime? >>> >>> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: >>> > How is the LLVM? >>> > >>> > -- >>> > -- >>> > >>> > Sent from an expensive device which will be obsolete in a few months! >>> > :D >>> > >>> > Casey >>> > >>> > >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" >>> > wrote: >>> >> >>> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 >>> >> >>> >> >>> >> so i am seeing basically results with N4 that are as good as using >>> >> sequential computation on my macbook for the matrix multiply >>> >> algorithm. any idea why? >>> >> >>> >> Thanks, >>> >> Anatoly >>> >> _______________________________________________ >>> >> Haskell-Cafe mailing list >>> >> Haskell-Cafe at haskell.org >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > From carter.schonwald at gmail.com Sun Mar 15 19:44:06 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sun, 15 Mar 2015 15:44:06 -0400 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: Read what I linked. You are benchmarking repa for exactly the pessimal workload that it is bad at. Repa is for point wise parallel and local convolution parallel programs. The way repa can express matrix multiplication is exactly the worst way to implement a parallel matrix mult. Like, pretty pessimal wrt a memory traffic / communication complexity metric of performance. Benchmark something like image blur algorithms and repa will really shine. Right now your benchmark is the repa equivalent of noticing that random access on singly linked lists is slow :) On Mar 15, 2015 2:44 PM, "Anatoly Yakovenko" wrote: > I am not really focusing on matrix multiply specifically. So the real > problem is that the implementation using parallelized functions is > slower then the sequential one, and adding more threads makes it > barely as fast as the sequential one. > > So why would i ever use the parallelized versions? > > > On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald > wrote: > > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf this paper > > (among many others by the blis project) articulates some of the ideas i > > allude to pretty well (with pictures!) > > > > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald > > wrote: > >> > >> dense matrix product is not an algorithm that makes sense in repa's > >> execution model, > >> in square matrix multiply of two N x N matrices, each result entry > depends > >> on 2n values total across the two input matrices. > >> even then, thats actually the wrong way to parallelize dense matrix > >> product! its worth reading the papers about goto blas and the more > recent > >> blis project. a high performance dense matrix multipy winds up needing > to do > >> some nested array parallelism with mutable updates to have efficient > sharing > >> of sub computations! > >> > >> > >> > >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko < > aeyakovenko at gmail.com> > >> wrote: > >>> > >>> you think the backed would make any difference? this seems like a > >>> runtime issue to me, how are the threads scheduled by the ghc runtime? > >>> > >>> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: > >>> > How is the LLVM? > >>> > > >>> > -- > >>> > -- > >>> > > >>> > Sent from an expensive device which will be obsolete in a few months! > >>> > :D > >>> > > >>> > Casey > >>> > > >>> > > >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" > > >>> > wrote: > >>> >> > >>> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 > >>> >> > >>> >> > >>> >> so i am seeing basically results with N4 that are as good as using > >>> >> sequential computation on my macbook for the matrix multiply > >>> >> algorithm. any idea why? > >>> >> > >>> >> Thanks, > >>> >> Anatoly > >>> >> _______________________________________________ > >>> >> Haskell-Cafe mailing list > >>> >> Haskell-Cafe at haskell.org > >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >>> _______________________________________________ > >>> Haskell-Cafe mailing list > >>> Haskell-Cafe at haskell.org > >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> > >> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sun Mar 15 19:46:01 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sun, 15 Mar 2015 15:46:01 -0400 Subject: [Haskell-cafe] is build breakage data about the main Haskell platform projects available? In-Reply-To: References: Message-ID: Dan's stats are hard to audit because not every project has contributors squash commits before they merge, so some of his counts are likely pessimistic because he's counting intermediate states that were never the true state of master. On Mar 15, 2015 1:35 PM, "Johan Larson" wrote: > Dan Luu recently dug up some build performance data about various open > source projects, and found that many such projects have broken builds > more than half the time. > > http://danluu.com/broken-builds/ > > Unfortunately Luu's data set doesn't include Haskell. Does anyone have > the facts on this? > > (A brief search didn't turn up anything.) > > -- > Johan Larson -- Toronto, Canada > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aeyakovenko at gmail.com Sun Mar 15 20:21:15 2015 From: aeyakovenko at gmail.com (Anatoly Yakovenko) Date: Sun, 15 Mar 2015 13:21:15 -0700 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: Ok, so whats the difference between the sequence and parallel versions? does the parallel one contain a thunk for every element in the output? On Sun, Mar 15, 2015 at 12:44 PM, Carter Schonwald wrote: > Read what I linked. > You are benchmarking repa for exactly the pessimal workload that it is bad > at. > > Repa is for point wise parallel and local convolution parallel programs. > The way repa can express matrix multiplication is exactly the worst way to > implement a parallel matrix mult. Like, pretty pessimal wrt a memory > traffic / communication complexity metric of performance. > > Benchmark something like image blur algorithms and repa will really shine. > > Right now your benchmark is the repa equivalent of noticing that random > access on singly linked lists is slow :) > > On Mar 15, 2015 2:44 PM, "Anatoly Yakovenko" wrote: >> >> I am not really focusing on matrix multiply specifically. So the real >> problem is that the implementation using parallelized functions is >> slower then the sequential one, and adding more threads makes it >> barely as fast as the sequential one. >> >> So why would i ever use the parallelized versions? >> >> >> On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald >> wrote: >> > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf this paper >> > (among many others by the blis project) articulates some of the ideas i >> > allude to pretty well (with pictures!) >> > >> > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald >> > wrote: >> >> >> >> dense matrix product is not an algorithm that makes sense in repa's >> >> execution model, >> >> in square matrix multiply of two N x N matrices, each result entry >> >> depends >> >> on 2n values total across the two input matrices. >> >> even then, thats actually the wrong way to parallelize dense matrix >> >> product! its worth reading the papers about goto blas and the more >> >> recent >> >> blis project. a high performance dense matrix multipy winds up needing >> >> to do >> >> some nested array parallelism with mutable updates to have efficient >> >> sharing >> >> of sub computations! >> >> >> >> >> >> >> >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko >> >> >> >> wrote: >> >>> >> >>> you think the backed would make any difference? this seems like a >> >>> runtime issue to me, how are the threads scheduled by the ghc runtime? >> >>> >> >>> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: >> >>> > How is the LLVM? >> >>> > >> >>> > -- >> >>> > -- >> >>> > >> >>> > Sent from an expensive device which will be obsolete in a few >> >>> > months! >> >>> > :D >> >>> > >> >>> > Casey >> >>> > >> >>> > >> >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" >> >>> > >> >>> > wrote: >> >>> >> >> >>> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 >> >>> >> >> >>> >> >> >>> >> so i am seeing basically results with N4 that are as good as using >> >>> >> sequential computation on my macbook for the matrix multiply >> >>> >> algorithm. any idea why? >> >>> >> >> >>> >> Thanks, >> >>> >> Anatoly >> >>> >> _______________________________________________ >> >>> >> Haskell-Cafe mailing list >> >>> >> Haskell-Cafe at haskell.org >> >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >>> _______________________________________________ >> >>> Haskell-Cafe mailing list >> >>> Haskell-Cafe at haskell.org >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >> >> >> > From carter.schonwald at gmail.com Sun Mar 15 20:40:51 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sun, 15 Mar 2015 16:40:51 -0400 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: The likely issue is cache thrash. On Mar 15, 2015 4:21 PM, "Anatoly Yakovenko" wrote: > Ok, so whats the difference between the sequence and parallel > versions? does the parallel one contain a thunk for every element in > the output? > > On Sun, Mar 15, 2015 at 12:44 PM, Carter Schonwald > wrote: > > Read what I linked. > > You are benchmarking repa for exactly the pessimal workload that it is > bad > > at. > > > > Repa is for point wise parallel and local convolution parallel programs. > > The way repa can express matrix multiplication is exactly the worst way > to > > implement a parallel matrix mult. Like, pretty pessimal wrt a memory > > traffic / communication complexity metric of performance. > > > > Benchmark something like image blur algorithms and repa will really > shine. > > > > Right now your benchmark is the repa equivalent of noticing that random > > access on singly linked lists is slow :) > > > > On Mar 15, 2015 2:44 PM, "Anatoly Yakovenko" > wrote: > >> > >> I am not really focusing on matrix multiply specifically. So the real > >> problem is that the implementation using parallelized functions is > >> slower then the sequential one, and adding more threads makes it > >> barely as fast as the sequential one. > >> > >> So why would i ever use the parallelized versions? > >> > >> > >> On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald > >> wrote: > >> > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf this > paper > >> > (among many others by the blis project) articulates some of the ideas > i > >> > allude to pretty well (with pictures!) > >> > > >> > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald > >> > wrote: > >> >> > >> >> dense matrix product is not an algorithm that makes sense in repa's > >> >> execution model, > >> >> in square matrix multiply of two N x N matrices, each result entry > >> >> depends > >> >> on 2n values total across the two input matrices. > >> >> even then, thats actually the wrong way to parallelize dense matrix > >> >> product! its worth reading the papers about goto blas and the more > >> >> recent > >> >> blis project. a high performance dense matrix multipy winds up > needing > >> >> to do > >> >> some nested array parallelism with mutable updates to have efficient > >> >> sharing > >> >> of sub computations! > >> >> > >> >> > >> >> > >> >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko > >> >> > >> >> wrote: > >> >>> > >> >>> you think the backed would make any difference? this seems like a > >> >>> runtime issue to me, how are the threads scheduled by the ghc > runtime? > >> >>> > >> >>> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: > >> >>> > How is the LLVM? > >> >>> > > >> >>> > -- > >> >>> > -- > >> >>> > > >> >>> > Sent from an expensive device which will be obsolete in a few > >> >>> > months! > >> >>> > :D > >> >>> > > >> >>> > Casey > >> >>> > > >> >>> > > >> >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" > >> >>> > > >> >>> > wrote: > >> >>> >> > >> >>> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 > >> >>> >> > >> >>> >> > >> >>> >> so i am seeing basically results with N4 that are as good as > using > >> >>> >> sequential computation on my macbook for the matrix multiply > >> >>> >> algorithm. any idea why? > >> >>> >> > >> >>> >> Thanks, > >> >>> >> Anatoly > >> >>> >> _______________________________________________ > >> >>> >> Haskell-Cafe mailing list > >> >>> >> Haskell-Cafe at haskell.org > >> >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> >>> _______________________________________________ > >> >>> Haskell-Cafe mailing list > >> >>> Haskell-Cafe at haskell.org > >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> >> > >> >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sun Mar 15 20:41:28 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sun, 15 Mar 2015 16:41:28 -0400 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: Read that paper I linked. Anything else I say will be a rehash of that paper. :) On Mar 15, 2015 4:21 PM, "Anatoly Yakovenko" wrote: > Ok, so whats the difference between the sequence and parallel > versions? does the parallel one contain a thunk for every element in > the output? > > On Sun, Mar 15, 2015 at 12:44 PM, Carter Schonwald > wrote: > > Read what I linked. > > You are benchmarking repa for exactly the pessimal workload that it is > bad > > at. > > > > Repa is for point wise parallel and local convolution parallel programs. > > The way repa can express matrix multiplication is exactly the worst way > to > > implement a parallel matrix mult. Like, pretty pessimal wrt a memory > > traffic / communication complexity metric of performance. > > > > Benchmark something like image blur algorithms and repa will really > shine. > > > > Right now your benchmark is the repa equivalent of noticing that random > > access on singly linked lists is slow :) > > > > On Mar 15, 2015 2:44 PM, "Anatoly Yakovenko" > wrote: > >> > >> I am not really focusing on matrix multiply specifically. So the real > >> problem is that the implementation using parallelized functions is > >> slower then the sequential one, and adding more threads makes it > >> barely as fast as the sequential one. > >> > >> So why would i ever use the parallelized versions? > >> > >> > >> On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald > >> wrote: > >> > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf this > paper > >> > (among many others by the blis project) articulates some of the ideas > i > >> > allude to pretty well (with pictures!) > >> > > >> > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald > >> > wrote: > >> >> > >> >> dense matrix product is not an algorithm that makes sense in repa's > >> >> execution model, > >> >> in square matrix multiply of two N x N matrices, each result entry > >> >> depends > >> >> on 2n values total across the two input matrices. > >> >> even then, thats actually the wrong way to parallelize dense matrix > >> >> product! its worth reading the papers about goto blas and the more > >> >> recent > >> >> blis project. a high performance dense matrix multipy winds up > needing > >> >> to do > >> >> some nested array parallelism with mutable updates to have efficient > >> >> sharing > >> >> of sub computations! > >> >> > >> >> > >> >> > >> >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko > >> >> > >> >> wrote: > >> >>> > >> >>> you think the backed would make any difference? this seems like a > >> >>> runtime issue to me, how are the threads scheduled by the ghc > runtime? > >> >>> > >> >>> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: > >> >>> > How is the LLVM? > >> >>> > > >> >>> > -- > >> >>> > -- > >> >>> > > >> >>> > Sent from an expensive device which will be obsolete in a few > >> >>> > months! > >> >>> > :D > >> >>> > > >> >>> > Casey > >> >>> > > >> >>> > > >> >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" > >> >>> > > >> >>> > wrote: > >> >>> >> > >> >>> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 > >> >>> >> > >> >>> >> > >> >>> >> so i am seeing basically results with N4 that are as good as > using > >> >>> >> sequential computation on my macbook for the matrix multiply > >> >>> >> algorithm. any idea why? > >> >>> >> > >> >>> >> Thanks, > >> >>> >> Anatoly > >> >>> >> _______________________________________________ > >> >>> >> Haskell-Cafe mailing list > >> >>> >> Haskell-Cafe at haskell.org > >> >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> >>> _______________________________________________ > >> >>> Haskell-Cafe mailing list > >> >>> Haskell-Cafe at haskell.org > >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> >> > >> >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tifonzafel at gmail.com Sun Mar 15 22:53:02 2015 From: tifonzafel at gmail.com (felipe zapata) Date: Sun, 15 Mar 2015 18:53:02 -0400 Subject: [Haskell-cafe] Distributing Haskell on a cluster Message-ID: Hi all, I have posted the following question on stackoverflow, but so far I have not received an answer. http://stackoverflow.com/questions/29039815/distributing-haskell-on-a-cluster I have a piece of code that process files, processFiles :: [FilePath] -> (FilePath -> IO ()) -> IO () This function spawns an async process that execute an IO action. This IO action must be submitted to a cluster through a job scheduling system (e.g Slurm). Because I must use the job scheduling system, it's not possible to use cloudHaskell to distribute the closure. Instead the program writes a new *Main.hs* containing the desired computations, that is copy to the cluster node together with all the modules that main depends on and then it is executed remotely with "runhaskell Main.hs [opts]". Then the async process should ask periodically to the job scheduling system (using *threadDelay*) if the job is done. Is there a way to avoid creating a new Main? Can I serialize the IO action and execute it somehow in the node? Best, Felipe -------------- next part -------------- An HTML attachment was scrubbed... URL: From aeyakovenko at gmail.com Sun Mar 15 23:16:22 2015 From: aeyakovenko at gmail.com (Anatoly Yakovenko) Date: Sun, 15 Mar 2015 16:16:22 -0700 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: Ok, got it. I picked the wrong function to try to understand how Repa parallelizes :) So whats a good heuristic for using the parallel versions vs sequential for Repa? Do the internals try to parallelize every element? or does it fuse them into some small number of parallelized tasks? So just based from my observations f (Z :. r :. c) = r * c a <- computeP (fromFunction f) a `deepSeqArray` sumAllP a should be faster then: let a = computeS $ fromFunction f a `deepSeqArray` sumAllP $ a but probably slower then sumAllS $ computeS $ fromFunction f Since an intermediate array is not even computed. Thanks, Anatoly On Sun, Mar 15, 2015 at 1:41 PM, Carter Schonwald wrote: > Read that paper I linked. Anything else I say will be a rehash of that > paper. :) > > On Mar 15, 2015 4:21 PM, "Anatoly Yakovenko" wrote: >> >> Ok, so whats the difference between the sequence and parallel >> versions? does the parallel one contain a thunk for every element in >> the output? >> >> On Sun, Mar 15, 2015 at 12:44 PM, Carter Schonwald >> wrote: >> > Read what I linked. >> > You are benchmarking repa for exactly the pessimal workload that it is >> > bad >> > at. >> > >> > Repa is for point wise parallel and local convolution parallel programs. >> > The way repa can express matrix multiplication is exactly the worst way >> > to >> > implement a parallel matrix mult. Like, pretty pessimal wrt a memory >> > traffic / communication complexity metric of performance. >> > >> > Benchmark something like image blur algorithms and repa will really >> > shine. >> > >> > Right now your benchmark is the repa equivalent of noticing that random >> > access on singly linked lists is slow :) >> > >> > On Mar 15, 2015 2:44 PM, "Anatoly Yakovenko" >> > wrote: >> >> >> >> I am not really focusing on matrix multiply specifically. So the real >> >> problem is that the implementation using parallelized functions is >> >> slower then the sequential one, and adding more threads makes it >> >> barely as fast as the sequential one. >> >> >> >> So why would i ever use the parallelized versions? >> >> >> >> >> >> On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald >> >> wrote: >> >> > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf this >> >> > paper >> >> > (among many others by the blis project) articulates some of the ideas >> >> > i >> >> > allude to pretty well (with pictures!) >> >> > >> >> > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald >> >> > wrote: >> >> >> >> >> >> dense matrix product is not an algorithm that makes sense in repa's >> >> >> execution model, >> >> >> in square matrix multiply of two N x N matrices, each result entry >> >> >> depends >> >> >> on 2n values total across the two input matrices. >> >> >> even then, thats actually the wrong way to parallelize dense matrix >> >> >> product! its worth reading the papers about goto blas and the more >> >> >> recent >> >> >> blis project. a high performance dense matrix multipy winds up >> >> >> needing >> >> >> to do >> >> >> some nested array parallelism with mutable updates to have efficient >> >> >> sharing >> >> >> of sub computations! >> >> >> >> >> >> >> >> >> >> >> >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko >> >> >> >> >> >> wrote: >> >> >>> >> >> >>> you think the backed would make any difference? this seems like a >> >> >>> runtime issue to me, how are the threads scheduled by the ghc >> >> >>> runtime? >> >> >>> >> >> >>> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: >> >> >>> > How is the LLVM? >> >> >>> > >> >> >>> > -- >> >> >>> > -- >> >> >>> > >> >> >>> > Sent from an expensive device which will be obsolete in a few >> >> >>> > months! >> >> >>> > :D >> >> >>> > >> >> >>> > Casey >> >> >>> > >> >> >>> > >> >> >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" >> >> >>> > >> >> >>> > wrote: >> >> >>> >> >> >> >>> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 >> >> >>> >> >> >> >>> >> >> >> >>> >> so i am seeing basically results with N4 that are as good as >> >> >>> >> using >> >> >>> >> sequential computation on my macbook for the matrix multiply >> >> >>> >> algorithm. any idea why? >> >> >>> >> >> >> >>> >> Thanks, >> >> >>> >> Anatoly >> >> >>> >> _______________________________________________ >> >> >>> >> Haskell-Cafe mailing list >> >> >>> >> Haskell-Cafe at haskell.org >> >> >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >>> _______________________________________________ >> >> >>> Haskell-Cafe mailing list >> >> >>> Haskell-Cafe at haskell.org >> >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >> >> >> >> >> >> > From andrew at operationaldynamics.com Mon Mar 16 00:06:31 2015 From: andrew at operationaldynamics.com (Andrew Cowie) Date: Mon, 16 Mar 2015 00:06:31 +0000 Subject: [Haskell-cafe] Distributing Haskell on a cluster In-Reply-To: References: Message-ID: Bit of a whinger from left-field, but rather than deploying a Main script and then using GHCi, have you considered compiling the program and shipping that? Before you veto the idea out of hand, statically compiled binaries are good for being almost self-contained, and (depending on what you changed) and they rsync well. And if that doesn't appeal, then consider instead building the Haskell program dynamically; Hello World is only a couple kB; serious program only a hundred or so. Anyway, I know you're just looking to send a code fragment closure, but if you're dealing with the input and output of the program through a stable interface, then the program is the closure. Just a thought. AfC On Mon, Mar 16, 2015 at 9:53 AM felipe zapata wrote: > Hi all, > I have posted the following question on stackoverflow, but so far I have > not received an answer. > > http://stackoverflow.com/questions/29039815/distributing-haskell-on-a-cluster > > > I have a piece of code that process files, > > processFiles :: [FilePath] -> (FilePath -> IO ()) -> IO () > > This function spawns an async process that execute an IO action. This IO > action must be submitted to a cluster through a job scheduling system (e.g > Slurm). > > Because I must use the job scheduling system, it's not possible to use > cloudHaskell to distribute the closure. Instead the program writes a new > *Main.hs* containing the desired computations, that is copy to the > cluster node together with all the modules that main depends on and then it > is executed remotely with "runhaskell Main.hs [opts]". Then the async > process should ask periodically to the job scheduling system (using > *threadDelay*) if the job is done. > > Is there a way to avoid creating a new Main? Can I serialize the IO action > and execute it somehow in the node? > > Best, > > Felipe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ozgun.ataman at soostone.com Mon Mar 16 00:31:31 2015 From: ozgun.ataman at soostone.com (Ozgun Ataman) Date: Sun, 15 Mar 2015 20:31:31 -0400 Subject: [Haskell-cafe] Distributing Haskell on a cluster In-Reply-To: References: Message-ID: <65E705DD-AE44-4EAD-9FE3-0B906F959EE8@soostone.com> Anecdotal support for this idea: This is exactly how we distribute hadron[1]-based Hadoop MapReduce programs to cluster nodes at work. The compiled executable essentially ships itself to the nodes and recognizes the different environment when executed in that context. [1] hadron is a haskell hadoop streaming framework that came out of our work. It's on github and close to being released on hackage once the current dev branch is finalized/merged. In case it's helpful: https://github.com/soostone/hadron Oz > On Mar 15, 2015, at 8:06 PM, Andrew Cowie wrote: > > Bit of a whinger from left-field, but rather than deploying a Main script and then using GHCi, have you considered compiling the program and shipping that? > > Before you veto the idea out of hand, statically compiled binaries are good for being almost self-contained, and (depending on what you changed) and they rsync well. And if that doesn't appeal, then consider instead building the Haskell program dynamically; Hello World is only a couple kB; serious program only a hundred or so. > > Anyway, I know you're just looking to send a code fragment closure, but if you're dealing with the input and output of the program through a stable interface, then the program is the closure. > > Just a thought. > > AfC > >> On Mon, Mar 16, 2015 at 9:53 AM felipe zapata wrote: >> Hi all, >> I have posted the following question on stackoverflow, but so far I have not received an answer. >> http://stackoverflow.com/questions/29039815/distributing-haskell-on-a-cluster >> >> >> I have a piece of code that process files, >> >> processFiles :: [FilePath] -> (FilePath -> IO ()) -> IO () >> This function spawns an async process that execute an IO action. This IO action must be submitted to a cluster through a job scheduling system (e.g Slurm). >> >> Because I must use the job scheduling system, it's not possible to use cloudHaskell to distribute the closure. Instead the program writes a new Main.hs containing the desired computations, that is copy to the cluster node together with all the modules that main depends on and then it is executed remotely with "runhaskell Main.hs [opts]". Then the async process should ask periodically to the job scheduling system (using threadDelay) if the job is done. >> >> Is there a way to avoid creating a new Main? Can I serialize the IO action and execute it somehow in the node? >> >> Best, >> >> Felipe >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From tifonzafel at gmail.com Mon Mar 16 00:54:54 2015 From: tifonzafel at gmail.com (felipe zapata) Date: Sun, 15 Mar 2015 20:54:54 -0400 Subject: [Haskell-cafe] Distributing Haskell on a cluster In-Reply-To: <65E705DD-AE44-4EAD-9FE3-0B906F959EE8@soostone.com> References: <65E705DD-AE44-4EAD-9FE3-0B906F959EE8@soostone.com> Message-ID: I haven't considered that idea, but it seems the natural solution. Many thanks On 15 March 2015 at 20:31, Ozgun Ataman wrote: > Anecdotal support for this idea: This is exactly how we distribute > hadron[1]-based Hadoop MapReduce programs to cluster nodes at work. The > compiled executable essentially ships itself to the nodes and recognizes > the different environment when executed in that context. > > [1] hadron is a haskell hadoop streaming framework that came out of our > work. It's on github and close to being released on hackage once the > current dev branch is finalized/merged. In case it's helpful: > https://github.com/soostone/hadron > > Oz > > On Mar 15, 2015, at 8:06 PM, Andrew Cowie > wrote: > > Bit of a whinger from left-field, but rather than deploying a Main script > and then using GHCi, have you considered compiling the program and shipping > that? > > Before you veto the idea out of hand, statically compiled binaries are > good for being almost self-contained, and (depending on what you changed) > and they rsync well. And if that doesn't appeal, then consider instead > building the Haskell program dynamically; Hello World is only a couple kB; > serious program only a hundred or so. > > Anyway, I know you're just looking to send a code fragment closure, but if > you're dealing with the input and output of the program through a stable > interface, then the program is the closure. > > Just a thought. > > AfC > > On Mon, Mar 16, 2015 at 9:53 AM felipe zapata > wrote: > >> Hi all, >> I have posted the following question on stackoverflow, but so far I have >> not received an answer. >> >> http://stackoverflow.com/questions/29039815/distributing-haskell-on-a-cluster >> >> >> I have a piece of code that process files, >> >> processFiles :: [FilePath] -> (FilePath -> IO ()) -> IO () >> >> This function spawns an async process that execute an IO action. This IO >> action must be submitted to a cluster through a job scheduling system (e.g >> Slurm). >> >> Because I must use the job scheduling system, it's not possible to use >> cloudHaskell to distribute the closure. Instead the program writes a new >> *Main.hs* containing the desired computations, that is copy to the >> cluster node together with all the modules that main depends on and then it >> is executed remotely with "runhaskell Main.hs [opts]". Then the async >> process should ask periodically to the job scheduling system (using >> *threadDelay*) if the job is done. >> >> Is there a way to avoid creating a new Main? Can I serialize the IO >> action and execute it somehow in the node? >> >> Best, >> >> Felipe >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Mon Mar 16 03:04:52 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sun, 15 Mar 2015 23:04:52 -0400 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: you're getting on the right track! :) the idea you're reaching for is "parallel work depth". Eg, if instead of foldl' (which has O(n) work depth), you had a "parallel" fold that kinda looks like a recursive split and then merge version of the fold operation, you'd have O(log n) work depth. (and that'd likely be faster!). But then you'd notice "below some threshold, its better to compute sequentially, because the overhead of parallization is too big". etc etc. (the point i'm trying to reach for is that effective parallelization requires a pretty rich understanding of your application / software / hardware cost model) likewise, REPA is really only going to shine on workloads that look "pointwise" or "flat", at least with the current iteration. Its probably a good idea to look at the various example codes that are available for repa and acccelerate, because you'll notice that the codes which are especially performant have that "flat" style of paralellims On Sun, Mar 15, 2015 at 7:16 PM, Anatoly Yakovenko wrote: > Ok, got it. I picked the wrong function to try to understand how Repa > parallelizes :) > > So whats a good heuristic for using the parallel versions vs > sequential for Repa? > > Do the internals try to parallelize every element? or does it fuse > them into some small number of parallelized tasks? > > So just based from my observations > > f (Z :. r :. c) = r * c > > a <- computeP (fromFunction f) > a `deepSeqArray` sumAllP a > > should be faster then: > > let a = computeS $ fromFunction f > a `deepSeqArray` sumAllP $ a > > but probably slower then > > sumAllS $ computeS $ fromFunction f > > Since an intermediate array is not even computed. > > Thanks, > Anatoly > > > On Sun, Mar 15, 2015 at 1:41 PM, Carter Schonwald > wrote: > > Read that paper I linked. Anything else I say will be a rehash of that > > paper. :) > > > > On Mar 15, 2015 4:21 PM, "Anatoly Yakovenko" > wrote: > >> > >> Ok, so whats the difference between the sequence and parallel > >> versions? does the parallel one contain a thunk for every element in > >> the output? > >> > >> On Sun, Mar 15, 2015 at 12:44 PM, Carter Schonwald > >> wrote: > >> > Read what I linked. > >> > You are benchmarking repa for exactly the pessimal workload that it is > >> > bad > >> > at. > >> > > >> > Repa is for point wise parallel and local convolution parallel > programs. > >> > The way repa can express matrix multiplication is exactly the worst > way > >> > to > >> > implement a parallel matrix mult. Like, pretty pessimal wrt a memory > >> > traffic / communication complexity metric of performance. > >> > > >> > Benchmark something like image blur algorithms and repa will really > >> > shine. > >> > > >> > Right now your benchmark is the repa equivalent of noticing that > random > >> > access on singly linked lists is slow :) > >> > > >> > On Mar 15, 2015 2:44 PM, "Anatoly Yakovenko" > >> > wrote: > >> >> > >> >> I am not really focusing on matrix multiply specifically. So the > real > >> >> problem is that the implementation using parallelized functions is > >> >> slower then the sequential one, and adding more threads makes it > >> >> barely as fast as the sequential one. > >> >> > >> >> So why would i ever use the parallelized versions? > >> >> > >> >> > >> >> On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald > >> >> wrote: > >> >> > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf this > >> >> > paper > >> >> > (among many others by the blis project) articulates some of the > ideas > >> >> > i > >> >> > allude to pretty well (with pictures!) > >> >> > > >> >> > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald > >> >> > wrote: > >> >> >> > >> >> >> dense matrix product is not an algorithm that makes sense in > repa's > >> >> >> execution model, > >> >> >> in square matrix multiply of two N x N matrices, each result entry > >> >> >> depends > >> >> >> on 2n values total across the two input matrices. > >> >> >> even then, thats actually the wrong way to parallelize dense > matrix > >> >> >> product! its worth reading the papers about goto blas and the more > >> >> >> recent > >> >> >> blis project. a high performance dense matrix multipy winds up > >> >> >> needing > >> >> >> to do > >> >> >> some nested array parallelism with mutable updates to have > efficient > >> >> >> sharing > >> >> >> of sub computations! > >> >> >> > >> >> >> > >> >> >> > >> >> >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko > >> >> >> > >> >> >> wrote: > >> >> >>> > >> >> >>> you think the backed would make any difference? this seems like > a > >> >> >>> runtime issue to me, how are the threads scheduled by the ghc > >> >> >>> runtime? > >> >> >>> > >> >> >>> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: > >> >> >>> > How is the LLVM? > >> >> >>> > > >> >> >>> > -- > >> >> >>> > -- > >> >> >>> > > >> >> >>> > Sent from an expensive device which will be obsolete in a few > >> >> >>> > months! > >> >> >>> > :D > >> >> >>> > > >> >> >>> > Casey > >> >> >>> > > >> >> >>> > > >> >> >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" > >> >> >>> > > >> >> >>> > wrote: > >> >> >>> >> > >> >> >>> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 > >> >> >>> >> > >> >> >>> >> > >> >> >>> >> so i am seeing basically results with N4 that are as good as > >> >> >>> >> using > >> >> >>> >> sequential computation on my macbook for the matrix multiply > >> >> >>> >> algorithm. any idea why? > >> >> >>> >> > >> >> >>> >> Thanks, > >> >> >>> >> Anatoly > >> >> >>> >> _______________________________________________ > >> >> >>> >> Haskell-Cafe mailing list > >> >> >>> >> Haskell-Cafe at haskell.org > >> >> >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> >> >>> _______________________________________________ > >> >> >>> Haskell-Cafe mailing list > >> >> >>> Haskell-Cafe at haskell.org > >> >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> >> >> > >> >> >> > >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From agocorona at gmail.com Mon Mar 16 11:21:22 2015 From: agocorona at gmail.com (Alberto G. Corona ) Date: Mon, 16 Mar 2015 12:21:22 +0100 Subject: [Haskell-cafe] Distributing Haskell on a cluster In-Reply-To: References: <65E705DD-AE44-4EAD-9FE3-0B906F959EE8@soostone.com> Message-ID: As usual, I could suggest a really crazy alternative: It could be possible to design your code as an EDSL that can emit his own source code, in the same way that web formlets emit HTML rendering. In this case, instead of HTML rendering, the rendering would be the source code of the closure that you want to execute remotely. Then you can compile it at the emitting node or at the receiver. The advantage is that you may remotely execute any routine coded using the EDSL. Hiding the mechanism behind a few primitives of the EDSL. The disadvantage is that you can not use IO routines with liftIO. You need an special lifting mechanism that produces also the source code of the IO routine. I?m doing some research on this mechanism with the Transient monad. 2015-03-16 1:54 GMT+01:00 felipe zapata : > I haven't considered that idea, but it seems the natural solution. > > Many thanks > > On 15 March 2015 at 20:31, Ozgun Ataman wrote: > >> Anecdotal support for this idea: This is exactly how we distribute >> hadron[1]-based Hadoop MapReduce programs to cluster nodes at work. The >> compiled executable essentially ships itself to the nodes and recognizes >> the different environment when executed in that context. >> >> [1] hadron is a haskell hadoop streaming framework that came out of our >> work. It's on github and close to being released on hackage once the >> current dev branch is finalized/merged. In case it's helpful: >> https://github.com/soostone/hadron >> >> Oz >> >> On Mar 15, 2015, at 8:06 PM, Andrew Cowie >> wrote: >> >> Bit of a whinger from left-field, but rather than deploying a Main script >> and then using GHCi, have you considered compiling the program and shipping >> that? >> >> Before you veto the idea out of hand, statically compiled binaries are >> good for being almost self-contained, and (depending on what you changed) >> and they rsync well. And if that doesn't appeal, then consider instead >> building the Haskell program dynamically; Hello World is only a couple kB; >> serious program only a hundred or so. >> >> Anyway, I know you're just looking to send a code fragment closure, but >> if you're dealing with the input and output of the program through a stable >> interface, then the program is the closure. >> >> Just a thought. >> >> AfC >> >> On Mon, Mar 16, 2015 at 9:53 AM felipe zapata >> wrote: >> >>> Hi all, >>> I have posted the following question on stackoverflow, but so far I have >>> not received an answer. >>> >>> http://stackoverflow.com/questions/29039815/distributing-haskell-on-a-cluster >>> >>> >>> I have a piece of code that process files, >>> >>> processFiles :: [FilePath] -> (FilePath -> IO ()) -> IO () >>> >>> This function spawns an async process that execute an IO action. This IO >>> action must be submitted to a cluster through a job scheduling system (e.g >>> Slurm). >>> >>> Because I must use the job scheduling system, it's not possible to use >>> cloudHaskell to distribute the closure. Instead the program writes a new >>> *Main.hs* containing the desired computations, that is copy to the >>> cluster node together with all the modules that main depends on and then it >>> is executed remotely with "runhaskell Main.hs [opts]". Then the async >>> process should ask periodically to the job scheduling system (using >>> *threadDelay*) if the job is done. >>> >>> Is there a way to avoid creating a new Main? Can I serialize the IO >>> action and execute it somehow in the node? >>> >>> Best, >>> >>> Felipe >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From aeyakovenko at gmail.com Mon Mar 16 12:11:35 2015 From: aeyakovenko at gmail.com (Anatoly Yakovenko) Date: Mon, 16 Mar 2015 05:11:35 -0700 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: hmm, so i was wrong https://gist.github.com/aeyakovenko/0af788390ee9d980c1d6 the first version performed the best, even when running with -N1 agains the sequential version. On Sun, Mar 15, 2015 at 8:04 PM, Carter Schonwald wrote: > you're getting on the right track! :) > > the idea you're reaching for is "parallel work depth". Eg, if instead of > foldl' (which has O(n) work depth), you had a "parallel" fold that kinda > looks like a recursive split and then merge version of the fold operation, > you'd have O(log n) work depth. (and that'd likely be faster!). But then > you'd notice "below some threshold, its better to compute sequentially, > because the overhead of parallization is too big". > > etc etc. (the point i'm trying to reach for is that effective > parallelization requires a pretty rich understanding of your application / > software / hardware cost model) > > likewise, REPA is really only going to shine on workloads that look > "pointwise" or "flat", at least with the current iteration. Its probably a > good idea to look at the various example codes that are available for repa > and acccelerate, because you'll notice that the codes which are especially > performant have that "flat" style of paralellims > > > On Sun, Mar 15, 2015 at 7:16 PM, Anatoly Yakovenko > wrote: >> >> Ok, got it. I picked the wrong function to try to understand how Repa >> parallelizes :) >> >> So whats a good heuristic for using the parallel versions vs >> sequential for Repa? >> >> Do the internals try to parallelize every element? or does it fuse >> them into some small number of parallelized tasks? >> >> So just based from my observations >> >> f (Z :. r :. c) = r * c >> >> a <- computeP (fromFunction f) >> a `deepSeqArray` sumAllP a >> >> should be faster then: >> >> let a = computeS $ fromFunction f >> a `deepSeqArray` sumAllP $ a >> >> but probably slower then >> >> sumAllS $ computeS $ fromFunction f >> >> Since an intermediate array is not even computed. >> >> Thanks, >> Anatoly >> >> >> On Sun, Mar 15, 2015 at 1:41 PM, Carter Schonwald >> wrote: >> > Read that paper I linked. Anything else I say will be a rehash of that >> > paper. :) >> > >> > On Mar 15, 2015 4:21 PM, "Anatoly Yakovenko" >> > wrote: >> >> >> >> Ok, so whats the difference between the sequence and parallel >> >> versions? does the parallel one contain a thunk for every element in >> >> the output? >> >> >> >> On Sun, Mar 15, 2015 at 12:44 PM, Carter Schonwald >> >> wrote: >> >> > Read what I linked. >> >> > You are benchmarking repa for exactly the pessimal workload that it >> >> > is >> >> > bad >> >> > at. >> >> > >> >> > Repa is for point wise parallel and local convolution parallel >> >> > programs. >> >> > The way repa can express matrix multiplication is exactly the worst >> >> > way >> >> > to >> >> > implement a parallel matrix mult. Like, pretty pessimal wrt a memory >> >> > traffic / communication complexity metric of performance. >> >> > >> >> > Benchmark something like image blur algorithms and repa will really >> >> > shine. >> >> > >> >> > Right now your benchmark is the repa equivalent of noticing that >> >> > random >> >> > access on singly linked lists is slow :) >> >> > >> >> > On Mar 15, 2015 2:44 PM, "Anatoly Yakovenko" >> >> > wrote: >> >> >> >> >> >> I am not really focusing on matrix multiply specifically. So the >> >> >> real >> >> >> problem is that the implementation using parallelized functions is >> >> >> slower then the sequential one, and adding more threads makes it >> >> >> barely as fast as the sequential one. >> >> >> >> >> >> So why would i ever use the parallelized versions? >> >> >> >> >> >> >> >> >> On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald >> >> >> wrote: >> >> >> > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf this >> >> >> > paper >> >> >> > (among many others by the blis project) articulates some of the >> >> >> > ideas >> >> >> > i >> >> >> > allude to pretty well (with pictures!) >> >> >> > >> >> >> > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald >> >> >> > wrote: >> >> >> >> >> >> >> >> dense matrix product is not an algorithm that makes sense in >> >> >> >> repa's >> >> >> >> execution model, >> >> >> >> in square matrix multiply of two N x N matrices, each result >> >> >> >> entry >> >> >> >> depends >> >> >> >> on 2n values total across the two input matrices. >> >> >> >> even then, thats actually the wrong way to parallelize dense >> >> >> >> matrix >> >> >> >> product! its worth reading the papers about goto blas and the >> >> >> >> more >> >> >> >> recent >> >> >> >> blis project. a high performance dense matrix multipy winds up >> >> >> >> needing >> >> >> >> to do >> >> >> >> some nested array parallelism with mutable updates to have >> >> >> >> efficient >> >> >> >> sharing >> >> >> >> of sub computations! >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko >> >> >> >> >> >> >> >> wrote: >> >> >> >>> >> >> >> >>> you think the backed would make any difference? this seems like >> >> >> >>> a >> >> >> >>> runtime issue to me, how are the threads scheduled by the ghc >> >> >> >>> runtime? >> >> >> >>> >> >> >> >>> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: >> >> >> >>> > How is the LLVM? >> >> >> >>> > >> >> >> >>> > -- >> >> >> >>> > -- >> >> >> >>> > >> >> >> >>> > Sent from an expensive device which will be obsolete in a few >> >> >> >>> > months! >> >> >> >>> > :D >> >> >> >>> > >> >> >> >>> > Casey >> >> >> >>> > >> >> >> >>> > >> >> >> >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" >> >> >> >>> > >> >> >> >>> > wrote: >> >> >> >>> >> >> >> >> >>> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 >> >> >> >>> >> >> >> >> >>> >> >> >> >> >>> >> so i am seeing basically results with N4 that are as good as >> >> >> >>> >> using >> >> >> >>> >> sequential computation on my macbook for the matrix multiply >> >> >> >>> >> algorithm. any idea why? >> >> >> >>> >> >> >> >> >>> >> Thanks, >> >> >> >>> >> Anatoly >> >> >> >>> >> _______________________________________________ >> >> >> >>> >> Haskell-Cafe mailing list >> >> >> >>> >> Haskell-Cafe at haskell.org >> >> >> >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >> >>> _______________________________________________ >> >> >> >>> Haskell-Cafe mailing list >> >> >> >>> Haskell-Cafe at haskell.org >> >> >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >> >> >> >> >> >> >> >> >> > > > From sumit.sahrawat.apm13 at iitbhu.ac.in Mon Mar 16 14:40:35 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Mon, 16 Mar 2015 20:10:35 +0530 Subject: [Haskell-cafe] [Haskell-beginners] testing IO code In-Reply-To: References: Message-ID: On 16 March 2015 at 19:51, Maurizio Vitale wrote: > suppose I have a restricted IO monad, RIO that only exposes readFile. > and then I have a monad SIO that will eventually provide a virtual file > system from a map path->content, also with a readFile function returning > SIO(String). > > What is the way to write a function parseFile that can operate in both > monads so that I can use SIO for testing? should I define a third monad > CompileMonad that has instances for both RIO and SIO and then having > parseFile :: CompileMonad ast? > You might be able to do something like, class MonadIO m => ProvidesReadFile m where readFile :: FilePath -> m String instance ProvidesReadFile RIO where readFile = readFileRIO -- the RIO specific readFile instance ProvidesReadFile SIO where readFile = readFileSIO -- the SIO specific readFile parseFile :: ProvidesReadFile m => FilePath -> m ast parseFile = do f <- readFile let ast = parse f -- the pure parser return ast -- works for both monads > Thanks, > > Maurizio > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > This is more suitable for the haskell-cafe. I am posting it there so that more people might comment on it. HTH. -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From polux2001 at gmail.com Mon Mar 16 15:11:57 2015 From: polux2001 at gmail.com (Paul Brauner) Date: Mon, 16 Mar 2015 15:11:57 +0000 Subject: [Haskell-cafe] [Haskell-beginners] testing IO code In-Reply-To: References: Message-ID: You might want to have a look at https://hackage.haskell.org/package/IOSpec which I think does something very similar to what you're trying to achieve. On Mon, Mar 16, 2015 at 3:47 PM Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote: > On 16 March 2015 at 19:51, Maurizio Vitale wrote: > >> suppose I have a restricted IO monad, RIO that only exposes readFile. >> and then I have a monad SIO that will eventually provide a virtual file >> system from a map path->content, also with a readFile function returning >> SIO(String). >> >> What is the way to write a function parseFile that can operate in both >> monads so that I can use SIO for testing? should I define a third monad >> CompileMonad that has instances for both RIO and SIO and then having >> parseFile :: CompileMonad ast? >> > > You might be able to do something like, > > class MonadIO m => ProvidesReadFile m where > readFile :: FilePath -> m String > > instance ProvidesReadFile RIO where > readFile = readFileRIO -- the RIO specific readFile > > instance ProvidesReadFile SIO where > readFile = readFileSIO -- the SIO specific readFile > > parseFile :: ProvidesReadFile m => FilePath -> m ast > parseFile = do > f <- readFile > let ast = parse f -- the pure parser > return ast -- works for both monads > > >> Thanks, >> >> Maurizio >> >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> >> > This is more suitable for the haskell-cafe. I am posting it there so that > more people might comment on it. > HTH. > > -- > Regards > > Sumit Sahrawat > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at functionaljobs.com Mon Mar 16 16:00:01 2015 From: sean at functionaljobs.com (Functional Jobs) Date: Mon, 16 Mar 2015 12:00:01 -0400 Subject: [Haskell-cafe] New Functional Programming Job Opportunities Message-ID: <5506fe15791e5@functionaljobs.com> Here are some functional programming job opportunities that were posted recently: Software Engineer at Xledger http://functionaljobs.com/jobs/8797-software-engineer-at-xledger Lead front end developer at Anchor Systems http://functionaljobs.com/jobs/8796-lead-front-end-developer-at-anchor-systems Cheers, Sean Murphy FunctionalJobs.com From mrz.vtl at gmail.com Mon Mar 16 16:06:01 2015 From: mrz.vtl at gmail.com (Maurizio Vitale) Date: Mon, 16 Mar 2015 09:06:01 -0700 Subject: [Haskell-cafe] [Haskell-beginners] testing IO code In-Reply-To: References: Message-ID: Thanks! This is what I had in mind, except that I'm new too Haskell so I tried English instead of code for expressing it :-) I'll also check the IOSpec package Paul suggested, On Mon, Mar 16, 2015 at 7:40 AM, Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote: > On 16 March 2015 at 19:51, Maurizio Vitale wrote: > >> suppose I have a restricted IO monad, RIO that only exposes readFile. >> and then I have a monad SIO that will eventually provide a virtual file >> system from a map path->content, also with a readFile function returning >> SIO(String). >> >> What is the way to write a function parseFile that can operate in both >> monads so that I can use SIO for testing? should I define a third monad >> CompileMonad that has instances for both RIO and SIO and then having >> parseFile :: CompileMonad ast? >> > > You might be able to do something like, > > class MonadIO m => ProvidesReadFile m where > readFile :: FilePath -> m String > > instance ProvidesReadFile RIO where > readFile = readFileRIO -- the RIO specific readFile > > instance ProvidesReadFile SIO where > readFile = readFileSIO -- the SIO specific readFile > > parseFile :: ProvidesReadFile m => FilePath -> m ast > parseFile = do > f <- readFile > let ast = parse f -- the pure parser > return ast -- works for both monads > > >> Thanks, >> >> Maurizio >> >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> >> > This is more suitable for the haskell-cafe. I am posting it there so that > more people might comment on it. > HTH. > > -- > Regards > > Sumit Sahrawat > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dons00 at gmail.com Mon Mar 16 16:29:14 2015 From: dons00 at gmail.com (Don Stewart) Date: Mon, 16 Mar 2015 16:29:14 +0000 Subject: [Haskell-cafe] Haskell development role at Standard Chartered in London Message-ID: The Strats team at Standard Chartered has an open position for a typed functional programming developer to join the team in London. This is a ?front office? finance role ? meaning you will work on the trading floor, directly with traders, building software to automate their work and improve their efficiency. The role is highly development focused, and you will use Haskell for almost all tasks: data analysis, market data publishing, database access, web services, desktop GUIs, large parallel tasks, quantitative models, solvers, everything. This is a fast paced role ? code you write today will be deployed within hours to hundreds of users and has to work. More details are in the full posting here: https://donsbot.wordpress.com/2015/03/16/haskell-development-role-in-strats-at-standard-chartered/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From horstmey at Mathematik.Uni-Marburg.de Mon Mar 16 16:51:14 2015 From: horstmey at Mathematik.Uni-Marburg.de (Thomas Horstmeyer) Date: Mon, 16 Mar 2015 17:51:14 +0100 Subject: [Haskell-cafe] Full page Haskell 2010 report request In-Reply-To: References: Message-ID: <55070A02.5060802@informatik.uni-marburg.de> Hi Chris, I just tested omitting the separation parameter for the html output in the makefile. html: $(HT_TEXS) ht/classes.eps ht/haddock.sty ht/haskell.bbl cd ht && htlatex haskell.tex "haskell,2" That "2" at the end of the second line is supposed to direct the separation into files up to the 2nd level. Change that to html: $(HT_TEXS) ht/classes.eps ht/haddock.sty ht/haskell.bbl cd ht && htlatex haskell.tex "haskell" The result is quite good. Only three footnotes got separated into extra files. HTH Thomas Am 27.02.2015 um 20:32 schrieb Christopher Done: > Hi, has anyone managed to produce a single-page HTML export of the > Haskell 2010 report? > > Here's one I made by munging together the multi-page one: > https://www.haskell.org/report/mono/2010#x8-440003.12 (this link is > currently unpublished on the home page). > > But it's incomplete due to link references and things. I'd like a > proper output but in the interest of my mental health prefer not to > touch LaTeX except by proxy through other poor souls. > > Anyone managed to do this? A full, linkable page (don't worry about > the section/para links, I added them with a few lines of JS, I can do > it again) is really conducive to discussion of Haskell's finer points. > > Ciao! > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From chrisdone at gmail.com Mon Mar 16 17:00:38 2015 From: chrisdone at gmail.com (Christopher Done) Date: Mon, 16 Mar 2015 18:00:38 +0100 Subject: [Haskell-cafe] Full page Haskell 2010 report request In-Reply-To: <55070A02.5060802@informatik.uni-marburg.de> References: <55070A02.5060802@informatik.uni-marburg.de> Message-ID: Any chance you can upload that somewhere so that I can download it? :-) On 16 March 2015 at 17:51, Thomas Horstmeyer wrote: > Hi Chris, > > I just tested omitting the separation parameter for the html output in the > makefile. > > html: $(HT_TEXS) ht/classes.eps ht/haddock.sty ht/haskell.bbl > cd ht && htlatex haskell.tex "haskell,2" > > That "2" at the end of the second line is supposed to direct the separation > into files up to the 2nd level. Change that to > > html: $(HT_TEXS) ht/classes.eps ht/haddock.sty ht/haskell.bbl > cd ht && htlatex haskell.tex "haskell" > > The result is quite good. Only three footnotes got separated into extra > files. > > HTH > Thomas > > > > Am 27.02.2015 um 20:32 schrieb Christopher Done: >> >> Hi, has anyone managed to produce a single-page HTML export of the >> Haskell 2010 report? >> >> Here's one I made by munging together the multi-page one: >> https://www.haskell.org/report/mono/2010#x8-440003.12 (this link is >> currently unpublished on the home page). >> >> But it's incomplete due to link references and things. I'd like a >> proper output but in the interest of my mental health prefer not to >> touch LaTeX except by proxy through other poor souls. >> >> Anyone managed to do this? A full, linkable page (don't worry about >> the section/para links, I added them with a few lines of JS, I can do >> it again) is really conducive to discussion of Haskell's finer points. >> >> Ciao! >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > From darais at cs.umd.edu Mon Mar 16 17:34:53 2015 From: darais at cs.umd.edu (David Darais) Date: Mon, 16 Mar 2015 13:34:53 -0400 Subject: [Haskell-cafe] Whole program analysis as a GHC plugin Message-ID: Hello cafe, I'm currently implementing a whole-program analysis for Haskell programs using the GHC api. I have a GHC plugin written and I'm successfully slurping in programs and processing them with my analysis tools. I'm getting stuck when my tool encounters an identifier that lives in another module. I'd like to unfold the identifier and retrieve its source code, allowing me to do whole-program analysis. Assuming I have the source code of the whole program, and that I get to (re)compile everything with my plugin enabled, I'm wondering: 1) Does the GHC api already support a nice way of doing this? 2) I see that there is support for unfolding identifiers if they've been specially marked in .hi files. Is there a way to mark everything to support unfolding, and would this give me the information I'm looking for? 3) Does anybody have experience with implementing a whole-program analysis for GHC as a plugin, and if so, how did you go about it? Many Thanks, David From kc1956 at gmail.com Tue Mar 17 01:20:30 2015 From: kc1956 at gmail.com (KC) Date: Mon, 16 Mar 2015 18:20:30 -0700 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: You want to throw your parallelizable matrix operations to the GPU cores. MATLAB can now do this and I believe it is starting to be built into R so that R can use the GPU cores.. On Mon, Mar 16, 2015 at 5:11 AM, Anatoly Yakovenko wrote: > hmm, so i was wrong > > https://gist.github.com/aeyakovenko/0af788390ee9d980c1d6 > > the first version performed the best, even when running with -N1 > agains the sequential version. > > On Sun, Mar 15, 2015 at 8:04 PM, Carter Schonwald > wrote: > > you're getting on the right track! :) > > > > the idea you're reaching for is "parallel work depth". Eg, if instead of > > foldl' (which has O(n) work depth), you had a "parallel" fold that kinda > > looks like a recursive split and then merge version of the fold > operation, > > you'd have O(log n) work depth. (and that'd likely be faster!). But then > > you'd notice "below some threshold, its better to compute sequentially, > > because the overhead of parallization is too big". > > > > etc etc. (the point i'm trying to reach for is that effective > > parallelization requires a pretty rich understanding of your application > / > > software / hardware cost model) > > > > likewise, REPA is really only going to shine on workloads that look > > "pointwise" or "flat", at least with the current iteration. Its probably > a > > good idea to look at the various example codes that are available for > repa > > and acccelerate, because you'll notice that the codes which are > especially > > performant have that "flat" style of paralellims > > > > > > On Sun, Mar 15, 2015 at 7:16 PM, Anatoly Yakovenko < > aeyakovenko at gmail.com> > > wrote: > >> > >> Ok, got it. I picked the wrong function to try to understand how Repa > >> parallelizes :) > >> > >> So whats a good heuristic for using the parallel versions vs > >> sequential for Repa? > >> > >> Do the internals try to parallelize every element? or does it fuse > >> them into some small number of parallelized tasks? > >> > >> So just based from my observations > >> > >> f (Z :. r :. c) = r * c > >> > >> a <- computeP (fromFunction f) > >> a `deepSeqArray` sumAllP a > >> > >> should be faster then: > >> > >> let a = computeS $ fromFunction f > >> a `deepSeqArray` sumAllP $ a > >> > >> but probably slower then > >> > >> sumAllS $ computeS $ fromFunction f > >> > >> Since an intermediate array is not even computed. > >> > >> Thanks, > >> Anatoly > >> > >> > >> On Sun, Mar 15, 2015 at 1:41 PM, Carter Schonwald > >> wrote: > >> > Read that paper I linked. Anything else I say will be a rehash of that > >> > paper. :) > >> > > >> > On Mar 15, 2015 4:21 PM, "Anatoly Yakovenko" > >> > wrote: > >> >> > >> >> Ok, so whats the difference between the sequence and parallel > >> >> versions? does the parallel one contain a thunk for every element in > >> >> the output? > >> >> > >> >> On Sun, Mar 15, 2015 at 12:44 PM, Carter Schonwald > >> >> wrote: > >> >> > Read what I linked. > >> >> > You are benchmarking repa for exactly the pessimal workload that it > >> >> > is > >> >> > bad > >> >> > at. > >> >> > > >> >> > Repa is for point wise parallel and local convolution parallel > >> >> > programs. > >> >> > The way repa can express matrix multiplication is exactly the worst > >> >> > way > >> >> > to > >> >> > implement a parallel matrix mult. Like, pretty pessimal wrt a > memory > >> >> > traffic / communication complexity metric of performance. > >> >> > > >> >> > Benchmark something like image blur algorithms and repa will really > >> >> > shine. > >> >> > > >> >> > Right now your benchmark is the repa equivalent of noticing that > >> >> > random > >> >> > access on singly linked lists is slow :) > >> >> > > >> >> > On Mar 15, 2015 2:44 PM, "Anatoly Yakovenko" < > aeyakovenko at gmail.com> > >> >> > wrote: > >> >> >> > >> >> >> I am not really focusing on matrix multiply specifically. So the > >> >> >> real > >> >> >> problem is that the implementation using parallelized functions is > >> >> >> slower then the sequential one, and adding more threads makes it > >> >> >> barely as fast as the sequential one. > >> >> >> > >> >> >> So why would i ever use the parallelized versions? > >> >> >> > >> >> >> > >> >> >> On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald > >> >> >> wrote: > >> >> >> > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf > this > >> >> >> > paper > >> >> >> > (among many others by the blis project) articulates some of the > >> >> >> > ideas > >> >> >> > i > >> >> >> > allude to pretty well (with pictures!) > >> >> >> > > >> >> >> > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald > >> >> >> > wrote: > >> >> >> >> > >> >> >> >> dense matrix product is not an algorithm that makes sense in > >> >> >> >> repa's > >> >> >> >> execution model, > >> >> >> >> in square matrix multiply of two N x N matrices, each result > >> >> >> >> entry > >> >> >> >> depends > >> >> >> >> on 2n values total across the two input matrices. > >> >> >> >> even then, thats actually the wrong way to parallelize dense > >> >> >> >> matrix > >> >> >> >> product! its worth reading the papers about goto blas and the > >> >> >> >> more > >> >> >> >> recent > >> >> >> >> blis project. a high performance dense matrix multipy winds up > >> >> >> >> needing > >> >> >> >> to do > >> >> >> >> some nested array parallelism with mutable updates to have > >> >> >> >> efficient > >> >> >> >> sharing > >> >> >> >> of sub computations! > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko > >> >> >> >> > >> >> >> >> wrote: > >> >> >> >>> > >> >> >> >>> you think the backed would make any difference? this seems > like > >> >> >> >>> a > >> >> >> >>> runtime issue to me, how are the threads scheduled by the ghc > >> >> >> >>> runtime? > >> >> >> >>> > >> >> >> >>> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: > >> >> >> >>> > How is the LLVM? > >> >> >> >>> > > >> >> >> >>> > -- > >> >> >> >>> > -- > >> >> >> >>> > > >> >> >> >>> > Sent from an expensive device which will be obsolete in a > few > >> >> >> >>> > months! > >> >> >> >>> > :D > >> >> >> >>> > > >> >> >> >>> > Casey > >> >> >> >>> > > >> >> >> >>> > > >> >> >> >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" > >> >> >> >>> > > >> >> >> >>> > wrote: > >> >> >> >>> >> > >> >> >> >>> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 > >> >> >> >>> >> > >> >> >> >>> >> > >> >> >> >>> >> so i am seeing basically results with N4 that are as good > as > >> >> >> >>> >> using > >> >> >> >>> >> sequential computation on my macbook for the matrix > multiply > >> >> >> >>> >> algorithm. any idea why? > >> >> >> >>> >> > >> >> >> >>> >> Thanks, > >> >> >> >>> >> Anatoly > >> >> >> >>> >> _______________________________________________ > >> >> >> >>> >> Haskell-Cafe mailing list > >> >> >> >>> >> Haskell-Cafe at haskell.org > >> >> >> >>> >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> >> >> >>> _______________________________________________ > >> >> >> >>> Haskell-Cafe mailing list > >> >> >> >>> Haskell-Cafe at haskell.org > >> >> >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> >> >> >> > >> >> >> >> > >> >> >> > > > > > > -- -- Sent from an expensive device which will be obsolete in a few months! :D Casey -------------- next part -------------- An HTML attachment was scrubbed... URL: From aeyakovenko at gmail.com Tue Mar 17 03:27:39 2015 From: aeyakovenko at gmail.com (Anatoly Yakovenko) Date: Mon, 16 Mar 2015 20:27:39 -0700 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: you mean by hand? or using accelerate? I am not sure GPU's would do that much better at matrix multiplication. According to that paper its pretty cache bound, so having a bigger l1/l2 would have a higher impact on performance then more cores, or wider simd. either way, i am more trying to understand how the parallelization techniques work in Repa, what usecases are they applicable in, and how to pick sequential or parallel versions of functions. Anatoly On Mon, Mar 16, 2015 at 6:20 PM, KC wrote: > You want to throw your parallelizable matrix operations to the GPU cores. > > MATLAB can now do this and I believe it is starting to be built into R so > that R can use the GPU cores.. > > > On Mon, Mar 16, 2015 at 5:11 AM, Anatoly Yakovenko > wrote: >> >> hmm, so i was wrong >> >> https://gist.github.com/aeyakovenko/0af788390ee9d980c1d6 >> >> the first version performed the best, even when running with -N1 >> agains the sequential version. >> >> On Sun, Mar 15, 2015 at 8:04 PM, Carter Schonwald >> wrote: >> > you're getting on the right track! :) >> > >> > the idea you're reaching for is "parallel work depth". Eg, if instead >> > of >> > foldl' (which has O(n) work depth), you had a "parallel" fold that kinda >> > looks like a recursive split and then merge version of the fold >> > operation, >> > you'd have O(log n) work depth. (and that'd likely be faster!). But then >> > you'd notice "below some threshold, its better to compute sequentially, >> > because the overhead of parallization is too big". >> > >> > etc etc. (the point i'm trying to reach for is that effective >> > parallelization requires a pretty rich understanding of your application >> > / >> > software / hardware cost model) >> > >> > likewise, REPA is really only going to shine on workloads that look >> > "pointwise" or "flat", at least with the current iteration. Its probably >> > a >> > good idea to look at the various example codes that are available for >> > repa >> > and acccelerate, because you'll notice that the codes which are >> > especially >> > performant have that "flat" style of paralellims >> > >> > >> > On Sun, Mar 15, 2015 at 7:16 PM, Anatoly Yakovenko >> > >> > wrote: >> >> >> >> Ok, got it. I picked the wrong function to try to understand how Repa >> >> parallelizes :) >> >> >> >> So whats a good heuristic for using the parallel versions vs >> >> sequential for Repa? >> >> >> >> Do the internals try to parallelize every element? or does it fuse >> >> them into some small number of parallelized tasks? >> >> >> >> So just based from my observations >> >> >> >> f (Z :. r :. c) = r * c >> >> >> >> a <- computeP (fromFunction f) >> >> a `deepSeqArray` sumAllP a >> >> >> >> should be faster then: >> >> >> >> let a = computeS $ fromFunction f >> >> a `deepSeqArray` sumAllP $ a >> >> >> >> but probably slower then >> >> >> >> sumAllS $ computeS $ fromFunction f >> >> >> >> Since an intermediate array is not even computed. >> >> >> >> Thanks, >> >> Anatoly >> >> >> >> >> >> On Sun, Mar 15, 2015 at 1:41 PM, Carter Schonwald >> >> wrote: >> >> > Read that paper I linked. Anything else I say will be a rehash of >> >> > that >> >> > paper. :) >> >> > >> >> > On Mar 15, 2015 4:21 PM, "Anatoly Yakovenko" >> >> > wrote: >> >> >> >> >> >> Ok, so whats the difference between the sequence and parallel >> >> >> versions? does the parallel one contain a thunk for every element in >> >> >> the output? >> >> >> >> >> >> On Sun, Mar 15, 2015 at 12:44 PM, Carter Schonwald >> >> >> wrote: >> >> >> > Read what I linked. >> >> >> > You are benchmarking repa for exactly the pessimal workload that >> >> >> > it >> >> >> > is >> >> >> > bad >> >> >> > at. >> >> >> > >> >> >> > Repa is for point wise parallel and local convolution parallel >> >> >> > programs. >> >> >> > The way repa can express matrix multiplication is exactly the >> >> >> > worst >> >> >> > way >> >> >> > to >> >> >> > implement a parallel matrix mult. Like, pretty pessimal wrt a >> >> >> > memory >> >> >> > traffic / communication complexity metric of performance. >> >> >> > >> >> >> > Benchmark something like image blur algorithms and repa will >> >> >> > really >> >> >> > shine. >> >> >> > >> >> >> > Right now your benchmark is the repa equivalent of noticing that >> >> >> > random >> >> >> > access on singly linked lists is slow :) >> >> >> > >> >> >> > On Mar 15, 2015 2:44 PM, "Anatoly Yakovenko" >> >> >> > >> >> >> > wrote: >> >> >> >> >> >> >> >> I am not really focusing on matrix multiply specifically. So the >> >> >> >> real >> >> >> >> problem is that the implementation using parallelized functions >> >> >> >> is >> >> >> >> slower then the sequential one, and adding more threads makes it >> >> >> >> barely as fast as the sequential one. >> >> >> >> >> >> >> >> So why would i ever use the parallelized versions? >> >> >> >> >> >> >> >> >> >> >> >> On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald >> >> >> >> wrote: >> >> >> >> > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf >> >> >> >> > this >> >> >> >> > paper >> >> >> >> > (among many others by the blis project) articulates some of the >> >> >> >> > ideas >> >> >> >> > i >> >> >> >> > allude to pretty well (with pictures!) >> >> >> >> > >> >> >> >> > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald >> >> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> dense matrix product is not an algorithm that makes sense in >> >> >> >> >> repa's >> >> >> >> >> execution model, >> >> >> >> >> in square matrix multiply of two N x N matrices, each result >> >> >> >> >> entry >> >> >> >> >> depends >> >> >> >> >> on 2n values total across the two input matrices. >> >> >> >> >> even then, thats actually the wrong way to parallelize dense >> >> >> >> >> matrix >> >> >> >> >> product! its worth reading the papers about goto blas and the >> >> >> >> >> more >> >> >> >> >> recent >> >> >> >> >> blis project. a high performance dense matrix multipy winds up >> >> >> >> >> needing >> >> >> >> >> to do >> >> >> >> >> some nested array parallelism with mutable updates to have >> >> >> >> >> efficient >> >> >> >> >> sharing >> >> >> >> >> of sub computations! >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko >> >> >> >> >> >> >> >> >> >> wrote: >> >> >> >> >>> >> >> >> >> >>> you think the backed would make any difference? this seems >> >> >> >> >>> like >> >> >> >> >>> a >> >> >> >> >>> runtime issue to me, how are the threads scheduled by the ghc >> >> >> >> >>> runtime? >> >> >> >> >>> >> >> >> >> >>> On Fri, Mar 13, 2015 at 4:58 PM, KC wrote: >> >> >> >> >>> > How is the LLVM? >> >> >> >> >>> > >> >> >> >> >>> > -- >> >> >> >> >>> > -- >> >> >> >> >>> > >> >> >> >> >>> > Sent from an expensive device which will be obsolete in a >> >> >> >> >>> > few >> >> >> >> >>> > months! >> >> >> >> >>> > :D >> >> >> >> >>> > >> >> >> >> >>> > Casey >> >> >> >> >>> > >> >> >> >> >>> > >> >> >> >> >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" >> >> >> >> >>> > >> >> >> >> >>> > wrote: >> >> >> >> >>> >> >> >> >> >> >>> >> https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 >> >> >> >> >>> >> >> >> >> >> >>> >> >> >> >> >> >>> >> so i am seeing basically results with N4 that are as good >> >> >> >> >>> >> as >> >> >> >> >>> >> using >> >> >> >> >>> >> sequential computation on my macbook for the matrix >> >> >> >> >>> >> multiply >> >> >> >> >>> >> algorithm. any idea why? >> >> >> >> >>> >> >> >> >> >> >>> >> Thanks, >> >> >> >> >>> >> Anatoly >> >> >> >> >>> >> _______________________________________________ >> >> >> >> >>> >> Haskell-Cafe mailing list >> >> >> >> >>> >> Haskell-Cafe at haskell.org >> >> >> >> >>> >> >> >> >> >> >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >> >> >>> _______________________________________________ >> >> >> >> >>> Haskell-Cafe mailing list >> >> >> >> >>> Haskell-Cafe at haskell.org >> >> >> >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> > >> > > > > > > -- > > -- > > Sent from an expensive device which will be obsolete in a few months! :D > > Casey > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From carter.schonwald at gmail.com Tue Mar 17 04:08:11 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 17 Mar 2015 00:08:11 -0400 Subject: [Haskell-cafe] repa parallelization results In-Reply-To: References: Message-ID: if you want to understand writing matrix algorithms for the GPU, http://icl.cs.utk.edu/magma/pubs/index.html has lots of reading resources. The cost model for memory and computation on a GPU is different from the CPU cost model. and http://icl.cs.utk.edu/magma/software/ has a bunch of high performance gpu kernels for a bunch of architectures. accelerate is good to look at, at minimum because it manages to focus on a fragment of functionall array programs that are moderately easy to optmize for gpu On Mon, Mar 16, 2015 at 11:27 PM, Anatoly Yakovenko wrote: > you mean by hand? or using accelerate? I am not sure GPU's would do > that much better at matrix multiplication. According to that paper > its pretty cache bound, so having a bigger l1/l2 would have a higher > impact on performance then more cores, or wider simd. > > either way, i am more trying to understand how the parallelization > techniques work in Repa, what usecases are they applicable in, and how > to pick sequential or parallel versions of functions. > > Anatoly > > > > On Mon, Mar 16, 2015 at 6:20 PM, KC wrote: > > You want to throw your parallelizable matrix operations to the GPU cores. > > > > MATLAB can now do this and I believe it is starting to be built into R so > > that R can use the GPU cores.. > > > > > > On Mon, Mar 16, 2015 at 5:11 AM, Anatoly Yakovenko < > aeyakovenko at gmail.com> > > wrote: > >> > >> hmm, so i was wrong > >> > >> https://gist.github.com/aeyakovenko/0af788390ee9d980c1d6 > >> > >> the first version performed the best, even when running with -N1 > >> agains the sequential version. > >> > >> On Sun, Mar 15, 2015 at 8:04 PM, Carter Schonwald > >> wrote: > >> > you're getting on the right track! :) > >> > > >> > the idea you're reaching for is "parallel work depth". Eg, if instead > >> > of > >> > foldl' (which has O(n) work depth), you had a "parallel" fold that > kinda > >> > looks like a recursive split and then merge version of the fold > >> > operation, > >> > you'd have O(log n) work depth. (and that'd likely be faster!). But > then > >> > you'd notice "below some threshold, its better to compute > sequentially, > >> > because the overhead of parallization is too big". > >> > > >> > etc etc. (the point i'm trying to reach for is that effective > >> > parallelization requires a pretty rich understanding of your > application > >> > / > >> > software / hardware cost model) > >> > > >> > likewise, REPA is really only going to shine on workloads that look > >> > "pointwise" or "flat", at least with the current iteration. Its > probably > >> > a > >> > good idea to look at the various example codes that are available for > >> > repa > >> > and acccelerate, because you'll notice that the codes which are > >> > especially > >> > performant have that "flat" style of paralellims > >> > > >> > > >> > On Sun, Mar 15, 2015 at 7:16 PM, Anatoly Yakovenko > >> > > >> > wrote: > >> >> > >> >> Ok, got it. I picked the wrong function to try to understand how Repa > >> >> parallelizes :) > >> >> > >> >> So whats a good heuristic for using the parallel versions vs > >> >> sequential for Repa? > >> >> > >> >> Do the internals try to parallelize every element? or does it fuse > >> >> them into some small number of parallelized tasks? > >> >> > >> >> So just based from my observations > >> >> > >> >> f (Z :. r :. c) = r * c > >> >> > >> >> a <- computeP (fromFunction f) > >> >> a `deepSeqArray` sumAllP a > >> >> > >> >> should be faster then: > >> >> > >> >> let a = computeS $ fromFunction f > >> >> a `deepSeqArray` sumAllP $ a > >> >> > >> >> but probably slower then > >> >> > >> >> sumAllS $ computeS $ fromFunction f > >> >> > >> >> Since an intermediate array is not even computed. > >> >> > >> >> Thanks, > >> >> Anatoly > >> >> > >> >> > >> >> On Sun, Mar 15, 2015 at 1:41 PM, Carter Schonwald > >> >> wrote: > >> >> > Read that paper I linked. Anything else I say will be a rehash of > >> >> > that > >> >> > paper. :) > >> >> > > >> >> > On Mar 15, 2015 4:21 PM, "Anatoly Yakovenko" < > aeyakovenko at gmail.com> > >> >> > wrote: > >> >> >> > >> >> >> Ok, so whats the difference between the sequence and parallel > >> >> >> versions? does the parallel one contain a thunk for every element > in > >> >> >> the output? > >> >> >> > >> >> >> On Sun, Mar 15, 2015 at 12:44 PM, Carter Schonwald > >> >> >> wrote: > >> >> >> > Read what I linked. > >> >> >> > You are benchmarking repa for exactly the pessimal workload that > >> >> >> > it > >> >> >> > is > >> >> >> > bad > >> >> >> > at. > >> >> >> > > >> >> >> > Repa is for point wise parallel and local convolution parallel > >> >> >> > programs. > >> >> >> > The way repa can express matrix multiplication is exactly the > >> >> >> > worst > >> >> >> > way > >> >> >> > to > >> >> >> > implement a parallel matrix mult. Like, pretty pessimal wrt a > >> >> >> > memory > >> >> >> > traffic / communication complexity metric of performance. > >> >> >> > > >> >> >> > Benchmark something like image blur algorithms and repa will > >> >> >> > really > >> >> >> > shine. > >> >> >> > > >> >> >> > Right now your benchmark is the repa equivalent of noticing that > >> >> >> > random > >> >> >> > access on singly linked lists is slow :) > >> >> >> > > >> >> >> > On Mar 15, 2015 2:44 PM, "Anatoly Yakovenko" > >> >> >> > > >> >> >> > wrote: > >> >> >> >> > >> >> >> >> I am not really focusing on matrix multiply specifically. So > the > >> >> >> >> real > >> >> >> >> problem is that the implementation using parallelized functions > >> >> >> >> is > >> >> >> >> slower then the sequential one, and adding more threads makes > it > >> >> >> >> barely as fast as the sequential one. > >> >> >> >> > >> >> >> >> So why would i ever use the parallelized versions? > >> >> >> >> > >> >> >> >> > >> >> >> >> On Sat, Mar 14, 2015 at 9:24 AM, Carter Schonwald > >> >> >> >> wrote: > >> >> >> >> > http://www.cs.utexas.edu/users/flame/pubs/blis3_ipdps14.pdf > >> >> >> >> > this > >> >> >> >> > paper > >> >> >> >> > (among many others by the blis project) articulates some of > the > >> >> >> >> > ideas > >> >> >> >> > i > >> >> >> >> > allude to pretty well (with pictures!) > >> >> >> >> > > >> >> >> >> > On Sat, Mar 14, 2015 at 12:21 PM, Carter Schonwald > >> >> >> >> > wrote: > >> >> >> >> >> > >> >> >> >> >> dense matrix product is not an algorithm that makes sense in > >> >> >> >> >> repa's > >> >> >> >> >> execution model, > >> >> >> >> >> in square matrix multiply of two N x N matrices, each result > >> >> >> >> >> entry > >> >> >> >> >> depends > >> >> >> >> >> on 2n values total across the two input matrices. > >> >> >> >> >> even then, thats actually the wrong way to parallelize dense > >> >> >> >> >> matrix > >> >> >> >> >> product! its worth reading the papers about goto blas and > the > >> >> >> >> >> more > >> >> >> >> >> recent > >> >> >> >> >> blis project. a high performance dense matrix multipy winds > up > >> >> >> >> >> needing > >> >> >> >> >> to do > >> >> >> >> >> some nested array parallelism with mutable updates to have > >> >> >> >> >> efficient > >> >> >> >> >> sharing > >> >> >> >> >> of sub computations! > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> >> On Fri, Mar 13, 2015 at 9:03 PM, Anatoly Yakovenko > >> >> >> >> >> > >> >> >> >> >> wrote: > >> >> >> >> >>> > >> >> >> >> >>> you think the backed would make any difference? this seems > >> >> >> >> >>> like > >> >> >> >> >>> a > >> >> >> >> >>> runtime issue to me, how are the threads scheduled by the > ghc > >> >> >> >> >>> runtime? > >> >> >> >> >>> > >> >> >> >> >>> On Fri, Mar 13, 2015 at 4:58 PM, KC > wrote: > >> >> >> >> >>> > How is the LLVM? > >> >> >> >> >>> > > >> >> >> >> >>> > -- > >> >> >> >> >>> > -- > >> >> >> >> >>> > > >> >> >> >> >>> > Sent from an expensive device which will be obsolete in a > >> >> >> >> >>> > few > >> >> >> >> >>> > months! > >> >> >> >> >>> > :D > >> >> >> >> >>> > > >> >> >> >> >>> > Casey > >> >> >> >> >>> > > >> >> >> >> >>> > > >> >> >> >> >>> > On Mar 13, 2015 10:24 AM, "Anatoly Yakovenko" > >> >> >> >> >>> > > >> >> >> >> >>> > wrote: > >> >> >> >> >>> >> > >> >> >> >> >>> >> > https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 > >> >> >> >> >>> >> > >> >> >> >> >>> >> > >> >> >> >> >>> >> so i am seeing basically results with N4 that are as > good > >> >> >> >> >>> >> as > >> >> >> >> >>> >> using > >> >> >> >> >>> >> sequential computation on my macbook for the matrix > >> >> >> >> >>> >> multiply > >> >> >> >> >>> >> algorithm. any idea why? > >> >> >> >> >>> >> > >> >> >> >> >>> >> Thanks, > >> >> >> >> >>> >> Anatoly > >> >> >> >> >>> >> _______________________________________________ > >> >> >> >> >>> >> Haskell-Cafe mailing list > >> >> >> >> >>> >> Haskell-Cafe at haskell.org > >> >> >> >> >>> >> > >> >> >> >> >>> >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> >> >> >> >>> _______________________________________________ > >> >> >> >> >>> Haskell-Cafe mailing list > >> >> >> >> >>> Haskell-Cafe at haskell.org > >> >> >> >> >>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> >> >> >> >> > >> >> >> >> >> > >> >> >> >> > > >> > > >> > > > > > > > > > > > -- > > > > -- > > > > Sent from an expensive device which will be obsolete in a few months! :D > > > > Casey > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominic at steinitz.org Tue Mar 17 10:21:55 2015 From: dominic at steinitz.org (Dominic Steinitz) Date: Tue, 17 Mar 2015 10:21:55 +0000 (UTC) Subject: [Haskell-cafe] repa parallelization results References: Message-ID: Anatoly Yakovenko gmail.com> writes: > > https://gist.github.com/aeyakovenko/bf558697a0b3f377f9e8 > > so i am seeing basically results with N4 that are as good as using > sequential computation on my macbook for the matrix multiply > algorithm. any idea why? > > Thanks, > Anatoly > Hi Anatoly, repa is good for things that live on a grid e.g. forward / backward Euler, Crank Nicholson, convolution e.g. of images, multi-grid methods where each cell is updated based on local information (so we are in the world of comonads). I imagine it would also be good for Ising models (but maybe using Swendson-Yang or Wolff). It is not good where the update is based on global information e.g. simulating the solar system. You might compare your results in repa againt yarr https://hackage.haskell.org/package/yarr. Here are some examples of repa / yarr that could be of use https://idontgetoutmuch.wordpress.com/2014/02/10/ laplaces-equation-in-haskell-using-a-dsl-for-stencils-3/ https://idontgetoutmuch.wordpress.com/2013/08/06/ planetary-simulation-with-excursions-in-symplectic-manifolds-6/ https://idontgetoutmuch.wordpress.com/2013/02/10/ parallelising-path-dependent-options-in-haskell-2/ https://readerunner.wordpress.com/2014/04/30/ multigrid-methods-with-repa/ If I knew how to cross-post this to https://mail.haskell.org/cgi-bin/mailman/listinfo/numeric when using gmane I would do so. Dominic. From christiaan.baaij at gmail.com Tue Mar 17 10:47:08 2015 From: christiaan.baaij at gmail.com (Christiaan Baaij) Date: Tue, 17 Mar 2015 11:47:08 +0100 Subject: [Haskell-cafe] Whole program analysis as a GHC plugin In-Reply-To: References: Message-ID: <13C97646-609C-4FDA-ADBB-80D4AA945DC9@gmail.com> forgot to cc the list in an earlier email... Hi David, Not all identifier have an unfolding in the .hi files? you?d have to recompile all shipped libraries with: -fexpose-all-unfoldings. Even then, identifiers that evaluate to bottom will, annoyingly, still not get an unfolding in the .hi files. Many identifiers do, however, have an unfolding! With that out of the way, I?ve created a whole-program transformation compiler that converts ?structural? Haskell to Hardware (VHDL/Verilog). You can take a look at: https://github.com/clash-lang/clash-compiler/tree/master/clash-ghc/src-ghc/CLaSH/GHC for all the modules that interact with the GHC API. Especially look at: https://github.com/clash-lang/clash-compiler/blob/master/clash-ghc/src-ghc/CLaSH/GHC/LoadModules.hs#L56 Which, given a module name ?A", gives you all binders from the module ?A", and all the binders from other modules that are needed by the binders in ?A? It uses: https://github.com/clash-lang/clash-compiler/blob/master/clash-ghc/src-ghc/CLaSH/GHC/LoadInterfaceFiles.hs#L59 to load the unfoldings from ?.hi? files. The code is pretty much hacked together as I was exploring the GHC API to get the things I wanted. So my apologies for the poor readability. Cheers, Christiaan > On 16 Mar 2015, at 18:34, David Darais wrote: > > Hello cafe, > > I'm currently implementing a whole-program analysis for Haskell programs using the GHC api. I have a GHC plugin written and I'm successfully slurping in programs and processing them with my analysis tools. > > I'm getting stuck when my tool encounters an identifier that lives in another module. I'd like to unfold the identifier and retrieve its source code, allowing me to do whole-program analysis. > > Assuming I have the source code of the whole program, and that I get to (re)compile everything with my plugin enabled, I'm wondering: > > 1) Does the GHC api already support a nice way of doing this? > 2) I see that there is support for unfolding identifiers if they've been specially marked in .hi files. Is there a way to mark everything to support unfolding, and would this give me the information I'm looking for? > 3) Does anybody have experience with implementing a whole-program analysis for GHC as a plugin, and if so, how did you go about it? > > Many Thanks, > David > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From horstmey at Mathematik.Uni-Marburg.de Tue Mar 17 11:36:31 2015 From: horstmey at Mathematik.Uni-Marburg.de (Thomas Horstmeyer) Date: Tue, 17 Mar 2015 12:36:31 +0100 Subject: [Haskell-cafe] Full page Haskell 2010 report request In-Reply-To: References: <55070A02.5060802@informatik.uni-marburg.de> Message-ID: <550811BF.1020502@informatik.uni-marburg.de> Ah, sorry, somehow I was under the impression that you already had built the report and had your local infrastructure set up for that. I have put a zip archive online for you: http://www.mathematik.uni-marburg.de/~horstmey/dl/haskell2010singlehtml.zip Cheers, Thomas Am 16.03.2015 um 18:00 schrieb Christopher Done: > Any chance you can upload that somewhere so that I can download it? :-) > > On 16 March 2015 at 17:51, Thomas Horstmeyer > wrote: >> Hi Chris, >> >> I just tested omitting the separation parameter for the html output in the >> makefile. >> >> html: $(HT_TEXS) ht/classes.eps ht/haddock.sty ht/haskell.bbl >> cd ht && htlatex haskell.tex "haskell,2" >> >> That "2" at the end of the second line is supposed to direct the separation >> into files up to the 2nd level. Change that to >> >> html: $(HT_TEXS) ht/classes.eps ht/haddock.sty ht/haskell.bbl >> cd ht && htlatex haskell.tex "haskell" >> >> The result is quite good. Only three footnotes got separated into extra >> files. >> >> HTH >> Thomas >> >> >> >> Am 27.02.2015 um 20:32 schrieb Christopher Done: >>> >>> Hi, has anyone managed to produce a single-page HTML export of the >>> Haskell 2010 report? >>> >>> Here's one I made by munging together the multi-page one: >>> https://www.haskell.org/report/mono/2010#x8-440003.12 (this link is >>> currently unpublished on the home page). >>> >>> But it's incomplete due to link references and things. I'd like a >>> proper output but in the interest of my mental health prefer not to >>> touch LaTeX except by proxy through other poor souls. >>> >>> Anyone managed to do this? A full, linkable page (don't worry about >>> the section/para links, I added them with a few lines of JS, I can do >>> it again) is really conducive to discussion of Haskell's finer points. >>> >>> Ciao! >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> From chrisdone at gmail.com Tue Mar 17 11:46:42 2015 From: chrisdone at gmail.com (Christopher Done) Date: Tue, 17 Mar 2015 12:46:42 +0100 Subject: [Haskell-cafe] Full page Haskell 2010 report request In-Reply-To: <550811BF.1020502@informatik.uni-marburg.de> References: <55070A02.5060802@informatik.uni-marburg.de> <550811BF.1020502@informatik.uni-marburg.de> Message-ID: Cheers! On 17 March 2015 at 12:36, Thomas Horstmeyer wrote: > Ah, sorry, somehow I was under the impression that you already had built the > report and had your local infrastructure set up for that. > > I have put a zip archive online for you: > > http://www.mathematik.uni-marburg.de/~horstmey/dl/haskell2010singlehtml.zip > > > Cheers, > Thomas > > > Am 16.03.2015 um 18:00 schrieb Christopher Done: > >> Any chance you can upload that somewhere so that I can download it? :-) >> >> On 16 March 2015 at 17:51, Thomas Horstmeyer >> wrote: >>> >>> Hi Chris, >>> >>> I just tested omitting the separation parameter for the html output in >>> the >>> makefile. >>> >>> html: $(HT_TEXS) ht/classes.eps ht/haddock.sty ht/haskell.bbl >>> cd ht && htlatex haskell.tex "haskell,2" >>> >>> That "2" at the end of the second line is supposed to direct the >>> separation >>> into files up to the 2nd level. Change that to >>> >>> html: $(HT_TEXS) ht/classes.eps ht/haddock.sty ht/haskell.bbl >>> cd ht && htlatex haskell.tex "haskell" >>> >>> The result is quite good. Only three footnotes got separated into extra >>> files. >>> >>> HTH >>> Thomas >>> >>> >>> >>> Am 27.02.2015 um 20:32 schrieb Christopher Done: >>>> >>>> >>>> Hi, has anyone managed to produce a single-page HTML export of the >>>> Haskell 2010 report? >>>> >>>> Here's one I made by munging together the multi-page one: >>>> https://www.haskell.org/report/mono/2010#x8-440003.12 (this link is >>>> currently unpublished on the home page). >>>> >>>> But it's incomplete due to link references and things. I'd like a >>>> proper output but in the interest of my mental health prefer not to >>>> touch LaTeX except by proxy through other poor souls. >>>> >>>> Anyone managed to do this? A full, linkable page (don't worry about >>>> the section/para links, I added them with a few lines of JS, I can do >>>> it again) is really conducive to discussion of Haskell's finer points. >>>> >>>> Ciao! >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>> > From mrz.vtl at gmail.com Tue Mar 17 16:12:56 2015 From: mrz.vtl at gmail.com (Maurizio Vitale) Date: Tue, 17 Mar 2015 09:12:56 -0700 Subject: [Haskell-cafe] extracting a single declaration using haskell-src-ext Message-ID: G'day! Is there an easy way to extract a single declaration from an Haskell source file and print it with the original formatting? [I could live with pretty printing, but the default prettyPrint gives me a very strange formatting where something like: main = do putStrLn "Hello" becomes: main = do putStrLn "Hello"] The closest I've got is to parse the file with comments and then get inside Module ...decls and do printExact with an empty comment list for the decl I'm interested in. This gives me the original formatting and empty lines where comments were that I can then remove. But if there was anything already out there that just take a String for the toplevel I'm interested in and convert that only, I'd love to know. Thanks, Maurizio -------------- next part -------------- An HTML attachment was scrubbed... URL: From alan.zimm at gmail.com Tue Mar 17 17:51:51 2015 From: alan.zimm at gmail.com (Alan & Kim Zimmerman) Date: Tue, 17 Mar 2015 19:51:51 +0200 Subject: [Haskell-cafe] extracting a single declaration using haskell-src-ext In-Reply-To: References: Message-ID: This can be done with HaRe, if you use the library version rather than the built-in refactorings. It does not support 7.8.x though, and the 7.10 support is ongoing. Alan On Tue, Mar 17, 2015 at 6:12 PM, Maurizio Vitale wrote: > G'day! > > Is there an easy way to extract a single declaration from an Haskell > source file and print it with the original formatting? > > [I could live with pretty printing, but the default prettyPrint gives me a > very strange formatting where something like: > main = do > putStrLn "Hello" > becomes: > main = do putStrLn "Hello"] > > The closest I've got is to parse the file with comments and then get > inside Module ...decls and do printExact with an empty comment list for the > decl I'm interested in. This gives me the original formatting and empty > lines where comments were that I can then remove. > > But if there was anything already out there that just take a String for > the toplevel I'm interested in and convert that only, I'd love to know. > > Thanks, > > Maurizio > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mgsloan at gmail.com Tue Mar 17 20:02:27 2015 From: mgsloan at gmail.com (Michael Sloan) Date: Tue, 17 Mar 2015 13:02:27 -0700 Subject: [Haskell-cafe] extracting a single declaration using haskell-src-ext In-Reply-To: References: Message-ID: Hello! I wrote some code to do this quite recently, as part of an internal tool at FP Complete. I've copied out the relevant functions and written an example of using it here: https://gist.github.com/mgsloan/ac77dd33326322fc6ccd I hope that helps! -Michael On Tue, Mar 17, 2015 at 9:12 AM, Maurizio Vitale wrote: > G'day! > > Is there an easy way to extract a single declaration from an Haskell source > file and print it with the original formatting? > > [I could live with pretty printing, but the default prettyPrint gives me a > very strange formatting where something like: > main = do > putStrLn "Hello" > becomes: > main = do putStrLn "Hello"] > > The closest I've got is to parse the file with comments and then get inside > Module ...decls and do printExact with an empty comment list for the decl > I'm interested in. This gives me the original formatting and empty lines > where comments were that I can then remove. > > But if there was anything already out there that just take a String for the > toplevel I'm interested in and convert that only, I'd love to know. > > Thanks, > > Maurizio > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From eir at cis.upenn.edu Tue Mar 17 21:47:11 2015 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Tue, 17 Mar 2015 17:47:11 -0400 Subject: [Haskell-cafe] linear: instance Additive (Point f) ?? Message-ID: <95F6AB79-7A0C-4BE0-879A-509DD0C5F170@cis.upenn.edu> Hi caf?, I'm in the middle of responding to https://github.com/goldfirere/units/pull/45 and trying to learn the `linear` package, which I have yet to use. I have what may be a basic question: why is there an `instance Additive f => Additive (Point f)` (in the Affine module)? It would seem that the whole point of Point is that it is *not* Additive. We don't want to add Points! Could someone enlighten me? Thanks! Richard PS: Of course, this instance is directly hurting my use of the package. But it is hurting my understanding of the package, because it disagrees with the mental model I've built up of the definitions. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Tue Mar 17 22:40:23 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Tue, 17 Mar 2015 22:40:23 +0000 Subject: [Haskell-cafe] linear: instance Additive (Point f) ?? In-Reply-To: <95F6AB79-7A0C-4BE0-879A-509DD0C5F170@cis.upenn.edu> References: <95F6AB79-7A0C-4BE0-879A-509DD0C5F170@cis.upenn.edu> Message-ID: <20150317224022.GF8845@weber> On Tue, Mar 17, 2015 at 05:47:11PM -0400, Richard Eisenberg wrote: > I have what may be a basic question: why is there an `instance Additive f => Additive (Point f)` (in the Affine module)? [...] > PS: Of course, this instance is directly hurting my use of the package. [...] Missing a "not"? From mrz.vtl at gmail.com Wed Mar 18 00:34:20 2015 From: mrz.vtl at gmail.com (Maurizio Vitale) Date: Tue, 17 Mar 2015 20:34:20 -0400 Subject: [Haskell-cafe] extracting a single declaration using haskell-src-ext In-Reply-To: References: Message-ID: Beautiful, thanks! On Tue, Mar 17, 2015 at 4:02 PM, Michael Sloan wrote: > Hello! > > I wrote some code to do this quite recently, as part of an internal > tool at FP Complete. I've copied out the relevant functions and > written an example of using it here: > https://gist.github.com/mgsloan/ac77dd33326322fc6ccd > > I hope that helps! > -Michael > > On Tue, Mar 17, 2015 at 9:12 AM, Maurizio Vitale > wrote: > > G'day! > > > > Is there an easy way to extract a single declaration from an Haskell > source > > file and print it with the original formatting? > > > > [I could live with pretty printing, but the default prettyPrint gives me > a > > very strange formatting where something like: > > main = do > > putStrLn "Hello" > > becomes: > > main = do putStrLn "Hello"] > > > > The closest I've got is to parse the file with comments and then get > inside > > Module ...decls and do printExact with an empty comment list for the decl > > I'm interested in. This gives me the original formatting and empty lines > > where comments were that I can then remove. > > > > But if there was anything already out there that just take a String for > the > > toplevel I'm interested in and convert that only, I'd love to know. > > > > Thanks, > > > > Maurizio > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eir at cis.upenn.edu Wed Mar 18 01:09:57 2015 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Tue, 17 Mar 2015 21:09:57 -0400 Subject: [Haskell-cafe] linear: instance Additive (Point f) ?? In-Reply-To: <20150317224022.GF8845@weber> References: <95F6AB79-7A0C-4BE0-879A-509DD0C5F170@cis.upenn.edu> <20150317224022.GF8845@weber> Message-ID: <17D9EC7F-997E-40A6-8B96-A77418A15DDC@cis.upenn.edu> On Mar 17, 2015, at 6:40 PM, Tom Ellis wrote: > On Tue, Mar 17, 2015 at 05:47:11PM -0400, Richard Eisenberg wrote: >> PS: Of course, this instance is directly hurting my use of the package. > [...] > > Missing a "not"? Indeed! And what a terrible word to miss. Thanks for the correction. Richard From byorgey at gmail.com Wed Mar 18 02:41:36 2015 From: byorgey at gmail.com (Brent Yorgey) Date: Wed, 18 Mar 2015 02:41:36 +0000 Subject: [Haskell-cafe] linear: instance Additive (Point f) ?? In-Reply-To: <95F6AB79-7A0C-4BE0-879A-509DD0C5F170@cis.upenn.edu> References: <95F6AB79-7A0C-4BE0-879A-509DD0C5F170@cis.upenn.edu> Message-ID: I have EXACTLY the same question. We recently switched from vector-space to linear for diagrams. There are quite a lot of reasons why this works really well for us. But I was very sad to find that we can now add points, which indeed we do not want to be able to do. At least there are still different types for points and vectors, which allows transformations like 'translate' to act on them differently, which I actually find to be much more critical from a correctness point of view. I have had a brief explanation, but I forget the exact details. Something about 'Additive' not really being about 'additive groups' but instead being a superclass of Applicative. I remember being convinced at least that it's a "pick your poison" sort of choice, i.e. removing the Additive instance for Point would make certain other things ugly/annoying. Hopefully someone else can chime in with more detail. -Brent On Tue, Mar 17, 2015 at 5:47 PM Richard Eisenberg wrote: > Hi caf?, > > I'm in the middle of responding to https://github.com/goldfirere/ > units/pull/45 and trying to learn the `linear` package, which I have yet > to use. > > I have what may be a basic question: why is there an `instance Additive f > => Additive (Point f)` (in the Affine module)? It would seem that the whole > point of Point is that it is *not* Additive. We don't want to add Points! > > Could someone enlighten me? > > Thanks! > Richard > > PS: Of course, this instance is directly hurting my use of the package. > But it is hurting my understanding of the package, because it disagrees > with the mental model I've built up of the definitions. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Wed Mar 18 05:49:16 2015 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Wed, 18 Mar 2015 12:49:16 +0700 Subject: [Haskell-cafe] Haskell Weekly News Message-ID: *Top picks:* - Simon Marlow, who built much of GHC's runtime, now works at Facebook. He contributes to Haxl, a tool to "automatically batch and overlap requests for data from multiple data sources in a rule engine for identifying malicious content." In a talk last year at FP Days , he explains how you too can use Haxl in your projects. The video was just made available at InfoQ . Hat-tip to redditor Pikachut for links to slides and code . - GHC builds can be frightfully slow. Karel Gardas wonders how he can speedup builds on his 32-threaded SPARC T2000. Folks point him toward Andrey Mokhov's ongoing investigation of Neil Mitchell's shake to replace GHC's current use of GNU make. SPJ hopes that it "will make a big difference." - Back in September last year, Ahmad Fatoum asks whether we can fix the Win32 FFI so that it supports optional params? Some Win32 functions -- e.g. see FindWindow -- accept NULL pointers as invocation of default behavior, currently impossible from Haskell. One option is to make copies of over 100 functions to prevent existing client code from breaking. A more radical one is to extend the existing FFI in-place and alter the type signatures by Maybe-fying the params that are actually optional. The vocal opinion is in favor of the latter, deeper fix. Yitzchak Gale recently brought up the issue on haskell-libraries. - Maurizio Vitale asks for a way to extract verbatim a single definition from Haskell source. Michael Sloan shows a way to do it using haskell-src-exts . - Conor McBride discusses Naperian / Representable functors as a subclass of Applicative. Elsewhere in the thread, Ed Kmett remarks that "The Log of a coinductive container being an inductive type is a new result for me." - A subreddit called haskelltil (TIL = Today I Learned) for little discoveries was announced on haskell reddit . *Repo of the week: *Calvin Cheng , co-founder and CTO at AlgoAccess, releases code and slides on learning Haskell for the OO programmer. *In your neighborhood:* - Kat Chuang organized an NYC-based study group to dissect Nishan Shukla's Haskell Data Analysis Cookbook . "This is your AHA! Haskell Moment." - Redditor netroby launched a QQ instant messaging group , code number 424801832, to talk Haskell. *Quote of the week:* Dimitri DeFigueiredo says about the haskell-beginners mailing list, "This is the friendliest mailing list I have ever subscribed to. The people in this list are so nice that even if Haskell were not so wonderfully elegant, I would like to learn it just to be able to chat and work with them." *Acknowledgments* Thanks to Henk-Jan van Tuyl for help with the Quotes. Thanks to Gershom Bazerman, Roman Cheplyaka, and Artyom for offering assistance on web hosting HWN. *Letter to the Editor:* Can I just say that I'm very much in favour of the new format. There's interesting content that can't just be gained from occasionally checking reddit, there's an actual comment on each one rather than just the headline, and most importantly the quote is still there ;) Sorry if this is adding to a deluge of email that you're now getting because of this. Yours, Anon *Response:* Dear Anon, Glad you're enjoying HWN as much as I do creating and publishing it. I love the quotes too, and I depend on my readers to email me what they'd like to share with Team Haskell. (Sneak peak at the top-secret contingency plan: If I don't have quotes for the week, I ransack the archives. Shhh!! Don't tell anyone.) Yours is the only thank you I received. Appreciation like yours is what keeps HWN going, so let me thank you in return for sharing the love, for I remain Yours editorially, Kim-Ee Yeoh p.s. Stay tuned for an upcoming editorial on what the future holds for HWN. -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From P.Achten at cs.ru.nl Wed Mar 18 09:59:35 2015 From: P.Achten at cs.ru.nl (Peter Achten) Date: Wed, 18 Mar 2015 10:59:35 +0100 Subject: [Haskell-cafe] [TFP'15] final call for papers - deadline extended march 31 - Message-ID: <55094C87.6090502@cs.ru.nl> ----------------------------- L A S T C A L L F O R P A P E R S ----------------------------- ======== TFP 2015 =========== 16th Symposium on Trends in Functional Programming June 3-5, 2015 Inria Sophia Antipolis, France http://tfp2015.inria.fr/ The symposium on Trends in Functional Programming (TFP) is an international forum for researchers with interests in all aspects of functional programming, taking a broad view of current and future trends in the area. It aspires to be a lively environment for presenting the latest research results, and other contributions (see below). Authors of draft papers will be invited to submit revised papers based on the feedback receive at the symposium. A post-symposium refereeing process will then select a subset of these articles for formal publication. The selected revised papers will be published as a Springer Lecture Notes in Computer Science (www.springer.com/lncs) volume. TFP 2015 will be the main event of a pair of functional programming events. TFP 2015 will be accompanied by the International Workshop on Trends in Functional Programming in Education (TFPIE), which will take place on June 2nd. The TFP symposium is the heir of the successful series of Scottish Functional Programming Workshops. Previous TFP symposia were held in * Edinburgh (Scotland) in 2003; * Munich (Germany) in 2004; * Tallinn (Estonia) in 2005; * Nottingham (UK) in 2006; * New York (USA) in 2007; * Nijmegen (The Netherlands) in 2008; * Komarno (Slovakia) in 2009; * Oklahoma (USA) in 2010; * Madrid (Spain) in 2011; * St. Andrews (UK) in 2012; * Provo (Utah, USA) in 2013; * and in Soesterberg (The Netherlands) in 2014. For further general information about TFP please see the TFP homepage. (http://www.tifp.org/). == INVITED SPEAKERS == TFP is pleased to announce talks by the following two invited speakers: * Laurence Rideau is a researcher at INRIA and is interested in the semantics of programming languages , the formal methods, and the verification tools for programs and mathematical proofs. She participated in the beginnings of the Compcert project (certified compiler), and is part of the Component Mathematical team in the MSR-INRIA joint laboratory, who performed the formalization of the Feit-Thompson theorem successfully. Thirty years ago, computers barged in mathematics with the famous proof of the Four Color Theorem. Initially limited to simple calculation, their role is now expanding to the reasoning whose complexity is beyond the capabilities of most humans, as the proof of the classification of finite simple groups. We present our large collaborative adventure around the formalization of the Feit-Thompson theorem (http://en.wikipedia.org/wiki/Feit%E2%80%93Thompson_theorem) that is a first step to the classification of finite groups and that uses a palette of methods and techniques that range from formal logic to software (and mathematics) engineering. * Anil Madhavapeddy == SCOPE == The symposium recognizes that new trends may arise through various routes. As part of the Symposium's focus on trends we therefore identify the following five article categories. High-quality articles are solicited in any of these categories: Research Articles: leading-edge, previously unpublished research work Position Articles: on what new trends should or should not be Project Articles: descriptions of recently started new projects Evaluation Articles: what lessons can be drawn from a finished project Overview Articles: summarizing work with respect to a trendy subject Articles must be original and not simultaneously submitted for publication to any other forum. They may consider any aspect of functional programming: theoretical, implementation-oriented, or experience-oriented. Applications of functional programming techniques to other languages are also within the scope of the symposium. Topics suitable for the symposium include: Functional programming and multicore/manycore computing Functional programming in the cloud High performance functional computing Extra-functional (behavioural) properties of functional programs Dependently typed functional programming Validation and verification of functional programs Debugging and profiling for functional languages Functional programming in different application areas: security, mobility, telecommunications applications, embedded systems, global computing, grids, etc. Interoperability with imperative programming languages Novel memory management techniques Program analysis and transformation techniques Empirical performance studies Abstract/virtual machines and compilers for functional languages (Embedded) domain specific languages New implementation strategies Any new emerging trend in the functional programming area If you are in doubt on whether your article is within the scope of TFP, please contact the TFP 2015 program chair, Manuel Serrano. == BEST PAPER AWARDS == To reward excellent contributions, TFP awards a prize for the best paper accepted for the formal proceedings. TFP traditionally pays special attention to research students, acknowledging that students are almost by definition part of new subject trends. A student paper is one for which the authors state that the paper is mainly the work of students, the students are listed as first authors, and a student would present the paper. A prize for the best student paper is awarded each year. In both cases, it is the PC of TFP that awards the prize. In case the best paper happens to be a student paper, that paper will then receive both prizes. == SPONSORS == TFP is financially supported by Erlang Solutions. == PAPER SUBMISSIONS == Acceptance of articles for presentation at the symposium is based on a lightweight peer review process of extended abstracts (4 to 10 pages in length) or full papers (20 pages). The submission must clearly indicate which category it belongs to: research, position, project, evaluation, or overview paper. It should also indicate which authors are research students, and whether the main author(s) are students. A draft paper for which ALL authors are students will receive additional feedback by one of the PC members shortly after the symposium has taken place. We use EasyChair for the refereeing process. Papers must be submitted at: https://easychair.org/conferences/?conf=tfp2015 Papers must be written in English, and written using the LNCS style. For more information about formatting please consult the Springer LNCS web site: http://www.springer.com/computer/lncs?SGWID=0-164-6-793341-0 == IMPORTANT DATES == Submission of draft papers: March 31, 2015 Notification: April 7, 2015 Registration: May 4, 2015 TFP Symposium: June 3-5, 2015 Student papers feedback: June 9, 2015 Submission for formal review: July 1, 2015 Notification of acceptance: September 8, 2015 Camera ready paper: October 8, 2015 == PROGRAM COMMITTEE == Janis Voigtl?nder University of Bonn, DE Scott Owens University of Kent, UK Neil Sculthorpe Swansea University, UK Colin Runciman University of York, UK Manuel Serrano Inria (PC chair), FR Rinus Plasmeijer University of Nijmegen, NL Tomas Petricek University of Cambridge, UK Marco T. Morazan Seton Hall University, USA Wolfgang De Meuter Vrije Universiteit Brussel, BE Michel Mauny Ensta ParisTech, FR Sam Lindley The University of Edinburgh, UK Daan Leijen Microsoft, USA Jurriaan Hage Utrecht University, NL Andy Gill University of Kansas, USA Thomas Gazagnaire University of Cambrige, UK Lars-Ake Fredlund Universidad Polit?cnica de Madrid, ES Jean-Christophe Filliatre Universit? Paris Sud Orsay, FR Marc Feeley Universit? de Montr?al, CA Olaf Chitil University of Kent, UK Edwin Brady University of St Andrews, UK From K.Bleijenberg at lijbrandt.nl Wed Mar 18 10:11:34 2015 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Wed, 18 Mar 2015 11:11:34 +0100 Subject: [Haskell-cafe] can't nterrupt winGHCi or ghci Message-ID: <000001d06163$ea03f990$be0becb0$@lijbrandt.nl> With a haskell program I generated a very big haskell file. Sometimes the generated haskell is not valid. If I load the genearated file in winGHCi a flood of error messages streams over the screen. If I press ctrl-break WinGHCi stops and says interrupted. If I click Ok the program continues printing error messages. Ctrl-c or just c, doesn't help. So I have to wait until WinGHCi has shown all error messages (can take minutes) or close the WinGHCi window. Ghci has (on Windows) the same behaviour. Is there a special key combination to stop Ghc or Ghci or is this a bug? Kees -------------- next part -------------- An HTML attachment was scrubbed... URL: From ekmett at gmail.com Wed Mar 18 17:23:38 2015 From: ekmett at gmail.com (Edward Kmett) Date: Wed, 18 Mar 2015 13:23:38 -0400 Subject: [Haskell-cafe] linear: instance Additive (Point f) ?? In-Reply-To: References: <95F6AB79-7A0C-4BE0-879A-509DD0C5F170@cis.upenn.edu> Message-ID: On Tue, Mar 17, 2015 at 10:41 PM, Brent Yorgey wrote: > I have EXACTLY the same question. We recently switched from vector-space > to linear for diagrams. There are quite a lot of reasons why this works > really well for us. But I was very sad to find that we can now add points, > which indeed we do not want to be able to do. At least there are still > different types for points and vectors, which allows transformations like > 'translate' to act on them differently, which I actually find to be much > more critical from a correctness point of view. > > I have had a brief explanation, but I forget the exact details. Something > about 'Additive' not really being about 'additive groups' but instead being > a superclass of Applicative. I remember being convinced at least that it's > a "pick your poison" sort of choice, i.e. removing the Additive instance > for Point would make certain other things ugly/annoying. Hopefully someone > else can chime in with more detail. > > The name Additive is a bit of a misnomer, like you said. The real reason it exists is to support matrix operations on both sparse/dense matrices. Matrix multiplication looks like: (!*!) :: (Functor m, Foldable t, Additive t, Additive n, Num a) => m (t a) -> t (n a) -> m (n a) Without that instance you'd be unable to build matrices with Point's as one or both of the dimensions, which are intended to transform points. If we can decide that that doesn't make sense (as after all points aren't additive), so such matrices _are_ kinda weird, we can remove the instance. I'm happy to bend the way Point works, as I stick to the projective machinery almost exclusively, myself. Thoughts? -Edward On Tue, Mar 17, 2015 at 5:47 PM Richard Eisenberg wrote: > Hi caf?, >> >> I'm in the middle of responding to https://github.com/goldfirere/ >> units/pull/45 and trying to learn the `linear` package, which I have yet >> to use. >> >> I have what may be a basic question: why is there an `instance Additive f >> => Additive (Point f)` (in the Affine module)? It would seem that the whole >> point of Point is that it is *not* Additive. We don't want to add Points! >> >> Could someone enlighten me? >> >> Thanks! >> Richard >> >> PS: Of course, this instance is directly hurting my use of the package. >> But it is hurting my understanding of the package, because it disagrees >> with the mental model I've built up of the definitions. >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gale at sefer.org Wed Mar 18 19:24:14 2015 From: gale at sefer.org (Yitzchak Gale) Date: Wed, 18 Mar 2015 21:24:14 +0200 Subject: [Haskell-cafe] Proposed significant breaking changes to Win32 Message-ID: There are some discussions going on in this GitHub issue: https://github.com/haskell/win32/issues/24 with proposals for extensive breaking changes to the Win32 library. Well over 100 functions would be involved. These changes would finally fix many long outstanding defects in the API, some of which make it difficult to use important Win32 functions in the way originally intended. It is estimated that about 70 packages on Hackage depend on Win32 and could potentially be affected. If you might be affected, have an opinion, or just are interested, please drop by the GitHub issue. There is also a thread on the libraries mailing list. Thanks, Yitz From david.feuer at gmail.com Wed Mar 18 21:21:03 2015 From: david.feuer at gmail.com (David Feuer) Date: Wed, 18 Mar 2015 17:21:03 -0400 Subject: [Haskell-cafe] Incremental sequence sorting Message-ID: I had an idea, and it's kind of complicated, so I was wondering if I could get a sanity check from someone before putting *too* much time into it. Specifically, I was thinking about a sort of incremental sorting of sequences (in Data.Sequence). The idea is very closely related to the incremental sorting described by Navarro and Paredes ( http://www.dcc.uchile.cl/~gnavarro/ps/algor09.pdf ). The basic concept: sequences are represented as Hinze-Paterson 2-3 finger trees. They are fairly lazy, so building them from the top down tends to be a good thing. Suppose I have a sequence to be sorted. To start building the result sequence, I need to know which elements go in the first digit and which go in the last digit. To do this, I need two order statistics, starting with one separating the first digit from the rest, then one separating the last digit from the rest. Once I have separated these, I can produce the top of the sequence. The digit separation is the same all down the spine. Within digits, 2-3 trees split similarly. I can get the order statistics using median-of-medians. As Navarro and Paredes (and presumably others) describe, median-of-medians partially sorts the sequence in the process of finding the desired order statistic. Navarro and Paredes use a stack of indices into an array to take advantage of this, but I need things rather more incremental. What I was thinking is that I could use a finger tree of sequences (a sequence of sequences making it easy to find where a particular total length is reached) to separate the different segments from each other. Each time I need to split on a particular order statistic, I can isolate the necessary segment, use median-of-medians (splitting it into pieces), and then append the pieces onto either side as appropriate. Does anyone have a sense of 1. Whether this is sane and/or 2. What the chances are that its performance will be competitive with either of the current Data.Sequence sorting functions and/or 3. How I should actually implement median-of-medians for this particular application (as there seem to be very few Haskell implementations of the algorithm, and I've found no optimized ones)? Thanks, David Feuer From K.Bleijenberg at lijbrandt.nl Thu Mar 19 07:59:57 2015 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Thu, 19 Mar 2015 08:59:57 +0100 Subject: [Haskell-cafe] can't STOP after interrupt winGHCi or ghci Message-ID: <001501d0621a$b1698a20$143c9e60$@lijbrandt.nl> Now I realize maybe I didn't make my point clear. What I want is not just interrupting the output of the compiler, but also stop the output of the compiler after interrupting. Van: Haskell-Cafe [mailto:haskell-cafe-bounces at haskell.org] Namens Kees Bleijenberg Verzonden: woensdag 18 maart 2015 11:12 Aan: haskell-cafe at haskell.org Onderwerp: [Haskell-cafe] can't nterrupt winGHCi or ghci With a haskell program I generated a very big haskell file. Sometimes the generated haskell is not valid. If I load the genearated file in winGHCi a flood of error messages streams over the screen. If I press ctrl-break WinGHCi stops and says interrupted. If I click Ok the program continues printing error messages. Ctrl-c or just c, doesn't help. So I have to wait until WinGHCi has shown all error messages (can take minutes) or close the WinGHCi window. Ghci has (on Windows) the same behaviour. Is there a special key combination to stop Ghc or Ghci or is this a bug? Kees -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.perez at keera.co.uk Thu Mar 19 15:11:42 2015 From: ivan.perez at keera.co.uk (Ivan Perez) Date: Thu, 19 Mar 2015 15:11:42 +0000 Subject: [Haskell-cafe] ANN: Magic Cookies! Android board game in Haskell Message-ID: Dear Caf? This is a just a quick announcement: we have just released Magic Cookies, an Android board game written in Haskell. It is now available on Google Play [1]. The game uses the Functional Reactive Programming library Yampa and SDL2 for multimedia. If you like the game, please share the link on facebook/twitter/etc and let all of your friends know. We have gone through dozens of iterations during beta testing, but we cannot guarantee that the game works 100% perfectly on all devices. If you find a bug, or anything else you don't like, please do not rate low. Instead, open an issue [2] or send us an email (support at keera.co.uk). Suggestions are also welcome. We will continue working to make the game lighter, faster, and more fun. See [3] for more details, and to sign up as a beta-tester for other games we are already working on. We certainly enjoyed making it, and we hope you all enjoy playing it. All the best Ivan, Fass & Jorge [1] https://play.google.com/store/apps/details?id=uk.co.keera.games.magiccookies [2] https://github.com/keera-studios/magic-cookies [3] http://keera.co.uk/blog/2015/03/19/magic-cookies-released-google-play/ From alexander at plaimi.net Thu Mar 19 17:39:12 2015 From: alexander at plaimi.net (Alexander Berntsen) Date: Thu, 19 Mar 2015 18:39:12 +0100 Subject: [Haskell-cafe] ANN: Magic Cookies! Android board game in Haskell In-Reply-To: References: Message-ID: <550B09C0.8000408@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Is it really written in Haskell? I cannot tell, as I do not have access to the source code. Is the unjust subjugation of users a conscious game design decision? - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREIAAYFAlULCb4ACgkQRtClrXBQc7U+lQD9FNM97DwPOAHtnzHWCRb0/d1a or0YIFYuJSnOON2kZv4A/iQar3/n+j6THDVTXZQ+GMFR1zLMizLOnpxzJ4G1fMUE =Wkfc -----END PGP SIGNATURE----- From lists at qseep.net Fri Mar 20 05:11:52 2015 From: lists at qseep.net (Lyle Kopnicky) Date: Thu, 19 Mar 2015 22:11:52 -0700 Subject: [Haskell-cafe] Existentials for multi-parameter type classes? Message-ID: Hi folks, I know how to write existentially quantified data constructors for single-parameter type classes, but I'm having trouble doing it for multi-parameter type classes. Is it not possible, or am I just using the wrong syntax? I have this class: class Collidable a b where collideWith :: a -> b -> String And I tried to define an existentially quantified data constructor thusly: data Collision = forall a. (forall b. Collidable a b => Collision {collider1 :: a, collider2 :: b}) I get a parse error. So then I tried: data Collision = forall a. forall b. Collidable a b => Collision {collider1 :: a, collider2 :: b} I get a different parse error. Is there any way to make this work? Thanks, Lyle -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Fri Mar 20 05:15:07 2015 From: david.feuer at gmail.com (David Feuer) Date: Fri, 20 Mar 2015 01:15:07 -0400 Subject: [Haskell-cafe] Existentials for multi-parameter type classes? In-Reply-To: References: Message-ID: I highly recommend writing all existentials using GADT syntax. It is *far* more intuitive. David On Mar 20, 2015 1:12 AM, "Lyle Kopnicky" wrote: > Hi folks, > > I know how to write existentially quantified data constructors for > single-parameter type classes, but I'm having trouble doing it for > multi-parameter type classes. Is it not possible, or am I just using the > wrong syntax? > > I have this class: > > class Collidable a b where > collideWith :: a -> b -> String > > And I tried to define an existentially quantified data constructor thusly: > > data Collision = forall a. (forall b. Collidable a b => Collision > {collider1 :: a, collider2 :: b}) > > I get a parse error. So then I tried: > > data Collision = forall a. forall b. Collidable a b => Collision > {collider1 :: a, collider2 :: b} > > I get a different parse error. Is there any way to make this work? > > Thanks, > Lyle > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mgsloan at gmail.com Fri Mar 20 05:15:08 2015 From: mgsloan at gmail.com (Michael Sloan) Date: Thu, 19 Mar 2015 22:15:08 -0700 Subject: [Haskell-cafe] Existentials for multi-parameter type classes? In-Reply-To: References: Message-ID: There is! data Collision = forall a b. Collidable a b => Collision {collider1 :: a, collider2 :: b} On Thu, Mar 19, 2015 at 10:11 PM, Lyle Kopnicky wrote: > Hi folks, > > I know how to write existentially quantified data constructors for > single-parameter type classes, but I'm having trouble doing it for > multi-parameter type classes. Is it not possible, or am I just using the > wrong syntax? > > I have this class: > > class Collidable a b where > collideWith :: a -> b -> String > > And I tried to define an existentially quantified data constructor thusly: > > data Collision = forall a. (forall b. Collidable a b => Collision {collider1 > :: a, collider2 :: b}) > > I get a parse error. So then I tried: > > data Collision = forall a. forall b. Collidable a b => Collision {collider1 > :: a, collider2 :: b} > > I get a different parse error. Is there any way to make this work? > > Thanks, > Lyle > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From david.feuer at gmail.com Fri Mar 20 05:25:11 2015 From: david.feuer at gmail.com (David Feuer) Date: Fri, 20 Mar 2015 01:25:11 -0400 Subject: [Haskell-cafe] Existentials for multi-parameter type classes? In-Reply-To: References: Message-ID: And in GADT syntax with crazy records, that's data Collision where Collision :: Collidable a b => {collider1 :: a, collider2 :: b} -> Collision Or (much cleaner) without the crazy record syntax, data Collision where Collision :: Collidable a b => a -> b -> Collision On Mar 20, 2015 1:15 AM, "Michael Sloan" wrote: > There is! > > data Collision = forall a b. Collidable a b => Collision {collider1 :: > a, collider2 :: b} > > On Thu, Mar 19, 2015 at 10:11 PM, Lyle Kopnicky wrote: > > Hi folks, > > > > I know how to write existentially quantified data constructors for > > single-parameter type classes, but I'm having trouble doing it for > > multi-parameter type classes. Is it not possible, or am I just using the > > wrong syntax? > > > > I have this class: > > > > class Collidable a b where > > collideWith :: a -> b -> String > > > > And I tried to define an existentially quantified data constructor > thusly: > > > > data Collision = forall a. (forall b. Collidable a b => Collision > {collider1 > > :: a, collider2 :: b}) > > > > I get a parse error. So then I tried: > > > > data Collision = forall a. forall b. Collidable a b => Collision > {collider1 > > :: a, collider2 :: b} > > > > I get a different parse error. Is there any way to make this work? > > > > Thanks, > > Lyle > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at qseep.net Fri Mar 20 05:43:41 2015 From: lists at qseep.net (Lyle Kopnicky) Date: Thu, 19 Mar 2015 22:43:41 -0700 Subject: [Haskell-cafe] Existentials for multi-parameter type classes? In-Reply-To: References: Message-ID: Thanks to both of you, that's exactly what I needed! -------------- next part -------------- An HTML attachment was scrubbed... URL: From gladstein at gladstein.com Fri Mar 20 06:10:38 2015 From: gladstein at gladstein.com (David Gladstein) Date: Thu, 19 Mar 2015 23:10:38 -0700 Subject: [Haskell-cafe] apt-get install haskell-platform fails on ubuntu 14.04 Message-ID: http://askubuntu.com/questions/597278/haskell-platform-unmet-dependencies I'm installing on a newly-built system. I looked at the haskell.org download instructions, and I couldn't find anything that made sense. apt-get install haskell-platform worked about a month ago. Does anyone know what happened? -------------- next part -------------- An HTML attachment was scrubbed... URL: From i.vysniauskas at gmail.com Fri Mar 20 12:06:10 2015 From: i.vysniauskas at gmail.com (=?UTF-8?Q?Ignas_Vy=C5=A1niauskas?=) Date: Fri, 20 Mar 2015 14:06:10 +0200 Subject: [Haskell-cafe] Strongly typed data / API specification librares Message-ID: Hi cafe, Does anyone know of any libraries that allow one to describe data / interfaces (think IDLs), with emphasis on good support for modules, strong typing and extensibility? I am thinking in the lines of Thrift[1], Piqi[2], Swagger[3], but with the core data specification language as decoupled as possible from any kind of implementation related things (such as actual representation of data, or RPC / RESTful bindings). haskell-servant[4] and silk-rest[5] are kind of relevant, but they are very much oriented towards RESTful APIs. Sorry if this is slightly off-topic, but I couldn't think anywhere else to inquire about this. Thanks, Ignas [1]: https://thrift.apache.org/ [2]: http://piqi.org/ [3]: http://swagger.io/ [4]: http://haskell-servant.github.io/ [5]: http://silkapp.github.io/rest/ From gladstein at gladstein.com Fri Mar 20 15:27:35 2015 From: gladstein at gladstein.com (David Gladstein) Date: Fri, 20 Mar 2015 08:27:35 -0700 (PDT) Subject: [Haskell-cafe] apt-get install haskell-platform fails on ubuntu 14.04 In-Reply-To: References: Message-ID: As of this morning the haksell.org site does point one to the haskell platform install instructions. Those instructions point one to a community ubuntu package that will supposedly install a 2013 version of the platform... not good. In any case, the link below describes in detail the failure I'm getting. I hope and trust that apt-get install haskell-platform is still the preferred way to install? On Thursday, March 19, 2015 at 11:10:45 PM UTC-7, David Gladstein wrote: > > http://askubuntu.com/questions/597278/haskell-platform-unmet-dependencies > > I'm installing on a newly-built system. I looked at the haskell.org > download instructions, and I couldn't find anything that made sense. > > apt-get install haskell-platform worked about a month ago. > > Does anyone know what happened? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gladstein at gladstein.com Fri Mar 20 15:27:35 2015 From: gladstein at gladstein.com (David Gladstein) Date: Fri, 20 Mar 2015 08:27:35 -0700 (PDT) Subject: [Haskell-cafe] apt-get install haskell-platform fails on ubuntu 14.04 In-Reply-To: References: Message-ID: As of this morning the haksell.org site does point one to the haskell platform install instructions. Those instructions point one to a community ubuntu package that will supposedly install a 2013 version of the platform... not good. In any case, the link below describes in detail the failure I'm getting. I hope and trust that apt-get install haskell-platform is still the preferred way to install? On Thursday, March 19, 2015 at 11:10:45 PM UTC-7, David Gladstein wrote: > > http://askubuntu.com/questions/597278/haskell-platform-unmet-dependencies > > I'm installing on a newly-built system. I looked at the haskell.org > download instructions, and I couldn't find anything that made sense. > > apt-get install haskell-platform worked about a month ago. > > Does anyone know what happened? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From berdario at gmail.com Fri Mar 20 15:54:53 2015 From: berdario at gmail.com (Dario Bertini) Date: Fri, 20 Mar 2015 15:54:53 +0000 Subject: [Haskell-cafe] apt-get install haskell-platform fails on ubuntu 14.04 In-Reply-To: References: Message-ID: On Ubuntu I usually rely on hvr's ppa to install ghc and cabal https://launchpad.net/~hvr/+archive/ubuntu/ghc and then I'd use stackage to have a set of libraries you can rely on install http://www.stackage.org/lts sorry if this is a non-answer, anyhow if your error is the same as on that askubuntu question it seems unrelated to Haskell, have you tried `apt-get install -f` like mentioned in the comment? From creichert07 at gmail.com Fri Mar 20 17:44:19 2015 From: creichert07 at gmail.com (Christopher Reichert) Date: Fri, 20 Mar 2015 12:44:19 -0500 Subject: [Haskell-cafe] Strongly typed data / API specification librares In-Reply-To: References: Message-ID: Are you looking for something like this: https://github.com/twittner/swagger? Basicallly, a DSL to generate the API specification? The added benefit is that it's compatible with WAI which helps when/if you want to serve the specification. I've used the interactive documentation and swagger-codegen to generate several clients in other languages (python, ruby). I'm quite happy with the results. -Christopher On Fri, Mar 20, 2015 at 7:06 AM, Ignas Vy?niauskas wrote: > Hi cafe, > > Does anyone know of any libraries that allow one to describe data / > interfaces (think IDLs), with emphasis on good support for modules, > strong typing and extensibility? > > I am thinking in the lines of Thrift[1], Piqi[2], Swagger[3], but with > the core data specification language as decoupled as possible from any > kind of implementation related things (such as actual representation > of data, or RPC / RESTful bindings). > > haskell-servant[4] and silk-rest[5] are kind of relevant, but they are > very much oriented towards RESTful APIs. > > Sorry if this is slightly off-topic, but I couldn't think anywhere > else to inquire about this. > > Thanks, > Ignas > > > [1]: https://thrift.apache.org/ > [2]: http://piqi.org/ > [3]: http://swagger.io/ > [4]: http://haskell-servant.github.io/ > [5]: http://silkapp.github.io/rest/ > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gladstein at gladstein.com Fri Mar 20 18:34:57 2015 From: gladstein at gladstein.com (David Gladstein) Date: Fri, 20 Mar 2015 11:34:57 -0700 Subject: [Haskell-cafe] apt-get install haskell-platform fails on ubuntu 14.04 In-Reply-To: References: Message-ID: Firstly, thanks to all who helped. apt-get install -f doesn't help. I solved the problem using the answer in this link: http://askubuntu.com/questions/588695/cant-install-libglew-dev-because-libcheese-and-libclutter-dont-have-the-requir which is to do sudo apt-get install libglew-dev libcheese7 libcheese-gtk23 libclutter-gst-2.0-0 libcogl15 libclutter-gtk-1.0-0 libclutter-1.0-0 xserver-xorg-input-all On Fri, Mar 20, 2015 at 8:54 AM, Dario Bertini wrote: > On Ubuntu I usually rely on hvr's ppa to install ghc and cabal > > https://launchpad.net/~hvr/+archive/ubuntu/ghc > > and then I'd use stackage to have a set of libraries you can rely on > install > > http://www.stackage.org/lts > > sorry if this is a non-answer, anyhow if your error is the same as on > that askubuntu question it seems unrelated to Haskell, have you tried > `apt-get install -f` like mentioned in the comment? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Fri Mar 20 21:21:26 2015 From: david.feuer at gmail.com (David Feuer) Date: Fri, 20 Mar 2015 17:21:26 -0400 Subject: [Haskell-cafe] What's the story of this weird type? Message-ID: I was reading an answer by Luis Casillas on Stack Overflow http://stackoverflow.com/a/23418746/1477667 and he used a somewhat peculiar type, with apparently not-so-useful constraints: newtype f :-> g = Natural { eta :: forall x. (Functor f, Functor g) => f x -> g x } There are a couple things about it that I don't understand. 1. I can construct a :-> from a function that doesn't satisfy the constraints, and I can pattern match to get access to it, but I can't use it. Why am I allowed to construct it at all? data Mb a = N | J a -- Not a Functor instance -- This is accepted (why?) pot = Natural (\case [] -> N (a:_) -> J a) -- And I can even do this: mb :: Functor Mb => Mb Int mb = case pot of Natural f -> f [3] But then of course I can't satisfy the constraint to use it. 2. I would have thought that such a weird/broken thing as this would only be allowed with -XDatatypeContexts, but in fact it is allowed without it. Why? David From lambda.fairy at gmail.com Fri Mar 20 22:39:12 2015 From: lambda.fairy at gmail.com (Chris Wong) Date: Sat, 21 Mar 2015 11:39:12 +1300 Subject: [Haskell-cafe] What's the story of this weird type? In-Reply-To: References: Message-ID: Hi David, On Sat, Mar 21, 2015 at 10:21 AM, David Feuer wrote: > I was reading an answer by Luis Casillas on Stack Overflow > > http://stackoverflow.com/a/23418746/1477667 > > and he used a somewhat peculiar type, with apparently not-so-useful constraints: > > newtype f :-> g = > Natural { eta :: forall x. (Functor f, Functor g) => f x -> g x } > > There are a couple things about it that I don't understand. > > 1. I can construct a :-> from a function that doesn't satisfy the > constraints, and I can pattern match to get access to it, but I can't > use it. Why am I allowed to construct it at all? > > data Mb a = N | J a -- Not a Functor instance > > -- This is accepted (why?) > pot = Natural (\case > [] -> N > (a:_) -> J a) > > -- And I can even do this: > mb :: Functor Mb => Mb Int > mb = case pot of > Natural f -> f [3] > > But then of course I can't satisfy the constraint to use it. I think it would help to use the dictionary-passing interpretation of type classes: newtype f :-> g = Natural { eta :: forall x. FunctorInstance f -> FunctorInstance g -> f x -> g x } In this form we can see why your code works that way. This inner function only needs the Functor instances when it is *called*, not when it's constructed. So GHC defers resolving the constraints until the function is used. Alternatively, we can write :-> as a GADT: newtype f :-> g where Natural :: (forall x. (Functor f, Functor g) => f x -> g x) -> (f :-> g) -- a.k.a. Natural :: (forall x. FunctorInstance f -> FunctorInstance g -> f x -> g x) -> (f :-> g) Notice again how it's the inner function that wants the instances, not the Natural constructor itself. This form suggests a method to check the constraints earlier. If we move the (Functor f, Functor g) out of the inner forall: data f :-> g where Natural :: (Functor f, Functor g) => (forall x. f x -> g x) -> (f :-> g) -- a.k.a. Natural :: FunctorInstance f -> FunctorInstance g -> (forall x. f x -> g x) -> (f :-> g) then GHC will check the constraints on construction, not use. This is very close to *existential types* which you may have come across before. Note that we have to use "data" here, not "newtype". This is because to enforce its constraints, GHC must store a copy of the Functor instances in the data type itself. So the data type ends up with two extra fields, so it can't be a newtype any more. > 2. I would have thought that such a weird/broken thing as this would > only be allowed with -XDatatypeContexts, but in fact it is allowed > without it. Why? There are in fact *three* places where you can place a context in a data type: -- Datatype contexts (discouraged) data Class a => Type a = Constructor a -- Existential types data Type = forall a. Class a => Constructor a -- Higher-rank polymorphism newtype Type = Constructor (forall a. Class a => a) Only the first is discouraged: the others are quite useful. > David > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -- https://lambda.xyz From david.feuer at gmail.com Sat Mar 21 00:05:50 2015 From: david.feuer at gmail.com (David Feuer) Date: Fri, 20 Mar 2015 20:05:50 -0400 Subject: [Haskell-cafe] What's the story of this weird type? In-Reply-To: References: Message-ID: On Mar 20, 2015 6:39 PM, "Chris Wong" wrote: > In this form we can see why your code works that way. This inner > function only needs the Functor instances when it is *called*, not > when it's constructed. So GHC defers resolving the constraints until > the function is used. Isn't this the same sort of situation that makes DatatypeContexts bad? In the GADT version with the constraints pulled outward, we can pattern match to get access to the dictionaries. Here, we pattern match to get something that demands, but does not use, a constraint. When is this useful? -------------- next part -------------- An HTML attachment was scrubbed... URL: From sumit.sahrawat.apm13 at iitbhu.ac.in Sat Mar 21 07:37:52 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Sat, 21 Mar 2015 13:07:52 +0530 Subject: [Haskell-cafe] [Haskell-beginners] Multi-parameter type classes and ambiguous type variables... In-Reply-To: References: Message-ID: This might be better answered at the haskell-cafe. Sending to cafe. On 21 March 2015 at 03:09, Stuart Hungerford wrote: > Hi, > > As a learning exercise I'm modelling some algebraic structures as > Haskell typeclasses. Some of these are multi-parameter type classes. > Here's a very simplified version of the type class relationships: > > class MM a where > one :: a > > class AM a where > zero :: a > > class (AM a, MM a) => SR a > > class (AM a) => AG a where > inv :: a -> a > > class (SR a) => R a where > neg :: a -> a > > class (R r, AG g) => M r g where > sca :: r -> g -> g > > check :: (Eq g, M r g) => g -> Bool > check x = sca one x == x > > The problem I have is that GHC is finding the "r" type variable in the > "check" function ambiguous. Given my still limited Haskell knowledge > I'm not surprised this is happening. What I would like to know is how > experienced Haskellers handle this situation in practice: is there an > idiomatic way of disambiguating "r" or is it a sign of poor type class > design? > > Thanks, > > Stu > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From lambda.fairy at gmail.com Sat Mar 21 08:00:31 2015 From: lambda.fairy at gmail.com (Chris Wong) Date: Sat, 21 Mar 2015 21:00:31 +1300 Subject: [Haskell-cafe] What's the story of this weird type? In-Reply-To: References: Message-ID: On Sat, Mar 21, 2015 at 1:05 PM, David Feuer wrote: > > On Mar 20, 2015 6:39 PM, "Chris Wong" wrote: > >> In this form we can see why your code works that way. This inner >> function only needs the Functor instances when it is *called*, not >> when it's constructed. So GHC defers resolving the constraints until >> the function is used. > > Isn't this the same sort of situation that makes DatatypeContexts bad? In > the GADT version with the constraints pulled outward, we can pattern match > to get access to the dictionaries. Here, we pattern match to get something > that demands, but does not use, a constraint. When is this useful? Yeah on pondering the code, I agree with you that the constraints aren't very useful there. -- https://lambda.xyz From lambda.fairy at gmail.com Sat Mar 21 08:31:23 2015 From: lambda.fairy at gmail.com (Chris Wong) Date: Sat, 21 Mar 2015 21:31:23 +1300 Subject: [Haskell-cafe] [Haskell-beginners] Multi-parameter type classes and ambiguous type variables... In-Reply-To: References: Message-ID: On Sat, Mar 21, 2015 at 8:37 PM, Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote: > This might be better answered at the haskell-cafe. Sending to cafe. > > On 21 March 2015 at 03:09, Stuart Hungerford > wrote: >> >> Hi, >> >> As a learning exercise I'm modelling some algebraic structures as >> Haskell typeclasses. Some of these are multi-parameter type classes. >> Here's a very simplified version of the type class relationships: >> >> class MM a where >> one :: a >> >> class AM a where >> zero :: a >> >> class (AM a, MM a) => SR a >> >> class (AM a) => AG a where >> inv :: a -> a >> >> class (SR a) => R a where >> neg :: a -> a >> >> class (R r, AG g) => M r g where >> sca :: r -> g -> g >> >> check :: (Eq g, M r g) => g -> Bool >> check x = sca one x == x >> >> The problem I have is that GHC is finding the "r" type variable in the >> "check" function ambiguous. Given my still limited Haskell knowledge >> I'm not surprised this is happening. What I would like to know is how >> experienced Haskellers handle this situation in practice: is there an >> idiomatic way of disambiguating "r" or is it a sign of poor type class >> design? In the type signature: check :: (Eq g, M r g) => g -> Bool you fix the type `g`, but not the type `r`. This causes an ambiguity in the program because if you had e.g. instance M Float Vector where ... instance M Int Vector where ... both in the same program, and you passed a Vector to `check`, GHC won't know which instance to choose. To solve this ambiguity, either fix `r` with an extra parameter: check :: (Eq g, M r g) => r -> g -> Bool check one' x = sca one' x == x Or declare that `r` is uniquely determined by `g` using a *functional dependency*: class (R r, AG g) => M r g | g -> r where sca :: r -> g -> g Or equivalently, using *associated types*: class (AG g, R (Scalar g)) => M g where type Scalar g :: * sca :: Scalar g -> g -> g check :: (Eq g, M g) => g -> Bool check x = -- as before A Google search for these two terms should yield plenty of tutorials and examples. (By the way, I'd suggest using longer names like "Ring" and "AdditiveGroup" instead, as they're easier to read.) Chris >> Thanks, >> >> Stu >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > > > > -- > Regards > > Sumit Sahrawat > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- https://lambda.xyz From silvio.frischi at gmail.com Sat Mar 21 14:32:25 2015 From: silvio.frischi at gmail.com (silvio) Date: Sat, 21 Mar 2015 15:32:25 +0100 Subject: [Haskell-cafe] Continuation vs Codensity Message-ID: <550D80F9.30904@gmail.com> I just saw this http://stackoverflow.com/questions/25827227/why-cant-there-be-an-instance-of-monadfix-for-the-continuation-monad Personally, I think the suggested type for callCC newtype ContT m a = ContT { runContT :: forall r. (a -> m r) -> m r } class MonadCont m where callCC :: (forall b. (a -> m b) -> m b) -> m a is much more intuitive and resembles the actual type of ContT much more closely then the current callCC and it can be Fixed. So I was wondering if there was an other reason than convention for not using that type. Silvio From stuart.hungerford at gmail.com Sat Mar 21 20:15:52 2015 From: stuart.hungerford at gmail.com (Stuart Hungerford) Date: Sun, 22 Mar 2015 07:15:52 +1100 Subject: [Haskell-cafe] [Haskell-beginners] Multi-parameter type classes and ambiguous type variables... In-Reply-To: References: Message-ID: On Sat, Mar 21, 2015 at 7:31 PM, Chris Wong wrote: > [...] >>> check :: (Eq g, M r g) => g -> Bool >>> check x = sca one x == x >>> >>> The problem I have is that GHC is finding the "r" type variable in the >>> "check" function ambiguous. Given my still limited Haskell knowledge >>> I'm not surprised this is happening. What I would like to know is how >>> experienced Haskellers handle this situation in practice: is there an >>> idiomatic way of disambiguating "r" or is it a sign of poor type class >>> design? > > In the type signature: > > check :: (Eq g, M r g) => g -> Bool > > you fix the type `g`, but not the type `r`. This causes an ambiguity > in the program because if you had e.g. > > instance M Float Vector where ... > instance M Int Vector where ... > > both in the same program, and you passed a Vector to `check`, GHC > won't know which instance to choose. > > To solve this ambiguity, either fix `r` with an extra parameter: > > check :: (Eq g, M r g) => r -> g -> Bool > check one' x = sca one' x == x > > Or declare that `r` is uniquely determined by `g` using a *functional > dependency*: > > class (R r, AG g) => M r g | g -> r where > sca :: r -> g -> g > > Or equivalently, using *associated types*: > > class (AG g, R (Scalar g)) => M g where > type Scalar g :: * > sca :: Scalar g -> g -> g > > check :: (Eq g, M g) => g -> Bool > check x = -- as before > > A Google search for these two terms should yield plenty of tutorials > and examples. Thanks for this excellent explanation. > (By the way, I'd suggest using longer names like "Ring" and > "AdditiveGroup" instead, as they're easier to read.) Yes -- I stripped the example down, including the full names of the type classes, for explaining the issue. I could well have left the full names though. Stu From stuart.hungerford at gmail.com Sat Mar 21 21:53:27 2015 From: stuart.hungerford at gmail.com (Stuart Hungerford) Date: Sun, 22 Mar 2015 08:53:27 +1100 Subject: [Haskell-cafe] [Haskell-beginners] Multi-parameter type classes and ambiguous type variables... In-Reply-To: References: Message-ID: On Sat, Mar 21, 2015 at 7:31 PM, Chris Wong wrote: >>> [...] >>> class MM a where >>> one :: a >>> >>> class AM a where >>> zero :: a >>> >>> class (AM a, MM a) => SR a >>> >>> class (AM a) => AG a where >>> inv :: a -> a >>> >>> class (SR a) => R a where >>> neg :: a -> a >>> >>> class (R r, AG g) => M r g where >>> sca :: r -> g -> g >>> >>> check :: (Eq g, M r g) => g -> Bool >>> check x = sca one x == x > [...] If I also planned to have M instances like instance M Float Float where ... instance M Int Float where ... instance (M r g) => M r [g] where ... instance (M s u, M s v) => M s (u, v) where ... Which of the three approaches would make for the most idiomatic Haskell (add extra 'r' parameter, functional dependencies or associated types)? Is it common to require a range of language extension pragmas to make this kind of thing work or am I just going about this in a non-idiomatic way? Thanks, Stu From mietek at bak.io Sat Mar 21 23:49:58 2015 From: mietek at bak.io (=?iso-8859-1?Q?Mi=EBtek_Bak?=) Date: Sat, 21 Mar 2015 23:49:58 +0000 Subject: [Haskell-cafe] Cabal and cabal-install minor release (1.22.2.0) In-Reply-To: References: Message-ID: Thanks, Ryan. Binaries of cabal-install 1.22.2.0 are now available in Halcyon on the following platforms: - Amazon Linux 2014.09 (x86_64) - Arch Linux (x86_64) - CentOS 6 (i386 and x86_64) - CentOS 7 (x86_64) - Debian 6 (i386 and x86_64) - Debian 7 (i386 and x86_64) - Fedora 19 (i386 and x86_64) - Fedora 20 (i386 and x86_64) - Fedora 21 (x86_64) - openSUSE 13.2 (x86_64) - OS X 10.8 (x86_64) - OS X 10.9 (x86_64) - OS X 10.10 (x86_64) - Red Hat Enterprise Linux 6 (x86_64) - Red Hat Enterprise Linux 7 (x86_64) - SUSE Linux Enterprise Server 12 (x86_64) - Ubuntu 10.04 LTS (i386 and x86_64) - Ubuntu 12.04 LTS (i386 and x86_64) - Ubuntu 14.04 LTS (i386 and x86_64) - Ubuntu 14.10 (i386 and x86_64) See https://github.com/mietek/halcyon/issues/38 for details of cross-platform support. Let me know if I can help with the automation. -- Mi?tek On 2015-03-21, at 21:34, Ryan Thomas wrote: > I have released both Cabal and cabal-install 1.22.2.0 today, > cabal-install has just gone out now. > > These have been published to Hackage and are available on the download > page of haskell.org. > > As a part of this process I have also updated the release > documentation (https://github.com/haskell/cabal/wiki/Making-a-release) > to support the new sftp-only push to haskell.org. > > There are a couple of outstanding items to tie off with this release: > - The {Cabal|cabal-install}-latest symlinks on haskell.org still need > to be updated > - The Windows/OSX/Linux specific binaries need to be built and updated > on the download page; Johan I will probably need some guidance on the > process for this. > > Once I get these items tied off, my main focus will be the automation > of this release process. > > > Cheers, > > ryan > _______________________________________________ > cabal-devel mailing list > cabal-devel at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/cabal-devel -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4203 bytes Desc: not available URL: From briand at aracnet.com Sun Mar 22 04:57:17 2015 From: briand at aracnet.com (briand at aracnet.com) Date: Sat, 21 Mar 2015 21:57:17 -0700 Subject: [Haskell-cafe] netwire example error message Message-ID: <20150321215717.627b3113@cedar.deldotd.com> The error message: time.hs:13:8: No instance for (Show e0) arising from a use of ?testWire? The type variable ?e0? is ambiguous Note: there are several potential instances: instance Show Double -- Defined in ?GHC.Float? instance Show Float -- Defined in ?GHC.Float? instance (Integral a, Show a) => Show (GHC.Real.Ratio a) -- Defined in ?GHC.Real? ...plus 45 others In the expression: testWire clockSession_ pos In an equation for ?main?: main = testWire clockSession_ pos Failed, modules loaded: none. So here's my type debugging. (netwire sure is convoluted) pos => Wire s e m a Float integral => a -> Wire s e m a a clockSession_ => Session m (Timed NominalDiffTime ()) looks to me like the problem is probably rooted in the interaction of pos with (Timed NominalDiffTime) as it does not seem to have a float instance, but that doesn't seem like it should result in an error about ambiguity. Any help appreciated. Thanks Brian ---- import Prelude hiding ((.)) -- To use (.) in the scope of Categories instead import Control.Wire import FRP.Netwire speed :: Float speed = 0.5 pos :: (HasTime t s, Monad m) => Wire s e m a Float pos = integral 0 . pure speed -- The main function main :: IO () main = testWire clockSession_ pos From joachifm at fastmail.fm Sun Mar 22 06:15:09 2015 From: joachifm at fastmail.fm (joachifm at fastmail.fm) Date: Sun, 22 Mar 2015 07:15:09 +0100 Subject: [Haskell-cafe] netwire example error message In-Reply-To: <20150321215717.627b3113@cedar.deldotd.com> References: <20150321215717.627b3113@cedar.deldotd.com> Message-ID: <1427004909.2605511.243563518.2C6FFBE6@webmail.messagingengine.com> On Sun, Mar 22, 2015, at 05:57 AM, briand at aracnet.com wrote: > The error message: > > time.hs:13:8: > No instance for (Show e0) arising from a use of ?testWire? > The type variable ?e0? is ambiguous > Note: there are several potential instances: > instance Show Double -- Defined in ?GHC.Float? > instance Show Float -- Defined in ?GHC.Float? > instance (Integral a, Show a) => Show (GHC.Real.Ratio a) > -- Defined in ?GHC.Real? > ...plus 45 others > In the expression: testWire clockSession_ pos > In an equation for ?main?: main = testWire clockSession_ pos > Failed, modules loaded: none. The problem is that `testWire` wants to print the inhibition value but has no way of choosing which `Show` instance to use, because the type of `e` is left unspecified in your snippet. This is obvious if you look at the constraints on `testWire`, but not so obvious from the error message. The solution is to fix the inhibition type to `()` (or whatever). From briand at aracnet.com Sun Mar 22 06:33:46 2015 From: briand at aracnet.com (briand at aracnet.com) Date: Sat, 21 Mar 2015 23:33:46 -0700 Subject: [Haskell-cafe] netwire example error message In-Reply-To: <1427004909.2605511.243563518.2C6FFBE6@webmail.messagingengine.com> References: <20150321215717.627b3113@cedar.deldotd.com> <1427004909.2605511.243563518.2C6FFBE6@webmail.messagingengine.com> Message-ID: <20150321233346.3caf144c@cedar.deldotd.com> On Sun, 22 Mar 2015 07:15:09 +0100 joachifm at fastmail.fm wrote: > On Sun, Mar 22, 2015, at 05:57 AM, briand at aracnet.com wrote: > > The error message: > > > > time.hs:13:8: > > No instance for (Show e0) arising from a use of ?testWire? > > The type variable ?e0? is ambiguous > > Note: there are several potential instances: > > instance Show Double -- Defined in ?GHC.Float? > > instance Show Float -- Defined in ?GHC.Float? > > instance (Integral a, Show a) => Show (GHC.Real.Ratio a) > > -- Defined in ?GHC.Real? > > ...plus 45 others > > In the expression: testWire clockSession_ pos > > In an equation for ?main?: main = testWire clockSession_ pos > > Failed, modules loaded: none. > > The problem is that `testWire` wants to print the inhibition value but > has no way of choosing which `Show` instance to use, because the type of > `e` is left unspecified in your snippet. This is obvious if you look at > the constraints on `testWire`, but not so obvious from the error > message. The solution is to fix the inhibition type to `()` (or > whatever). I change the type of pos to pos :: (HasTime t s, Monad m) => Wire s () m a Float and that did it. Also, () could just be Float, or, as you were saying, whatever. Thank you, thank you ! Brian p.s. and for the record not my snippet, got it from a blog. i'm guessing it was untested... From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sun Mar 22 09:03:49 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sun, 22 Mar 2015 09:03:49 +0000 Subject: [Haskell-cafe] time and TimeLocale compatibility Message-ID: <20150322090348.GI8845@weber> Hello all, The `formatTime` function from time-1.4 uses the TimeLocale type from old-locale, whereas time-1.5 provides its own definition of the TimeLocale type. I want to provide `formatTime` with the argument `defaultTimeLocale`. 1.4 requires the version in old-locale whereas 1.5 requires the version it defines itself. Is it possible to use this function in a way that is compatible with both 1.4 and 1.5? If time-1.5 had merely reexported the old-locale version, and then (the future) time-1.6 replaced it completely this would have offered a smoother upgrade path, but as far as I can tell nothing like this was done. What are my options? Tom From haskell-cafe at accounts.gphilip.in Sun Mar 22 09:09:49 2015 From: haskell-cafe at accounts.gphilip.in (G Philip) Date: Sun, 22 Mar 2015 10:09:49 +0100 Subject: [Haskell-cafe] Getting Haskeline to quit early Message-ID: <1427015389.3858040.243586894.1B57CFC9@webmail.messagingengine.com> (I posted this to Stack Overflow [1], but no luck there so far.) Hi all, I am trying to use Haskeline [2] to write a program which asks the user a sequence of questions, each one optionally with a default value in [brackets], and reads in their responses. I want the user to be able to 1. Press Enter to submit the [default] value; 2. Type in a string, edit it if needed, and then press Enter to submit this value; 3. Press Ctrl-C to reset all values to the defaults and start over; and, 4. Press Ctrl-D or enter "quit" to quit, in which case all the values which they submitted are lost. I have been able to get points 1-3 working, but I cannot get point 4 to work: pressing Ctrl-D (or entering "quit") just brings up the next prompt instead of making the program quit the questioning. Looking at my program (please see below) I understand why this happens, but I am not able to figure out how to fix this so that Ctrl-D (or "quit") actually makes the questioning stop. How do I fix the program to make this happen? I did see this question [2] over at Stack Overflow which seems to ask something similar, but I could not get much from there; I am not even sure that they are asking the same question as I am. As a secondary question: my current program has quite a few `case` statements which switch on `Maybe` values. In particular, I currently check for `Nothing` two or three levels deep so that I can correctly return a `Nothing` when the user presses Ctrl-D. I have a feeling that this could be simplified using (something like) the monadic `>>=` operator, but I am unable to figure out how to do this in this case. Is my hunch right? Is there a way to do away with all this pattern matching which looks for `Nothing`? Also: please tell me anything else which could improve my code below. I am quite new to this, so it is very likely that I am missing many obvious things here. Thanks in advance! Regards, Philip ---------------- The program --------------- My program asks the user about the composition of a fruit basket. The information associated with a fruit basket consists of the name of the owner of the fruit basket and the names of the different kinds of fruit in the basket. To be able to ask for the latter, I first ask for the _number_ of different kind of fruit in the basket, and then ask for the name of each kind. We start with a default fruit basket whose information is then modified based on what the user tells us. module Main where import System.Console.Haskeline type PersonName = String type FruitName = String data FruitBasket = FruitBasket { ownerName :: PersonName, fruitCount :: Int, fruitNames :: [FruitName] } deriving Show defaultBasket = FruitBasket "Mary" 2 ["Apple", "Peach"] main :: IO () main = do basket <- getBasketData defaultBasket putStrLn $ "Got: " ++ show(basket) -- Prompt the user for information about a fruit basket, and -- return a FruitBasket instance containing this information. The -- first argument is an instance of FruitBasket from which we get -- the default values for the various prompts. The return value -- has a Maybe type because the user may abort the questioning, in -- which case we get nothing from them. getBasketData :: FruitBasket -> IO (Maybe FruitBasket) getBasketData basket = runInputT defaultSettings $ withInterrupt $ getData basket where getData :: FruitBasket -> InputT IO (Maybe FruitBasket) getData initialBasket = handleInterrupt f $ do outputStrLn banner input <- getInputLine $ "Who owns this basket? [" ++ defaultOwner ++ "] : " basket <- case input of Nothing -> return Nothing -- User pressed Ctrl-D with the input being empty Just "" -> return (Just initialBasket) -- User pressed Enter with the input being empty Just "quit" -> return Nothing -- User typed in "quit" and pressed Enter Just newOwner -> return (Just initialBasket{ownerName = newOwner}) input <- getInputLine $ "Number of kinds of fruit in the basket? [" ++ show defaultCount ++ "] : " basket' <- case input of Nothing -> return Nothing Just "" -> return basket Just "quit" -> return Nothing Just count -> return $ updateFruitCount basket (read count) where updateFruitCount Nothing _ = Nothing updateFruitCount (Just realBasket) newCount = Just $ realBasket{fruitCount = newCount} let defaultFruitNames = pruneOrPadNames basket' newNames <- getFruitNames defaultFruitNames 1 case newNames of Nothing -> return (Just defaultBasket) Just newSetOfNames -> return $ updateFruitNames basket' newSetOfNames where updateFruitNames Nothing _ = Nothing updateFruitNames (Just realBasket) realNewNames = Just $ realBasket{fruitNames = realNewNames} where f = (outputStrLn "Press Ctrl-D or enter \"quit\" to quit." >> getData initialBasket) defaultOwner = ownerName initialBasket defaultCount = fruitCount initialBasket banner :: String banner = "Please enter details of the fruit basket below. At each prompt you can do one of the following:\n\ \\t (a) Press Enter to submit the [default] value;\n\ \\t (b) Type in a string, edit it if needed, and then press Enter to submit this value;\n\ \\t (c) Press Ctrl-C to reset all values to the defaults and start over;\n\ \\t (d) Press Ctrl-D or enter \"quit\" to quit; all the values you submitted will be lost." pruneOrPadNames :: Maybe FruitBasket -> Maybe [String] pruneOrPadNames Nothing = Nothing pruneOrPadNames (Just basket) = Just $ pruneOrPad (fruitNames basket) (fruitCount basket) -- When requiredLength is not larger than (length inputList), -- (pruneOrPad inputList requiredLength) is the prefix of -- inputList of length requiredLength. Otherwise, it is inputList -- padded with as many empty strings as required to make the total -- length equal to requiredLength. pruneOrPad :: [String] -> Int -> [String] pruneOrPad inputList requiredLength | requiredLength <= inputLength = take requiredLength inputList | otherwise = inputList ++ (replicate difference "") where inputLength = length inputList difference = requiredLength - inputLength getFruitNames Nothing _ = return Nothing getFruitNames (Just []) _ = return $ Just [""] getFruitNames (Just (name:names)) count = do input <- getInputLine $ "Name of fruit " ++ (show count) ++ " [" ++ name ++ "] : " newNames <- case input of Nothing -> return Nothing Just "" -> do -- Keep the default name for this fruit ... newNames' <- getFruitNames (Just names) (count + 1) case newNames' of Nothing -> return Nothing -- ... unless the user chose to quit -- while entering a name Just [""] -> return $ Just [name] -- At this point names = [] so it is -- already time to stop asking for -- more names. Just furtherNames -> return $ Just (name : furtherNames) Just "quit" -> return Nothing Just name' -> do newNames' <- getFruitNames (Just names) (count + 1) case newNames' of Nothing -> return Nothing Just [""] -> return $ Just [name'] Just furtherNames -> return $ Just (name' : furtherNames) return newNames References ------------- [1] http://stackoverflow.com/questions/29189428/getting-haskeline-to-quit-early [2]: https://hackage.haskell.org/package/haskeline-0.7.1.3/docs/System-Console-Haskeline.html [3]: http://stackoverflow.com/questions/4771199/haskell-best-practise-early-termination-in-haskeline From alberto at toscat.net Sun Mar 22 09:31:00 2015 From: alberto at toscat.net (Alberto Valverde) Date: Sun, 22 Mar 2015 10:31:00 +0100 Subject: [Haskell-cafe] time and TimeLocale compatibility In-Reply-To: <20150322090348.GI8845@weber> References: <20150322090348.GI8845@weber> Message-ID: Hi Tom, This worked for me: https://ghc.haskell.org/trac/ghc/wiki/Migration/7.10#time-1.5.0.1 Cheers, Alberto On Sunday, March 22, 2015, Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > Hello all, > > The `formatTime` function from time-1.4 uses the TimeLocale type from > old-locale, whereas time-1.5 provides its own definition of the TimeLocale > type. I want to provide `formatTime` with the argument > `defaultTimeLocale`. > 1.4 requires the version in old-locale whereas 1.5 requires the version it > defines itself. > > Is it possible to use this function in a way that is compatible with both > 1.4 and 1.5? If time-1.5 had merely reexported the old-locale version, and > then (the future) time-1.6 replaced it completely this would have offered a > smoother upgrade path, but as far as I can tell nothing like this was done. > > What are my options? > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sun Mar 22 10:32:47 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sun, 22 Mar 2015 10:32:47 +0000 Subject: [Haskell-cafe] time and TimeLocale compatibility In-Reply-To: References: <20150322090348.GI8845@weber> Message-ID: <20150322103247.GJ8845@weber> Thanks Alberto. It's disappointing if CPP is the only way to handle this transation. However, if this is indeed the case it would be better to do it once and for all (i.e. abstract this process into a resuable component) rather than force every package maintainer to do it on an individual level. Thus I have created the following time14-compat package providing Data.Time.Compat that can be used from both 1.4 and 1.5: https://github.com/tomjaguarpaw/haskell-time14-compat Comments welcome. I haven't tested it particularly thoroughly, but it is rather simple. I'll stick it up on Hackage once enough eyeballs have sanity-checked it. Tom On Sun, Mar 22, 2015 at 10:31:00AM +0100, Alberto Valverde wrote: > Hi Tom, > > This worked for me: > https://ghc.haskell.org/trac/ghc/wiki/Migration/7.10#time-1.5.0.1 > > Cheers, > Alberto > > On Sunday, March 22, 2015, Tom Ellis < > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > > > Hello all, > > > > The `formatTime` function from time-1.4 uses the TimeLocale type from > > old-locale, whereas time-1.5 provides its own definition of the TimeLocale > > type. I want to provide `formatTime` with the argument > > `defaultTimeLocale`. > > 1.4 requires the version in old-locale whereas 1.5 requires the version it > > defines itself. > > > > Is it possible to use this function in a way that is compatible with both > > 1.4 and 1.5? If time-1.5 had merely reexported the old-locale version, and > > then (the future) time-1.6 replaced it completely this would have offered a > > smoother upgrade path, but as far as I can tell nothing like this was done. > > > > What are my options? > > > > Tom > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sun Mar 22 10:52:05 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sun, 22 Mar 2015 10:52:05 +0000 Subject: [Haskell-cafe] time and TimeLocale compatibility In-Reply-To: <20150322103247.GJ8845@weber> References: <20150322090348.GI8845@weber> <20150322103247.GJ8845@weber> Message-ID: <20150322105205.GK8845@weber> I have been informed a package for this already exists: http://hackage.haskell.org/package/time-locale-compat-0.1.0.1 On Sun, Mar 22, 2015 at 10:32:47AM +0000, Tom Ellis wrote: > I have created the following time14-compat package providing > Data.Time.Compat that can be used from both 1.4 and 1.5: > > https://github.com/tomjaguarpaw/haskell-time14-compat > > Comments welcome. I haven't tested it particularly thoroughly, but it is > rather simple. I'll stick it up on Hackage once enough eyeballs have > sanity-checked it. From matthewtpickering at gmail.com Sun Mar 22 13:12:04 2015 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Sun, 22 Mar 2015 13:12:04 +0000 Subject: [Haskell-cafe] GSoC Proposal: Refactor program with HLint suggestions Message-ID: Dear Caf?, I would appreciate any comments on the proposal I have written for this years GSoC. The proposal focuses on an oft-requested feature, the ability for HLint to perform the refactorings which it suggests. I believe this is now possible with the work that Alan Zimmerman has recently completed on ghc-exactprint. More details can be found here - http://mpickering.github.io/gsoc2015.html (There is also a pdf version available - http://mpickering.github.io/gsoc2015.pdf) Matt From chneukirchen at gmail.com Sun Mar 22 14:13:16 2015 From: chneukirchen at gmail.com (Christian Neukirchen) Date: Sun, 22 Mar 2015 15:13:16 +0100 Subject: [Haskell-cafe] Munich Haskell Meeting, 2015-03-25 @ 19:30 Message-ID: <87iodt6ryb.fsf@gmail.com> Dear all, Next week, our monthly Munich Haskell Meeting will take place again on Wednesday, March 25 at Cafe Puck at 19h30. For details see here: http://www.haskell-munich.de/dates If you plan to join, please add yourself to this dudle so we can reserve enough seats! It is OK to add yourself to the dudle anonymously or pseudonymously. https://dudle.inf.tu-dresden.de/haskell-munich-mar-2015/ Everybody is welcome! cu, -- Christian Neukirchen http://chneukirchen.org From gale at sefer.org Sun Mar 22 14:40:16 2015 From: gale at sefer.org (Yitzchak Gale) Date: Sun, 22 Mar 2015 16:40:16 +0200 Subject: [Haskell-cafe] time and TimeLocale compatibility In-Reply-To: <20150322103247.GJ8845@weber> References: <20150322090348.GI8845@weber> <20150322103247.GJ8845@weber> Message-ID: Tom Ellis wrote: > It's disappointing if CPP is the only way to handle this transation. Glad that there is a compat package (and thanks for offering to create one). I agree that it's the best way. But even without a compat package, it is not necessary to use CPP even within the same package, and in my opinion better to avoid it. You can use cabal conditionals directly without going via CPP. The trick is that put your two different imports in modules with the same name in two separate source directories, and in cabal include one hs-source-dir or the other conditionally. Regards, Yitz From the.dead.shall.rise at gmail.com Mon Mar 23 00:35:09 2015 From: the.dead.shall.rise at gmail.com (Mikhail Glushenkov) Date: Mon, 23 Mar 2015 01:35:09 +0100 Subject: [Haskell-cafe] Cabal and cabal-install minor release (1.22.2.0) In-Reply-To: References: Message-ID: Hi, On 22 March 2015 at 00:49, Mi?tek Bak wrote: > Thanks, Ryan. > > > Binaries of cabal-install 1.22.2.0 are now available in Halcyon on the following platforms: > > [...] That's quite impressive! Have you considered adding Windows support? Our release process could use some automation in this area. From mietek at bak.io Mon Mar 23 01:42:38 2015 From: mietek at bak.io (=?iso-8859-1?Q?Mi=EBtek_Bak?=) Date: Mon, 23 Mar 2015 01:42:38 +0000 Subject: [Haskell-cafe] Cabal and cabal-install minor release (1.22.2.0) In-Reply-To: References: Message-ID: <02E88F78-98DD-4825-AD3E-C0C8B9060041@bak.io> I?d like to add Windows support, eventually (https://github.com/mietek/halcyon/issues/42). My main focus right now is enabling the distribution of Haskell applications in binary form, without requiring the cooperation of application authors. To be specific, I?d like the user to be able to say `halcyon install idris`, and get the latest version of Idris installed on their system in 5-10 seconds. Preposterous? This is how Halcyon already works: https://halcyon.sh/tutorial/#install-the-app Of course, this requires the application to be built ahead of time, which in turn requires version constraints to be declared for the application. Now, application authors don?t seem eager to declare version constraints. However, declaring a particular version of Stackage LTS is equivalent to declaring a full set of version constraints (https://github.com/mietek/halcyon/issues/41, https://github.com/mietek/halcyon/issues/40). It seems to me that adopting Stackage LTS should reduce the binary distribution problem to automating the process of performing regular builds across many platforms. Looking forward to your comments. -- Mi?tek https://mietek.io On 2015-03-23, at 00:35, Mikhail Glushenkov wrote: > Hi, > > On 22 March 2015 at 00:49, Mi?tek Bak wrote: >> Thanks, Ryan. >> >> >> Binaries of cabal-install 1.22.2.0 are now available in Halcyon on the following platforms: >> >> [...] > > That's quite impressive! Have you considered adding Windows support? > Our release process could use some automation in this area. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4203 bytes Desc: not available URL: From bertram.felgenhauer at googlemail.com Mon Mar 23 02:26:24 2015 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Mon, 23 Mar 2015 03:26:24 +0100 Subject: [Haskell-cafe] ANN: Lambdabot 5.0.1 Message-ID: <20150323022624.GA15553@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Dear Haskell users, I'm pleased to announce a minor release of Lambdabot. Lambdabot is an IRC bot that can also be used offline; it provides tools for querying information about and even for producing Haskell code. To install it, use the following command: cabal install lambdabot --constraint 'transformers installed' (the constraint helps cabal-install to find an install plan) * What's new - lambdabot is now smarter about locating its data files. This means that commands like @src now work out of the box, without having to copy files into ~/.lambdabot/State - lambdabot-5.0.1 uses (and requires) monad-control 1.0 * Development Development of lambdabot happens on github, where you can also find the bugtracker: https://github.com/lambdabot/lambdabot Have fun with lambdabot, Bertram From simon at joyful.com Mon Mar 23 05:48:40 2015 From: simon at joyful.com (Simon Michael) Date: Sun, 22 Mar 2015 22:48:40 -0700 Subject: [Haskell-cafe] Getting Haskeline to quit early In-Reply-To: <1427015389.3858040.243586894.1B57CFC9@webmail.messagingengine.com> References: <1427015389.3858040.243586894.1B57CFC9@webmail.messagingengine.com> Message-ID: Hi Philip, I'm sorry this answer is not more specific, but perhaps you can get ideas from hledger's add command, which has that functionality: http://hledger.org/step-by-step.html#record-a-transaction-with-hledger-add Here's the code: https://github.com/simonmichael/hledger/blob/master/hledger/Hledger/Cli/Add.hs Note that it uses wizards, which sits on top of haskeline and is rather nice: http://hackage.haskell.org/package/wizards Hope it helps, -Simon From michael at snoyman.com Mon Mar 23 06:48:35 2015 From: michael at snoyman.com (Michael Snoyman) Date: Mon, 23 Mar 2015 06:48:35 +0000 Subject: [Haskell-cafe] Cabal and cabal-install minor release (1.22.2.0) In-Reply-To: <02E88F78-98DD-4825-AD3E-C0C8B9060041@bak.io> References: <02E88F78-98DD-4825-AD3E-C0C8B9060041@bak.io> Message-ID: I already do regular binary builds: every time I do a Stackage Nightly or LTS Haskell build. If it would be useful to share those binaries somewhere, let me know. Of course, sharing the entire binary package database for each nightly build would become a pretty hefty storage burden, but we can probably figure something out around the LTSs. On Mon, Mar 23, 2015 at 3:42 AM Mi?tek Bak wrote: > I?d like to add Windows support, eventually (https://github.com/mietek/ > halcyon/issues/42). > > My main focus right now is enabling the distribution of Haskell > applications in binary form, without requiring the cooperation of > application authors. To be specific, I?d like the user to be able to say > `halcyon install idris`, and get the latest version of Idris installed on > their system in 5-10 seconds. > > Preposterous? This is how Halcyon already works: > https://halcyon.sh/tutorial/#install-the-app > > Of course, this requires the application to be built ahead of time, which > in turn requires version constraints to be declared for the application. > > Now, application authors don?t seem eager to declare version constraints. > However, declaring a particular version of Stackage LTS is equivalent to > declaring a full set of version constraints (https://github.com/mietek/ > halcyon/issues/41, https://github.com/mietek/halcyon/issues/40). > > It seems to me that adopting Stackage LTS should reduce the binary > distribution problem to automating the process of performing regular builds > across many platforms. > > Looking forward to your comments. > > > -- > Mi?tek > https://mietek.io > > > > > On 2015-03-23, at 00:35, Mikhail Glushenkov > wrote: > > > Hi, > > > > On 22 March 2015 at 00:49, Mi?tek Bak wrote: > >> Thanks, Ryan. > >> > >> > >> Binaries of cabal-install 1.22.2.0 are now available in Halcyon on the > following platforms: > >> > >> [...] > > > > That's quite impressive! Have you considered adding Windows support? > > Our release process could use some automation in this area. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.seefried at gmail.com Mon Mar 23 10:37:32 2015 From: sean.seefried at gmail.com (Sean Seefried) Date: Mon, 23 Mar 2015 21:37:32 +1100 Subject: [Haskell-cafe] ANN: Magic Cookies! Android board game in Haskell In-Reply-To: References: Message-ID: Great job team! It's been fun helping you beta test this game. My girlfriend finds it quite addictive. Sean On 20 March 2015 at 02:11, Ivan Perez wrote: > Dear Caf? > > This is a just a quick announcement: we have just released Magic > Cookies, an Android board game written in Haskell. It is now available > on Google Play [1]. > > The game uses the Functional Reactive Programming library Yampa and > SDL2 for multimedia. > > If you like the game, please share the link on facebook/twitter/etc > and let all of your friends know. > > We have gone through dozens of iterations during beta testing, but we > cannot guarantee that the game works 100% perfectly on all devices. If > you find a bug, or anything else you don't like, please do not rate > low. Instead, open an issue [2] or send us an email > (support at keera.co.uk). Suggestions are also welcome. We will continue > working to make the game lighter, faster, and more fun. > > See [3] for more details, and to sign up as a beta-tester for other > games we are already working on. > > We certainly enjoyed making it, and we hope you all enjoy playing it. > > All the best > > Ivan, Fass & Jorge > > [1] > https://play.google.com/store/apps/details?id=uk.co.keera.games.magiccookies > [2] https://github.com/keera-studios/magic-cookies > [3] http://keera.co.uk/blog/2015/03/19/magic-cookies-released-google-play/ > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mietek at bak.io Mon Mar 23 14:28:33 2015 From: mietek at bak.io (=?iso-8859-1?Q?Mi=EBtek_Bak?=) Date: Mon, 23 Mar 2015 14:28:33 +0000 Subject: [Haskell-cafe] OS X builds of GHC 7.8.4, 7.10.1-rc2, and 7.10.1-rc3 Message-ID: An OS X build of GHC 7.10.1-rc3 is now available, courtesy of Mark Lentczner. This is in addition to the GHC 7.8.4 and 7.10.1-rc2 builds Mark has made available on February 2. Thanks, Mark. GHC 7.8.4 for OS X can already be downloaded from haskell.org, even though it?s not mentioned on the GHC 7.8.4 webpage: https://downloads.haskell.org/~ghc/7.8.4/ghc-7.8.4-x86_64-apple-darwin.tar.xz To avoid running up Mark?s bandwidth bill, I?m omitting the URL to his staging area. I?ve mirrored all three builds in Halcyon public storage: 7.8.4: https://halcyon.global.ssl.fastly.net/original/ghc-7.8.4-x86_64-apple-darwin.tar.xz 7.10.1-rc2: https://halcyon.global.ssl.fastly.net/original/ghc-7.10.0.20150123-x86_64-apple-darwin.tar.bz2 7.10.1-rc3: https://halcyon.global.ssl.fastly.net/original/ghc-7.10.0.20150316-x86_64-apple-darwin.tar.bz2 Binary builds of GHC, repackaged with documentation removed, are also available in Halcyon ? on OS X 10.10, 10.9, 10.8, and a considerable number of Linux distributions. This includes GHC 7.10.1-rc3, 7.10.1-rc2, 7.8.4, 7.8.3, 7.8.2, 7.6.3, 7.6.1, 7.4.2, 7.2.2, and 7.0.4. Using Halcyon, installing GHC together with cabal-install is expected to take 20-30 seconds: https://halcyon.sh/tutorial/#install-ghc-and-cabal -- Mi?tek https://mietek.io -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4203 bytes Desc: not available URL: From haskell-cafe at accounts.gphilip.in Mon Mar 23 16:00:08 2015 From: haskell-cafe at accounts.gphilip.in (G Philip) Date: Mon, 23 Mar 2015 17:00:08 +0100 Subject: [Haskell-cafe] Getting Haskeline to quit early In-Reply-To: References: <1427015389.3858040.243586894.1B57CFC9@webmail.messagingengine.com> Message-ID: <1427126408.1384955.244092802.1A065EA2@webmail.messagingengine.com> Hi Michael, Thank you for your reply. I managed to find a solution by myself, which I have added as an answer to my question on Stack Overflow [1]. wizards looks (look?) very interesting, though. I may change to using that instead of Haskeline now! Regards, Philip [1] http://stackoverflow.com/a/29195676/4108393 On Mon, Mar 23, 2015, at 06:48 AM, Simon Michael wrote: > Hi Philip, > > I'm sorry this answer is not more specific, but perhaps you can get > ideas from hledger's add command, which has that functionality: > > http://hledger.org/step-by-step.html#record-a-transaction-with-hledger-add > > Here's the code: > > https://github.com/simonmichael/hledger/blob/master/hledger/Hledger/Cli/Add.hs > > Note that it uses wizards, which sits on top of haskeline and is rather > nice: > > http://hackage.haskell.org/package/wizards > > Hope it helps, > -Simon > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From martin.drautzburg at web.de Mon Mar 23 21:02:41 2015 From: martin.drautzburg at web.de (martin) Date: Mon, 23 Mar 2015 22:02:41 +0100 Subject: [Haskell-cafe] Applicative of Applicative Message-ID: <55107F71.6080308@web.de> Hello all, I've been playing with temporal values, i.e. values which change over time at discrete points in time. I thought it would be good to make it an instance of Applicative and I was pleased with the results. I may be re-inventing some of frp here, but hey. Then I wondered how I would replace one Temporal by another at some point in time. Kind of like switching from summer schedule to winter schedule. Or switching channels on the TV, where each channel is a Temporal Image. It seems that by stacking up Temporals in this way, I could theoretically start with sample values and abstract my way up to a symphony. What is unclear to me is the following: when I have two Temporal Ints, I know what (+) <$> does. It operates on the Ints. But when I have Temporal Temporal Ints, then the function before the <$> would operate on the next level, i.e. it has to be a function which accepts a Temporal. But a Temporal Temporal Int can always be flattened into a Temporal Int. So I may just as well ask to apply a function to the bottom level, namely the Ints. How to I choose how deep down I want to reach? And any other guidance will also be much appreciated. Martin From tmorris at tmorris.net Mon Mar 23 21:50:10 2015 From: tmorris at tmorris.net (Tony Morris) Date: Tue, 24 Mar 2015 07:50:10 +1000 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: <55107F71.6080308@web.de> References: <55107F71.6080308@web.de> Message-ID: This package is geared toward your specific question. https://hackage.haskell.org/package/TypeCompose On Tue, Mar 24, 2015 at 7:02 AM, martin wrote: > Hello all, > > I've been playing with temporal values, i.e. values which change over time > at discrete points in time. I thought it > would be good to make it an instance of Applicative and I was pleased with > the results. I may be re-inventing some of > frp here, but hey. > > Then I wondered how I would replace one Temporal by another at some point > in time. Kind of like switching from summer > schedule to winter schedule. Or switching channels on the TV, where each > channel is a Temporal Image. > > It seems that by stacking up Temporals in this way, I could theoretically > start with sample values and abstract my way > up to a symphony. What is unclear to me is the following: when I have two > Temporal Ints, I know what (+) <$> does. It > operates on the Ints. But when I have Temporal Temporal Ints, then the > function before the <$> would operate on the next > level, i.e. it has to be a function which accepts a Temporal. > > But a Temporal Temporal Int can always be flattened into a Temporal Int. > So I may just as well ask to apply a function > to the bottom level, namely the Ints. > > How to I choose how deep down I want to reach? And any other guidance will > also be much appreciated. > > Martin > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lambda.fairy at gmail.com Tue Mar 24 03:13:43 2015 From: lambda.fairy at gmail.com (Chris Wong) Date: Tue, 24 Mar 2015 16:13:43 +1300 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: <55107F71.6080308@web.de> References: <55107F71.6080308@web.de> Message-ID: Hi Martin, On Tue, Mar 24, 2015 at 10:02 AM, martin wrote: > Hello all, > > I've been playing with temporal values, i.e. values which change over time at discrete points in time. I thought it > would be good to make it an instance of Applicative and I was pleased with the results. I may be re-inventing some of > frp here, but hey. > > Then I wondered how I would replace one Temporal by another at some point in time. Kind of like switching from summer > schedule to winter schedule. Or switching channels on the TV, where each channel is a Temporal Image. > > It seems that by stacking up Temporals in this way, I could theoretically start with sample values and abstract my way > up to a symphony. What is unclear to me is the following: when I have two Temporal Ints, I know what (+) <$> does. It > operates on the Ints. But when I have Temporal Temporal Ints, then the function before the <$> would operate on the next > level, i.e. it has to be a function which accepts a Temporal. > > But a Temporal Temporal Int can always be flattened into a Temporal Int. So I may just as well ask to apply a function > to the bottom level, namely the Ints. > > How to I choose how deep down I want to reach? And any other guidance will also be much appreciated. Have you considered making Temporal a Monad? All monads by definition provide a `join :: m (m a) -> m a` which flattens their nested structure. > Martin > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -- https://lambda.xyz From nikita.y.volkov at gmail.com Tue Mar 24 03:56:54 2015 From: nikita.y.volkov at gmail.com (Nikita Volkov) Date: Tue, 24 Mar 2015 06:56:54 +0300 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: References: <55107F71.6080308@web.de> Message-ID: > Have you considered making Temporal a Monad? All monads by definition > provide a `join :: m (m a) -> m a` which flattens their nested > structure. Actually `join` is exactly the operation that makes the difference between Monad and Applicative Functor. Monad's binding operation can easily be defined using a combination of `join` and `fmap`: (>>=) m f = join (fmap f m) So my bet is that the answer to the OP's question lies in Monad. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alllex.semin at gmail.com Tue Mar 24 05:55:05 2015 From: alllex.semin at gmail.com (Alex Semin) Date: Tue, 24 Mar 2015 08:55:05 +0300 Subject: [Haskell-cafe] GSoC Proposal: Concurrent Bag. Message-ID: <5510FC39.1010608@gmail.com> Hello everyone! I have written a proposal for this GSoC. It is mostly related to this ticket: https://ghc.haskell.org/trac/summer-of-code/ticket/1608 Here is link to the proposal: https://gist.github.com/Alllex/009d9842f97963aa9955 I will be glad to get any feedback and comments. Regards, Alex Semin From strake888 at gmail.com Tue Mar 24 05:59:45 2015 From: strake888 at gmail.com (M Farkas-Dyck) Date: Tue, 24 Mar 2015 00:59:45 -0500 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: <55107F71.6080308@web.de> References: <55107F71.6080308@web.de> Message-ID: <20150324055945.GA1559@mintha> The composition of any 2 Applicatives is itself an applicative functor. So we have liftA2 (<*>) :: (Applicative p, Applicative q) => p (q (a -> b)) -> p (q a) -> p (q b) On 23/03/2015 at 22:02:41 +0100, martin wrote: > But a Temporal Temporal Int can always be flattened into a Temporal Int. This is simply join, so it's also a Monad. I assume (pure = return) would make its argument time-invariant. > So I may just as well ask to apply a function to the bottom level, namely the Ints. > > How to I choose how deep down I want to reach? Consider what semantics you want. Not knowing the semantics of Temporal and join :: Temporal (Temporal a) -> Temporal a, I can't say for sure, but changing TV channels seems to me a good example of Temporal (Temporal Image), for each channel is a Temporal Image and which is shown itself varies temporally. Analogously, if I have _ :: [[a]], I can fmap (fmap (_ :: a -> b)) :: [[a]] -> [[b]], fmap (_ :: [a] -> [b]) :: [a] -> [b], or fmap (_ :: a -> b) ? join :: [[a]] -> [b] it; which I do is a function of the semantics I want. Hope this helps ? From strake888 at gmail.com Tue Mar 24 06:12:09 2015 From: strake888 at gmail.com (M Farkas-Dyck) Date: Tue, 24 Mar 2015 01:12:09 -0500 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: <20150324055945.GA1559@mintha> References: <55107F71.6080308@web.de> <20150324055945.GA1559@mintha> Message-ID: <20150324061209.GA1660@mintha> On 24/03/2015 at 00:59:45 -0500, M Farkas-Dyck wrote: > fmap (_ :: a -> b) ? join :: [[a]] -> [b] which is simply (>>= _), derp. From snailandmail at gmail.com Tue Mar 24 08:04:49 2015 From: snailandmail at gmail.com (Nikita Kartashov) Date: Tue, 24 Mar 2015 11:04:49 +0300 Subject: [Haskell-cafe] GSOC 2015 proposal feedback Message-ID: <5D2A1424-36A2-4FEC-B0EB-2A50BB4247AA@gmail.com> Hello, everyone! As someone on #haskell-gsoc IRC suggested, I would like to post my proposal. Please, if you have time, read it and send me your thoughts. Thanks! Here is the link: https://gist.github.com/nkartashov/e46fd146b1df2d79aaf3 With regards, Nikita Kartashov -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 496 bytes Desc: Message signed with OpenPGP using GPGMail URL: From M.W.Wang at kent.ac.uk Tue Mar 24 16:12:13 2015 From: M.W.Wang at kent.ac.uk (Meng Wang) Date: Tue, 24 Mar 2015 16:12:13 +0000 Subject: [Haskell-cafe] Haskell-related PhD Studentship at Kent Message-ID: <75B07F0E-F6BB-4855-A8F1-65A22BF1B2B2@kent.ac.uk> Dear Haskellers, I am seeking a PhD student on a Haskell-related project: http://www.cs.kent.ac.uk/research/studyingforaphd/phd-wang.html This would be a good opportunity for someone who is interested in applying Haskell ideas to real problems. The funding covers maintenance, EU student fees and research related expenses. But non-EU students are welcome to apply too. For Sep 2015 starting, the application deadline is 17 April 2015. If you are interested, please contact me at m.w.wang at kent.ac.uk. Best wishes, Meng ? Dr Meng Wang School of Computing University of Kent http://www.cs.kent.ac.uk/people/staff/mw516/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Tue Mar 24 17:17:24 2015 From: martin.drautzburg at web.de (martin) Date: Tue, 24 Mar 2015 18:17:24 +0100 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: <20150324061209.GA1660@mintha> References: <55107F71.6080308@web.de> <20150324055945.GA1559@mintha> <20150324061209.GA1660@mintha> Message-ID: <55119C24.4070400@web.de> Hey guys, you made my day. I had considered making it a monad, but I couldn't figure out what a->mb is supposed to mean in this context and so I thought it was just an Applicative Functor. The idea that the presence of join makes it a monad was not obvious to me. Now I can see the light. I can now imagine how I can have a Temporal Schedule which switches from "Winter Schedule" to "Summer Schedule" at June 1st and a function which takes such a schedule and populates it with some Temporal Data. Way cool. Does the rest of the world know that you haskellers can do such things? > @M Farkas-Dyck > I assume (pure = return) would make its argument time-invariant. Exactly! From tikhon at jelv.is Tue Mar 24 17:40:56 2015 From: tikhon at jelv.is (Tikhon Jelvis) Date: Tue, 24 Mar 2015 10:40:56 -0700 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: <55119C24.4070400@web.de> References: <55107F71.6080308@web.de> <20150324055945.GA1559@mintha> <20150324061209.GA1660@mintha> <55119C24.4070400@web.de> Message-ID: There are two equivalent definitions of monad: one in terms of (>>=) and one in terms of fmap and join. Given (>>=), we can define join and fmap as join :: Monad m => m (m a) -> m a join x = x >>= id Given the join and fmap, we can define (>>=) as (>>=) :: Monad m => m a -> (a -> m b) -> m b x >>= f = join (fmap f x) This is why some other languages like Scala call (>>=) flatMap: it's the combination of flattening (join) and mapping (fmap). Personally, much of the time, I find join more intuitive for a given monad than (>>=), but (>>=) is more useful for everyday code so it's included in the class by default. Recently, there was a move to add join to the class so that you could choose which one to implement, but that ran into some technical difficulties and had to be postponed. As far as time-varying code goes, you were right in your intuition that it's closely related to FRP. You have, in fact, come up with a type similar to events in classical FRP?an accomplishment on its own! I found Conal Elliott's "Push-Pull Functional Reactive Programming"[1] to have a good overview of existing ideas in this vein, including a discussion of the relevant Functor/Applicative/Monad instances. My understanding is that while the monad instance for this temporal type is well-defined, current libraries do not implement it for performance reasons. It's difficult to enable this sort of logic without exposing potential memory leaks, which make practical programming in the style significantly more difficult. But the conceptual ideas are all entirely sound! On Tue, Mar 24, 2015 at 10:17 AM, martin wrote: > Hey guys, you made my day. > > I had considered making it a monad, but I couldn't figure out what a->mb > is supposed to mean in this context and so I > thought it was just an Applicative Functor. The idea that the presence of > join makes it a monad was not obvious to me. > > Now I can see the light. I can now imagine how I can have a Temporal > Schedule which switches from "Winter Schedule" to > "Summer Schedule" at June 1st and a function which takes such a schedule > and populates it with some Temporal Data. > > Way cool. Does the rest of the world know that you haskellers can do such > things? > > > @M Farkas-Dyck > > I assume (pure = return) would make its argument time-invariant. > > Exactly! > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthewtpickering at gmail.com Tue Mar 24 17:56:48 2015 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Tue, 24 Mar 2015 17:56:48 +0000 Subject: [Haskell-cafe] hpc - ignore some expressions In-Reply-To: References: <5362AA65-5F23-4EAE-8D87-1A08C9AFDF00@steinitz.org> Message-ID: Hi Ozgur, I personally found the paper describing HPC to be quite descriptive. See especially section 3.3 - it seems like it would be possible to hack something up to remove entries containing "error" for example. That being said, I can't find any reference to the program "hpc-makemtix" aside from that paper. Maybe it got folded back into hpc? Did you make any progress with this? http://www.cs.york.ac.uk/plasma/publications/pdf/GillRuncimanHW07.pdf On Mon, Feb 23, 2015 at 9:19 PM, Ozgur Akgun wrote: > > On 23 February 2015 at 20:02, Dominic Steinitz wrote: >> >> I think you are right about it being fragile and becoming a big overhead >> in maintenance. Maybe one could add some sort of annotation to the sources >> for which you wish to check coverage and also modify HPC to handle these? > > > A simple interface where the user provides a list of function names to be > ignored would be a good start. > > Something like: > > hpc markup prog.tix --destdir=report > --ignore=fail,error,impossible,undefined > > It _could_ also be a good idea to have a way of ignoring literals. Flags > like --ignore-num-literals and --ignore-string-literals could treat all such > literals as covered or ignored. > > Maybe I should put this as a feature request to the hpc maintainers. > I am wondering if they maintain an issue tracker or not. > > The wiki pages for hpc aren't very helpful... > > (Starting from: https://wiki.haskell.org/GHC/HPC) > > Ozgur > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From ozgurakgun at gmail.com Tue Mar 24 18:07:41 2015 From: ozgurakgun at gmail.com (Ozgur Akgun) Date: Tue, 24 Mar 2015 18:07:41 +0000 Subject: [Haskell-cafe] hpc - ignore some expressions In-Reply-To: References: <5362AA65-5F23-4EAE-8D87-1A08C9AFDF00@steinitz.org> Message-ID: Matthew, I had also sent an email to the authors of that paper, Colin Runciman and Andy Gill, and I did receive a prompt reply from them. "hpc draft" seems to be the new name for "hpc-makemtix" and "hpc overlay" seems to be "hpc-maketix". Unfortunately, I couldn't get "hpc overlay" to work for my project and gave up. It just kept crashing. I will probably revisit this later and try to diagnose what the error actually was. Hope this helps, Ozgur On 24 March 2015 at 17:56, Matthew Pickering wrote: > Hi Ozgur, > > I personally found the paper describing HPC to be quite descriptive. > See especially section 3.3 - it seems like it would be possible to > hack something up to remove entries containing "error" for example. > That being said, I can't find any reference to the program > "hpc-makemtix" aside from that paper. Maybe it got folded back into > hpc? Did you make any progress with this? > > http://www.cs.york.ac.uk/plasma/publications/pdf/GillRuncimanHW07.pdf > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Tue Mar 24 19:07:00 2015 From: martin.drautzburg at web.de (martin) Date: Tue, 24 Mar 2015 20:07:00 +0100 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: References: <55107F71.6080308@web.de> <20150324055945.GA1559@mintha> <20150324061209.GA1660@mintha> <55119C24.4070400@web.de> Message-ID: <5511B5D4.40809@web.de> Am 03/24/2015 um 06:40 PM schrieb Tikhon Jelvis: > As far as time-varying code goes, you were right in your intuition that it's closely related to FRP. You have, in fact, > come up with a type similar to events in classical FRP?an accomplishment on its own! My temporal type is defined as follows data Change a = Chg { ct :: Time, -- "change time" cv :: a -- "change value" } data Temporal a = Temporal { td :: a, -- "temporal default" tc :: [Change a] -- "temporal changes" } deriving (Show) I started off with "Event" instead of "Change", but found this misleading. Two successive changes with the same value have the same effect as a single change, while for Events in the sense of "left button click" there is a difference between a click and a doubleclick. I don't know if I'll ever have to intersperse Changes from two lists. In that case two successive changes to the same value *will* make a difference, because the second change my undo the effect of an interspersed change. I am still somewhat struggeling with train schedules. I'd love to craft an example with a summer and a winter schedule, but I don't quite know what to use as a value. Intuitively it'd be something like "departure time", but of what? I am not sure if there is a missing piece, or if I just have to turn away from traditional train schedules and us "train on track 1" as the changing value. From strake888 at gmail.com Tue Mar 24 21:26:00 2015 From: strake888 at gmail.com (M Farkas-Dyck) Date: Tue, 24 Mar 2015 16:26:00 -0500 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: <5511B5D4.40809@web.de> References: <55107F71.6080308@web.de> <20150324055945.GA1559@mintha> <20150324061209.GA1660@mintha> <55119C24.4070400@web.de> <5511B5D4.40809@web.de> Message-ID: <20150324212600.GA28174@mintha> On 24/03/2015 at 20:07:00 +0100, martin wrote: > My temporal type is defined as follows > > data Change a = Chg { > ct :: Time, -- "change time" > cv :: a -- "change value" > } > > data Temporal a = Temporal { > td :: a, -- "temporal default" > tc :: [Change a] -- "temporal changes" > } deriving (Show) > > I started off with "Event" instead of "Change", but found this misleading. Two successive changes with the same value > have the same effect as a single change, while for Events in the sense of "left button click" there is a difference > between a click and a doubleclick. As you have it, yes. One could alternately define data Change a = Chg { ct :: Time, c :: a -> a } in which case changes would not in general be idempotent, and idempotent changes would have form Chg { ct = _, c = pure _ }. > I don't know if I'll ever have to intersperse Changes from two lists. In that case two successive changes to the same > value *will* make a difference, because the second change my undo the effect of an interspersed change. Seems a good reason to keep multiplicates in the list ? > I am still somewhat struggeling with train schedules. I'd love to craft an example with a summer and a winter schedule, > but I don't quite know what to use as a value. Intuitively it'd be something like "departure time", but of what? I am > not sure if there is a missing piece, or if I just have to turn away from traditional train schedules and us "train on > track 1" as the changing value. Each train could have a Temporal Location. Which definition makes sense is a function of what you want to ask of the schedules. From thomasmiedema at gmail.com Tue Mar 24 22:17:02 2015 From: thomasmiedema at gmail.com (Thomas Miedema) Date: Tue, 24 Mar 2015 23:17:02 +0100 Subject: [Haskell-cafe] hpc - ignore some expressions In-Reply-To: References: <5362AA65-5F23-4EAE-8D87-1A08C9AFDF00@steinitz.org> Message-ID: > > On Mon, Feb 23, 2015 at 9:19 PM, Ozgur Akgun wrote: > > Maybe I should put this as a feature request to the hpc maintainers. > > I am wondering if they maintain an issue tracker or not. > I don't have any answers to your questions, but just want to let you know that hpc uses the same issue tracker as GHC. There are currently 3 open tickets . Fixes for several long standing issues will be included in 7.10 and 7.12. If you find any more bugs, or indeed have a feature request, please report them. -Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: From aeyakovenko at gmail.com Wed Mar 25 01:32:20 2015 From: aeyakovenko at gmail.com (Anatoly Yakovenko) Date: Tue, 24 Mar 2015 18:32:20 -0700 Subject: [Haskell-cafe] cabal test and tests that overlap in covarage Message-ID: is this a cabal error or hpc error? i see this when running 'cabal test' with tests that overlap in coverage 5 of 5 test suites (5 of 5 test cases) passed. hpc: found 2 instances of RBM.List in ["./.hpc","./dist/hpc/vanilla/mix/proto","./dist/hpc/vanilla/mix/perf-repa-RBM","./dist/hpc/vanilla/mix/test-repa-RBM","./dist/hpc/vanilla/mix/perf-list-RBM","./dist/hpc/vanilla/mix/test-list-RBM","./dist/hpc/vanilla/mix/rbm-0.0"] Thanks, Anatoly From mike at proclivis.com Wed Mar 25 03:20:05 2015 From: mike at proclivis.com (Michael Jones) Date: Tue, 24 Mar 2015 21:20:05 -0600 Subject: [Haskell-cafe] Command Line Args passed to wxHaskell Message-ID: <74A243CD-6996-4864-8C80-4F4B065D682D@proclivis.com> I am seeing strange behavior with a wxHaskell app compiled on Windows 7. On Linux, all is well. I can call my app like: app +RTS -N4 -RTS myArg And in the app I can process the myArg and start a wxHaskell frame. When I compile the same application on Windows 7, I get an error dialog box that says: ?Unexpected parameter `+RTS`. And a second Usage dialog that looks like it comes from wxHaskell. I am not sure why Windows is different, but perhaps it is the fact that on Windows 7 I compiled up wxHaskell 0.92, and on Linux I used 0.91 from a cabal update. I used 0.92 on on Windows because I could not get 0.91 to compile due to some type problems where the wxPack version was incompatible with a header file and the Haskell compiler related to 64 bit types long long. There is some noise about this on the web, but no solutions. Nonetheless, I assume that args are grabbed directly by wxHaskell and Environment.getArgs does not consume them such that they are still available to wxHaskell. Is there some way to consume arguments so they are no longer available or a way to modify them so that when wxHaskell starts up it sees arguments I can control in code? In wx there is an API to set arguments, but it does not seem to be part of wxHaskell. So I think I need something I can do outside the wxHaskell API. Mike From thomasmiedema at gmail.com Wed Mar 25 08:37:11 2015 From: thomasmiedema at gmail.com (Thomas Miedema) Date: Wed, 25 Mar 2015 09:37:11 +0100 Subject: [Haskell-cafe] cabal test and tests that overlap in covarage In-Reply-To: References: Message-ID: That looks like an instance of hpc bug #9619 , which should be fixed in GHC 7.10. On Wed, Mar 25, 2015 at 2:32 AM, Anatoly Yakovenko wrote: > is this a cabal error or hpc error? > > i see this when running 'cabal test' with tests that overlap in coverage > > 5 of 5 test suites (5 of 5 test cases) passed. > > hpc: found 2 instances of RBM.List in > > ["./.hpc","./dist/hpc/vanilla/mix/proto","./dist/hpc/vanilla/mix/perf-repa-RBM","./dist/hpc/vanilla/mix/test-repa-RBM","./dist/hpc/vanilla/mix/perf-list-RBM","./dist/hpc/vanilla/mix/test-list-RBM","./dist/hpc/vanilla/mix/rbm-0.0"] > > Thanks, > Anatoly > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mietek at bak.io Wed Mar 25 11:29:40 2015 From: mietek at bak.io (=?iso-8859-1?Q?Mi=EBtek_Bak?=) Date: Wed, 25 Mar 2015 11:29:40 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> Message-ID: On 2015-03-25, at 09:59, Chris Done wrote: >> Halcyon wants a constraints file for a particular app to list all Cabal packages which are the app?s direct or indirect dependencies. > > Why is that? What does it do with the cabal.config file? There are two flavours of `cabal.config` files: (1) `cabal freeze`-flavoured, declaring a complete set of dependencies for a particular application, and (2) the Stackage flavour, declaring a set of packages which are guaranteed to build together. It?s worth noting that the first flavour was originally proposed to be a separate file with a simpler syntax, named `cabal.freeze` (https://github.com/haskell/cabal/issues/1502). Unfortunately, this didn?t make it into cabal-install, due to lack of time (https://github.com/haskell/cabal/pull/1519). Halcyon supports `cabal freeze`-flavoured `cabal.config` files, and also accepts separate constraints files, named `.halcyon/constraints`. The declared version constraints are used to calculate a sandbox hash. When building an application, Halcyon uses the sandbox hash to try and locate a previously-built sandbox archive. If available in local cache or remote storage, this archive is restored, completely side-stepping the need to `cabal install --dependencies-only`. Otherwise, a new sandbox is built, archived, and uploaded to remote storage. Moreover, if a full match for the sandbox hash isn?t located, Halcyon attempts to locate a partial match. Each previously-built sandbox is assigned a score, which reflects the number of required dependencies contained within. Sandboxes with extraneous dependencies are rejected. The highest-scoring partial match is used as a base for building the new sandbox. While inferior to the package-level granularity provided by Nix and proposed for future versions of Cabal, the approach implemented in Halcyon has the benefit of working with regular Cabal packages and repositories, and being used in production since June 2014. -- Mi?tek https://mietek.io -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4203 bytes Desc: not available URL: From mietek at bak.io Wed Mar 25 12:02:33 2015 From: mietek at bak.io (=?iso-8859-1?Q?Mi=EBtek_Bak?=) Date: Wed, 25 Mar 2015 12:02:33 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> Message-ID: <5E73356C-1973-4374-A706-A92359E96F08@bak.io> On 2015-03-25, at 11:40, Michael Snoyman wrote: > Every Stackage Nightly and LTS Haskell release has a YAML file[1] that provides a lot of information, included the exact versions of packages and package dependencies. The stackage-types[2] package provides the datatypes necessary to parse that YAML file. Putting those two together, it should be possible to write something that looks at a project's list of shallow package dependencies, and construct a list of precisely which package-version combinations are necessary to build the entire project, which I think is what you're saying you get from cabal freeze but not from the current cabal.config on stackage.org. If I understand correctly, the result should be equivalent to configuring `cabal-remote-repo` to point to a particular Stackage snapshot, running `cabal freeze`, and parsing its output. Halcyon already does this ? the following command will ignore any constraints declared by the application, and instead use the newest versions of all dependencies available in the specified Cabal repository: ``` $ halcyon install http://github.com/mietek/hello-yesod --ignore-all-constraints --cabal-remote-repo=stackage-lts-latest:http://www.stackage.org/lts ``` However, this means we?re using Stackage in ?exclusive? mode. I?d like to support using Stackage in ?inclusive? mode, with `cabal-remote-repo` pointing to Hackage, and a Stackage-flavoured `cabal.config`. -- Mi?tek https://mietek.io -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4203 bytes Desc: not available URL: From mietek at bak.io Wed Mar 25 12:26:50 2015 From: mietek at bak.io (=?iso-8859-1?Q?Mi=EBtek_Bak?=) Date: Wed, 25 Mar 2015 12:26:50 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> Message-ID: <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> On 2015-03-25, at 12:16, Michael Snoyman wrote: > Trying to understand the problem: currently, with your approach, if the project depends on a library not in the LTS Haskell release, then the cabal-install dependency solver won't be able to find it. Instead, you'd like to be able to use the dependency solver to track down those extra dependencies. Is that correct? > > If so, why not take a multi-pass approach: download the cabal.config from stackage.org (which creates an inclusive snapshot), and then use --dry-run, which will tell you all the packages to be used. You?re correct. However, this will have to be `cabal install --dependencies-only --dry-run`, and not `cabal freeze --dry-run`, because `cabal freeze` always completely ignores any existing version constraints, whether local or global (https://github.com/haskell/cabal/issues/2265). I?m planning to switch away from `cabal freeze` soon, but it?s not going to be a drop-in replacement (https://github.com/mietek/halcyon/issues/52). This is a good moment to carefully consider the meaning of a per-application `cabal.config` file, and whether the `cabal freeze` flavour should be completely replaced by separate constraints files. Perhaps, as mentioned in the original `cabal freeze` proposal, we could also have separate constraints sets for different GHC versions. I?m hoping Cabal developers could chime in on the discussion. -- Mi?tek https://mietek.io -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4203 bytes Desc: not available URL: From acowley at seas.upenn.edu Wed Mar 25 14:17:00 2015 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Wed, 25 Mar 2015 10:17:00 -0400 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> Message-ID: The suggestion to use "cabal install --dependencies-only ..." instead of "cabal freeze" in that issue is really nicely presented. "cabal freeze" is close to the right thing, but it's just not as fully featured as "cabal install" (e.g. taking flags). As for Stackage, I think it would be helpful to cache the full build plans computed for each package in Stackage. This is most of the work my Nix tooling currently does, so it would be a big time saver. Anthony On Wed, Mar 25, 2015 at 8:26 AM, Mi?tek Bak wrote: > On 2015-03-25, at 12:16, Michael Snoyman wrote: > >> Trying to understand the problem: currently, with your approach, if the project depends on a library not in the LTS Haskell release, then the cabal-install dependency solver won't be able to find it. Instead, you'd like to be able to use the dependency solver to track down those extra dependencies. Is that correct? >> >> If so, why not take a multi-pass approach: download the cabal.config from stackage.org (which creates an inclusive snapshot), and then use --dry-run, which will tell you all the packages to be used. > > You?re correct. However, this will have to be `cabal install --dependencies-only --dry-run`, and not `cabal freeze --dry-run`, because `cabal freeze` always completely ignores any existing version constraints, whether local or global (https://github.com/haskell/cabal/issues/2265). > > I?m planning to switch away from `cabal freeze` soon, but it?s not going to be a drop-in replacement (https://github.com/mietek/halcyon/issues/52). > > This is a good moment to carefully consider the meaning of a per-application `cabal.config` file, and whether the `cabal freeze` flavour should be completely replaced by separate constraints files. Perhaps, as mentioned in the original `cabal freeze` proposal, we could also have separate constraints sets for different GHC versions. > > I?m hoping Cabal developers could chime in on the discussion. > > > -- > Mi?tek > https://mietek.io > > From acowley at gmail.com Wed Mar 25 14:21:05 2015 From: acowley at gmail.com (Anthony Cowley) Date: Wed, 25 Mar 2015 10:21:05 -0400 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> Message-ID: The suggestion to use "cabal install --dependencies-only ..." instead of "cabal freeze" in that issue is really nicely presented. "cabal freeze" is close to the right thing, but it's just not as fully featured as "cabal install" (e.g. taking flags). As for Stackage, I think it would be helpful to cache the full build plans computed for each package in Stackage. This is most of the work my Nix tooling currently does, so it would be a big time saver. Anthony (re-sending after joining the GitHub group) On Wed, Mar 25, 2015 at 8:26 AM, Mi?tek Bak wrote: > On 2015-03-25, at 12:16, Michael Snoyman wrote: > >> Trying to understand the problem: currently, with your approach, if the project depends on a library not in the LTS Haskell release, then the cabal-install dependency solver won't be able to find it. Instead, you'd like to be able to use the dependency solver to track down those extra dependencies. Is that correct? >> >> If so, why not take a multi-pass approach: download the cabal.config from stackage.org (which creates an inclusive snapshot), and then use --dry-run, which will tell you all the packages to be used. > > You?re correct. However, this will have to be `cabal install --dependencies-only --dry-run`, and not `cabal freeze --dry-run`, because `cabal freeze` always completely ignores any existing version constraints, whether local or global (https://github.com/haskell/cabal/issues/2265). > > I?m planning to switch away from `cabal freeze` soon, but it?s not going to be a drop-in replacement (https://github.com/mietek/halcyon/issues/52). > > This is a good moment to carefully consider the meaning of a per-application `cabal.config` file, and whether the `cabal freeze` flavour should be completely replaced by separate constraints files. Perhaps, as mentioned in the original `cabal freeze` proposal, we could also have separate constraints sets for different GHC versions. > > I?m hoping Cabal developers could chime in on the discussion. > > > -- > Mi?tek > https://mietek.io > > From michael at snoyman.com Wed Mar 25 14:24:19 2015 From: michael at snoyman.com (Michael Snoyman) Date: Wed, 25 Mar 2015 14:24:19 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> Message-ID: On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley wrote: > The suggestion to use "cabal install --dependencies-only ..." instead > of "cabal freeze" in that issue is really nicely presented. "cabal > freeze" is close to the right thing, but it's just not as fully > featured as "cabal install" (e.g. taking flags). > > As for Stackage, I think it would be helpful to cache the full build > plans computed for each package in Stackage. This is most of the work > my Nix tooling currently does, so it would be a big time saver. > > > By "full build plans," do you mean the dist/setup-config file, or something else? That file would be problematic since it's Cabal-library-version specific IIRC. If you're looking for the full listing of deep dependencies and versions, we can extract that from the .yaml file using the technique I mentioned earlier. Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From acowley at seas.upenn.edu Wed Mar 25 14:30:37 2015 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Wed, 25 Mar 2015 10:30:37 -0400 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> Message-ID: On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman wrote: > > > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley > wrote: >> >> The suggestion to use "cabal install --dependencies-only ..." instead >> of "cabal freeze" in that issue is really nicely presented. "cabal >> freeze" is close to the right thing, but it's just not as fully >> featured as "cabal install" (e.g. taking flags). >> >> As for Stackage, I think it would be helpful to cache the full build >> plans computed for each package in Stackage. This is most of the work >> my Nix tooling currently does, so it would be a big time saver. >> >> > > By "full build plans," do you mean the dist/setup-config file, or something > else? That file would be problematic since it's Cabal-library-version > specific IIRC. If you're looking for the full listing of deep dependencies > and versions, we can extract that from the .yaml file using the technique I > mentioned earlier. > > Michael Yes, I meant the full listing of deep dependencies. Anthony From nicholls.mark at vimn.com Wed Mar 25 14:32:43 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Wed, 25 Mar 2015 14:32:43 +0000 Subject: [Haskell-cafe] indexed writer monad Message-ID: Anyone? I can handle monads, but I have something (actually in F#) that feels like it should be something like a indexed writer monad (which F# probably wouldn't support). So I thought I'd do some research in Haskell. I know little or nothing about indexed monad (though I have built the indexed state monad in C#). So I would assume there would be an indexed monoid (that looks at bit like a tuple?)... e.g. (a,b) ++ (c,d) = (a,b,c,d) (a,b,c,d) ++ (e) = (a,b,c,d,e) ? There seems to be some stuff about "update monads", but it doesn't really look like a writer. I could do with playing around with an indexed writer, in order to get my head around what I'm doing....then try and capture what I'm doing...then try (and fail) to port it back. CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Wed Mar 25 14:45:48 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Wed, 25 Mar 2015 16:45:48 +0200 Subject: [Haskell-cafe] indexed writer monad In-Reply-To: References: Message-ID: <5512CA1C.5000506@ro-che.info> An indexed monoid is just a Category. On 25/03/15 16:32, Nicholls, Mark wrote: > Anyone? > > > > I can handle monads, but I have something (actually in F#) that feels > like it should be something like a indexed writer monad (which F# > probably wouldn?t support). > > > > So I thought I?d do some research in Haskell. > > > > I know little or nothing about indexed monad (though I have built the > indexed state monad in C#). > > > > So I would assume there would be an indexed monoid (that looks at bit > like a tuple?)? > > > > e.g. > > > > (a,b) ++ (c,d) = (a,b,c,d) > > (a,b,c,d) ++ (e) = (a,b,c,d,e) > > > > ? > > > > There seems to be some stuff about ?update monads?, but it doesn?t > really look like a writer. > > > > I could do with playing around with an indexed writer, in order to get > my head around what I?m doing?.then try and capture what I?m doing?then > try (and fail) to port it back. > > > > > > > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by > copyright (and other intellectual property rights). If you are not the > intended recipient please e-mail the sender and then delete the email > and any attached files immediately. Any further use or dissemination is > prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and > any attachments are virus free, it is your responsibility to ensure that > this message and any attachments are virus free and do not affect your > systems / data. > > Communicating by email is not 100% secure and carries risks such as > delay, data corruption, non-delivery, wrongful interception and > unauthorised amendment. If you communicate with us by e-mail, you > acknowledge and assume these risks, and you agree to take appropriate > measures to minimise these risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions > International, Be Viacom, Viacom International Media Networks and VIMN > and Comedy Central are all trading names of MTV Networks Europe. MTV > Networks Europe is a partnership between MTV Networks Europe Inc. and > Viacom Networks Europe Inc. Address for service in Great Britain is > 17-29 Hawley Crescent, London, NW1 8TT. > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From michael at snoyman.com Wed Mar 25 14:51:22 2015 From: michael at snoyman.com (Michael Snoyman) Date: Wed, 25 Mar 2015 14:51:22 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> Message-ID: On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley wrote: > On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman > wrote: > > > > > > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley > > wrote: > >> > >> The suggestion to use "cabal install --dependencies-only ..." instead > >> of "cabal freeze" in that issue is really nicely presented. "cabal > >> freeze" is close to the right thing, but it's just not as fully > >> featured as "cabal install" (e.g. taking flags). > >> > >> As for Stackage, I think it would be helpful to cache the full build > >> plans computed for each package in Stackage. This is most of the work > >> my Nix tooling currently does, so it would be a big time saver. > >> > >> > > > > By "full build plans," do you mean the dist/setup-config file, or > something > > else? That file would be problematic since it's Cabal-library-version > > specific IIRC. If you're looking for the full listing of deep > dependencies > > and versions, we can extract that from the .yaml file using the > technique I > > mentioned earlier. > > > > Michael > > Yes, I meant the full listing of deep dependencies. > > > I've put together a Gist with an executable that does what I described: https://gist.github.com/snoyberg/5b244331533fcb614523 You give it three arguments on the command line: * LTS version, e.g. 1.14 * Name of package being checked * true == only include dependencies of the library and executable, anything else == include test and benchmark dependencies as well If that's useful, I can package that up and put it on Hackage. Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From acowley at gmail.com Wed Mar 25 14:58:21 2015 From: acowley at gmail.com (Anthony Cowley) Date: Wed, 25 Mar 2015 10:58:21 -0400 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> Message-ID: <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> > On Mar 25, 2015, at 10:51 AM, Michael Snoyman wrote: > > > >> On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley wrote: >> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman wrote: >> > >> > >> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley >> > wrote: >> >> >> >> The suggestion to use "cabal install --dependencies-only ..." instead >> >> of "cabal freeze" in that issue is really nicely presented. "cabal >> >> freeze" is close to the right thing, but it's just not as fully >> >> featured as "cabal install" (e.g. taking flags). >> >> >> >> As for Stackage, I think it would be helpful to cache the full build >> >> plans computed for each package in Stackage. This is most of the work >> >> my Nix tooling currently does, so it would be a big time saver. >> >> >> >> >> > >> > By "full build plans," do you mean the dist/setup-config file, or something >> > else? That file would be problematic since it's Cabal-library-version >> > specific IIRC. If you're looking for the full listing of deep dependencies >> > and versions, we can extract that from the .yaml file using the technique I >> > mentioned earlier. >> > >> > Michael >> >> Yes, I meant the full listing of deep dependencies. > > I've put together a Gist with an executable that does what I described: > > https://gist.github.com/snoyberg/5b244331533fcb614523 > > You give it three arguments on the command line: > > * LTS version, e.g. 1.14 > * Name of package being checked > * true == only include dependencies of the library and executable, anything else == include test and benchmark dependencies as well > > If that's useful, I can package that up and put it on Hackage. > > Michael This is very helpfulness, thanks! There is a bootstrapping issue, though, which is, I imagine, why both Mi?tek and I have been writing much more bash than we'd like. But perhaps this becomes part of a cabal-install-like bootstrap.sh script to get things going. Anthony -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Wed Mar 25 15:03:38 2015 From: michael at snoyman.com (Michael Snoyman) Date: Wed, 25 Mar 2015 15:03:38 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> Message-ID: On Wed, Mar 25, 2015 at 4:58 PM Anthony Cowley wrote: > > > On Mar 25, 2015, at 10:51 AM, Michael Snoyman wrote: > > > > On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley > wrote: > >> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman >> wrote: >> > >> > >> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley >> > wrote: >> >> >> >> The suggestion to use "cabal install --dependencies-only ..." instead >> >> of "cabal freeze" in that issue is really nicely presented. "cabal >> >> freeze" is close to the right thing, but it's just not as fully >> >> featured as "cabal install" (e.g. taking flags). >> >> >> >> As for Stackage, I think it would be helpful to cache the full build >> >> plans computed for each package in Stackage. This is most of the work >> >> my Nix tooling currently does, so it would be a big time saver. >> >> >> >> >> > >> > By "full build plans," do you mean the dist/setup-config file, or >> something >> > else? That file would be problematic since it's Cabal-library-version >> > specific IIRC. If you're looking for the full listing of deep >> dependencies >> > and versions, we can extract that from the .yaml file using the >> technique I >> > mentioned earlier. >> > >> > Michael >> >> Yes, I meant the full listing of deep dependencies. >> >> >> > I've put together a Gist with an executable that does what I described: > > https://gist.github.com/snoyberg/5b244331533fcb614523 > > You give it three arguments on the command line: > > * LTS version, e.g. 1.14 > * Name of package being checked > * true == only include dependencies of the library and executable, > anything else == include test and benchmark dependencies as well > > If that's useful, I can package that up and put it on Hackage. > > Michael > > > This is very helpfulness, thanks! There is a bootstrapping issue, though, > which is, I imagine, why both Mi?tek and I have been writing much more bash > than we'd like. But perhaps this becomes part of a cabal-install-like > bootstrap.sh script to get things going. > > Anthony > Oh, that's actually a great idea. What if we had a program that: 1. takes a set of packages that needs to be installed, and an LTS version 2. computes the dependency tree 3. writes out a shell script (possibly batch program?) to wget, tar xf, and runghc Setup.hs in the correct order to get all of those packages installed As you can tell from the program I just threw together, stackage-types supports this kind of thing pretty trivially. Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Wed Mar 25 15:22:48 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Wed, 25 Mar 2015 15:22:48 +0000 Subject: [Haskell-cafe] indexed writer monad In-Reply-To: <5512CA1C.5000506@ro-che.info> References: <5512CA1C.5000506@ro-che.info> Message-ID: Ah that assumes I know what a category is! (I did find some code that claimed the same thing)....maths doesn't scare me (much), and I suspect its nothing complicated (sounds like a category is a tuple then! Probably not), but I don't want to read a book on category theory to write a bit of code...yet. Ideally there would be a chapter in something like "learn you an indexed Haskell for the great good". Then I could take the code, use it...mess about with it...break it...put it back together in a slightly different shape and....bingo...it either works...or I find theres a good reason why it doesn't....(or I post a message to the caf?). -----Original Message----- From: Roman Cheplyaka [mailto:roma at ro-che.info] Sent: 25 March 2015 2:46 PM To: Nicholls, Mark; haskell-cafe at haskell.org Subject: Re: [Haskell-cafe] indexed writer monad An indexed monoid is just a Category. On 25/03/15 16:32, Nicholls, Mark wrote: > Anyone? > > > > I can handle monads, but I have something (actually in F#) that feels > like it should be something like a indexed writer monad (which F# > probably wouldn't support). > > > > So I thought I'd do some research in Haskell. > > > > I know little or nothing about indexed monad (though I have built the > indexed state monad in C#). > > > > So I would assume there would be an indexed monoid (that looks at bit > like a tuple?). > > > > e.g. > > > > (a,b) ++ (c,d) = (a,b,c,d) > > (a,b,c,d) ++ (e) = (a,b,c,d,e) > > > > ? > > > > There seems to be some stuff about "update monads", but it doesn't > really look like a writer. > > > > I could do with playing around with an indexed writer, in order to get > my head around what I'm doing..then try and capture what I'm > doing.then try (and fail) to port it back. > > > > > > > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by > copyright (and other intellectual property rights). If you are not the > intended recipient please e-mail the sender and then delete the email > and any attached files immediately. Any further use or dissemination > is prohibited. > > While MTV Networks Europe has taken steps to ensure that this email > and any attachments are virus free, it is your responsibility to > ensure that this message and any attachments are virus free and do not > affect your systems / data. > > Communicating by email is not 100% secure and carries risks such as > delay, data corruption, non-delivery, wrongful interception and > unauthorised amendment. If you communicate with us by e-mail, you > acknowledge and assume these risks, and you agree to take appropriate > measures to minimise these risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions > International, Be Viacom, Viacom International Media Networks and VIMN > and Comedy Central are all trading names of MTV Networks Europe. MTV > Networks Europe is a partnership between MTV Networks Europe Inc. and > Viacom Networks Europe Inc. Address for service in Great Britain is > 17-29 Hawley Crescent, London, NW1 8TT. > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From roma at ro-che.info Wed Mar 25 16:03:11 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Wed, 25 Mar 2015 18:03:11 +0200 Subject: [Haskell-cafe] indexed writer monad In-Reply-To: References: <5512CA1C.5000506@ro-che.info> Message-ID: <5512DC3F.9040301@ro-che.info> Sorry, I didn't mean to scare you off. By Category, I didn't mean the math concept; I meant simply the class from the Control.Category module. You don't need to learn any category theory to understand it. Since you seem to know already what Monoid is, try to compare those two classes, notice the similarities and see how (and why) one could be called an indexed version of the other. But if you don't know what "indexed" means, how do you know you need it? Perhaps you could describe your problem, and we could tell you what abstraction would fit that use case, be it indexed monad or something else. On 25/03/15 17:22, Nicholls, Mark wrote: > Ah that assumes I know what a category is! (I did find some code that claimed the same thing)....maths doesn't scare me (much), and I suspect its nothing complicated (sounds like a category is a tuple then! Probably not), but I don't want to read a book on category theory to write a bit of code...yet. > > Ideally there would be a chapter in something like "learn you an indexed Haskell for the great good". > > Then I could take the code, use it...mess about with it...break it...put it back together in a slightly different shape and....bingo...it either works...or I find theres a good reason why it doesn't....(or I post a message to the caf?). > > -----Original Message----- > From: Roman Cheplyaka [mailto:roma at ro-che.info] > Sent: 25 March 2015 2:46 PM > To: Nicholls, Mark; haskell-cafe at haskell.org > Subject: Re: [Haskell-cafe] indexed writer monad > > An indexed monoid is just a Category. > > On 25/03/15 16:32, Nicholls, Mark wrote: >> Anyone? >> >> >> >> I can handle monads, but I have something (actually in F#) that feels >> like it should be something like a indexed writer monad (which F# >> probably wouldn't support). >> >> >> >> So I thought I'd do some research in Haskell. >> >> >> >> I know little or nothing about indexed monad (though I have built the >> indexed state monad in C#). >> >> >> >> So I would assume there would be an indexed monoid (that looks at bit >> like a tuple?). >> >> >> >> e.g. >> >> >> >> (a,b) ++ (c,d) = (a,b,c,d) >> >> (a,b,c,d) ++ (e) = (a,b,c,d,e) >> >> >> >> ? >> >> >> >> There seems to be some stuff about "update monads", but it doesn't >> really look like a writer. >> >> >> >> I could do with playing around with an indexed writer, in order to get >> my head around what I'm doing..then try and capture what I'm >> doing.then try (and fail) to port it back. >> >> >> >> >> >> >> >> CONFIDENTIALITY NOTICE >> >> This e-mail (and any attached files) is confidential and protected by >> copyright (and other intellectual property rights). If you are not the >> intended recipient please e-mail the sender and then delete the email >> and any attached files immediately. Any further use or dissemination >> is prohibited. >> >> While MTV Networks Europe has taken steps to ensure that this email >> and any attachments are virus free, it is your responsibility to >> ensure that this message and any attachments are virus free and do not >> affect your systems / data. >> >> Communicating by email is not 100% secure and carries risks such as >> delay, data corruption, non-delivery, wrongful interception and >> unauthorised amendment. If you communicate with us by e-mail, you >> acknowledge and assume these risks, and you agree to take appropriate >> measures to minimise these risks when e-mailing us. >> >> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, >> Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions >> International, Be Viacom, Viacom International Media Networks and VIMN >> and Comedy Central are all trading names of MTV Networks Europe. MTV >> Networks Europe is a partnership between MTV Networks Europe Inc. and >> Viacom Networks Europe Inc. Address for service in Great Britain is >> 17-29 Hawley Crescent, London, NW1 8TT. >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. > > Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. > > From nicholls.mark at vimn.com Wed Mar 25 16:27:19 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Wed, 25 Mar 2015 16:27:19 +0000 Subject: [Haskell-cafe] indexed writer monad In-Reply-To: <5512DC3F.9040301@ro-che.info> References: <5512CA1C.5000506@ro-che.info> <5512DC3F.9040301@ro-che.info> Message-ID: Ok... Well lets just take the indexed writer So....for a writer we're going... e.g. (a,[c]) -> (a -> (b,[c])) -> (b,[c]) If I use the logging use case metaphor... So I "log" a few Strings (probably)....and out pops a (t,[String]) ? (I've never actually used one!) But what if I want to "log" different types... I want to "log" a string, then an integer bla bla... So I won't get the monoid [String] I should get something like a nest 2 tuple. do log 1 log "a" log 3 log "sdds" return 23 I could get a (Integer,(String,(Integer,(String,END)))) and then I could dereference this indexed monoid(?)...by splitting it into a head of a specific type and a tail...like a list. Maybe my use of "indexed" isn't correct. So it seems to me, that writer monad is dependent on the monoid append (of lists usually?)....and my "special" monad would be dependent on a "special" monoid append of basically (these are types) (a,b) ++ (c,d) = (a,b,c,d) (a,b,c,d) ++ (e) = (a,b,c,d,e) Which are encoded as nested 2 tuples (with an End marker) (a,(b,End) ++ (c,(d,End)) = (a,(b, (c,(d,End))) ? That sort of implies some sort of type family trickery...which isnt toooo bad (I've dabbled). Looks like an ixmonad to me....In my pigoeon Haskell I could probably wrestle with some code for a few days....but does such a thing already exist?...I don't want to reinvent the wheel, just mess about with it, and turn it into a cog (and then fail to map it back to my OO world). -----Original Message----- From: Roman Cheplyaka [mailto:roma at ro-che.info] Sent: 25 March 2015 4:03 PM To: Nicholls, Mark; haskell-cafe at haskell.org Subject: Re: [Haskell-cafe] indexed writer monad Sorry, I didn't mean to scare you off. By Category, I didn't mean the math concept; I meant simply the class from the Control.Category module. You don't need to learn any category theory to understand it. Since you seem to know already what Monoid is, try to compare those two classes, notice the similarities and see how (and why) one could be called an indexed version of the other. But if you don't know what "indexed" means, how do you know you need it? Perhaps you could describe your problem, and we could tell you what abstraction would fit that use case, be it indexed monad or something else. On 25/03/15 17:22, Nicholls, Mark wrote: > Ah that assumes I know what a category is! (I did find some code that claimed the same thing)....maths doesn't scare me (much), and I suspect its nothing complicated (sounds like a category is a tuple then! Probably not), but I don't want to read a book on category theory to write a bit of code...yet. > > Ideally there would be a chapter in something like "learn you an indexed Haskell for the great good". > > Then I could take the code, use it...mess about with it...break it...put it back together in a slightly different shape and....bingo...it either works...or I find theres a good reason why it doesn't....(or I post a message to the caf?). > > -----Original Message----- > From: Roman Cheplyaka [mailto:roma at ro-che.info] > Sent: 25 March 2015 2:46 PM > To: Nicholls, Mark; haskell-cafe at haskell.org > Subject: Re: [Haskell-cafe] indexed writer monad > > An indexed monoid is just a Category. > > On 25/03/15 16:32, Nicholls, Mark wrote: >> Anyone? >> >> >> >> I can handle monads, but I have something (actually in F#) that feels >> like it should be something like a indexed writer monad (which F# >> probably wouldn't support). >> >> >> >> So I thought I'd do some research in Haskell. >> >> >> >> I know little or nothing about indexed monad (though I have built the >> indexed state monad in C#). >> >> >> >> So I would assume there would be an indexed monoid (that looks at bit >> like a tuple?). >> >> >> >> e.g. >> >> >> >> (a,b) ++ (c,d) = (a,b,c,d) >> >> (a,b,c,d) ++ (e) = (a,b,c,d,e) >> >> >> >> ? >> >> >> >> There seems to be some stuff about "update monads", but it doesn't >> really look like a writer. >> >> >> >> I could do with playing around with an indexed writer, in order to >> get my head around what I'm doing..then try and capture what I'm >> doing.then try (and fail) to port it back. >> >> >> >> >> >> >> >> CONFIDENTIALITY NOTICE >> >> This e-mail (and any attached files) is confidential and protected by >> copyright (and other intellectual property rights). If you are not >> the intended recipient please e-mail the sender and then delete the >> email and any attached files immediately. Any further use or >> dissemination is prohibited. >> >> While MTV Networks Europe has taken steps to ensure that this email >> and any attachments are virus free, it is your responsibility to >> ensure that this message and any attachments are virus free and do >> not affect your systems / data. >> >> Communicating by email is not 100% secure and carries risks such as >> delay, data corruption, non-delivery, wrongful interception and >> unauthorised amendment. If you communicate with us by e-mail, you >> acknowledge and assume these risks, and you agree to take appropriate >> measures to minimise these risks when e-mailing us. >> >> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, >> Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions >> International, Be Viacom, Viacom International Media Networks and >> VIMN and Comedy Central are all trading names of MTV Networks Europe. >> MTV Networks Europe is a partnership between MTV Networks Europe Inc. >> and Viacom Networks Europe Inc. Address for service in Great Britain >> is >> 17-29 Hawley Crescent, London, NW1 8TT. >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. > > Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. > > CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From acowley at gmail.com Wed Mar 25 17:35:10 2015 From: acowley at gmail.com (Anthony Cowley) Date: Wed, 25 Mar 2015 13:35:10 -0400 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> Message-ID: <13826087-C1FC-4C71-B3E3-102188A05A2B@gmail.com> > On Mar 25, 2015, at 11:03 AM, Michael Snoyman wrote: > > > >> On Wed, Mar 25, 2015 at 4:58 PM Anthony Cowley wrote: >> >> >>> On Mar 25, 2015, at 10:51 AM, Michael Snoyman wrote: >>> >>> >>> >>>> On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley wrote: >>>> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman wrote: >>>> > >>>> > >>>> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley >>>> > wrote: >>>> >> >>>> >> The suggestion to use "cabal install --dependencies-only ..." instead >>>> >> of "cabal freeze" in that issue is really nicely presented. "cabal >>>> >> freeze" is close to the right thing, but it's just not as fully >>>> >> featured as "cabal install" (e.g. taking flags). >>>> >> >>>> >> As for Stackage, I think it would be helpful to cache the full build >>>> >> plans computed for each package in Stackage. This is most of the work >>>> >> my Nix tooling currently does, so it would be a big time saver. >>>> >> >>>> >> >>>> > >>>> > By "full build plans," do you mean the dist/setup-config file, or something >>>> > else? That file would be problematic since it's Cabal-library-version >>>> > specific IIRC. If you're looking for the full listing of deep dependencies >>>> > and versions, we can extract that from the .yaml file using the technique I >>>> > mentioned earlier. >>>> > >>>> > Michael >>>> >>>> Yes, I meant the full listing of deep dependencies. >>> >>> I've put together a Gist with an executable that does what I described: >>> >>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>> >>> You give it three arguments on the command line: >>> >>> * LTS version, e.g. 1.14 >>> * Name of package being checked >>> * true == only include dependencies of the library and executable, anything else == include test and benchmark dependencies as well >>> >>> If that's useful, I can package that up and put it on Hackage. >>> >>> Michael >> >> This is very helpfulness, thanks! There is a bootstrapping issue, though, which is, I imagine, why both Mi?tek and I have been writing much more bash than we'd like. But perhaps this becomes part of a cabal-install-like bootstrap.sh script to get things going. >> >> Anthony > > Oh, that's actually a great idea. What if we had a program that: > > 1. takes a set of packages that needs to be installed, and an LTS version > 2. computes the dependency tree > 3. writes out a shell script (possibly batch program?) to wget, tar xf, and runghc Setup.hs in the correct order to get all of those packages installed > > As you can tell from the program I just threw together, stackage-types supports this kind of thing pretty trivially. > > Michael Yes, that's what the Nix tooling does. The extra bits are building up package databases suitable for each build without copying files all over the place. That has the extra benefit of being able to reuse builds when the recipe is unchanged. It is definitely not hard, but getting the build plans from stackage in a portable way would be valuable. Anthony -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Wed Mar 25 21:30:59 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Wed, 25 Mar 2015 23:30:59 +0200 Subject: [Haskell-cafe] indexed writer monad In-Reply-To: References: <5512CA1C.5000506@ro-che.info> <5512DC3F.9040301@ro-che.info> Message-ID: <55132913.6090008@ro-che.info> Alright, this does look like an indexed writer monad. Here's the indexed writer monad definition: newtype IxWriter c i j a = IxWriter { runIxWriter :: (c i j, a) } Here c is a Category, ie. an indexed Monoid. Under that constraint, you can make this an indexed monad (from the 'indexed' package). That should be a good exercise that'll help you to understand how this all works. In practice, you'll probably only need c = (->), so your writer becomes isomorphic to (i -> j, a). This is similar to the ordinary writer monad that uses difference lists as its monoid. The indexed 'tell' will be tell :: a -> IxWriter (->) z (z, a) () tell a = IxWriter (\z -> (z,a), ()) And to run an indexed monad, you apply that i->j function to your end marker. Does this help? On 25/03/15 18:27, Nicholls, Mark wrote: > Ok... > > Well lets just take the indexed writer > > So....for a writer we're going... > > e.g. > > (a,[c]) -> (a -> (b,[c])) -> (b,[c]) > > If I use the logging use case metaphor... > So I "log" a few Strings (probably)....and out pops a (t,[String]) > ? > > (I've never actually used one!) > > But what if I want to "log" different types... > > I want to "log" a string, then an integer bla bla... > > So I won't get the monoid [String] > > I should get something like a nest 2 tuple. > > do > log 1 > log "a" > log 3 > log "sdds" > return 23 > > I could get a > (Integer,(String,(Integer,(String,END)))) > > and then I could dereference this indexed monoid(?)...by splitting it into a head of a specific type and a tail...like a list. > > Maybe my use of "indexed" isn't correct. > > So it seems to me, that writer monad is dependent on the monoid append (of lists usually?)....and my "special" monad would be dependent on a "special" monoid append of basically > > (these are types) > > (a,b) ++ (c,d) = (a,b,c,d) > (a,b,c,d) ++ (e) = (a,b,c,d,e) > > Which are encoded as nested 2 tuples (with an End marker) > > (a,(b,End) ++ (c,(d,End)) = (a,(b, (c,(d,End))) > ? > > That sort of implies some sort of type family trickery...which isnt toooo bad (I've dabbled). > > Looks like an ixmonad to me....In my pigoeon Haskell I could probably wrestle with some code for a few days....but does such a thing already exist?...I don't want to reinvent the wheel, just mess about with it, and turn it into a cog (and then fail to map it back to my OO world). > > -----Original Message----- > From: Roman Cheplyaka [mailto:roma at ro-che.info] > Sent: 25 March 2015 4:03 PM > To: Nicholls, Mark; haskell-cafe at haskell.org > Subject: Re: [Haskell-cafe] indexed writer monad > > Sorry, I didn't mean to scare you off. > > By Category, I didn't mean the math concept; I meant simply the class from the Control.Category module. You don't need to learn any category theory to understand it. Since you seem to know already what Monoid is, try to compare those two classes, notice the similarities and see how (and why) one could be called an indexed version of the other. > > But if you don't know what "indexed" means, how do you know you need it? > Perhaps you could describe your problem, and we could tell you what abstraction would fit that use case, be it indexed monad or something else. > > On 25/03/15 17:22, Nicholls, Mark wrote: >> Ah that assumes I know what a category is! (I did find some code that claimed the same thing)....maths doesn't scare me (much), and I suspect its nothing complicated (sounds like a category is a tuple then! Probably not), but I don't want to read a book on category theory to write a bit of code...yet. >> >> Ideally there would be a chapter in something like "learn you an indexed Haskell for the great good". >> >> Then I could take the code, use it...mess about with it...break it...put it back together in a slightly different shape and....bingo...it either works...or I find theres a good reason why it doesn't....(or I post a message to the caf?). >> >> -----Original Message----- >> From: Roman Cheplyaka [mailto:roma at ro-che.info] >> Sent: 25 March 2015 2:46 PM >> To: Nicholls, Mark; haskell-cafe at haskell.org >> Subject: Re: [Haskell-cafe] indexed writer monad >> >> An indexed monoid is just a Category. >> >> On 25/03/15 16:32, Nicholls, Mark wrote: >>> Anyone? >>> >>> >>> >>> I can handle monads, but I have something (actually in F#) that feels >>> like it should be something like a indexed writer monad (which F# >>> probably wouldn't support). >>> >>> >>> >>> So I thought I'd do some research in Haskell. >>> >>> >>> >>> I know little or nothing about indexed monad (though I have built the >>> indexed state monad in C#). >>> >>> >>> >>> So I would assume there would be an indexed monoid (that looks at bit >>> like a tuple?). >>> >>> >>> >>> e.g. >>> >>> >>> >>> (a,b) ++ (c,d) = (a,b,c,d) >>> >>> (a,b,c,d) ++ (e) = (a,b,c,d,e) >>> >>> >>> >>> ? >>> >>> >>> >>> There seems to be some stuff about "update monads", but it doesn't >>> really look like a writer. >>> >>> >>> >>> I could do with playing around with an indexed writer, in order to >>> get my head around what I'm doing..then try and capture what I'm >>> doing.then try (and fail) to port it back. >>> >>> >>> >>> >>> >>> >>> >>> CONFIDENTIALITY NOTICE >>> >>> This e-mail (and any attached files) is confidential and protected by >>> copyright (and other intellectual property rights). If you are not >>> the intended recipient please e-mail the sender and then delete the >>> email and any attached files immediately. Any further use or >>> dissemination is prohibited. >>> >>> While MTV Networks Europe has taken steps to ensure that this email >>> and any attachments are virus free, it is your responsibility to >>> ensure that this message and any attachments are virus free and do >>> not affect your systems / data. >>> >>> Communicating by email is not 100% secure and carries risks such as >>> delay, data corruption, non-delivery, wrongful interception and >>> unauthorised amendment. If you communicate with us by e-mail, you >>> acknowledge and assume these risks, and you agree to take appropriate >>> measures to minimise these risks when e-mailing us. >>> >>> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, >>> Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions >>> International, Be Viacom, Viacom International Media Networks and >>> VIMN and Comedy Central are all trading names of MTV Networks Europe. >>> MTV Networks Europe is a partnership between MTV Networks Europe Inc. >>> and Viacom Networks Europe Inc. Address for service in Great Britain >>> is >>> 17-29 Hawley Crescent, London, NW1 8TT. >>> >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> >> CONFIDENTIALITY NOTICE >> >> This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. >> >> While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. >> >> Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. >> >> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. >> >> > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. > > Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. > > From michael at snoyman.com Thu Mar 26 07:21:53 2015 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 26 Mar 2015 07:21:53 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: <13826087-C1FC-4C71-B3E3-102188A05A2B@gmail.com> References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> <13826087-C1FC-4C71-B3E3-102188A05A2B@gmail.com> Message-ID: On Wed, Mar 25, 2015 at 7:35 PM Anthony Cowley wrote: > > > > On Mar 25, 2015, at 11:03 AM, Michael Snoyman wrote: > > > > On Wed, Mar 25, 2015 at 4:58 PM Anthony Cowley wrote: > >> >> >> On Mar 25, 2015, at 10:51 AM, Michael Snoyman >> wrote: >> >> >> >> On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley >> wrote: >> >>> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman >>> wrote: >>> > >>> > >>> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley >> > >>> > wrote: >>> >> >>> >> The suggestion to use "cabal install --dependencies-only ..." instead >>> >> of "cabal freeze" in that issue is really nicely presented. "cabal >>> >> freeze" is close to the right thing, but it's just not as fully >>> >> featured as "cabal install" (e.g. taking flags). >>> >> >>> >> As for Stackage, I think it would be helpful to cache the full build >>> >> plans computed for each package in Stackage. This is most of the work >>> >> my Nix tooling currently does, so it would be a big time saver. >>> >> >>> >> >>> > >>> > By "full build plans," do you mean the dist/setup-config file, or >>> something >>> > else? That file would be problematic since it's Cabal-library-version >>> > specific IIRC. If you're looking for the full listing of deep >>> dependencies >>> > and versions, we can extract that from the .yaml file using the >>> technique I >>> > mentioned earlier. >>> > >>> > Michael >>> >>> Yes, I meant the full listing of deep dependencies. >>> >>> >>> >> I've put together a Gist with an executable that does what I described: >> >> https://gist.github.com/snoyberg/5b244331533fcb614523 >> >> You give it three arguments on the command line: >> >> * LTS version, e.g. 1.14 >> * Name of package being checked >> * true == only include dependencies of the library and executable, >> anything else == include test and benchmark dependencies as well >> >> If that's useful, I can package that up and put it on Hackage. >> >> Michael >> >> >> This is very helpfulness, thanks! There is a bootstrapping issue, though, >> which is, I imagine, why both Mi?tek and I have been writing much more bash >> than we'd like. But perhaps this becomes part of a cabal-install-like >> bootstrap.sh script to get things going. >> >> Anthony >> > > Oh, that's actually a great idea. What if we had a program that: > > 1. takes a set of packages that needs to be installed, and an LTS version > 2. computes the dependency tree > 3. writes out a shell script (possibly batch program?) to wget, tar xf, > and runghc Setup.hs in the correct order to get all of those packages > installed > > As you can tell from the program I just threw together, stackage-types > supports this kind of thing pretty trivially. > > Michael > > > Yes, that's what the Nix tooling does. The extra bits are building up > package databases suitable for each build without copying files all over > the place. That has the extra benefit of being able to reuse builds when > the recipe is unchanged. It is definitely not hard, but getting the build > plans from stackage in a portable way would be valuable. > > Anthony > OK, I've updated the Gist so that it produces a shell script that will install all necessary packages. It also has a nicer optparse-applicative interface now. https://gist.github.com/snoyberg/5b244331533fcb614523 One thing I didn't do here is add support for custom GHC package databases. I assume you'll need that, but wasn't sure exactly how you're doing that in Nix. If this is useful for you, I'll start a stackage-bootstrap repo, clean up this code a bit, and we can continue improving it from there. Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Thu Mar 26 08:26:27 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Thu, 26 Mar 2015 08:26:27 +0000 Subject: [Haskell-cafe] indexed writer monad In-Reply-To: <55132913.6090008@ro-che.info> References: <5512CA1C.5000506@ro-che.info> <5512DC3F.9040301@ro-che.info> <55132913.6090008@ro-che.info> Message-ID: It does So im not barking up the wrong tree? Let me have a go, understand though that haskell comes about 5th in my list of languages by proffieciency, turning type cartwheels in fbound oo types is how my brain is wired, not seemingly trivial handstands in haskell It may take me several days (this is not part of my day job)! > On 25 Mar 2015, at 21:31, Roman Cheplyaka wrote: > > Alright, this does look like an indexed writer monad. > > Here's the indexed writer monad definition: > > newtype IxWriter c i j a = IxWriter { runIxWriter :: (c i j, a) } > > Here c is a Category, ie. an indexed Monoid. > > Under that constraint, you can make this an indexed monad (from the > 'indexed' package). That should be a good exercise that'll help you to > understand how this all works. > > In practice, you'll probably only need c = (->), so your writer becomes > isomorphic to (i -> j, a). This is similar to the ordinary writer monad > that uses difference lists as its monoid. > > The indexed 'tell' will be > > tell :: a -> IxWriter (->) z (z, a) () > tell a = IxWriter (\z -> (z,a), ()) > > And to run an indexed monad, you apply that i->j function to your end > marker. > > Does this help? > >> On 25/03/15 18:27, Nicholls, Mark wrote: >> Ok... >> >> Well lets just take the indexed writer >> >> So....for a writer we're going... >> >> e.g. >> >> (a,[c]) -> (a -> (b,[c])) -> (b,[c]) >> >> If I use the logging use case metaphor... >> So I "log" a few Strings (probably)....and out pops a (t,[String]) >> ? >> >> (I've never actually used one!) >> >> But what if I want to "log" different types... >> >> I want to "log" a string, then an integer bla bla... >> >> So I won't get the monoid [String] >> >> I should get something like a nest 2 tuple. >> >> do >> log 1 >> log "a" >> log 3 >> log "sdds" >> return 23 >> >> I could get a >> (Integer,(String,(Integer,(String,END)))) >> >> and then I could dereference this indexed monoid(?)...by splitting it into a head of a specific type and a tail...like a list. >> >> Maybe my use of "indexed" isn't correct. >> >> So it seems to me, that writer monad is dependent on the monoid append (of lists usually?)....and my "special" monad would be dependent on a "special" monoid append of basically >> >> (these are types) >> >> (a,b) ++ (c,d) = (a,b,c,d) >> (a,b,c,d) ++ (e) = (a,b,c,d,e) >> >> Which are encoded as nested 2 tuples (with an End marker) >> >> (a,(b,End) ++ (c,(d,End)) = (a,(b, (c,(d,End))) >> ? >> >> That sort of implies some sort of type family trickery...which isnt toooo bad (I've dabbled). >> >> Looks like an ixmonad to me....In my pigoeon Haskell I could probably wrestle with some code for a few days....but does such a thing already exist?...I don't want to reinvent the wheel, just mess about with it, and turn it into a cog (and then fail to map it back to my OO world). >> >> -----Original Message----- >> From: Roman Cheplyaka [mailto:roma at ro-che.info] >> Sent: 25 March 2015 4:03 PM >> To: Nicholls, Mark; haskell-cafe at haskell.org >> Subject: Re: [Haskell-cafe] indexed writer monad >> >> Sorry, I didn't mean to scare you off. >> >> By Category, I didn't mean the math concept; I meant simply the class from the Control.Category module. You don't need to learn any category theory to understand it. Since you seem to know already what Monoid is, try to compare those two classes, notice the similarities and see how (and why) one could be called an indexed version of the other. >> >> But if you don't know what "indexed" means, how do you know you need it? >> Perhaps you could describe your problem, and we could tell you what abstraction would fit that use case, be it indexed monad or something else. >> >>> On 25/03/15 17:22, Nicholls, Mark wrote: >>> Ah that assumes I know what a category is! (I did find some code that claimed the same thing)....maths doesn't scare me (much), and I suspect its nothing complicated (sounds like a category is a tuple then! Probably not), but I don't want to read a book on category theory to write a bit of code...yet. >>> >>> Ideally there would be a chapter in something like "learn you an indexed Haskell for the great good". >>> >>> Then I could take the code, use it...mess about with it...break it...put it back together in a slightly different shape and....bingo...it either works...or I find theres a good reason why it doesn't....(or I post a message to the caf?). >>> >>> -----Original Message----- >>> From: Roman Cheplyaka [mailto:roma at ro-che.info] >>> Sent: 25 March 2015 2:46 PM >>> To: Nicholls, Mark; haskell-cafe at haskell.org >>> Subject: Re: [Haskell-cafe] indexed writer monad >>> >>> An indexed monoid is just a Category. >>> >>>> On 25/03/15 16:32, Nicholls, Mark wrote: >>>> Anyone? >>>> >>>> >>>> >>>> I can handle monads, but I have something (actually in F#) that feels >>>> like it should be something like a indexed writer monad (which F# >>>> probably wouldn't support). >>>> >>>> >>>> >>>> So I thought I'd do some research in Haskell. >>>> >>>> >>>> >>>> I know little or nothing about indexed monad (though I have built the >>>> indexed state monad in C#). >>>> >>>> >>>> >>>> So I would assume there would be an indexed monoid (that looks at bit >>>> like a tuple?). >>>> >>>> >>>> >>>> e.g. >>>> >>>> >>>> >>>> (a,b) ++ (c,d) = (a,b,c,d) >>>> >>>> (a,b,c,d) ++ (e) = (a,b,c,d,e) >>>> >>>> >>>> >>>> ? >>>> >>>> >>>> >>>> There seems to be some stuff about "update monads", but it doesn't >>>> really look like a writer. >>>> >>>> >>>> >>>> I could do with playing around with an indexed writer, in order to >>>> get my head around what I'm doing..then try and capture what I'm >>>> doing.then try (and fail) to port it back. >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> CONFIDENTIALITY NOTICE >>>> >>>> This e-mail (and any attached files) is confidential and protected by >>>> copyright (and other intellectual property rights). If you are not >>>> the intended recipient please e-mail the sender and then delete the >>>> email and any attached files immediately. Any further use or >>>> dissemination is prohibited. >>>> >>>> While MTV Networks Europe has taken steps to ensure that this email >>>> and any attachments are virus free, it is your responsibility to >>>> ensure that this message and any attachments are virus free and do >>>> not affect your systems / data. >>>> >>>> Communicating by email is not 100% secure and carries risks such as >>>> delay, data corruption, non-delivery, wrongful interception and >>>> unauthorised amendment. If you communicate with us by e-mail, you >>>> acknowledge and assume these risks, and you agree to take appropriate >>>> measures to minimise these risks when e-mailing us. >>>> >>>> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, >>>> Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions >>>> International, Be Viacom, Viacom International Media Networks and >>>> VIMN and Comedy Central are all trading names of MTV Networks Europe. >>>> MTV Networks Europe is a partnership between MTV Networks Europe Inc. >>>> and Viacom Networks Europe Inc. Address for service in Great Britain >>>> is >>>> 17-29 Hawley Crescent, London, NW1 8TT. >>>> >>>> >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> CONFIDENTIALITY NOTICE >>> >>> This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. >>> >>> While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. >>> >>> Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. >>> >>> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. >> >> CONFIDENTIALITY NOTICE >> >> This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. >> >> While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. >> >> Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. >> >> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. > CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From kyagrd at gmail.com Thu Mar 26 08:28:43 2015 From: kyagrd at gmail.com (Ki Yung Ahn) Date: Thu, 26 Mar 2015 01:28:43 -0700 Subject: [Haskell-cafe] Do we have idiom for lifting a state monad into pair of states? Message-ID: Consider you have developed library routines that act on (State s1 a). For some reason, you need more than one state simultaneously. Let's say two side by side for simple example, that is (State (s1,s2) a). To use library functions on one state monad in a two state monad, we need to wrapper that lifts actions of (State s1 a) to (State (s1,s2) a). It is not difficult to write a lifter for such purposes as below. It is kind of like doing liftA in Applicative libarary, but instead of the last argument 'a' but on the fist argument 's' of (State s a). This seems like an idiom that can often come up. So, I tried some searching in some applicative related libraries and monad transformer related libraries but haven't found this idiom yet. If you had a need for idioms like below, what do you call it? Or, is there a way more general way I've missed that makes this a very special case of it. > import Control.Monad.State > import Control.Monad.Error > import Control.Applicative > > -- lift an action over a state into a pair of states > -- > do1st :: State s1 a -> State (s1,s2) a > do1st m1 = do (s1, s2) <- get > let (a, s1') = runState m1 s1 > put (s1',s2) > return a > > do2nd :: State s2 a -> State (s1,s2) a > do2nd m2 = do (s1, s2) <- get > let (a, s2') = runState m2 s2 > put (s1,s2') > return a > > > -- lift an action over a state with error > -- into a pair of states with error > -- > do1 :: Error e => ErrorT e (State s1) a -> ErrorT e (State (s1,s2)) a > do1 m1 = do (s1, s2) <- lift get > let (ma,s1') = (runState . runErrorT) m1 s1 > case ma of > Left e -> throwError e > Right a -> do lift $ put (s1',s2) > return a > > > do2 :: Error e => ErrorT e (State s2) a -> ErrorT e (State (s1,s2)) a > do2 m2 = do (s1, s2) <- lift get > let (ma,s2') = (runState . runErrorT) m2 s2 > case ma of > Left e -> throwError e > Right a -> do lift $ put (s1,s2') > return a From roma at ro-che.info Thu Mar 26 08:32:34 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 26 Mar 2015 10:32:34 +0200 Subject: [Haskell-cafe] Do we have idiom for lifting a state monad into pair of states? In-Reply-To: References: Message-ID: <5513C422.3060503@ro-che.info> It's called 'zoom' in various lens libraries. On 26/03/15 10:28, Ki Yung Ahn wrote: > Consider you have developed library routines that act on (State s1 a). > For some reason, you need more than one state simultaneously. Let's say > two side by side for simple example, that is (State (s1,s2) a). To use > library functions on one state monad in a two state monad, we need to > wrapper that lifts actions of (State s1 a) to (State (s1,s2) a). > > It is not difficult to write a lifter for such purposes as below. It is > kind of like doing liftA in Applicative libarary, but instead of the > last argument 'a' but on the fist argument 's' of (State s a). This > seems like an idiom that can often come up. So, I tried some searching > in some applicative related libraries and monad transformer related > libraries but haven't found this idiom yet. > > If you had a need for idioms like below, what do you call it? Or, is > there a way more general way I've missed that makes this a very special > case of it. > >> import Control.Monad.State >> import Control.Monad.Error >> import Control.Applicative >> >> -- lift an action over a state into a pair of states >> -- >> do1st :: State s1 a -> State (s1,s2) a >> do1st m1 = do (s1, s2) <- get >> let (a, s1') = runState m1 s1 >> put (s1',s2) >> return a >> >> do2nd :: State s2 a -> State (s1,s2) a >> do2nd m2 = do (s1, s2) <- get >> let (a, s2') = runState m2 s2 >> put (s1,s2') >> return a >> >> >> -- lift an action over a state with error >> -- into a pair of states with error >> -- >> do1 :: Error e => ErrorT e (State s1) a -> ErrorT e (State (s1,s2)) a >> do1 m1 = do (s1, s2) <- lift get >> let (ma,s1') = (runState . runErrorT) m1 s1 >> case ma of >> Left e -> throwError e >> Right a -> do lift $ put (s1',s2) >> return a >> >> >> do2 :: Error e => ErrorT e (State s2) a -> ErrorT e (State (s1,s2)) a >> do2 m2 = do (s1, s2) <- lift get >> let (ma,s2') = (runState . runErrorT) m2 s2 >> case ma of >> Left e -> throwError e >> Right a -> do lift $ put (s1,s2') >> return a > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From fumiexcel at gmail.com Thu Mar 26 08:44:28 2015 From: fumiexcel at gmail.com (Fumiaki Kinoshita) Date: Thu, 26 Mar 2015 17:44:28 +0900 Subject: [Haskell-cafe] Do we have idiom for lifting a state monad into pair of states? In-Reply-To: References: Message-ID: One solution is to use lens package. The lens package provides an interesting combinator, zoom, in Control.Lens.Zoom[1]: zoom :: Monad m => Lens' s t -> StateT t m a -> StateT s m a Lens' s a is the type of accessors to `a`. When it comes to tuples, you can use _1 :: Lens' (a, b) a _2 :: Lens' (a, b) b So do1st, do2nd are zoom _1, zoom _2 respectively. zoom also can be used for monad transformer stacks; zoom _1 may have the type of do1. [1] https://hackage.haskell.org/package/lens-4.8/docs/Control-Lens-Zoom.html 2015-03-26 17:28 GMT+09:00 Ki Yung Ahn : > Consider you have developed library routines that act on (State s1 a). > For some reason, you need more than one state simultaneously. Let's say > two side by side for simple example, that is (State (s1,s2) a). To use > library functions on one state monad in a two state monad, we need to > wrapper that lifts actions of (State s1 a) to (State (s1,s2) a). > > It is not difficult to write a lifter for such purposes as below. It is > kind of like doing liftA in Applicative libarary, but instead of the last > argument 'a' but on the fist argument 's' of (State s a). This seems like > an idiom that can often come up. So, I tried some searching in some > applicative related libraries and monad transformer related libraries but > haven't found this idiom yet. > > If you had a need for idioms like below, what do you call it? Or, is there > a way more general way I've missed that makes this a very special case of > it. > > > import Control.Monad.State > > import Control.Monad.Error > > import Control.Applicative > > > > -- lift an action over a state into a pair of states > > -- > > do1st :: State s1 a -> State (s1,s2) a > > do1st m1 = do (s1, s2) <- get > > let (a, s1') = runState m1 s1 > > put (s1',s2) > > return a > > > > do2nd :: State s2 a -> State (s1,s2) a > > do2nd m2 = do (s1, s2) <- get > > let (a, s2') = runState m2 s2 > > put (s1,s2') > > return a > > > > > > -- lift an action over a state with error > > -- into a pair of states with error > > -- > > do1 :: Error e => ErrorT e (State s1) a -> ErrorT e (State (s1,s2)) a > > do1 m1 = do (s1, s2) <- lift get > > let (ma,s1') = (runState . runErrorT) m1 s1 > > case ma of > > Left e -> throwError e > > Right a -> do lift $ put (s1',s2) > > return a > > > > > > do2 :: Error e => ErrorT e (State s2) a -> ErrorT e (State (s1,s2)) a > > do2 m2 = do (s1, s2) <- lift get > > let (ma,s2') = (runState . runErrorT) m2 s2 > > case ma of > > Left e -> throwError e > > Right a -> do lift $ put (s1,s2') > > return a > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kyagrd at gmail.com Thu Mar 26 08:56:09 2015 From: kyagrd at gmail.com (Ki Yung Ahn) Date: Thu, 26 Mar 2015 01:56:09 -0700 Subject: [Haskell-cafe] Do we have idiom for lifting a state monad into pair of states? In-Reply-To: <5513C422.3060503@ro-che.info> References: <5513C422.3060503@ro-che.info> Message-ID: Thanks, yes, it should of course been in Lens!! *Main Control.Lens> :t zoom _1 :: State s1 a -> State (s1,s2) a zoom _1 :: State s1 a -> State (s1,s2) a :: State s1 a -> State (s1, s2) a *Main Control.Lens> :t zoom _2 :: State s2 a -> State (s1,s2) a zoom _2 :: State s2 a -> State (s1,s2) a :: State s2 a -> State (s1, s2) a It works beautifully :) 2015? 03? 26? 01:32? Roman Cheplyaka ?(?) ? ?: > It's called 'zoom' in various lens libraries. > > On 26/03/15 10:28, Ki Yung Ahn wrote: >> Consider you have developed library routines that act on (State s1 a). >> For some reason, you need more than one state simultaneously. Let's say >> two side by side for simple example, that is (State (s1,s2) a). To use >> library functions on one state monad in a two state monad, we need to >> wrapper that lifts actions of (State s1 a) to (State (s1,s2) a). >> >> It is not difficult to write a lifter for such purposes as below. It is >> kind of like doing liftA in Applicative libarary, but instead of the >> last argument 'a' but on the fist argument 's' of (State s a). This >> seems like an idiom that can often come up. So, I tried some searching >> in some applicative related libraries and monad transformer related >> libraries but haven't found this idiom yet. >> >> If you had a need for idioms like below, what do you call it? Or, is >> there a way more general way I've missed that makes this a very special >> case of it. >> >>> import Control.Monad.State >>> import Control.Monad.Error >>> import Control.Applicative >>> >>> -- lift an action over a state into a pair of states >>> -- >>> do1st :: State s1 a -> State (s1,s2) a >>> do1st m1 = do (s1, s2) <- get >>> let (a, s1') = runState m1 s1 >>> put (s1',s2) >>> return a >>> >>> do2nd :: State s2 a -> State (s1,s2) a >>> do2nd m2 = do (s1, s2) <- get >>> let (a, s2') = runState m2 s2 >>> put (s1,s2') >>> return a >>> >>> >>> -- lift an action over a state with error >>> -- into a pair of states with error >>> -- >>> do1 :: Error e => ErrorT e (State s1) a -> ErrorT e (State (s1,s2)) a >>> do1 m1 = do (s1, s2) <- lift get >>> let (ma,s1') = (runState . runErrorT) m1 s1 >>> case ma of >>> Left e -> throwError e >>> Right a -> do lift $ put (s1',s2) >>> return a >>> >>> >>> do2 :: Error e => ErrorT e (State s2) a -> ErrorT e (State (s1,s2)) a >>> do2 m2 = do (s1, s2) <- lift get >>> let (ma,s2') = (runState . runErrorT) m2 s2 >>> case ma of >>> Left e -> throwError e >>> Right a -> do lift $ put (s1,s2') >>> return a >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> From acowley at gmail.com Thu Mar 26 13:00:39 2015 From: acowley at gmail.com (Anthony Cowley) Date: Thu, 26 Mar 2015 09:00:39 -0400 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> <13826087-C1FC-4C71-B3E3-102188A05A2B@gmail.com> Message-ID: <97BBBDDB-1D2C-49E4-82F3-A2445B14DDF7@gmail.com> > On Mar 26, 2015, at 3:21 AM, Michael Snoyman wrote: > > > >> On Wed, Mar 25, 2015 at 7:35 PM Anthony Cowley wrote: >> >> >> >>> On Mar 25, 2015, at 11:03 AM, Michael Snoyman wrote: >>> >>> >>> >>>> On Wed, Mar 25, 2015 at 4:58 PM Anthony Cowley wrote: >>>> >>>> >>>>> On Mar 25, 2015, at 10:51 AM, Michael Snoyman wrote: >>>>> >>>>> >>>>> >>>>>> On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley wrote: >>>>>> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman wrote: >>>>>> > >>>>>> > >>>>>> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley >>>>>> > wrote: >>>>>> >> >>>>>> >> The suggestion to use "cabal install --dependencies-only ..." instead >>>>>> >> of "cabal freeze" in that issue is really nicely presented. "cabal >>>>>> >> freeze" is close to the right thing, but it's just not as fully >>>>>> >> featured as "cabal install" (e.g. taking flags). >>>>>> >> >>>>>> >> As for Stackage, I think it would be helpful to cache the full build >>>>>> >> plans computed for each package in Stackage. This is most of the work >>>>>> >> my Nix tooling currently does, so it would be a big time saver. >>>>>> >> >>>>>> >> >>>>>> > >>>>>> > By "full build plans," do you mean the dist/setup-config file, or something >>>>>> > else? That file would be problematic since it's Cabal-library-version >>>>>> > specific IIRC. If you're looking for the full listing of deep dependencies >>>>>> > and versions, we can extract that from the .yaml file using the technique I >>>>>> > mentioned earlier. >>>>>> > >>>>>> > Michael >>>>>> >>>>>> Yes, I meant the full listing of deep dependencies. >>>>> >>>>> I've put together a Gist with an executable that does what I described: >>>>> >>>>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>>>> >>>>> You give it three arguments on the command line: >>>>> >>>>> * LTS version, e.g. 1.14 >>>>> * Name of package being checked >>>>> * true == only include dependencies of the library and executable, anything else == include test and benchmark dependencies as well >>>>> >>>>> If that's useful, I can package that up and put it on Hackage. >>>>> >>>>> Michael >>>> >>>> This is very helpfulness, thanks! There is a bootstrapping issue, though, which is, I imagine, why both Mi?tek and I have been writing much more bash than we'd like. But perhaps this becomes part of a cabal-install-like bootstrap.sh script to get things going. >>>> >>>> Anthony >>> >>> Oh, that's actually a great idea. What if we had a program that: >>> >>> 1. takes a set of packages that needs to be installed, and an LTS version >>> 2. computes the dependency tree >>> 3. writes out a shell script (possibly batch program?) to wget, tar xf, and runghc Setup.hs in the correct order to get all of those packages installed >>> >>> As you can tell from the program I just threw together, stackage-types supports this kind of thing pretty trivially. >>> >>> Michael >> >> Yes, that's what the Nix tooling does. The extra bits are building up package databases suitable for each build without copying files all over the place. That has the extra benefit of being able to reuse builds when the recipe is unchanged. It is definitely not hard, but getting the build plans from stackage in a portable way would be valuable. >> >> Anthony > > OK, I've updated the Gist so that it produces a shell script that will install all necessary packages. It also has a nicer optparse-applicative interface now. > > https://gist.github.com/snoyberg/5b244331533fcb614523 > > One thing I didn't do here is add support for custom GHC package databases. I assume you'll need that, but wasn't sure exactly how you're doing that in Nix. > > If this is useful for you, I'll start a stackage-bootstrap repo, clean up this code a bit, and we can continue improving it from there. > > Michael Just having a URL from which to GET the build plan would be most useful. As you say, the actual package building happens after DB creation, and that requires knowing what to put in the DB. Anthony -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Thu Mar 26 13:41:56 2015 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 26 Mar 2015 13:41:56 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: <97BBBDDB-1D2C-49E4-82F3-A2445B14DDF7@gmail.com> References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> <13826087-C1FC-4C71-B3E3-102188A05A2B@gmail.com> <97BBBDDB-1D2C-49E4-82F3-A2445B14DDF7@gmail.com> Message-ID: Is the idea that you'd be able to make a query such as: GET https://www.stackage.org/lts/1.14/build-plan?package=foo&package=bar&package=baz And get a result such as: [ {"name":"foo", "version":"1.2.3"} , ... ] ? On Thu, Mar 26, 2015 at 3:00 PM Anthony Cowley wrote: > > > > On Mar 26, 2015, at 3:21 AM, Michael Snoyman wrote: > > > > On Wed, Mar 25, 2015 at 7:35 PM Anthony Cowley wrote: > >> >> >> >> On Mar 25, 2015, at 11:03 AM, Michael Snoyman >> wrote: >> >> >> >> On Wed, Mar 25, 2015 at 4:58 PM Anthony Cowley wrote: >> >>> >>> >>> On Mar 25, 2015, at 10:51 AM, Michael Snoyman >>> wrote: >>> >>> >>> >>> On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley >>> wrote: >>> >>>> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman >>>> wrote: >>>> > >>>> > >>>> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley < >>>> acowley at seas.upenn.edu> >>>> > wrote: >>>> >> >>>> >> The suggestion to use "cabal install --dependencies-only ..." instead >>>> >> of "cabal freeze" in that issue is really nicely presented. "cabal >>>> >> freeze" is close to the right thing, but it's just not as fully >>>> >> featured as "cabal install" (e.g. taking flags). >>>> >> >>>> >> As for Stackage, I think it would be helpful to cache the full build >>>> >> plans computed for each package in Stackage. This is most of the work >>>> >> my Nix tooling currently does, so it would be a big time saver. >>>> >> >>>> >> >>>> > >>>> > By "full build plans," do you mean the dist/setup-config file, or >>>> something >>>> > else? That file would be problematic since it's Cabal-library-version >>>> > specific IIRC. If you're looking for the full listing of deep >>>> dependencies >>>> > and versions, we can extract that from the .yaml file using the >>>> technique I >>>> > mentioned earlier. >>>> > >>>> > Michael >>>> >>>> Yes, I meant the full listing of deep dependencies. >>>> >>>> >>>> >>> I've put together a Gist with an executable that does what I described: >>> >>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>> >>> You give it three arguments on the command line: >>> >>> * LTS version, e.g. 1.14 >>> * Name of package being checked >>> * true == only include dependencies of the library and executable, >>> anything else == include test and benchmark dependencies as well >>> >>> If that's useful, I can package that up and put it on Hackage. >>> >>> Michael >>> >>> >>> This is very helpfulness, thanks! There is a bootstrapping issue, >>> though, which is, I imagine, why both Mi?tek and I have been writing much >>> more bash than we'd like. But perhaps this becomes part of a >>> cabal-install-like bootstrap.sh script to get things going. >>> >>> Anthony >>> >> >> Oh, that's actually a great idea. What if we had a program that: >> >> 1. takes a set of packages that needs to be installed, and an LTS version >> 2. computes the dependency tree >> 3. writes out a shell script (possibly batch program?) to wget, tar xf, >> and runghc Setup.hs in the correct order to get all of those packages >> installed >> >> As you can tell from the program I just threw together, stackage-types >> supports this kind of thing pretty trivially. >> >> Michael >> >> >> Yes, that's what the Nix tooling does. The extra bits are building up >> package databases suitable for each build without copying files all over >> the place. That has the extra benefit of being able to reuse builds when >> the recipe is unchanged. It is definitely not hard, but getting the build >> plans from stackage in a portable way would be valuable. >> >> Anthony >> > > OK, I've updated the Gist so that it produces a shell script that will > install all necessary packages. It also has a nicer optparse-applicative > interface now. > > https://gist.github.com/snoyberg/5b244331533fcb614523 > > One thing I didn't do here is add support for custom GHC package > databases. I assume you'll need that, but wasn't sure exactly how you're > doing that in Nix. > > If this is useful for you, I'll start a stackage-bootstrap repo, clean up > this code a bit, and we can continue improving it from there. > > Michael > > > Just having a URL from which to GET the build plan would be most useful. > As you say, the actual package building happens after DB creation, and that > requires knowing what to put in the DB. > > Anthony > -------------- next part -------------- An HTML attachment was scrubbed... URL: From acowley at gmail.com Thu Mar 26 14:47:58 2015 From: acowley at gmail.com (Anthony Cowley) Date: Thu, 26 Mar 2015 10:47:58 -0400 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> <13826087-C1FC-4C71-B3E3-102188A05A2B@gmail.com> <97BBBDDB-1D2C-49E4-82F3-A2445B14DDF7@gmail.com> Message-ID: <15013C71-D09D-48C0-8954-F430DA251F5D@gmail.com> Yes, but a line-based format along the lines of: foo 1.2.3 bar-baz 0.1.00 Would be easier to parse with the usual shell tools. Anthony > On Mar 26, 2015, at 9:41 AM, Michael Snoyman wrote: > > Is the idea that you'd be able to make a query such as: > > GET https://www.stackage.org/lts/1.14/build-plan?package=foo&package=bar&package=baz > > And get a result such as: > > [ {"name":"foo", "version":"1.2.3"} > , ... > ] > > ? > >> On Thu, Mar 26, 2015 at 3:00 PM Anthony Cowley wrote: >> >> >> >>> On Mar 26, 2015, at 3:21 AM, Michael Snoyman wrote: >>> >>> >>> >>>> On Wed, Mar 25, 2015 at 7:35 PM Anthony Cowley wrote: >>>> >>>> >>>> >>>>> On Mar 25, 2015, at 11:03 AM, Michael Snoyman wrote: >>>>> >>>>> >>>>> >>>>>> On Wed, Mar 25, 2015 at 4:58 PM Anthony Cowley wrote: >>>>>> >>>>>> >>>>>>> On Mar 25, 2015, at 10:51 AM, Michael Snoyman wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley wrote: >>>>>>>> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman wrote: >>>>>>>> > >>>>>>>> > >>>>>>>> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley >>>>>>>> > wrote: >>>>>>>> >> >>>>>>>> >> The suggestion to use "cabal install --dependencies-only ..." instead >>>>>>>> >> of "cabal freeze" in that issue is really nicely presented. "cabal >>>>>>>> >> freeze" is close to the right thing, but it's just not as fully >>>>>>>> >> featured as "cabal install" (e.g. taking flags). >>>>>>>> >> >>>>>>>> >> As for Stackage, I think it would be helpful to cache the full build >>>>>>>> >> plans computed for each package in Stackage. This is most of the work >>>>>>>> >> my Nix tooling currently does, so it would be a big time saver. >>>>>>>> >> >>>>>>>> >> >>>>>>>> > >>>>>>>> > By "full build plans," do you mean the dist/setup-config file, or something >>>>>>>> > else? That file would be problematic since it's Cabal-library-version >>>>>>>> > specific IIRC. If you're looking for the full listing of deep dependencies >>>>>>>> > and versions, we can extract that from the .yaml file using the technique I >>>>>>>> > mentioned earlier. >>>>>>>> > >>>>>>>> > Michael >>>>>>>> >>>>>>>> Yes, I meant the full listing of deep dependencies. >>>>>>> >>>>>>> I've put together a Gist with an executable that does what I described: >>>>>>> >>>>>>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>>>>>> >>>>>>> You give it three arguments on the command line: >>>>>>> >>>>>>> * LTS version, e.g. 1.14 >>>>>>> * Name of package being checked >>>>>>> * true == only include dependencies of the library and executable, anything else == include test and benchmark dependencies as well >>>>>>> >>>>>>> If that's useful, I can package that up and put it on Hackage. >>>>>>> >>>>>>> Michael >>>>>> >>>>>> This is very helpfulness, thanks! There is a bootstrapping issue, though, which is, I imagine, why both Mi?tek and I have been writing much more bash than we'd like. But perhaps this becomes part of a cabal-install-like bootstrap.sh script to get things going. >>>>>> >>>>>> Anthony >>>>> >>>>> Oh, that's actually a great idea. What if we had a program that: >>>>> >>>>> 1. takes a set of packages that needs to be installed, and an LTS version >>>>> 2. computes the dependency tree >>>>> 3. writes out a shell script (possibly batch program?) to wget, tar xf, and runghc Setup.hs in the correct order to get all of those packages installed >>>>> >>>>> As you can tell from the program I just threw together, stackage-types supports this kind of thing pretty trivially. >>>>> >>>>> Michael >>>> >>>> Yes, that's what the Nix tooling does. The extra bits are building up package databases suitable for each build without copying files all over the place. That has the extra benefit of being able to reuse builds when the recipe is unchanged. It is definitely not hard, but getting the build plans from stackage in a portable way would be valuable. >>>> >>>> Anthony >>> >>> OK, I've updated the Gist so that it produces a shell script that will install all necessary packages. It also has a nicer optparse-applicative interface now. >>> >>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>> >>> One thing I didn't do here is add support for custom GHC package databases. I assume you'll need that, but wasn't sure exactly how you're doing that in Nix. >>> >>> If this is useful for you, I'll start a stackage-bootstrap repo, clean up this code a bit, and we can continue improving it from there. >>> >>> Michael >> >> Just having a URL from which to GET the build plan would be most useful. As you say, the actual package building happens after DB creation, and that requires knowing what to put in the DB. >> >> Anthony -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Thu Mar 26 14:50:06 2015 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 26 Mar 2015 14:50:06 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: <15013C71-D09D-48C0-8954-F430DA251F5D@gmail.com> References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> <13826087-C1FC-4C71-B3E3-102188A05A2B@gmail.com> <97BBBDDB-1D2C-49E4-82F3-A2445B14DDF7@gmail.com> <15013C71-D09D-48C0-8954-F430DA251F5D@gmail.com> Message-ID: And do you want the information on the core packages (e.g., base, template-haskell, containers) as well, or should they be left out? On Thu, Mar 26, 2015 at 4:48 PM Anthony Cowley wrote: > Yes, but a line-based format along the lines of: > > foo 1.2.3 > bar-baz 0.1.00 > > Would be easier to parse with the usual shell tools. > > Anthony > > On Mar 26, 2015, at 9:41 AM, Michael Snoyman wrote: > > Is the idea that you'd be able to make a query such as: > > GET > https://www.stackage.org/lts/1.14/build-plan?package=foo&package=bar&package=baz > > And get a result such as: > > [ {"name":"foo", "version":"1.2.3"} > , ... > ] > > ? > > On Thu, Mar 26, 2015 at 3:00 PM Anthony Cowley wrote: > >> >> >> >> On Mar 26, 2015, at 3:21 AM, Michael Snoyman wrote: >> >> >> >> On Wed, Mar 25, 2015 at 7:35 PM Anthony Cowley wrote: >> >>> >>> >>> >>> On Mar 25, 2015, at 11:03 AM, Michael Snoyman >>> wrote: >>> >>> >>> >>> On Wed, Mar 25, 2015 at 4:58 PM Anthony Cowley >>> wrote: >>> >>>> >>>> >>>> On Mar 25, 2015, at 10:51 AM, Michael Snoyman >>>> wrote: >>>> >>>> >>>> >>>> On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley >>>> wrote: >>>> >>>>> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman >>>>> wrote: >>>>> > >>>>> > >>>>> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley < >>>>> acowley at seas.upenn.edu> >>>>> > wrote: >>>>> >> >>>>> >> The suggestion to use "cabal install --dependencies-only ..." >>>>> instead >>>>> >> of "cabal freeze" in that issue is really nicely presented. "cabal >>>>> >> freeze" is close to the right thing, but it's just not as fully >>>>> >> featured as "cabal install" (e.g. taking flags). >>>>> >> >>>>> >> As for Stackage, I think it would be helpful to cache the full build >>>>> >> plans computed for each package in Stackage. This is most of the >>>>> work >>>>> >> my Nix tooling currently does, so it would be a big time saver. >>>>> >> >>>>> >> >>>>> > >>>>> > By "full build plans," do you mean the dist/setup-config file, or >>>>> something >>>>> > else? That file would be problematic since it's Cabal-library-version >>>>> > specific IIRC. If you're looking for the full listing of deep >>>>> dependencies >>>>> > and versions, we can extract that from the .yaml file using the >>>>> technique I >>>>> > mentioned earlier. >>>>> > >>>>> > Michael >>>>> >>>>> Yes, I meant the full listing of deep dependencies. >>>>> >>>>> >>>>> >>>> I've put together a Gist with an executable that does what I described: >>>> >>>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>>> >>>> You give it three arguments on the command line: >>>> >>>> * LTS version, e.g. 1.14 >>>> * Name of package being checked >>>> * true == only include dependencies of the library and executable, >>>> anything else == include test and benchmark dependencies as well >>>> >>>> If that's useful, I can package that up and put it on Hackage. >>>> >>>> Michael >>>> >>>> >>>> This is very helpfulness, thanks! There is a bootstrapping issue, >>>> though, which is, I imagine, why both Mi?tek and I have been writing much >>>> more bash than we'd like. But perhaps this becomes part of a >>>> cabal-install-like bootstrap.sh script to get things going. >>>> >>>> Anthony >>>> >>> >>> Oh, that's actually a great idea. What if we had a program that: >>> >>> 1. takes a set of packages that needs to be installed, and an LTS version >>> 2. computes the dependency tree >>> 3. writes out a shell script (possibly batch program?) to wget, tar xf, >>> and runghc Setup.hs in the correct order to get all of those packages >>> installed >>> >>> As you can tell from the program I just threw together, stackage-types >>> supports this kind of thing pretty trivially. >>> >>> Michael >>> >>> >>> Yes, that's what the Nix tooling does. The extra bits are building up >>> package databases suitable for each build without copying files all over >>> the place. That has the extra benefit of being able to reuse builds when >>> the recipe is unchanged. It is definitely not hard, but getting the build >>> plans from stackage in a portable way would be valuable. >>> >>> Anthony >>> >> >> OK, I've updated the Gist so that it produces a shell script that will >> install all necessary packages. It also has a nicer optparse-applicative >> interface now. >> >> https://gist.github.com/snoyberg/5b244331533fcb614523 >> >> One thing I didn't do here is add support for custom GHC package >> databases. I assume you'll need that, but wasn't sure exactly how you're >> doing that in Nix. >> >> If this is useful for you, I'll start a stackage-bootstrap repo, clean up >> this code a bit, and we can continue improving it from there. >> >> Michael >> >> >> Just having a URL from which to GET the build plan would be most useful. >> As you say, the actual package building happens after DB creation, and that >> requires knowing what to put in the DB. >> >> Anthony >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From acowley at gmail.com Thu Mar 26 15:01:39 2015 From: acowley at gmail.com (Anthony Cowley) Date: Thu, 26 Mar 2015 11:01:39 -0400 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> <13826087-C1FC-4C71-B3E3-102188A05A2B@gmail.com> <97BBBDDB-1D2C-49E4-82F3-A2445B14DDF7@gmail.com> <15013C71-D09D-48C0-8954-F430DA251F5D@gmail.com> Message-ID: This is a touch subtle. base can be left out, but other packages that ship with ghc and are usually found in the global package db should be included as they can be upgraded. This has knock on effects where a new version of the unix package means we have to rebuild the directory package with that updated dependency, for example. This is something I already handle, so I'd be happy to have everything included in the provided build plan. I'd need to think more about whether or not some packages can safely be totally left out, but I'm on the road at the moment and not terribly capable of thought. Anthony > On Mar 26, 2015, at 10:50 AM, Michael Snoyman wrote: > > And do you want the information on the core packages (e.g., base, template-haskell, containers) as well, or should they be left out? > >> On Thu, Mar 26, 2015 at 4:48 PM Anthony Cowley wrote: >> Yes, but a line-based format along the lines of: >> >> foo 1.2.3 >> bar-baz 0.1.00 >> >> Would be easier to parse with the usual shell tools. >> >> Anthony >> >>> On Mar 26, 2015, at 9:41 AM, Michael Snoyman wrote: >>> >>> Is the idea that you'd be able to make a query such as: >>> >>> GET https://www.stackage.org/lts/1.14/build-plan?package=foo&package=bar&package=baz >>> >>> And get a result such as: >>> >>> [ {"name":"foo", "version":"1.2.3"} >>> , ... >>> ] >>> >>> ? >>> >>>> On Thu, Mar 26, 2015 at 3:00 PM Anthony Cowley wrote: >>>> >>>> >>>> >>>>> On Mar 26, 2015, at 3:21 AM, Michael Snoyman wrote: >>>>> >>>>> >>>>> >>>>>> On Wed, Mar 25, 2015 at 7:35 PM Anthony Cowley wrote: >>>>>> >>>>>> >>>>>> >>>>>>> On Mar 25, 2015, at 11:03 AM, Michael Snoyman wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> On Wed, Mar 25, 2015 at 4:58 PM Anthony Cowley wrote: >>>>>>>> >>>>>>>> >>>>>>>>> On Mar 25, 2015, at 10:51 AM, Michael Snoyman wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley wrote: >>>>>>>>>> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman wrote: >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley >>>>>>>>>> > wrote: >>>>>>>>>> >> >>>>>>>>>> >> The suggestion to use "cabal install --dependencies-only ..." instead >>>>>>>>>> >> of "cabal freeze" in that issue is really nicely presented. "cabal >>>>>>>>>> >> freeze" is close to the right thing, but it's just not as fully >>>>>>>>>> >> featured as "cabal install" (e.g. taking flags). >>>>>>>>>> >> >>>>>>>>>> >> As for Stackage, I think it would be helpful to cache the full build >>>>>>>>>> >> plans computed for each package in Stackage. This is most of the work >>>>>>>>>> >> my Nix tooling currently does, so it would be a big time saver. >>>>>>>>>> >> >>>>>>>>>> >> >>>>>>>>>> > >>>>>>>>>> > By "full build plans," do you mean the dist/setup-config file, or something >>>>>>>>>> > else? That file would be problematic since it's Cabal-library-version >>>>>>>>>> > specific IIRC. If you're looking for the full listing of deep dependencies >>>>>>>>>> > and versions, we can extract that from the .yaml file using the technique I >>>>>>>>>> > mentioned earlier. >>>>>>>>>> > >>>>>>>>>> > Michael >>>>>>>>>> >>>>>>>>>> Yes, I meant the full listing of deep dependencies. >>>>>>>>> >>>>>>>>> I've put together a Gist with an executable that does what I described: >>>>>>>>> >>>>>>>>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>>>>>>>> >>>>>>>>> You give it three arguments on the command line: >>>>>>>>> >>>>>>>>> * LTS version, e.g. 1.14 >>>>>>>>> * Name of package being checked >>>>>>>>> * true == only include dependencies of the library and executable, anything else == include test and benchmark dependencies as well >>>>>>>>> >>>>>>>>> If that's useful, I can package that up and put it on Hackage. >>>>>>>>> >>>>>>>>> Michael >>>>>>>> >>>>>>>> This is very helpfulness, thanks! There is a bootstrapping issue, though, which is, I imagine, why both Mi?tek and I have been writing much more bash than we'd like. But perhaps this becomes part of a cabal-install-like bootstrap.sh script to get things going. >>>>>>>> >>>>>>>> Anthony >>>>>>> >>>>>>> Oh, that's actually a great idea. What if we had a program that: >>>>>>> >>>>>>> 1. takes a set of packages that needs to be installed, and an LTS version >>>>>>> 2. computes the dependency tree >>>>>>> 3. writes out a shell script (possibly batch program?) to wget, tar xf, and runghc Setup.hs in the correct order to get all of those packages installed >>>>>>> >>>>>>> As you can tell from the program I just threw together, stackage-types supports this kind of thing pretty trivially. >>>>>>> >>>>>>> Michael >>>>>> >>>>>> Yes, that's what the Nix tooling does. The extra bits are building up package databases suitable for each build without copying files all over the place. That has the extra benefit of being able to reuse builds when the recipe is unchanged. It is definitely not hard, but getting the build plans from stackage in a portable way would be valuable. >>>>>> >>>>>> Anthony >>>>> >>>>> OK, I've updated the Gist so that it produces a shell script that will install all necessary packages. It also has a nicer optparse-applicative interface now. >>>>> >>>>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>>>> >>>>> One thing I didn't do here is add support for custom GHC package databases. I assume you'll need that, but wasn't sure exactly how you're doing that in Nix. >>>>> >>>>> If this is useful for you, I'll start a stackage-bootstrap repo, clean up this code a bit, and we can continue improving it from there. >>>>> >>>>> Michael >>>> >>>> Just having a URL from which to GET the build plan would be most useful. As you say, the actual package building happens after DB creation, and that requires knowing what to put in the DB. >>>> >>>> Anthony -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Thu Mar 26 15:03:02 2015 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 26 Mar 2015 15:03:02 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> <13826087-C1FC-4C71-B3E3-102188A05A2B@gmail.com> <97BBBDDB-1D2C-49E4-82F3-A2445B14DDF7@gmail.com> <15013C71-D09D-48C0-8954-F430DA251F5D@gmail.com> Message-ID: It's trivial for me to include them all, and equally trivial for me to call out which ones are shipped with GHC somehow (such as an extra flag on that line). I'll implement this currently to dump everything out without any extra flag, and we can tweak it in the future. On Thu, Mar 26, 2015 at 5:01 PM Anthony Cowley wrote: > This is a touch subtle. base can be left out, but other packages that ship > with ghc and are usually found in the global package db should be included > as they can be upgraded. This has knock on effects where a new version of > the unix package means we have to rebuild the directory package with that > updated dependency, for example. This is something I already handle, so I'd > be happy to have everything included in the provided build plan. I'd need > to think more about whether or not some packages can safely be totally left > out, but I'm on the road at the moment and not terribly capable of thought. > > Anthony > > > On Mar 26, 2015, at 10:50 AM, Michael Snoyman wrote: > > And do you want the information on the core packages (e.g., base, > template-haskell, containers) as well, or should they be left out? > > On Thu, Mar 26, 2015 at 4:48 PM Anthony Cowley wrote: > >> Yes, but a line-based format along the lines of: >> >> foo 1.2.3 >> bar-baz 0.1.00 >> >> Would be easier to parse with the usual shell tools. >> >> Anthony >> >> On Mar 26, 2015, at 9:41 AM, Michael Snoyman wrote: >> >> Is the idea that you'd be able to make a query such as: >> >> GET >> https://www.stackage.org/lts/1.14/build-plan?package=foo&package=bar&package=baz >> >> And get a result such as: >> >> [ {"name":"foo", "version":"1.2.3"} >> , ... >> ] >> >> ? >> >> On Thu, Mar 26, 2015 at 3:00 PM Anthony Cowley wrote: >> >>> >>> >>> >>> On Mar 26, 2015, at 3:21 AM, Michael Snoyman >>> wrote: >>> >>> >>> >>> On Wed, Mar 25, 2015 at 7:35 PM Anthony Cowley >>> wrote: >>> >>>> >>>> >>>> >>>> On Mar 25, 2015, at 11:03 AM, Michael Snoyman >>>> wrote: >>>> >>>> >>>> >>>> On Wed, Mar 25, 2015 at 4:58 PM Anthony Cowley >>>> wrote: >>>> >>>>> >>>>> >>>>> On Mar 25, 2015, at 10:51 AM, Michael Snoyman >>>>> wrote: >>>>> >>>>> >>>>> >>>>> On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley >>>>> wrote: >>>>> >>>>>> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman < >>>>>> michael at snoyman.com> wrote: >>>>>> > >>>>>> > >>>>>> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley < >>>>>> acowley at seas.upenn.edu> >>>>>> > wrote: >>>>>> >> >>>>>> >> The suggestion to use "cabal install --dependencies-only ..." >>>>>> instead >>>>>> >> of "cabal freeze" in that issue is really nicely presented. "cabal >>>>>> >> freeze" is close to the right thing, but it's just not as fully >>>>>> >> featured as "cabal install" (e.g. taking flags). >>>>>> >> >>>>>> >> As for Stackage, I think it would be helpful to cache the full >>>>>> build >>>>>> >> plans computed for each package in Stackage. This is most of the >>>>>> work >>>>>> >> my Nix tooling currently does, so it would be a big time saver. >>>>>> >> >>>>>> >> >>>>>> > >>>>>> > By "full build plans," do you mean the dist/setup-config file, or >>>>>> something >>>>>> > else? That file would be problematic since it's >>>>>> Cabal-library-version >>>>>> > specific IIRC. If you're looking for the full listing of deep >>>>>> dependencies >>>>>> > and versions, we can extract that from the .yaml file using the >>>>>> technique I >>>>>> > mentioned earlier. >>>>>> > >>>>>> > Michael >>>>>> >>>>>> Yes, I meant the full listing of deep dependencies. >>>>>> >>>>>> >>>>>> >>>>> I've put together a Gist with an executable that does what I described: >>>>> >>>>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>>>> >>>>> You give it three arguments on the command line: >>>>> >>>>> * LTS version, e.g. 1.14 >>>>> * Name of package being checked >>>>> * true == only include dependencies of the library and executable, >>>>> anything else == include test and benchmark dependencies as well >>>>> >>>>> If that's useful, I can package that up and put it on Hackage. >>>>> >>>>> Michael >>>>> >>>>> >>>>> This is very helpfulness, thanks! There is a bootstrapping issue, >>>>> though, which is, I imagine, why both Mi?tek and I have been writing much >>>>> more bash than we'd like. But perhaps this becomes part of a >>>>> cabal-install-like bootstrap.sh script to get things going. >>>>> >>>>> Anthony >>>>> >>>> >>>> Oh, that's actually a great idea. What if we had a program that: >>>> >>>> 1. takes a set of packages that needs to be installed, and an LTS >>>> version >>>> 2. computes the dependency tree >>>> 3. writes out a shell script (possibly batch program?) to wget, tar xf, >>>> and runghc Setup.hs in the correct order to get all of those packages >>>> installed >>>> >>>> As you can tell from the program I just threw together, stackage-types >>>> supports this kind of thing pretty trivially. >>>> >>>> Michael >>>> >>>> >>>> Yes, that's what the Nix tooling does. The extra bits are building up >>>> package databases suitable for each build without copying files all over >>>> the place. That has the extra benefit of being able to reuse builds when >>>> the recipe is unchanged. It is definitely not hard, but getting the build >>>> plans from stackage in a portable way would be valuable. >>>> >>>> Anthony >>>> >>> >>> OK, I've updated the Gist so that it produces a shell script that will >>> install all necessary packages. It also has a nicer optparse-applicative >>> interface now. >>> >>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>> >>> One thing I didn't do here is add support for custom GHC package >>> databases. I assume you'll need that, but wasn't sure exactly how you're >>> doing that in Nix. >>> >>> If this is useful for you, I'll start a stackage-bootstrap repo, clean >>> up this code a bit, and we can continue improving it from there. >>> >>> Michael >>> >>> >>> Just having a URL from which to GET the build plan would be most useful. >>> As you say, the actual package building happens after DB creation, and that >>> requires knowing what to put in the DB. >>> >>> Anthony >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From lsp at informatik.uni-kiel.de Thu Mar 26 15:32:18 2015 From: lsp at informatik.uni-kiel.de (lennart spitzner) Date: Thu, 26 Mar 2015 16:32:18 +0100 Subject: [Haskell-cafe] Do we have idiom for lifting a state monad into pair of states? In-Reply-To: References: Message-ID: <55142682.7030603@informatik.uni-kiel.de> Let me grab this opportunity to advertise the multistate package [1]. The underlying assumption is that the types of the states in your stack are distinct. In that case, type inference can give you something like "automatic zooming" for a MultiState that contains arbitrary heterogenous lists (tuples). Generous usage of the Monad(Multi)State type class would thereby eliminate the need for do1st and do2nd. See the example in the package. The package does not (yet!) work well with existing transformers, for example one might think of running a StateT on one of the states in a MultiStateT. This is not a problem when using MultiStateT exclusively, but of course bad for interoperability. I am open for specific requests in that direction. In the last few days I have been working on adding a MultiRWST, but this is not completely finished yet (and I am not sure yet how to make the interface consistent; the whole run/eval/exec distinction seems unintuitive, especially when you have multiple states..) Lennart [1] https://hackage.haskell.org/package/multistate On 26/03/15 09:28, Ki Yung Ahn wrote: > Consider you have developed library routines that act on (State s1 a). > For some reason, you need more than one state simultaneously. Let's > say two side by side for simple example, that is (State (s1,s2) a). To > use library functions on one state monad in a two state monad, we need > to wrapper that lifts actions of (State s1 a) to (State (s1,s2) a). > > It is not difficult to write a lifter for such purposes as below. It > is kind of like doing liftA in Applicative libarary, but instead of > the last argument 'a' but on the fist argument 's' of (State s a). > This seems like an idiom that can often come up. So, I tried some > searching in some applicative related libraries and monad transformer > related libraries but haven't found this idiom yet. > > If you had a need for idioms like below, what do you call it? Or, is > there a way more general way I've missed that makes this a very > special case of it. > >> import Control.Monad.State >> import Control.Monad.Error >> import Control.Applicative >> >> -- lift an action over a state into a pair of states >> -- >> do1st :: State s1 a -> State (s1,s2) a >> do1st m1 = do (s1, s2) <- get >> let (a, s1') = runState m1 s1 >> put (s1',s2) >> return a >> >> do2nd :: State s2 a -> State (s1,s2) a >> do2nd m2 = do (s1, s2) <- get >> let (a, s2') = runState m2 s2 >> put (s1,s2') >> return a >> >> >> -- lift an action over a state with error >> -- into a pair of states with error >> -- >> do1 :: Error e => ErrorT e (State s1) a -> ErrorT e (State (s1,s2)) a >> do1 m1 = do (s1, s2) <- lift get >> let (ma,s1') = (runState . runErrorT) m1 s1 >> case ma of >> Left e -> throwError e >> Right a -> do lift $ put (s1',s2) >> return a >> >> >> do2 :: Error e => ErrorT e (State s2) a -> ErrorT e (State (s1,s2)) a >> do2 m2 = do (s1, s2) <- lift get >> let (ma,s2') = (runState . runErrorT) m2 s2 >> case ma of >> Left e -> throwError e >> Right a -> do lift $ put (s1,s2') >> return a > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From roma at ro-che.info Thu Mar 26 15:43:42 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 26 Mar 2015 17:43:42 +0200 Subject: [Haskell-cafe] Do we have idiom for lifting a state monad into pair of states? In-Reply-To: <55142682.7030603@informatik.uni-kiel.de> References: <55142682.7030603@informatik.uni-kiel.de> Message-ID: <5514292E.3080701@ro-che.info> monad-classes can do this, and more: http://bit.ly/1xBZr3I On 26/03/15 17:32, lennart spitzner wrote: > Let me grab this opportunity to advertise the multistate package [1]. > > The underlying assumption is that the types of the states in your > stack are distinct. In that case, type inference can give you > something like "automatic zooming" for a MultiState that contains > arbitrary heterogenous lists (tuples). > Generous usage of the Monad(Multi)State type class would thereby > eliminate the need for do1st and do2nd. See the example in the package. > > The package does not (yet!) work well with existing transformers, for > example one might think of running a StateT on one of the states in a > MultiStateT. This is not a problem when using MultiStateT exclusively, > but of course bad for interoperability. I am open for specific > requests in that direction. > > In the last few days I have been working on adding a MultiRWST, but > this is not completely finished yet (and I am not sure yet how to make > the interface consistent; the whole run/eval/exec distinction seems > unintuitive, especially when you have multiple states..) > > Lennart > > > [1] https://hackage.haskell.org/package/multistate > > > On 26/03/15 09:28, Ki Yung Ahn wrote: >> Consider you have developed library routines that act on (State s1 a). >> For some reason, you need more than one state simultaneously. Let's >> say two side by side for simple example, that is (State (s1,s2) a). To >> use library functions on one state monad in a two state monad, we need >> to wrapper that lifts actions of (State s1 a) to (State (s1,s2) a). >> >> It is not difficult to write a lifter for such purposes as below. It >> is kind of like doing liftA in Applicative libarary, but instead of >> the last argument 'a' but on the fist argument 's' of (State s a). >> This seems like an idiom that can often come up. So, I tried some >> searching in some applicative related libraries and monad transformer >> related libraries but haven't found this idiom yet. >> >> If you had a need for idioms like below, what do you call it? Or, is >> there a way more general way I've missed that makes this a very >> special case of it. >> >>> import Control.Monad.State >>> import Control.Monad.Error >>> import Control.Applicative >>> >>> -- lift an action over a state into a pair of states >>> -- >>> do1st :: State s1 a -> State (s1,s2) a >>> do1st m1 = do (s1, s2) <- get >>> let (a, s1') = runState m1 s1 >>> put (s1',s2) >>> return a >>> >>> do2nd :: State s2 a -> State (s1,s2) a >>> do2nd m2 = do (s1, s2) <- get >>> let (a, s2') = runState m2 s2 >>> put (s1,s2') >>> return a >>> >>> >>> -- lift an action over a state with error >>> -- into a pair of states with error >>> -- >>> do1 :: Error e => ErrorT e (State s1) a -> ErrorT e (State (s1,s2)) a >>> do1 m1 = do (s1, s2) <- lift get >>> let (ma,s1') = (runState . runErrorT) m1 s1 >>> case ma of >>> Left e -> throwError e >>> Right a -> do lift $ put (s1',s2) >>> return a >>> >>> >>> do2 :: Error e => ErrorT e (State s2) a -> ErrorT e (State (s1,s2)) a >>> do2 m2 = do (s1, s2) <- lift get >>> let (ma,s2') = (runState . runErrorT) m2 s2 >>> case ma of >>> Left e -> throwError e >>> Right a -> do lift $ put (s1,s2') >>> return a >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From michael at snoyman.com Thu Mar 26 15:49:15 2015 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 26 Mar 2015 15:49:15 +0000 Subject: [Haskell-cafe] Version constraints and cabal.config files In-Reply-To: References: <7D1B82EE-B31C-421E-9A12-FF1B4CCBAD28@bak.io> <5E73356C-1973-4374-A706-A92359E96F08@bak.io> <05FE5722-5E2C-40A7-891C-18BC1DC3CA8C@bak.io> <25FD20FD-AF3C-4122-857F-D3AD4FF4218E@gmail.com> <13826087-C1FC-4C71-B3E3-102188A05A2B@gmail.com> <97BBBDDB-1D2C-49E4-82F3-A2445B14DDF7@gmail.com> <15013C71-D09D-48C0-8954-F430DA251F5D@gmail.com> Message-ID: OK, should be working now: http://www.stackage.org/lts/build-plan?package=warp On Thu, Mar 26, 2015 at 5:03 PM Michael Snoyman wrote: > It's trivial for me to include them all, and equally trivial for me to > call out which ones are shipped with GHC somehow (such as an extra flag on > that line). I'll implement this currently to dump everything out without > any extra flag, and we can tweak it in the future. > > On Thu, Mar 26, 2015 at 5:01 PM Anthony Cowley wrote: > >> This is a touch subtle. base can be left out, but other packages that >> ship with ghc and are usually found in the global package db should be >> included as they can be upgraded. This has knock on effects where a new >> version of the unix package means we have to rebuild the directory package >> with that updated dependency, for example. This is something I already >> handle, so I'd be happy to have everything included in the provided build >> plan. I'd need to think more about whether or not some packages can safely >> be totally left out, but I'm on the road at the moment and not terribly >> capable of thought. >> >> Anthony >> >> >> On Mar 26, 2015, at 10:50 AM, Michael Snoyman >> wrote: >> >> And do you want the information on the core packages (e.g., base, >> template-haskell, containers) as well, or should they be left out? >> >> On Thu, Mar 26, 2015 at 4:48 PM Anthony Cowley wrote: >> >>> Yes, but a line-based format along the lines of: >>> >>> foo 1.2.3 >>> bar-baz 0.1.00 >>> >>> Would be easier to parse with the usual shell tools. >>> >>> Anthony >>> >>> On Mar 26, 2015, at 9:41 AM, Michael Snoyman >>> wrote: >>> >>> Is the idea that you'd be able to make a query such as: >>> >>> GET https://www.stackage.org/lts/1.14/build-plan?package=foo& >>> package=bar&package=baz >>> >>> And get a result such as: >>> >>> [ {"name":"foo", "version":"1.2.3"} >>> , ... >>> ] >>> >>> ? >>> >>> On Thu, Mar 26, 2015 at 3:00 PM Anthony Cowley >>> wrote: >>> >>>> >>>> >>>> >>>> On Mar 26, 2015, at 3:21 AM, Michael Snoyman >>>> wrote: >>>> >>>> >>>> >>>> On Wed, Mar 25, 2015 at 7:35 PM Anthony Cowley >>>> wrote: >>>> >>>>> >>>>> >>>>> >>>>> On Mar 25, 2015, at 11:03 AM, Michael Snoyman >>>>> wrote: >>>>> >>>>> >>>>> >>>>> On Wed, Mar 25, 2015 at 4:58 PM Anthony Cowley >>>>> wrote: >>>>> >>>>>> >>>>>> >>>>>> On Mar 25, 2015, at 10:51 AM, Michael Snoyman >>>>>> wrote: >>>>>> >>>>>> >>>>>> >>>>>> On Wed, Mar 25, 2015 at 4:30 PM Anthony Cowley < >>>>>> acowley at seas.upenn.edu> wrote: >>>>>> >>>>>>> On Wed, Mar 25, 2015 at 10:24 AM, Michael Snoyman < >>>>>>> michael at snoyman.com> wrote: >>>>>>> > >>>>>>> > >>>>>>> > On Wed, Mar 25, 2015 at 4:17 PM Anthony Cowley < >>>>>>> acowley at seas.upenn.edu> >>>>>>> > wrote: >>>>>>> >> >>>>>>> >> The suggestion to use "cabal install --dependencies-only ..." >>>>>>> instead >>>>>>> >> of "cabal freeze" in that issue is really nicely presented. "cabal >>>>>>> >> freeze" is close to the right thing, but it's just not as fully >>>>>>> >> featured as "cabal install" (e.g. taking flags). >>>>>>> >> >>>>>>> >> As for Stackage, I think it would be helpful to cache the full >>>>>>> build >>>>>>> >> plans computed for each package in Stackage. This is most of the >>>>>>> work >>>>>>> >> my Nix tooling currently does, so it would be a big time saver. >>>>>>> >> >>>>>>> >> >>>>>>> > >>>>>>> > By "full build plans," do you mean the dist/setup-config file, or >>>>>>> something >>>>>>> > else? That file would be problematic since it's >>>>>>> Cabal-library-version >>>>>>> > specific IIRC. If you're looking for the full listing of deep >>>>>>> dependencies >>>>>>> > and versions, we can extract that from the .yaml file using the >>>>>>> technique I >>>>>>> > mentioned earlier. >>>>>>> > >>>>>>> > Michael >>>>>>> >>>>>>> Yes, I meant the full listing of deep dependencies. >>>>>>> >>>>>>> >>>>>>> >>>>>> I've put together a Gist with an executable that does what I >>>>>> described: >>>>>> >>>>>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>>>>> >>>>>> You give it three arguments on the command line: >>>>>> >>>>>> * LTS version, e.g. 1.14 >>>>>> * Name of package being checked >>>>>> * true == only include dependencies of the library and executable, >>>>>> anything else == include test and benchmark dependencies as well >>>>>> >>>>>> If that's useful, I can package that up and put it on Hackage. >>>>>> >>>>>> Michael >>>>>> >>>>>> >>>>>> This is very helpfulness, thanks! There is a bootstrapping issue, >>>>>> though, which is, I imagine, why both Mi?tek and I have been writing much >>>>>> more bash than we'd like. But perhaps this becomes part of a >>>>>> cabal-install-like bootstrap.sh script to get things going. >>>>>> >>>>>> Anthony >>>>>> >>>>> >>>>> Oh, that's actually a great idea. What if we had a program that: >>>>> >>>>> 1. takes a set of packages that needs to be installed, and an LTS >>>>> version >>>>> 2. computes the dependency tree >>>>> 3. writes out a shell script (possibly batch program?) to wget, tar >>>>> xf, and runghc Setup.hs in the correct order to get all of those packages >>>>> installed >>>>> >>>>> As you can tell from the program I just threw together, stackage-types >>>>> supports this kind of thing pretty trivially. >>>>> >>>>> Michael >>>>> >>>>> >>>>> Yes, that's what the Nix tooling does. The extra bits are building up >>>>> package databases suitable for each build without copying files all over >>>>> the place. That has the extra benefit of being able to reuse builds when >>>>> the recipe is unchanged. It is definitely not hard, but getting the build >>>>> plans from stackage in a portable way would be valuable. >>>>> >>>>> Anthony >>>>> >>>> >>>> OK, I've updated the Gist so that it produces a shell script that will >>>> install all necessary packages. It also has a nicer optparse-applicative >>>> interface now. >>>> >>>> https://gist.github.com/snoyberg/5b244331533fcb614523 >>>> >>>> One thing I didn't do here is add support for custom GHC package >>>> databases. I assume you'll need that, but wasn't sure exactly how you're >>>> doing that in Nix. >>>> >>>> If this is useful for you, I'll start a stackage-bootstrap repo, clean >>>> up this code a bit, and we can continue improving it from there. >>>> >>>> Michael >>>> >>>> >>>> Just having a URL from which to GET the build plan would be most >>>> useful. As you say, the actual package building happens after DB creation, >>>> and that requires knowing what to put in the DB. >>>> >>>> Anthony >>>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Thu Mar 26 18:24:53 2015 From: martin.drautzburg at web.de (martin) Date: Thu, 26 Mar 2015 19:24:53 +0100 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: References: <55107F71.6080308@web.de> Message-ID: <55144EF5.70500@web.de> Am 03/24/2015 um 04:13 AM schrieb Chris Wong: > Hi Martin, > > On Tue, Mar 24, 2015 at 10:02 AM, martin wrote: >> Hello all, >> >> I've been playing with temporal values, i.e. values which change over time at discrete points in time. I thought it >> would be good to make it an instance of Applicative and I was pleased with the results. I may be re-inventing some of >> frp here, but hey. > > Have you considered making Temporal a Monad? All monads by definition > provide a `join :: m (m a) -> m a` which flattens their nested > structure. I just tried that, but I started with join and I wanted to get >>= for free. data Change a = Chg { ct :: Time, -- "change time" cv :: a -- "change value" } data Temporal a = Temporal { td :: a, -- "temporal default" tc :: [Change a] -- "temporal changes" } deriving (Show) -- apply a function to the value of a change cvf :: (a->b) -> Change a -> Change b cvf f e = Chg (ct e) (f $ cv e) instance Functor Temporal where fmap f (Temporal xd xs) = Temporal (f xd) (map (cvf f) xs) I beleive join is a bit too long to post here. But is seems to work with these examples exNat :: Temporal Int exNat = Temporal 0 (map (\x -> Chg (2*x) (fromIntegral x)) [1..100000]) ext2 :: Temporal Int ext2 = Temporal 10 [Chg 5 0] exNested2 = Temporal exNat [Chg 7 ext2] *Main> tJoin exNested2 Temporal {td = 0, tc = [(2,1),(4,2),(6,3),(7,10)]} It starts with exNat but only up to the Time=10 where ext2 is scheduled and adds the default at Time=10. Since ext2 has no further changes after Time=10, this is it. Then I defined Modad as instance Monad Temporal where return x = Temporal x [] ma >>= f = tJoin $ fmap f ma And Applicative instance Applicative Temporal where pure x = Temporal x [] (<*>) = ap But here is what I get *Main> (*) <$> exNat <*> ext2 Temporal {td = 0, tc = [(2,10),(4,20),(6,30),(8,40),(10,50) ... This is NOT what I expected. Before I had a hand-crafted <*> function, and this gave me *Main> (*) <$> exNat <*> ext2 Temporal {td = 0, tc = [(2,10),(4,20),(5,0),(6,0),(8,0) ... You see the values all drop to zero beyond Time=5, because ext2 drops to zero there and I am multiplying. Where do you think things went awry? Do you think its my tJoin function, or is there something wrong in the way I defined those typeclasses with respect to each other? Or did I voilate one of the laws? How could I find out? From alex.solla at gmail.com Thu Mar 26 20:08:29 2015 From: alex.solla at gmail.com (Alexander Solla) Date: Thu, 26 Mar 2015 13:08:29 -0700 Subject: [Haskell-cafe] Applicative of Applicative In-Reply-To: <55144EF5.70500@web.de> References: <55107F71.6080308@web.de> <55144EF5.70500@web.de> Message-ID: I haven't read all the code, but it seems to me that the most likely candidate is that your old <*> is breaking the applicative laws. <*> "can't" depend on the values it's applied to (but based on what you said, it looks like your old <*> was making choices) On Thu, Mar 26, 2015 at 11:24 AM, martin wrote: > Am 03/24/2015 um 04:13 AM schrieb Chris Wong: > > Hi Martin, > > > > On Tue, Mar 24, 2015 at 10:02 AM, martin > wrote: > >> Hello all, > >> > >> I've been playing with temporal values, i.e. values which change over > time at discrete points in time. I thought it > >> would be good to make it an instance of Applicative and I was pleased > with the results. I may be re-inventing some of > >> frp here, but hey. > > > > > Have you considered making Temporal a Monad? All monads by definition > > provide a `join :: m (m a) -> m a` which flattens their nested > > structure. > > I just tried that, but I started with join and I wanted to get >>= for > free. > > data Change a = Chg { > ct :: Time, -- "change time" > cv :: a -- "change value" > } > > data Temporal a = Temporal { > td :: a, -- "temporal default" > tc :: [Change a] -- "temporal changes" > } deriving (Show) > > -- apply a function to the value of a change > cvf :: (a->b) -> Change a -> Change b > cvf f e = Chg (ct e) (f $ cv e) > > > instance Functor Temporal where > fmap f (Temporal xd xs) = Temporal (f xd) (map (cvf f) xs) > > > I beleive join is a bit too long to post here. But is seems to work with > these examples > > exNat :: Temporal Int > exNat = Temporal 0 (map (\x -> Chg (2*x) (fromIntegral x)) [1..100000]) > > ext2 :: Temporal Int > ext2 = Temporal 10 [Chg 5 0] > > exNested2 = Temporal exNat [Chg 7 ext2] > > *Main> tJoin exNested2 > Temporal {td = 0, tc = [(2,1),(4,2),(6,3),(7,10)]} > > It starts with exNat but only up to the Time=10 where ext2 is scheduled > and adds the default at Time=10. Since ext2 has > no further changes after Time=10, this is it. > > > Then I defined Modad as > > instance Monad Temporal where > return x = Temporal x [] > ma >>= f = tJoin $ fmap f ma > > > And Applicative > > instance Applicative Temporal where > pure x = Temporal x [] > (<*>) = ap > > > But here is what I get > > *Main> (*) <$> exNat <*> ext2 > Temporal {td = 0, tc = [(2,10),(4,20),(6,30),(8,40),(10,50) ... > > This is NOT what I expected. Before I had a hand-crafted <*> function, and > this gave me > > *Main> (*) <$> exNat <*> ext2 > Temporal {td = 0, tc = [(2,10),(4,20),(5,0),(6,0),(8,0) ... > > You see the values all drop to zero beyond Time=5, because ext2 drops to > zero there and I am multiplying. > > Where do you think things went awry? Do you think its my tJoin function, > or is there something wrong in the way I > defined those typeclasses with respect to each other? Or did I voilate one > of the laws? How could I find out? > > > > > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From semen at trygub.com Thu Mar 26 22:24:44 2015 From: semen at trygub.com (Semen Trygubenko / =?utf-8?B?0KHQtdC80LXQvSDQotGA0LjQs9GD0LHQtdC9?= =?utf-8?B?0LrQvg==?=) Date: Thu, 26 Mar 2015 22:24:44 +0000 Subject: [Haskell-cafe] Haskell Weekly News: Issue 322 Message-ID: <20150326222444.GA91822@inanna.trygub.com> New Releases 99 Haskell: A web service by Bram Hoskin Solve live Haskell coding problems based on H-99 in the browser to strengthen your understanding of the language. http://www.99haskell.org/ https://github.com/bramgg/99haskell/ Magic Cookies A commercial Android game is released that is written in Haskell using SDL2 for multimedia and the Arrowized Functional Reactive Programming DSL Yampa. The authors had to "escape their functional comfort zones and come up with smarter abstractions that mutable reality and performance demand". The game consists of 2K lines of code, of which 1K is game specific and 400 are Yampa code. The most complex parts were certain Yampa constructs (arrow-based, with lots of tupling/untupling). http://keera.co.uk/blog/2015/03/19/magic-cookies-released-google-play/ https://play.google.com/store/apps/details?id=uk.co.keera.games.magiccookies https://github.com/keera-studios/keera-hails https://github.com/ivanperez-keera/Yampa Discussion Finding a GHC bug by Neil Mitchell A write up of the hunt for bug #10176 http://neilmitchell.blogspot.it/2015/03/finding-ghc-bug.html https://ghc.haskell.org/trac/ghc/ticket/10176 What are your most persuasive examples of using Quickcheck? Quickcheck helped many people in a number of areas ? compiler optimisations, date/time validation, regular expressions, encoding/decoding, topological sort, fuzzing HTTP APIs and even exhibiting classical voting paradox! Apart from the obvious benefit of helping to find big juicy bugs as well as valid but potentially harmless tiny bugs in edge cases that no-one cares about, Quickcheck can help attain enlightenment in the sense that spelling out Quickcheck properties in itself can be rewarding because this can reveal assumptions that have been made without realizing it. Roman Cheplyaka reminds us about SmallCheck and that it should be used instead of Quickcheck when one has a good idea about what depth is needed and when exhaustive search at that depth is affordable. https://www.reddit.com/r/haskell/comments/308ps6/what_are_your_most_persuasive_examples_of_using/ http://stackoverflow.com/questions/20092191/how-much-should-one-control-the-depth-parameter-in-smallcheck/20469204#20469204 What is the difference between free monads and free monoids? A comment by Edward Kmett. https://www.reddit.com/r/haskell/comments/2znhjk/what_is_the_difference_between_free_monads_and/ Type-Checked Pseudo-Code Tom Ashworth argues that Haskell is an excellent tool for fleshing out ideas and prototyping solutions, and that it makes one generalize and shake out many conceptual bugs before concepts become code. https://phuu.net/2015/03/24/type-checked-pseudo-code.html Where does GHC spend most of it's time during compilation? Optimisation and codegen, it seems. Also, GHC compilation times went up substantially from version 7.6 to 7.8. https://www.reddit.com/r/haskell/comments/309430/where_does_ghc_spend_most_of_its_time_during/ Quotes of the Week "Haskell doesn't feel like code. It feels like a language for thinking in: it's expressive, terse and simple, especially as type-checked pseudo-code." (Tom Ashworth) https://phuu.net/2015/03/24/type-checked-pseudo-code.html "Well that's not in the spec. If you want to change the requirements you have to renegotiate the contract =P" (sccrstud92) https://www.reddit.com/r/haskell/comments/2zxekg/while_learning_haskell_i_made_a_tool_for_learning/cpn6wnn "Unit tests are double entry bookkeeping" (EvanDaniel) https://www.reddit.com/r/haskell/comments/308ps6/what_are_your_most_persuasive_examples_of_using/cpr9wk2 augustss> "Well, type checking is worst case exponential?" barsoap> "Yep. That's also the reason why I don't really get the insistence of dependently-typed languages to have to be total at the type level: I don't care whether type-checking takes ten or infinitely many years, both figures are too large." https://www.reddit.com/r/haskell/comments/309430/where_does_ghc_spend_most_of_its_time_during/ "Our prophet Djistra said that a testing shows the presence, not the absence of bugs ? ? Today Djistra would have been stoned under a myriad of inutile unit tests that people perform for a sense of false security, in a sort of superstitious sacrificial ritual, a waste of time to convince himself and others that his software is right." (agocorona) https://www.reddit.com/r/haskell/comments/308ps6/what_are_your_most_persuasive_examples_of_using/cpq6j2k "You might also consider these sorts of infelicities as teachable moments" (ericpashman) https://www.reddit.com/r/haskell/comments/2zxekg/while_learning_haskell_i_made_a_tool_for_learning/cpnmybv "Nice gradual progression there. Big O notion, smoothly divided into 3 easy parts, then bam, Coyoneda. =) I approve. [Yes, I realize it is a bag of topics, not a course outline, but it still grabbed me.]" (edwardkmett) https://www.reddit.com/r/haskell/comments/2zqyes/we_released_a_video_library_about_functors/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: not available URL: From fumiexcel at gmail.com Fri Mar 27 04:03:04 2015 From: fumiexcel at gmail.com (Fumiaki Kinoshita) Date: Fri, 27 Mar 2015 13:03:04 +0900 Subject: [Haskell-cafe] ListT considered harmful Message-ID: It is well known that ListT m in transformers is not a monad unless the underlying monad is commutative. The fact that ListT is not a monad transformer is sufficient to remove it from the package, and several packages already defined their own ListT. Oughtn't we deprecate ListT or replace it by a correct one? -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Fri Mar 27 04:07:56 2015 From: michael at snoyman.com (Michael Snoyman) Date: Fri, 27 Mar 2015 04:07:56 +0000 Subject: [Haskell-cafe] ListT considered harmful In-Reply-To: References: Message-ID: I'm in favor of deprecation, but opposed to removing any time soon due to backwards compatibility concerns. On Fri, Mar 27, 2015 at 7:03 AM Fumiaki Kinoshita wrote: > It is well known that ListT m in transformers is not a monad unless the > underlying monad is commutative. The fact that ListT is not a monad > transformer is sufficient to remove it from the package, and several > packages already defined their own ListT. > > Oughtn't we deprecate ListT or replace it by a correct one? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lambda.fairy at gmail.com Fri Mar 27 05:36:35 2015 From: lambda.fairy at gmail.com (Chris Wong) Date: Fri, 27 Mar 2015 18:36:35 +1300 Subject: [Haskell-cafe] ListT considered harmful In-Reply-To: References: Message-ID: On Fri, Mar 27, 2015 at 5:07 PM, Michael Snoyman wrote: > I'm in favor of deprecation, but opposed to removing any time soon due to > backwards compatibility concerns. I agree. Given that we just deprecated ErrorT (which is both more popular, and does follow the monad laws) I think there is good reason to phase out transformers' ListT as well. I've attached a patch that adds the relevant pragma. I'm not familiar with darcs so excuse me if it's messed up :) libraries list and/or Ross Paterson, do you have anything to say about this issue? > On Fri, Mar 27, 2015 at 7:03 AM Fumiaki Kinoshita > wrote: >> >> It is well known that ListT m in transformers is not a monad unless the >> underlying monad is commutative. The fact that ListT is not a monad >> transformer is sufficient to remove it from the package, and several >> packages already defined their own ListT. >> >> Oughtn't we deprecate ListT or replace it by a correct one? >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- Chris Wong https://lambda.xyz -------------- next part -------------- New patches: [Deprecate Control.Monad.Trans.List Chris Wong **20150327045544 Ignore-this: 803a54f83f75fb1282172857c0451223 The ListT in this module is not a monad in the general case, requiring a tricky invariant (commutativity in the base monad) to use properly. There are plenty of packages which provide a "ListT done right", and we should encourage new users to depend on those instead. ] hunk ./Control/Monad/Trans/List.hs 20 -- which must be commutative. ----------------------------------------------------------------------------- -module Control.Monad.Trans.List ( +module Control.Monad.Trans.List + {-# DEPRECATED "Use the 'list-t' or 'pipes' packages instead" #-} + ( -- * The ListT monad transformer ListT(..), mapListT, Context: [move eq1, etc out of the classes Ross Paterson **20150325235706 Ignore-this: 23902fc2118e73528ef7d9b33dcd2410 ] [fix warnings Ross Paterson **20150325235322 Ignore-this: 5228163ad420d6b7befab60e7d572714 ] [instances of Eq2, Ord2, Read2 and Show2 Ross Paterson **20150325214456 Ignore-this: 394da2a95af800f78a602423da316e3d ] [switch liftings of Prelude classes to use explicit dictionaries Ross Paterson **20150325192309 Ignore-this: 8678c8c82d9d9ca34004a022d1d90f78 ] [fix foldr1/foldl1 for Backwards (spotted by Ryan Scott) Ross Paterson **20150324144124 Ignore-this: ac68e0a000afa5e9e48c405c0303f889 ] [TAG 0.4.3.0 Ross Paterson **20150308183108 Ignore-this: 1dec0ecddd2fdbfed11232edc4dd362e ] Patch bundle hash: 9c2ea89fbf6f1638d63ea4df165f40359c7cb94b From marat61 at gmail.com Fri Mar 27 07:04:29 2015 From: marat61 at gmail.com (=?UTF-8?B?0JfQsNC60LjRgNC+0LIg0JzQsNGA0LDRgg==?=) Date: Fri, 27 Mar 2015 10:04:29 +0300 Subject: [Haskell-cafe] DSL Message-ID: Hi folks! Are there any examples of Domain Specific Language (DSL) on Haskell? Thank you in advance. -- *Regards, Marat.* *? ????????? ?????.* -------------- next part -------------- An HTML attachment was scrubbed... URL: From tikhon at jelv.is Fri Mar 27 07:14:40 2015 From: tikhon at jelv.is (Tikhon Jelvis) Date: Fri, 27 Mar 2015 00:14:40 -0700 Subject: [Haskell-cafe] DSL In-Reply-To: References: Message-ID: Galois has released a few well-documented examples including Ivory[1], a language for safer systems programming and Cryptol[2], a language for specifying cryptographic algorithms. A couple of other low-level examples are Copilot[3] and Atom[4], both of which generate C for embedded programming but with somewhat different characteristics and aims. On a slightly different note, we have SBV[5] (SMT-based verification) which presents a high-level programming model for using multiple SMT solvers including the recently open-sourced Z3. All of these follow a pretty similar pattern in terms of letting you specify logic and generate code for it. A different sort of DSL can be found in various combinator libraries like Parsec[6] (for parsing) and the Wadler/Leijin Pretty Printer[7] for, well, pretty printing (ie the inverse of parsing). [1]: http://ivorylang.org/ivory-introduction.html [2]: https://galois.com/project/cryptol/ [3]: https://hackage.haskell.org/package/copilot [4]: https://hackage.haskell.org/package/atom [5]: https://hackage.haskell.org/package/sbv [6]: https://wiki.haskell.org/Parsec [7]: https://hackage.haskell.org/package/wl-pprint-1.0/docs/Text-PrettyPrint-Leijen.html On Fri, Mar 27, 2015 at 12:04 AM, ??????? ????? wrote: > Hi folks! > > Are there any examples of Domain Specific Language (DSL) on Haskell? Thank > you in advance. > > -- > > *Regards, Marat.* > *? ????????? ?????.* > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From austin at well-typed.com Fri Mar 27 07:43:48 2015 From: austin at well-typed.com (Austin Seipp) Date: Fri, 27 Mar 2015 02:43:48 -0500 Subject: [Haskell-cafe] ANNOUNCE: GHC version 7.10.1 Message-ID: ============================================================== The (Interactive) Glasgow Haskell Compiler -- version 7.10.1 ============================================================== The GHC Team is pleased to announce a new major release of GHC. There have been a number of significant changes since the last major release, including: * Several new language features and changes have been implemented: - Applicative is now a superclass of Monad and in the Prelude. - Many prelude combinators have been generalized - Static pointers * GHC now has preliminary and experimental support for DWARF based debugging. * `integer-gmp` has been completely rewritten. * Type-checking plugins can now extend the type checker. * Support for partial type signatures * Many bugfixes and other performance improvements. * Preliminary support for 'backpack' features like signatures. * Typeable is now generated by default for all data types automatically. We've also fixed a handful of issues reported since RC3: - A bug in the call arity analysis that would result in invalid core was fixed (#10176) - A bug in the Win32 package causing it to fail to load was fixed (#10165) - ghc-prim has (correctly) been bumped to version 0.4.0.0, to comply with the PVP. - Several libraries have been bumped to their latest available versions after coordination. The full release notes are here: https://downloads.haskell.org/~ghc/7.10.1/docs/html/users_guide/release-7-10-1.html How to get it ~~~~~~~~~~~~~ The easy way is to go to the web page, which should be self-explanatory: https://www.haskell.org/ghc/ We supply binary builds in the native package format for many platforms, and the source distribution is available from the same place. Packages will appear as they are built - if the package for your system isn't available yet, please try again later. Background ~~~~~~~~~~ Haskell is a standard lazy functional programming language. GHC is a state-of-the-art programming suite for Haskell. Included is an optimising compiler generating good code for a variety of platforms, together with an interactive system for convenient, quick development. The distribution includes space and time profiling facilities, a large collection of libraries, and support for various language extensions, including concurrency, exceptions, and foreign language interfaces (C, whatever). GHC is distributed under a BSD-style open source license. A wide variety of Haskell related resources (tutorials, libraries, specifications, documentation, compilers, interpreters, references, contact information, links to research groups) are available from the Haskell home page (see below). On-line GHC-related resources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Relevant URLs on the World-Wide Web: GHC home page http://www.haskell.org/ghc/ GHC developers' home page http://ghc.haskell.org/trac/ghc/ Haskell home page http://www.haskell.org/ Supported Platforms ~~~~~~~~~~~~~~~~~~~ The list of platforms we support, and the people responsible for them, is here: https://ghc.haskell.org/trac/ghc/wiki/Platforms https://ghc.haskell.org/trac/ghc/wiki/CodeOwners Ports to other platforms are possible with varying degrees of difficulty. The Building Guide describes how to go about porting to a new platform: https://ghc.haskell.org/trac/ghc/wiki/Building Developers ~~~~~~~~~~ We welcome new contributors. Instructions on accessing our source code repository, and getting started with hacking on GHC, are available from the GHC's developer's site run by Trac: https://ghc.haskell.org/trac/ghc/ Mailing lists ~~~~~~~~~~~~~ We run mailing lists for GHC users and bug reports; to subscribe, use the web interfaces at https://www.haskell.org/mailman/listinfo/glasgow-haskell-users https://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs There are several other haskell and ghc-related mailing lists on www.haskell.org; for the full list, see https://www.haskell.org/mailman/listinfo/ Some GHC developers hang out on #haskell on IRC, too: https://www.haskell.org/haskellwiki/IRC_channel Please report bugs using our bug tracking system. Instructions on reporting bugs can be found here: https://www.haskell.org/ghc/reportabug Hashes & Signatures ~~~~~~~~~~~~~~~~~ On https://downloads.haskell.org/~ghc/7.10.1/ you will find a signed copy of the SHA256 hashes for the tarballs, using my GPG key (0F8F 3AA9 9235 C704 ADA0 B419 B942 AEE5 3B58 D86F). -- Regards, Austin Seipp, Haskell Consultant Well-Typed LLP, http://www.well-typed.com/ From jan.stolarek at p.lodz.pl Fri Mar 27 08:21:09 2015 From: jan.stolarek at p.lodz.pl (Jan Stolarek) Date: Fri, 27 Mar 2015 09:21:09 +0100 Subject: [Haskell-cafe] ANNOUNCE: GHC version 7.10.1 In-Reply-To: References: Message-ID: <201503270921.10136.jan.stolarek@p.lodz.pl> Austin, links to x86_64 linux versions for CentOS don't work. Janek Dnia pi?tek, 27 marca 2015, Austin Seipp napisa?: > ============================================================== > The (Interactive) Glasgow Haskell Compiler -- version 7.10.1 > ============================================================== > > The GHC Team is pleased to announce a new major release of GHC. There > have been a number of significant changes since the last major > release, including: > > * Several new language features and changes have been implemented: > - Applicative is now a superclass of Monad and in the Prelude. > > - Many prelude combinators have been generalized > > - Static pointers > > * GHC now has preliminary and experimental support for DWARF based > debugging. > > * `integer-gmp` has been completely rewritten. > > * Type-checking plugins can now extend the type checker. > > * Support for partial type signatures > > * Many bugfixes and other performance improvements. > > * Preliminary support for 'backpack' features like signatures. > > * Typeable is now generated by default for all data types automatically. > > We've also fixed a handful of issues reported since RC3: > > - A bug in the call arity analysis that would result in invalid core > was fixed (#10176) > - A bug in the Win32 package causing it to fail to load was fixed > (#10165) - ghc-prim has (correctly) been bumped to version 0.4.0.0, to > comply with the PVP. > - Several libraries have been bumped to their latest available > versions after coordination. > > The full release notes are here: > > https://downloads.haskell.org/~ghc/7.10.1/docs/html/users_guide/release-7-1 >0-1.html > > > How to get it > ~~~~~~~~~~~~~ > > The easy way is to go to the web page, which should be self-explanatory: > > https://www.haskell.org/ghc/ > > We supply binary builds in the native package format for many > platforms, and the source distribution is available from the same > place. > > Packages will appear as they are built - if the package for your > system isn't available yet, please try again later. > > > Background > ~~~~~~~~~~ > > Haskell is a standard lazy functional programming language. > > GHC is a state-of-the-art programming suite for Haskell. Included is > an optimising compiler generating good code for a variety of > platforms, together with an interactive system for convenient, quick > development. The distribution includes space and time profiling > facilities, a large collection of libraries, and support for various > language extensions, including concurrency, exceptions, and foreign > language interfaces (C, whatever). GHC is distributed under a > BSD-style open source license. > > A wide variety of Haskell related resources (tutorials, libraries, > specifications, documentation, compilers, interpreters, references, > contact information, links to research groups) are available from the > Haskell home page (see below). > > > On-line GHC-related resources > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Relevant URLs on the World-Wide Web: > > GHC home page http://www.haskell.org/ghc/ > GHC developers' home page http://ghc.haskell.org/trac/ghc/ > Haskell home page http://www.haskell.org/ > > > Supported Platforms > ~~~~~~~~~~~~~~~~~~~ > > The list of platforms we support, and the people responsible for them, > is here: > > https://ghc.haskell.org/trac/ghc/wiki/Platforms > https://ghc.haskell.org/trac/ghc/wiki/CodeOwners > > Ports to other platforms are possible with varying degrees of > difficulty. The Building Guide describes how to go about porting to a > new platform: > > https://ghc.haskell.org/trac/ghc/wiki/Building > > > Developers > ~~~~~~~~~~ > > We welcome new contributors. Instructions on accessing our source > code repository, and getting started with hacking on GHC, are > available from the GHC's developer's site run by Trac: > > https://ghc.haskell.org/trac/ghc/ > > > Mailing lists > ~~~~~~~~~~~~~ > > We run mailing lists for GHC users and bug reports; to subscribe, use > the web interfaces at > > https://www.haskell.org/mailman/listinfo/glasgow-haskell-users > https://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs > > There are several other haskell and ghc-related mailing lists on > www.haskell.org; for the full list, see > > https://www.haskell.org/mailman/listinfo/ > > Some GHC developers hang out on #haskell on IRC, too: > > https://www.haskell.org/haskellwiki/IRC_channel > > Please report bugs using our bug tracking system. Instructions on > reporting bugs can be found here: > > https://www.haskell.org/ghc/reportabug > > > Hashes & Signatures > ~~~~~~~~~~~~~~~~~ > > On https://downloads.haskell.org/~ghc/7.10.1/ you will find a signed > copy of the SHA256 hashes for the tarballs, using my GPG key (0F8F > 3AA9 9235 C704 ADA0 B419 B942 AEE5 3B58 D86F). --- Politechnika ??dzka Lodz University of Technology Tre?? tej wiadomo?ci zawiera informacje przeznaczone tylko dla adresata. Je?eli nie jeste?cie Pa?stwo jej adresatem, b?d? otrzymali?cie j? przez pomy?k? prosimy o powiadomienie o tym nadawcy oraz trwa?e jej usuni?cie. This email contains information intended solely for the use of the individual to whom it is addressed. If you are not the intended recipient or if you have received this message in error, please notify the sender and delete it from your system. From michael at snoyman.com Fri Mar 27 09:01:25 2015 From: michael at snoyman.com (Michael Snoyman) Date: Fri, 27 Mar 2015 09:01:25 +0000 Subject: [Haskell-cafe] MinGHC for GHC 7.10.1 available Message-ID: I've just uploaded a new release of MinGHC, including GHC 7.10.1 and cabal-install 1.22.2.0. This release can be downloaded from: https://s3.amazonaws.com/download.fpcomplete.com/minghc/minghc-7.10.1-i386.exe In the process, I also needed to upload a cabal-install binary for Windows, which is available at: https://s3.amazonaws.com/download.fpcomplete.com/minghc/cabal-install-1.22.2.0-i386-unknown-mingw32.tar.gz I've tested this distribution, but only lightly. Feedback from others would be useful :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From R.Paterson at city.ac.uk Fri Mar 27 10:23:03 2015 From: R.Paterson at city.ac.uk (Ross Paterson) Date: Fri, 27 Mar 2015 10:23:03 +0000 Subject: [Haskell-cafe] ListT considered harmful In-Reply-To: References: Message-ID: <20150327102303.GA3707@city.ac.uk> On Fri, Mar 27, 2015 at 01:03:04PM +0900, Fumiaki Kinoshita wrote: > It is well known that ListT m in transformers is not a monad unless > the underlying monad is commutative. The fact that ListT is not a > monad transformer is sufficient to remove it from the package, and > several packages already defined their own ListT. > > Oughtn't we deprecate ListT or replace it by a correct one? This flaw is at least documented, and it does severely limit the usefulness of ListT. Deprecation seems reasonable, but we'd need to offer a replacement first. From bulat.ziganshin at gmail.com Fri Mar 27 13:54:24 2015 From: bulat.ziganshin at gmail.com (Bulat Ziganshin) Date: Fri, 27 Mar 2015 16:54:24 +0300 Subject: [Haskell-cafe] Terra language: Lua+LLVM JIT+multi-stage metaprogramming Message-ID: <497545615.20150327165424@gmail.com> Hello , http://terralang.org/ it doesn't have any relation to haskell, but i found it very interesting - it employs LLVM JIT to produce efficient code on the fly and can save it to .o files, and it's tightly integrated with Lua as metaprogramming language It has predecessors like template haskell, metalua, julia, ocamlp4, but all them lack either convenient multi-stage meta-programming, or efficency of low-level code -- Best regards, Bulat mailto:Bulat.Ziganshin at gmail.com From j.cretel at umail.ucc.ie Fri Mar 27 14:10:56 2015 From: j.cretel at umail.ucc.ie (Julien Cretel) Date: Fri, 27 Mar 2015 14:10:56 +0000 Subject: [Haskell-cafe] GSOC 2015 proposal: a standalone functional parser for CommonMark Message-ID: Dear Haskell-Cafe, This is very short notice, but here is a link to my proposal for this year's Google Summer of Code: https://gist.github.com/Jubobs/7a9298eeaf02bcefbc35 The goal of the project is to produce a standalone, pure-Haskell library for parsing CommonMark, the updated Markdown specification. Here is a link to the corresponding trac ticket, along with a link to a relevant Google-Groups discussion involving John MacFarlane and Matthew Pickering: https://ghc.haskell.org/trac/summer-of-code/ticket/1660 https://groups.google.com/forum/#!topic/pandoc-discuss/xZrf-dL0ZPs Should you have any comments, suggestions, corrections, etc... before the submission deadline, feel free to chime in. All the best, Julien From whosekiteneverfly at gmail.com Fri Mar 27 14:30:36 2015 From: whosekiteneverfly at gmail.com (Yuji Yamamoto) Date: Fri, 27 Mar 2015 23:30:36 +0900 Subject: [Haskell-cafe] DSL In-Reply-To: References: Message-ID: Check out relational-record . You can write type-checked SQLs in Haskell with it. 2015-03-27 16:04 GMT+09:00 ??????? ????? : > Hi folks! > > Are there any examples of Domain Specific Language (DSL) on Haskell? Thank > you in advance. > > -- > > *Regards, Marat.* > *? ????????? ?????.* > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- ???? twitter: @igrep Facebook: http://www.facebook.com/igrep Google+: https://plus.google.com/u/0/+YujiYamamoto_igrep -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabian.orccon at pucp.pe Fri Mar 27 14:40:17 2015 From: fabian.orccon at pucp.pe (CESAR FABIAN ORCCON CHIPANA) Date: Fri, 27 Mar 2015 09:40:17 -0500 Subject: [Haskell-cafe] I need feedback: Create a function which makes a relation between types and functions. Message-ID: Good morning (afternoon, evening) This is one of my proposals. http://cfoch-dev.tumblr.com/post/114756897282/create-a-function-which-makes-a-relation-between I hope you can give me your feedback. Thanks so much. -- ------------------------------------ Fabi?n Orcc?n (cfoch) http://cfoch.tumblr.com http://cfoch-art.tumblr.com http://cfoch-dev.tumblr.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabian.orccon at pucp.pe Fri Mar 27 14:45:21 2015 From: fabian.orccon at pucp.pe (CESAR FABIAN ORCCON CHIPANA) Date: Fri, 27 Mar 2015 09:45:21 -0500 Subject: [Haskell-cafe] I need your feedback (GSoC): Analyzing stock market in Haskell Message-ID: Hello This is my second proposal. It would be really useful for me to read your comments about this proposal. http://cfoch-dev.tumblr.com/post/114754745097/analyzing-stock-market-in-haskell Thanks, Fabi?n Orcc?n -- ------------------------------------ Fabi?n Orcc?n (cfoch) http://cfoch.tumblr.com http://cfoch-art.tumblr.com http://cfoch-dev.tumblr.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From clintonmead at gmail.com Fri Mar 27 19:07:01 2015 From: clintonmead at gmail.com (Clinton Mead) Date: Sat, 28 Mar 2015 06:07:01 +1100 Subject: [Haskell-cafe] Information about "definitive-base" prelude replacement Message-ID: I've played around a bit with "classy-prelude", but recently I stumbled into "definitive-base", on hackage here - https://hackage.haskell.org/package/definitive-base. The documentation is sparse, but there's some brief information here: https://marc.coiffier.net/projects/definitive-framework.html It looks interesting, but I was wondering if anyone has used it as a replacement prelude, and perhaps written/blogged on it? I'm just looking for a bit of a primer I guess. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mantkiew at gsd.uwaterloo.ca Fri Mar 27 19:30:09 2015 From: mantkiew at gsd.uwaterloo.ca (Michal Antkiewicz) Date: Fri, 27 Mar 2015 15:30:09 -0400 Subject: [Haskell-cafe] DSL In-Reply-To: References: Message-ID: Hi, A very nice example is Lucid for generating HTML: https://github.com/chrisdone/lucid It's noteworthy how Chris nicely handles optionality of attributes. Michal On Fri, Mar 27, 2015 at 3:04 AM, ??????? ????? wrote: > Hi folks! > > Are there any examples of Domain Specific Language (DSL) on Haskell? Thank > you in advance. > > -- > > *Regards, Marat.* > *? ????????? ?????.* > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From serg.foo at gmail.com Sat Mar 28 13:00:08 2015 From: serg.foo at gmail.com (Sergey Vinokurov) Date: Sat, 28 Mar 2015 15:00:08 +0200 Subject: [Haskell-cafe] DSL In-Reply-To: References: Message-ID: Hi, You may find out FPF, the DSL for describing exotic financial contracts, interesting. There's somewhat detailed paper http://arbitrary.name/papers/fpf.pdf. Also there're less detailed slides http://www.timphilipwilliams.com/slides/HaskellAtBarclays.pdf which have more general info on EDSLs in Haskell. On Fri, Mar 27, 2015 at 9:04 AM, ??????? ????? wrote: > Hi folks! > > Are there any examples of Domain Specific Language (DSL) on Haskell? Thank > you in advance. > > -- > Regards, Marat. > ? ????????? ?????. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From mike at proclivis.com Sat Mar 28 17:37:38 2015 From: mike at proclivis.com (Michael Jones) Date: Sat, 28 Mar 2015 11:37:38 -0600 Subject: [Haskell-cafe] Command Line Args passed to wxHaskell In-Reply-To: <74A243CD-6996-4864-8C80-4F4B065D682D@proclivis.com> References: <74A243CD-6996-4864-8C80-4F4B065D682D@proclivis.com> Message-ID: <729CDC80-3355-48EE-BD95-B15FC854ED13@proclivis.com> I found a solution to this, not a good one, but gets around the problem. I compiled wxWidgets after a tweak to msw/Main.cpp. const wxChar *cmdLine = ::GetCommandLine(); was changed to: const wxChar *cmdLine = NULL; This precludes passing any args to wxWidgets at startup, but at least the app runs. In the long run it would help if wxHaskell stripped the RTS parameters, and then give the application some control over which args are passed to wxWidgets. (Assuming there is no way to do that today that I am unaware of.) Compiling wxWidgets worked more or less like the docs on the web, but I did have to be careful with paths because the make was picking up the gcc in the Haskell tree. So I had to hack my path temporarily when compiling wxWidgets. Having to deal with wxc.dll in a sandbox is a bit of a pain. I copied it to Windows/System32 as a hack. Is there a trick that would tell the wxHaskell app to add the sandbox dir to the DLL search so that things behaved more like Linux? Mike On Mar 24, 2015, at 9:20 PM, Michael Jones wrote: > I am seeing strange behavior with a wxHaskell app compiled on Windows 7. > > On Linux, all is well. I can call my app like: > > app +RTS -N4 -RTS myArg > > And in the app I can process the myArg and start a wxHaskell frame. > > When I compile the same application on Windows 7, I get an error dialog box that says: > > ?Unexpected parameter `+RTS`. And a second Usage dialog that looks like it comes from wxHaskell. > > I am not sure why Windows is different, but perhaps it is the fact that on Windows 7 I compiled up wxHaskell 0.92, and on Linux I used 0.91 from a cabal update. I used 0.92 on on Windows because I could not get 0.91 to compile due to some type problems where the wxPack version was incompatible with a header file and the Haskell compiler related to 64 bit types long long. There is some noise about this on the web, but no solutions. > > Nonetheless, I assume that args are grabbed directly by wxHaskell and Environment.getArgs does not consume them such that they are still available to wxHaskell. > > Is there some way to consume arguments so they are no longer available or a way to modify them so that when wxHaskell starts up it sees arguments I can control in code? > > In wx there is an API to set arguments, but it does not seem to be part of wxHaskell. So I think I need something I can do outside the wxHaskell API. > > Mike > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From jeffbrown.the at gmail.com Sun Mar 29 00:31:15 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Sat, 28 Mar 2015 17:31:15 -0700 Subject: [Haskell-cafe] cabal install wx failures Message-ID: Hi, I switched OSs to change other problems and in the process lost wxHaskell. The first time I tried to add it to my new system, cabal install wx gave me more output, installing a lot of things. Since then it has only given this: jeff at linux-ee07:~> cabal install wx Resolving dependencies... [1 of 1] Compiling Main ( /tmp/wxc-0.91.0.0-16672/wxc-0.91.0.0/Setup.hs, /tmp/wxc-0.91.0.0-16672/wxc-0.91.0.0/dist/setup/Main.o ) Linking /tmp/wxc-0.91.0.0-16672/wxc-0.91.0.0/dist/setup/setup ... Configuring wxc-0.91.0.0... Warning: No config found to match: /usr/bin/wx-config --version=2.9 --version-full in /usr/lib64/wx/config If you require this configuration, please install the desired library build. If this is part of an automated configuration test and no other errors occur, you may safely ignore it. You may use wx-config --list to see all configs available in the default prefix. readProcess failed: readProcess: wx-config "--version=2.9" "--version-full" (exit 1): failed Configuring wxc to build against wxWidgets 3.0.2.0 Building wxc /usr/bin/gcc -Wl,--hash-size=31 -Wl,--reduce-memory-overheads -Wl,--disable-new-dtags -Isrc/include -I/usr/include/wx-3.0 -I/usr/lib64/wx/include/gtk3-unicode-3.0 -D__WXGTK__ -DWXUSINGDLL -DwxDEBUG_LEVEL=0 -D_FILE_OFFSET_BITS=64 -DwxcREFUSE_MEDIACTRL -fPIC -c src/cpp/apppath.cpp -o dist/build/src/cpp/apppath.o gcc: error trying to exec 'cc1plus': execvp: No such file or directory Failed to install wxc-0.91.0.0 cabal: Error: some packages failed to install: wx-0.91.0.0 depends on wxc-0.91.0.0 which failed to install. wxc-0.91.0.0 failed during the building phase. The exception was: ExitFailure 1 wxcore-0.91.0.0 depends on wxc-0.91.0.0 which failed to install. jeff at linux-ee07:~> The file /usr/bin/wx-config exists. It may have gotten there today when I installed some wx packages via zypper (because I use openSuse). I don't remember which, but in the wx-configg file appear these lines: this_version="3.0" [ -z "$output_option_release" ] || echo "3.0" [ -z "$output_option_version" ] || echo "3.0.2" [ -z "$output_option_version_full" ] || echo "3.0.2.0" so I believe the version of wx I have is 3.0.2.0. I'm running OpenSuse 13.2 on a Lenovo Thinkpad Edge 535 or 545. Thanks, Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Sun Mar 29 01:35:03 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Sat, 28 Mar 2015 18:35:03 -0700 Subject: [Haskell-cafe] cabal install wx failures In-Reply-To: References: Message-ID: I realized this should be on haskell-beginners, not haskell-cafe, so I reposted there. Sorry. On Sat, Mar 28, 2015 at 5:31 PM, Jeffrey Brown wrote: > Hi, > > I switched OSs to change other problems and in the process lost wxHaskell. > > The first time I tried to add it to my new system, cabal install wx gave > me more output, installing a lot of things. Since then it has only given > this: > > jeff at linux-ee07:~> cabal install wx > Resolving dependencies... > [1 of 1] Compiling Main ( > /tmp/wxc-0.91.0.0-16672/wxc-0.91.0.0/Setup.hs, > /tmp/wxc-0.91.0.0-16672/wxc-0.91.0.0/dist/setup/Main.o ) > Linking /tmp/wxc-0.91.0.0-16672/wxc-0.91.0.0/dist/setup/setup ... > Configuring wxc-0.91.0.0... > > Warning: No config found to match: > /usr/bin/wx-config --version=2.9 --version-full > in /usr/lib64/wx/config > If you require this configuration, please install > the desired > library build. If this is part of an automated > configuration > test and no other errors occur, you may safely > ignore it. > You may use wx-config --list to see all configs > available in > the default prefix. > > readProcess failed: readProcess: wx-config "--version=2.9" > "--version-full" (exit 1): failed > Configuring wxc to build against wxWidgets 3.0.2.0 > > Building wxc > /usr/bin/gcc -Wl,--hash-size=31 -Wl,--reduce-memory-overheads > -Wl,--disable-new-dtags -Isrc/include -I/usr/include/wx-3.0 > -I/usr/lib64/wx/include/gtk3-unicode-3.0 -D__WXGTK__ -DWXUSINGDLL > -DwxDEBUG_LEVEL=0 -D_FILE_OFFSET_BITS=64 -DwxcREFUSE_MEDIACTRL -fPIC -c > src/cpp/apppath.cpp -o dist/build/src/cpp/apppath.o > gcc: error trying to exec 'cc1plus': execvp: No such file or directory > Failed to install wxc-0.91.0.0 > cabal: Error: some packages failed to install: > wx-0.91.0.0 depends on wxc-0.91.0.0 which failed to install. > wxc-0.91.0.0 failed during the building phase. The exception was: > ExitFailure 1 > wxcore-0.91.0.0 depends on wxc-0.91.0.0 which failed to install. > jeff at linux-ee07:~> > > The file /usr/bin/wx-config exists. It may have gotten there today when I > installed some wx packages via zypper (because I use openSuse). I don't > remember which, but in the wx-configg file appear these lines: > > this_version="3.0" > [ -z "$output_option_release" ] || echo "3.0" > [ -z "$output_option_version" ] || echo "3.0.2" > [ -z "$output_option_version_full" ] || echo "3.0.2.0" > > so I believe the version of wx I have is 3.0.2.0. > > I'm running OpenSuse 13.2 on a Lenovo Thinkpad Edge 535 or 545. > > Thanks, > Jeff > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Sun Mar 29 09:33:38 2015 From: michael at snoyman.com (Michael Snoyman) Date: Sun, 29 Mar 2015 09:33:38 +0000 Subject: [Haskell-cafe] LTS Haskell 2.0: Last call Message-ID: This is the last announcement about the upcoming LTS 2 release, which is schedule for this Wednesday, April 1 (no joke). For those unfamiliar with the process: we will essentially be taking that day's Stackage Nightly and promoting it to LTS 2, and locking down the major versions of all packages in that package set until LTS 3. If you'd like to get any additional packages in, please send your pull requests now[1]. I'd also like to call attention to the current upper bounds issues[2]. If we can get any of these issues resolved before Wednesday, then newer versions of the relevant packages can make it into LTS 2. Otherwise, LTS 2 will continue with the old versions. (Alternatively, we can consider dropping the packages with restrictive upper bounds, if there's demand to do so.) Things worth pointing out: * primitive 0.6 is out, and introduces very minimal breaking changes. If you can get your packages to support the new version (likely with just a cabal file change), that would be great. * criterion 1.1 is out. I may simply disable benchmarks on the relevant users to allow the new version to slip in. * QuickCheck 2.8 would be a nice addition * lens 4.8 is blocked on a number of diagrams-* packages and a few others. I have no idea how complicated the changes are there. * blaze-builder 0.4 is blocked by snap, and unlikely to unblock in time, which likely means we'll have two ByteString Builder variants for this release * wizards depends on an old control-monad-free Thanks for everybody's participation! [1] https://github.com/fpco/stackage#get-your-package-included [2] https://github.com/fpco/stackage/issues?q=is%3Aopen+is%3Aissue+label%3Abounds -------------- next part -------------- An HTML attachment was scrubbed... URL: From goodingm at gmail.com Sun Mar 29 16:07:50 2015 From: goodingm at gmail.com (htebalaka) Date: Sun, 29 Mar 2015 09:07:50 -0700 (MST) Subject: [Haskell-cafe] Information about "definitive-base" prelude replacement In-Reply-To: References: Message-ID: <1427645270539-5767851.post@n5.nabble.com> I haven't used it before, but it looks like it redefines a number of existing typeclasses to make its own hierarchy, which I don't think will interoperate with other libraries that still depend on the standard implementations. Clinton Mead wrote > I've played around a bit with "classy-prelude", but recently I stumbled > into "definitive-base", on hackage here - > https://hackage.haskell.org/package/definitive-base. > The documentation is sparse, but there's some brief information here: > > https://marc.coiffier.net/projects/definitive-framework.html > > It looks interesting, but I was wondering if anyone has used it as a > replacement prelude, and perhaps written/blogged on it? I'm just looking > for a bit of a primer I guess. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@ > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -- View this message in context: http://haskell.1045720.n5.nabble.com/Information-about-definitive-base-prelude-replacement-tp5767780p5767851.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. From mietek at bak.io Sun Mar 29 18:15:25 2015 From: mietek at bak.io (=?iso-8859-1?Q?Mi=EBtek_Bak?=) Date: Sun, 29 Mar 2015 19:15:25 +0100 Subject: [Haskell-cafe] OS X build of GHC 7.10.1 In-Reply-To: References: Message-ID: An OS X build of GHC 7.10.1 is now available, thanks to Mark Lentczner. I?ve mirrored the build in Halcyon public storage: https://halcyon.global.ssl.fastly.net/original/ghc-7.10.1-x86_64-apple-darwin.tar.bz2 A binary build of GHC 7.10.1, repackaged with documentation removed, is also available in Halcyon ? on OS X and Linux. https://halcyon.sh -- Mi?tek https://mietek.io On 2015-03-23, at 14:28, Mi?tek Bak wrote: > An OS X build of GHC 7.10.1-rc3 is now available, courtesy of Mark Lentczner. This is in addition to the GHC 7.8.4 and 7.10.1-rc2 builds Mark has made available on February 2. Thanks, Mark. > > > GHC 7.8.4 for OS X can already be downloaded from haskell.org, even though it?s not mentioned on the GHC 7.8.4 webpage: > https://downloads.haskell.org/~ghc/7.8.4/ghc-7.8.4-x86_64-apple-darwin.tar.xz > > > To avoid running up Mark?s bandwidth bill, I?m omitting the URL to his staging area. I?ve mirrored all three builds in Halcyon public storage: > > 7.8.4: > https://halcyon.global.ssl.fastly.net/original/ghc-7.8.4-x86_64-apple-darwin.tar.xz > > 7.10.1-rc2: > https://halcyon.global.ssl.fastly.net/original/ghc-7.10.0.20150123-x86_64-apple-darwin.tar.bz2 > > 7.10.1-rc3: > https://halcyon.global.ssl.fastly.net/original/ghc-7.10.0.20150316-x86_64-apple-darwin.tar.bz2 > > > Binary builds of GHC, repackaged with documentation removed, are also available in Halcyon ? on OS X 10.10, 10.9, 10.8, and a considerable number of Linux distributions. > > This includes GHC 7.10.1-rc3, 7.10.1-rc2, 7.8.4, 7.8.3, 7.8.2, 7.6.3, 7.6.1, 7.4.2, 7.2.2, and 7.0.4. > > Using Halcyon, installing GHC together with cabal-install is expected to take 20-30 seconds: > https://halcyon.sh/tutorial/#install-ghc-and-cabal > > > -- > Mi?tek > https://mietek.io > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4203 bytes Desc: not available URL: From omari at smileystation.com Sun Mar 29 22:09:53 2015 From: omari at smileystation.com (Omari Norman) Date: Sun, 29 Mar 2015 18:09:53 -0400 Subject: [Haskell-cafe] [announce] pipes-cliff - library for streaming to and from processes with Pipes Message-ID: Sometimes you have to write Haskell code to interact with external processes. What a bother. The System.Process module makes it easy to send data in and out, but what if you want to stream your data in constant time and space? Then you need to cobble together your own solution using the provided Handles. Or you can use pipes-cliff, which lets you use the excellent Pipes library to stream your data in and out. Some simple examples in the package get you started. https://hackage.haskell.org/package/pipes-cliff Also, take a look at the README.md file, which lists some similar packages. Maybe one of those will work better for you. https://github.com/massysett/pipes-cliff/blob/master/README.md -------------- next part -------------- An HTML attachment was scrubbed... URL: From winterkoninkje at gmail.com Mon Mar 30 00:49:32 2015 From: winterkoninkje at gmail.com (wren romano) Date: Sun, 29 Mar 2015 20:49:32 -0400 Subject: [Haskell-cafe] ANN: logfloat 0.13.3 Message-ID: -------------------------------------------- -- logfloat 0.13.3 -------------------------------------------- This package provides a type for storing numbers in the log-domain, primarily useful for preventing underflow when multiplying many probabilities as in HMMs and other probabilistic models. The package also provides modules for dealing with floating numbers correctly. This version drops support for Hugs and GHC < 7.8. Nothing major has changed, so they should still work; it's just that they're no longer officially supported. Thus, this version of the library provides a transitional point between backwards compatability and adding new features (see below). -------------------------------------------- -- Changes since 0.12.1 (2010-03-19) -------------------------------------------- * Monomorphized logFloat, logToLogFloat, fromLogFloat, and logFromLogFloat: that is, they all take/return Double now. The change was made to help reduce the need for explicit type signatures. It shouldn't really affect most users, since it seems noone was really making use of the polymorphism provided by previous versions. To get the previous behavior back, just explicitly add calls to realToFrac wherever necessary. * Fixed some instances to get them to compile under the new role-based type system of GHC 7.10 * Cleaned up various extraneous rewrite rules, specializations, etc * Added the functions sum, product, and pow. Both sum and product preserve more precision than the fold-based definitions in the Prelude. Moreover, sum is _much_ faster than the Prelude version, since it only requires crossing the log/exp boundary n+1 times, instead of 2*(n-1) times. The only downside is that sum requires two passes over the input and thus is not amenable to list fusion. -------------------------------------------- -- Upcoming changes (0.14+) -------------------------------------------- * Since the Data.Number.RealToFrac module is no longer required by any of the others, it will probably be forked off to a separate package in order to improve portability of the rest of the package by removing the need for MPTCs. * There's long been clamoring for adding a vector:Data.Vector.Unboxed.Unbox instance. I've been reluctant to add such an instance due to wanting to retain backwards compatibility and portability. Having dropped support for Hugs and older versions of GHC, I'm now willing to add them in. The logfloat library is conceptually quite simple, and thus to whatever extent possible I'd still like to retain portability to non-GHC compilers. So if you are interested in using logfloat with another compiler/interpreter but run into problems (e.g., due to the type families required by the vector library), please get in touch and I'll try to get things to work. -------------------------------------------- -- Compatibility / Portability -------------------------------------------- The package is compatible with GHC 7.8.3 and 7.10.1. It may still compile with older versions of GHC (or even Hugs!), however they are no longer officially supported. The package is not compatible with nhc98 and Yhc because Data.Number.RealToFrac uses MPTCs. However, that module is no longer required by any others, and all the other modules should be compatible with these compilers. Thus, it should be fairly easy to port. If you do so, please let me know and I'll try to incorporate support for them. -------------------------------------------- -- Links -------------------------------------------- Homepage: http://code.haskell.org/~wren/ Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/logfloat Darcs: http://code.haskell.org/~wren/logfloat/ Haddock (Darcs version): http://code.haskell.org/~wren/logfloat/dist/doc/html/logfloat/ -- Live well, ~wren From winterkoninkje at gmail.com Mon Mar 30 00:58:09 2015 From: winterkoninkje at gmail.com (wren romano) Date: Sun, 29 Mar 2015 20:58:09 -0400 Subject: [Haskell-cafe] ANN: stm-chans 3.0.0.3 Message-ID: -------------------------------------------- -- stm-chans 3.0.0.3 -------------------------------------------- The stm-chans package offers a collection of channel types, similar to Control.Concurrent.STM.{TChan,TQueue} but with additional features. -------------------------------------------- -- Changes since 3.0.0 (2013-05-29) -------------------------------------------- Cleaned up the header gunk to compile cleanly under GHC 7.10. No actual code has been altered. -------------------------------------------- -- Long description -------------------------------------------- In particular stm-chans offers the following data types: * Control.Concurrent.STM.TBChan: Bounded FIFO channels. When the channel is full, writers will block/retry. This ensures that the writers do not get too far ahead of the readers, which helps to make sure that memory and cpu resources are used responsibly. * Control.Concurrent.STM.TMChan: Closeable FIFO channels. * Control.Concurrent.STM.TMQueue: Closeable FIFO queues. Like TChan (Maybe a) but with a monotonicity guarantee that once Nothing is returned all future reads will be Nothing as well. * Control.Concurrent.STM.TBMChan: Bounded Closeable FIFO channels. * Control.Concurrent.STM.TBMQueue: Bounded Closeable FIFO queues. Combines the capabilities of TBChan and TMChan. -------------------------------------------- -- Links -------------------------------------------- Homepage: http://code.haskell.org/~wren/ Hackage: http://hackage.haskell.org/package/stm-chans Darcs: http://community.haskell.org/~wren/stm-chans Haddock (Darcs version): http://community.haskell.org/~wren/stm-chans/dist/doc/html/stm-chans -- Live well, ~wren From winterkoninkje at gmail.com Mon Mar 30 01:12:48 2015 From: winterkoninkje at gmail.com (wren romano) Date: Sun, 29 Mar 2015 21:12:48 -0400 Subject: [Haskell-cafe] ANN: unification-fd 0.10.0 Message-ID: -------------------------------------------- -- unification-fd 0.10.0 -------------------------------------------- The unification-fd package offers generic functions for single-sorted first-order structural unification (think of programming in Prolog, or of the metavariables in type inference)[1][2]. The library *is* sufficient for implementing higher-rank type systems a la [Peyton Jones, Vytiniotis, Weirich, Shields], but bear in mind that unification variables are the metavariables of type inference--- not the type-variables. As of this version, the library is also sufficient for implementing (non-recursive) feature structure unification. An effort has been made to make the package as portable as possible. However, because it uses the ST monad and the mtl-2 package it can't be H98 nor H2010. However, it only uses the following common extensions which should be well supported[3]: Rank2Types MultiParamTypeClasses FunctionalDependencies -- Alas, necessary for type inference FlexibleContexts -- Necessary for practical use of MPTCs FlexibleInstances -- Necessary for practical use of MPTCs UndecidableInstances -- For Show instances due to two-level types -------------------------------------------- -- Changes since 0.8.0 (2012-07-11) -------------------------------------------- * (0.8.1) Added Functor, Foldable, and Traversable instances for COntrol.Unification.Types.UnificationFailure. Thanks Graham Rogers. * (0.9.0) Changed the fundeps on BindingMonad and RankedBindingMonad so that things compule under GHC 7.8.2 * (0.9.0) eta-expanded the rewrite rules in Data.Functor.Fixedpoint so that GHC 7.8 no longer gives warnings about not firing due to (.) possibly being inlined first * Cleaned things up to compile cleanly for GHC 7.10 * For EitherK and MaybeK, liberalized the instances to only require Applicative instead of Monad wherever possible. * Completely revamped the old UnificationFailure data type as the new UFailure data type and Fallible type class. This was necessary to clean up some deprecation warnings about using Control.Monad.Error, to remove the hack of needing an UnknownError constructor, and to make the data type for representing failures more extensible. -------------------------------------------- -- Description -------------------------------------------- The unification API is generic in the type of the structures being unified and in the implementation of unification variables, following the two-level types pearl of Sheard (2001). This style mixes well with Swierstra (2008), though an implementation of the latter is not included in this package. That is, all you have to do is define the functor whose fixed-point is the recursive type you're interested in: -- The non-recursive structure of terms data S a = ... -- The recursive term type type Term = Fix S And then provide an instance for Unifiable, where zipMatch performs one level of equality testing for terms and returns the one-level spine filled with pairs of subterms to be recursively checked, or Nothing if this level doesn't match. Each subterm can be separately marked as being resolved, Left xy, or as requiring further unification, Right(x,y). class (Traversable t) => Unifiable t where zipMatch :: t a -> t a -> Maybe (t (Either a (a, a))) The choice of which variable implementation to use is defined by similarly simple classes Variable and BindingMonad. We store the variable bindings in a monad, for obvious reasons. In case it's not obvious, see Dijkstra et al. (2008) for benchmarks demonstrating the cost of naively applying bindings eagerly. There are currently two implementations of variables provided: one based on STRefs, and another based on a state monad carrying an IntMap. The former has the benefit of O(1) access time, but the latter is plenty fast and has the benefit of supporting backtracking. Backtracking itself is provided by the logict package and is described in Kiselyov et al. (2005). In addition to this modularity, unification-fd implements a number of optimizations over the algorithm presented in Sheard (2001)--- which is also the algorithm presented in Cardelli (1987). * Their implementation uses path compression, which we retain. Though we modify the compression algorithm in order to make sharing observable. * In addition, we perform aggressive opportunistic observable sharing, a potentially novel method of introducing even more sharing than is provided by the monadic bindings. Basically, we make it so that we can use the observable sharing provided by the modified path compression as much as possible (without introducing any new variables). * And we remove the notoriously expensive occurs-check, replacing it with visited-sets (which detect cyclic terms more lazily and without the asymptotic overhead of the occurs-check). A variant of unification which retains the occurs-check is also provided, in case you really need to fail fast. * Finally, a highly experimental branch of the API performs *weighted* path compression, which is asymptotically optimal. Unfortunately, the current implementation is quite a bit uglier than the unweighted version, and I haven't had a chance to perform benchmarks to see how the constant factors compare. Hence moving it to an experimental branch. These optimizations pass a test suite for detecting obvious errors. If you find any bugs, do be sure to let me know. Also, if you happen to have a test suite or benchmark suite for unification on hand, I'd love to get a copy. -------------------------------------------- -- Notes and limitations -------------------------------------------- [1] At present the library does not appear amenable for implementing higher-rank unification itself; i.e., for higher-ranked metavariables, or higher-ranked logic programming. To be fully general we'd have to abstract over which structural positions are co/contravariant, whether the unification variables should be predicative or impredicative, as well as the isomorphisms of moving quantifiers around. It's on my todo list, but it's certainly non-trivial. If you have any suggestions, feel free to contact me. [2] At present it is only suitable for single-sorted (aka untyped) unification, a la Prolog. In the future I aim to support multi-sorted (aka typed) unification, however doing so is complicated by the fact that it can lead to the loss of MGUs; so it will likely be offered as an alternative to the single-sorted variant, similar to how the weighted path-compression is currently offered as an alternative. [3] With the exception of fundeps which are notoriously difficult to implement. However, they are supported by Hugs and GHC 6.6, so I don't feel bad about requiring them. Once the API stabilizes a bit more I plan to release a unification-tf package which uses type families instead, for those who feel type families are easier to implement or use. There have been a couple requests for unification-tf, so I've bumped it up on my todo list. -------------------------------------------- -- References -------------------------------------------- Luca Cardelli (1987) /Basic polymorphic typechecking/. Science of Computer Programming, 8(2):147--172. Atze Dijkstra, Arie Middelkoop, S. Doaitse Swierstra (2008) /Efficient Functional Unification and Substitution/, Technical Report UU-CS-2008-027, Utrecht University. Simon Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, Mark Shields /Practical type inference for arbitrary-rank types/, to appear in the Journal of Functional Programming. (Draft of 31 July 2007.) Oleg Kiselyov, Chung-chieh Shan, Daniel P. Friedman, and Amr Sabry (2005) /Backtracking, Interleaving, and/ /Terminating Monad Transformers/, ICFP. Tim Sheard (2001) /Generic Unification via Two-Level Types/ /and Paramterized Modules/, Functional Pearl, ICFP. Tim Sheard & Emir Pasalic (2004) /Two-Level Types and/ /Parameterized Modules/. JFP 14(5): 547--587. This is an expanded version of Sheard (2001) with new examples. Wouter Swierstra (2008) /Data types a la carte/, Functional Pearl. JFP 18: 423--436. -------------------------------------------- -- Links -------------------------------------------- Homepage: http://code.haskell.org/~wren/ Hackage: http://hackage.haskell.org/package/unification-fd Darcs: http://community.haskell.org/~wren/unification-fd Haddock (Darcs version): http://community.haskell.org/~wren/unification-fd/dist/doc/html/unification-fd -- Live well, ~wren From sol at typeful.net Mon Mar 30 04:04:35 2015 From: sol at typeful.net (Simon Hengel) Date: Mon, 30 Mar 2015 12:04:35 +0800 Subject: [Haskell-cafe] RFC: rewrite-with-location proposal In-Reply-To: References: <20131202220625.GA6022@x200> <59543203684B2244980D7E4057D5FBC1486E0A24@DB3EX14MBXC308.europe.corp.microsoft.com> Message-ID: <20150330040435.GA22872@x200> Hi Evan, On Wed, Feb 04, 2015 at 04:10:56PM -0800, Evan Laforge wrote: > On Wed, Feb 4, 2015 at 3:51 PM, Eric Seidel wrote: > > Yep, my original motivation was getting access to source locations > > within embedded DSLs. The call-stack is a nice and easy extension, but > > I'm not sure how useful it will be in practice, as the first function > > that doesn't request a CallStack parameter will cut off the stack. This > > means that the generated stacks will often be quite short, I imagine. > > Well, as I said, all I really care about is the direct caller. From > the example in the commit, it looks like the function with the (?x :: > Location) annotation can get its immediate caller, even if that caller > doesn't have the annotation. If that's true, that's all that is > needed! I completely agree with you. Logging and failing test cases where my main motivation when I looked at the problem domain (even though I still think the situation with error/undefined is unfortunate too). > And from my point of view, it's not just "maybe useful in practice", > but absolutely required, to the point where I wrote a custom > preprocessor for it. I've been using it for 6 or 7 years and I sort > of forgot that other people don't have it. I actually have no idea > how other people do logging... just hope the message is unique and > grep -n all the time? And for tests, manually give every single > assertion a unique name and grep -n again? hspec-discover adds heuristic source locations by now (without really parsing any Haskell code, so it's pretty robust, worst case is you don't get a source location). This is on a spec item (== test case) granularity. I still want proper source locations, so that we can attach them to individual expectations/assertions. > Enable TH globally? For logging-facade I added a TH version, but I don't really like it. And again, I'm super eager to use proper source locations here, once the patch got merged! > I don't think it needs to be used at all in the standard libraries, > since logging and testing are not part of base. I can understand if > the merge window for 7.10 is closed, but trying to come up with a use > in base shouldn't hold it up! As you argued in a later mail, I would be in favor of using it for all partial functions in base, too (but we may want to spend some time looking at how list fusion may be affected). But I think it makes sense to treat this as two separate discussions. Hopefully we get this patch merged ASAP, then we can still discuss to what extend we want to use it in base. Cheers, Simon [1] http://hackage.haskell.org/package/logging-facade-0.0.0/docs/System-Logging-Facade-TH.html From aldodavide at gmx.com Mon Mar 30 04:05:59 2015 From: aldodavide at gmx.com (Aldo Davide) Date: Mon, 30 Mar 2015 06:05:59 +0200 Subject: [Haskell-cafe] Is it possible for cabal sandboxes to use $HOME/.cabal/lib? Message-ID: Hi all, There are some packages that I use again and again and I would like to install them once (but not in a system-wide location) and then have cabal sandboxes use that install, instead of installing them in every sandbox, which is time consuming. Is there a way do that? For example, I noticed that cabal, when operating inside a sandbox, can still find the packages installed system-wide, but not the ones in $HOME/.cabal/lib. Can I change that? Thanks From whosekiteneverfly at gmail.com Mon Mar 30 04:48:36 2015 From: whosekiteneverfly at gmail.com (Yuji Yamamoto) Date: Mon, 30 Mar 2015 13:48:36 +0900 Subject: [Haskell-cafe] Is it possible for cabal sandboxes to use $HOME/.cabal/lib? In-Reply-To: References: Message-ID: Hi Aldo, Maybe what you want to do is "cabal sandbox init --sandbox=$HOME/.cabal/lib/". Specify "--sandbox=" option. 2015-03-30 13:05 GMT+09:00 Aldo Davide : > Hi all, > > There are some packages that I use again and again and I would like to > install them once (but not in a system-wide location) and then have cabal > sandboxes use that install, instead of installing them in every sandbox, > which is time consuming. Is there a way do that? For example, I noticed > that cabal, when operating inside a sandbox, can still find the packages > installed system-wide, but not the ones in $HOME/.cabal/lib. Can I change > that? > > Thanks > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- ???? twitter: @igrep Facebook: http://www.facebook.com/igrep Google+: https://plus.google.com/u/0/+YujiYamamoto_igrep -------------- next part -------------- An HTML attachment was scrubbed... URL: From aldodavide at gmx.com Mon Mar 30 05:02:47 2015 From: aldodavide at gmx.com (Aldo Davide) Date: Mon, 30 Mar 2015 07:02:47 +0200 Subject: [Haskell-cafe] Is it possible for cabal sandboxes to use $HOME/.cabal/lib? In-Reply-To: References: , Message-ID: An HTML attachment was scrubbed... URL: From michael at snoyman.com Mon Mar 30 05:33:51 2015 From: michael at snoyman.com (Michael Snoyman) Date: Mon, 30 Mar 2015 05:33:51 +0000 Subject: [Haskell-cafe] Generalizing "unlift" functions with monad-control Message-ID: I'm trying to extract an "unlift" function from monad-control, which would allow stripping off a layer of a transformer stack in some cases. It's easy to see that this works well for ReaderT, e.g.: {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} import Control.Monad.Trans.Control import Control.Monad.Trans.Reader newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n b } askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) askRun = liftWith (return . Unlift) The reason this works is that the `StT` associated type for `ReaderT` just returns the original type, i.e. `type instance StT (ReaderT r) m a = a`. In theory, we should be able to generalize `askRun` to any transformer for which that applies. However, I can't figure out any way to express that generalized type signature in a way that GHC accepts it. It seems like the following should do the trick: askRunG :: ( MonadTransControl t , Monad m , b ~ StT t b ) => t m (Unlift t) askRunG = liftWith (return . Unlift) However, I get the following error message when trying this: foo.hs:11:12: Occurs check: cannot construct the infinite type: b0 ~ StT t b0 The type variable ?b0? is ambiguous In the ambiguity check for the type signature for ?askRunG?: askRunG :: forall (t :: (* -> *) -> * -> *) (m :: * -> *) b. (MonadTransControl t, Monad m, b ~ StT t b) => t m (Unlift t) To defer the ambiguity check to use sites, enable AllowAmbiguousTypes In the type signature for ?askRunG?: askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) => t m (Unlift t) Adding AllowAmbiguousTypes to the mix provides: foo.hs:17:30: Could not deduce (b1 ~ StT t b1) from the context (MonadTransControl t, Monad m, b ~ StT t b) bound by the type signature for askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) => t m (Unlift t) at foo.hs:(12,12)-(16,25) ?b1? is a rigid type variable bound by the type forall (n1 :: * -> *) b2. Monad n1 => t n1 b2 -> n1 (StT t b2) at foo.hs:1:1 Expected type: Run t -> Unlift t Actual type: (forall (n :: * -> *) b. Monad n => t n b -> n b) -> Unlift t Relevant bindings include askRunG :: t m (Unlift t) (bound at foo.hs:17:1) In the second argument of ?(.)?, namely ?Unlift? In the first argument of ?liftWith?, namely ?(return . Unlift)? I've tested with both GHC 7.8.4 and 7.10.1. Any suggestions? -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Mon Mar 30 06:40:55 2015 From: fa-ml at ariis.it (Francesco Ariis) Date: Mon, 30 Mar 2015 08:40:55 +0200 Subject: [Haskell-cafe] Index for local documentation is incomplete Message-ID: <20150330064055.GA8514@x60s.casa> Dear Haskellers, I have a problem with local haddock documentation. Specifically, the documentation gets built but the index.html is not updated. As an example, here is the bottom part of the log of a package I installed a few days ago: > Haddock coverage: > 100% ( 6 / 6) in 'System.FilePath.Manip' > 100% ( 7 / 7) in 'System.FilePath.GlobPattern' > 100% ( 2 / 2) in 'System.FilePath.Glob' > 65% ( 41 / 63) in 'System.FilePath.Find' > Documentation created: dist/doc/html/filemanip/index.html > Creating package registration file: /tmp/pkgConf-filemanip-0.3.66815.3 > Installing library in > /home/user/.cabal/lib/i386-linux-ghc-7.8.3/filemanip-0.3.6.3 > Registering filemanip-0.3.6.3... The documentation files are present in ~/.cabal/share/doc/i386-linux-ghc-7.8.3/filemanip-0.3.6.3/html/index.html but when if I open `~/.cabal/share/doc/index.html`, there is no `System.FilePath.Find` module. cabal version is 1.22.0.0, GHC 7.8.3 Any idea on how to diagnose this? From oleg at okmij.org Mon Mar 30 07:28:07 2015 From: oleg at okmij.org (oleg at okmij.org) Date: Mon, 30 Mar 2015 03:28:07 -0400 (EDT) Subject: [Haskell-cafe] Terra language: Lua+LLVM JIT+multi-stage metaprogramming Message-ID: <20150330072807.34CBCC382B@www1.g3.pair.com> Bulat Ziganshin wrote: > It has predecessors like template haskell, metalua, julia, ocamlp4, > but all them lack either convenient multi-stage meta-programming, or > efficency of low-level code You have omitted MetaOCaml. One may argue about the convenience of MetaOCaml but one has to acknowledge that it is the typed and hygienic staged language. (The TExp subset of the new TH is typed and hygienic, but it does not permit any effects in the generator, which are often necessary). As to low level, it turns out relatively straightforward to interface MetaOCaml with LLVM, so that OCaml becomes a very powerful, typed and hygienic ``macro language'' for LLVM. From fa-ml at ariis.it Mon Mar 30 10:03:14 2015 From: fa-ml at ariis.it (Francesco Ariis) Date: Mon, 30 Mar 2015 12:03:14 +0200 Subject: [Haskell-cafe] Index for local documentation is incomplete In-Reply-To: <20150330064055.GA8514@x60s.casa> References: <20150330064055.GA8514@x60s.casa> Message-ID: <20150330100314.GB29543@x60s.casa> On Mon, Mar 30, 2015 at 08:40:55AM +0200, Francesco Ariis wrote: > Dear Haskellers, > I have a problem with local haddock documentation. Specifically, the > documentation gets built but the index.html is not updated. [...] I nuked ~/.cabal and installed ghc 7.8.4 With cabal 1.22.2.0 everything seems back to normal, with only the path for the index file changing ~/.cabal/share/doc/i386-linux-ghc-7.8.4/index.html From mrz.vtl at gmail.com Mon Mar 30 14:18:02 2015 From: mrz.vtl at gmail.com (Maurizio Vitale) Date: Mon, 30 Mar 2015 07:18:02 -0700 Subject: [Haskell-cafe] preprocessing and Parsec Message-ID: G'day, I'm implementing a parser for a language that has a preprocessor. It has `include, `ifdef..`else..`endif, `define and uses of the `defined fragments, which are also prefixed by '`'. I can think of two ways of doing this: a preprocess :: Stream->Stream (for String, Text, ByteString) or processing preprocessor directives as part of the"whitespace skipping" at begin of file and after each token. The first one seems cleaner/easier (and also allow parsers not to require a (restricted) IO monad for reading files). The second one, seems to make easier to give nice error messages (in the separate preprocessor way, you can add something like #line to tell where inclusions came from, but you cannot easily do this for macro replacement). My eventual goal is to give clang-like error messages with macro expansion backtrace. Any recommendations? pointers to examples of parsec-based parsers that have a pre-processing step? Thanks, Maurizio -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at functionaljobs.com Mon Mar 30 16:00:01 2015 From: sean at functionaljobs.com (Functional Jobs) Date: Mon, 30 Mar 2015 12:00:01 -0400 Subject: [Haskell-cafe] New Functional Programming Job Opportunities Message-ID: <55197303a6b23@functionaljobs.com> Here are some functional programming job opportunities that were posted recently: Full-stack Software Engineer at Capital Match http://functionaljobs.com/jobs/8802-full-stack-software-engineer-at-capital-match Cheers, Sean Murphy FunctionalJobs.com From byorgey at gmail.com Mon Mar 30 16:16:29 2015 From: byorgey at gmail.com (Brent Yorgey) Date: Mon, 30 Mar 2015 16:16:29 +0000 Subject: [Haskell-cafe] linear: instance Additive (Point f) ?? In-Reply-To: References: <95F6AB79-7A0C-4BE0-879A-509DD0C5F170@cis.upenn.edu> Message-ID: Sorry for the delay in responding. I am not sure what it would mean to multiply matrices where one or both dimensions are given by Points. Indeed, such things seem very strange, precisely because Points are not additive. I am certainly in favor of removing the instance, and I doubt anyone will miss being able to make Point-structured matrices. -Brent On Wed, Mar 18, 2015 at 1:23 PM Edward Kmett wrote: > On Tue, Mar 17, 2015 at 10:41 PM, Brent Yorgey wrote: > >> I have EXACTLY the same question. We recently switched from vector-space >> to linear for diagrams. There are quite a lot of reasons why this works >> really well for us. But I was very sad to find that we can now add points, >> which indeed we do not want to be able to do. At least there are still >> different types for points and vectors, which allows transformations like >> 'translate' to act on them differently, which I actually find to be much >> more critical from a correctness point of view. >> >> I have had a brief explanation, but I forget the exact details. >> Something about 'Additive' not really being about 'additive groups' but >> instead being a superclass of Applicative. I remember being convinced at >> least that it's a "pick your poison" sort of choice, i.e. removing the >> Additive instance for Point would make certain other things ugly/annoying. >> Hopefully someone else can chime in with more detail. >> >> > The name Additive is a bit of a misnomer, like you said. The real reason > it exists is to support matrix operations on both sparse/dense matrices. > > Matrix multiplication looks like: > > (!*!) :: (Functor m, Foldable t, Additive t, Additive n, Num a) => m (t > a) -> t (n a) -> m (n a) > > Without that instance you'd be unable to build matrices with Point's as > one or both of the dimensions, which are intended to transform points. > > If we can decide that that doesn't make sense (as after all points aren't > additive), so such matrices _are_ kinda weird, we can remove the instance. > > I'm happy to bend the way Point works, as I stick to the projective > machinery almost exclusively, myself. > > Thoughts? > > -Edward > > On Tue, Mar 17, 2015 at 5:47 PM Richard Eisenberg > wrote: > >> Hi caf?, >>> >>> I'm in the middle of responding to https://github.com/goldfirere/ >>> units/pull/45 and trying to learn the `linear` package, which I have >>> yet to use. >>> >>> I have what may be a basic question: why is there an `instance Additive >>> f => Additive (Point f)` (in the Affine module)? It would seem that the >>> whole point of Point is that it is *not* Additive. We don't want to add >>> Points! >>> >>> Could someone enlighten me? >>> >>> Thanks! >>> Richard >>> >>> PS: Of course, this instance is directly hurting my use of the package. >>> But it is hurting my understanding of the package, because it disagrees >>> with the mental model I've built up of the definitions. >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicola.gigante at gmail.com Mon Mar 30 17:00:39 2015 From: nicola.gigante at gmail.com (Nicola Gigante) Date: Mon, 30 Mar 2015 19:00:39 +0200 Subject: [Haskell-cafe] Enforcing data structures invariant in the type system Message-ID: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> Hi all. I?m very interested in what can be done with Haskell?s type system regarding the enforcing of algorithms and data structures invariants. For example, I remember I saw a paper about an implementation of a red-black tree in Haskell where the types guaranteed the invariant about the alternation of rad and black nodes. I would like to learn those techniques, in particular the use of language features that enable this kind of things and then how to do them in practice. In the past tried hacking something with GADTs and Data Kinds but I've always got stuck with GHC errors that I could not understand, so I think I?m missing something. Where could I start from? Are there simple walk-through examples and/or fundational material? For example is it possible to write a sorting function that guarantees in the types that the output is sorted? I don?t need this specific example but you got the point. Thank you very much, Nicola From marcin.jan.mrotek at gmail.com Mon Mar 30 17:14:13 2015 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Mon, 30 Mar 2015 19:14:13 +0200 Subject: [Haskell-cafe] Enforcing data structures invariant in the type system In-Reply-To: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> References: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> Message-ID: Hello, First of all, if you don't mind me not answering your question directly, I'd strongly suggest learning Agda or Idris before you start using dependent types in Haskell. (for example try the first two tutorials from here: http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.Othertutorials) These are true dependently typed languages, and while GHC's extensions can get Haskell remarkably close, the result is still somewhat clunky. IMHO learning the basics in a cleaner environment is going to be much easier. Secondly, have a look at Liquid Haskell: http://ucsd-progsys.github.io/liquidhaskell-tutorial/01-intro.html Refinement types are a restricted kind of dependent types that can be solved automagically by SMT solvers. Thirdly, as for your actual question, have a look at this series of tutorials: https://www.fpcomplete.com/user/konn/prove-your-haskell-for-great-safety/dependent-types-in-haskell Best regards, Marcin Mrotek From ollie at ocharles.org.uk Mon Mar 30 17:17:35 2015 From: ollie at ocharles.org.uk (Oliver Charles) Date: Mon, 30 Mar 2015 18:17:35 +0100 Subject: [Haskell-cafe] Enforcing data structures invariant in the type system In-Reply-To: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> References: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> Message-ID: You're in the right ballpark that's for sure - and your experience with hard-to-decode error messages is not a new one either! Haskell is somewhat "experiemental" in this domain, as its only now starting to learn the features necessary to do what you want to do. I think some of the best work to learn the latest techniques is described here: https://github.com/jstolarek/dep-typed-wbl-heaps-hs -- ocharles On Mon, Mar 30, 2015 at 6:00 PM, Nicola Gigante wrote: > Hi all. > > I?m very interested in what can be done with Haskell?s type system > regarding > the enforcing of algorithms and data structures invariants. > > For example, I remember I saw a paper about an implementation of a > red-black > tree in Haskell where the types guaranteed the invariant about the > alternation of > rad and black nodes. > > I would like to learn those techniques, in particular the use of language > features that > enable this kind of things and then how to do them in practice. > In the past tried hacking something with GADTs and Data Kinds but I've > always > got stuck with GHC errors that I could not understand, so I think I?m > missing something. > > Where could I start from? Are there simple walk-through examples and/or > fundational > material? For example is it possible to write a sorting function that > guarantees in the types > that the output is sorted? I don?t need this specific example but you got > the point. > > Thank you very much, > Nicola > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicola.gigante at gmail.com Mon Mar 30 17:23:54 2015 From: nicola.gigante at gmail.com (Nicola Gigante) Date: Mon, 30 Mar 2015 19:23:54 +0200 Subject: [Haskell-cafe] Enforcing data structures invariant in the type system In-Reply-To: References: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> Message-ID: > Il giorno 30/mar/2015, alle ore 19:14, Marcin Mrotek ha scritto: > > Hello, > Hi! > First of all, if you don't mind me not answering your question > directly, I'd strongly suggest learning Agda or Idris before you start > using dependent types in Haskell. (for example try the first two > tutorials from here: > http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.Othertutorials) > These are true dependently typed languages, and while GHC's extensions > can get Haskell remarkably close, the result is still somewhat clunky. > IMHO learning the basics in a cleaner environment is going to be much > easier. > I appreciate this suggestion! Agda has been on the todo list for a while. Which do you suggest to start from, choosing between agda and idris? Are there any major differences? > Secondly, have a look at Liquid Haskell: > http://ucsd-progsys.github.io/liquidhaskell-tutorial/01-intro.html > Refinement types are a restricted kind of dependent types that can be > solved automagically by SMT solvers. > I?ve read a paper about liquid haskell some time ago and I find it amazing. What I?d like to ask now is: is liquid haskell strictly more expressive than the haskell type system or is ?only? a more convenient way of writing the constraints in a way that can be efficiently solved? > Thirdly, as for your actual question, have a look at this series of > tutorials: https://www.fpcomplete.com/user/konn/prove-your-haskell-for-great-safety/dependent-types-in-haskell > Thank you! Those are exactly the droids I was looking for. > Best regards, > Marcin Mrotek Greetings, Nicola From nicola.gigante at gmail.com Mon Mar 30 17:27:10 2015 From: nicola.gigante at gmail.com (Nicola Gigante) Date: Mon, 30 Mar 2015 19:27:10 +0200 Subject: [Haskell-cafe] Enforcing data structures invariant in the type system In-Reply-To: References: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> Message-ID: <590C1233-233E-432D-8444-0C4C401DF2B8@gmail.com> > Il giorno 30/mar/2015, alle ore 19:17, Oliver Charles ha scritto: > > You're in the right ballpark that's for sure - and your experience with hard-to-decode error messages is not a new one either! Haskell is somewhat "experiemental" in this domain, as its only now starting to learn the features necessary to do what you want to do. > Having some compilers background I understand very well the difficulties in making sensible error messages, especially when dealing with such advanced features. The point was more that I don?t know the basics on how those features work (and what is involved in the job of the type checker) so I can?t even parse what GHC try to tell me (skolem what?). > I think some of the best work to learn the latest techniques is described here: https://github.com/jstolarek/dep-typed-wbl-heaps-hs > Thank you that looks very useful! > -- ocharles Greetings, Nicola -------------- next part -------------- An HTML attachment was scrubbed... URL: From yongqli at kerrmetric.com Mon Mar 30 17:32:12 2015 From: yongqli at kerrmetric.com (Yongqian Li) Date: Mon, 30 Mar 2015 10:32:12 -0700 Subject: [Haskell-cafe] GHC 7.10.1 on OS X Message-ID: Does anyone know how to resolve this issue? When I do a "cabal build", I get error: unknown directive .macosx_version_min 10, 0 ^ : Error running clang! you need clang installed to use theLLVM backend (or GHC tried to execute clang incorrectly) : ghc: phase `Clang (Assembler)' failed (exitcode = 1) However, my clang is fine, as is my LLVM: % clang --version Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) Target: x86_64-apple-darwin14.1.0 Thread model: posix % opt --version LLVM (http://llvm.org/): LLVM version 3.5.1 Optimized build with assertions. Built Jan 15 2015 (18:24:46). Default target: x86_64-apple-darwin14.1.0 Host CPU: core-avx2 From dominic at steinitz.org Mon Mar 30 17:37:45 2015 From: dominic at steinitz.org (Dominic Steinitz) Date: Mon, 30 Mar 2015 18:37:45 +0100 Subject: [Haskell-cafe] Parallel Profiling Message-ID: <0CD0B231-DF22-4D83-8334-E44540D1993E@steinitz.org> Does anyone know of any tools for analysing parallel program performance? I am trying to use threadscope but it keeps crashing with my 100M log file and ghc-events-analyze is not going to help as I have many hundreds of threads all carrying out the same computation. I think I?d like a library that would allow me to construct my own analyses rather than display them via GTK. There is ghc-events but that seems to be just for parsing the logs and I couldn?t find anything that used it in the way I would like to (apart from threadscope and ghc-events-analyze of course). Thanks Dominic Steinitz dominic at steinitz.org http://idontgetoutmuch.wordpress.com From ekmett at gmail.com Mon Mar 30 18:02:20 2015 From: ekmett at gmail.com (Edward Kmett) Date: Mon, 30 Mar 2015 14:02:20 -0400 Subject: [Haskell-cafe] linear: instance Additive (Point f) ?? In-Reply-To: References: <95F6AB79-7A0C-4BE0-879A-509DD0C5F170@cis.upenn.edu> Message-ID: Then, tentatively, I'll file an issue and make the change for next time we push out linear. -Edward On Mon, Mar 30, 2015 at 12:16 PM, Brent Yorgey wrote: > Sorry for the delay in responding. I am not sure what it would mean to > multiply matrices where one or both dimensions are given by Points. > Indeed, such things seem very strange, precisely because Points are not > additive. I am certainly in favor of removing the instance, and I doubt > anyone will miss being able to make Point-structured matrices. > > -Brent > > > On Wed, Mar 18, 2015 at 1:23 PM Edward Kmett wrote: > >> On Tue, Mar 17, 2015 at 10:41 PM, Brent Yorgey wrote: >> >>> I have EXACTLY the same question. We recently switched from >>> vector-space to linear for diagrams. There are quite a lot of reasons why >>> this works really well for us. But I was very sad to find that we can now >>> add points, which indeed we do not want to be able to do. At least there >>> are still different types for points and vectors, which allows >>> transformations like 'translate' to act on them differently, which I >>> actually find to be much more critical from a correctness point of view. >>> >>> I have had a brief explanation, but I forget the exact details. >>> Something about 'Additive' not really being about 'additive groups' but >>> instead being a superclass of Applicative. I remember being convinced at >>> least that it's a "pick your poison" sort of choice, i.e. removing the >>> Additive instance for Point would make certain other things ugly/annoying. >>> Hopefully someone else can chime in with more detail. >>> >>> >> The name Additive is a bit of a misnomer, like you said. The real reason >> it exists is to support matrix operations on both sparse/dense matrices. >> >> Matrix multiplication looks like: >> >> (!*!) :: (Functor m, Foldable t, Additive t, Additive n, Num a) => m (t >> a) -> t (n a) -> m (n a) >> >> Without that instance you'd be unable to build matrices with Point's as >> one or both of the dimensions, which are intended to transform points. >> >> If we can decide that that doesn't make sense (as after all points aren't >> additive), so such matrices _are_ kinda weird, we can remove the instance. >> >> I'm happy to bend the way Point works, as I stick to the projective >> machinery almost exclusively, myself. >> >> Thoughts? >> >> -Edward >> >> On Tue, Mar 17, 2015 at 5:47 PM Richard Eisenberg >> wrote: >> >>> Hi caf?, >>>> >>>> I'm in the middle of responding to https://github.com/goldfirere/ >>>> units/pull/45 and trying to learn the `linear` package, which I have >>>> yet to use. >>>> >>>> I have what may be a basic question: why is there an `instance Additive >>>> f => Additive (Point f)` (in the Affine module)? It would seem that the >>>> whole point of Point is that it is *not* Additive. We don't want to add >>>> Points! >>>> >>>> Could someone enlighten me? >>>> >>>> Thanks! >>>> Richard >>>> >>>> PS: Of course, this instance is directly hurting my use of the package. >>>> But it is hurting my understanding of the package, because it disagrees >>>> with the mental model I've built up of the definitions. >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank at fstaals.net Mon Mar 30 18:28:39 2015 From: frank at fstaals.net (Frank Staals) Date: Mon, 30 Mar 2015 20:28:39 +0200 Subject: [Haskell-cafe] Enforcing data structures invariant in the type system In-Reply-To: <590C1233-233E-432D-8444-0C4C401DF2B8@gmail.com> (Nicola Gigante's message of "Mon, 30 Mar 2015 19:27:10 +0200") References: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> <590C1233-233E-432D-8444-0C4C401DF2B8@gmail.com> Message-ID: Nicola Gigante writes: >> Il giorno 30/mar/2015, alle ore 19:17, Oliver Charles ha scritto: >> >> You're in the right ballpark that's for sure - and your experience with >> hard-to-decode error messages is not a new one either! Haskell is somewhat >> "experiemental" in this domain, as its only now starting to learn the >> features necessary to do what you want to do. >> > > Having some compilers background I understand very well the difficulties in making sensible error messages, > especially when dealing with such advanced features. The point was more that I don?t know the basics on > how those features work (and what is involved in the job of the type checker) so I can?t even parse what > GHC try to tell me (skolem what?). > >> I think some of the best work to learn the latest techniques is described >> here: https://github.com/jstolarek/dep-typed-wbl-heaps-hs >> >> > Thank you that looks very useful! > >> -- ocharles > > Greetings, > Nicola > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Stephanie Stephanie Weirich gave an invited talk about maintaining color and height invariants for Red-Black trees at ICFP this year [1]. Connor McBride had a talk and paper about also maintinging order invariants [2]. You might want to have a look at them. As for getting used to the error messages. I think the only way to learn is to get your hands dirty yourself. I can highly reccommend also just doing the red-black trees yourself. Getting insertions to work is not too difficult. Deletions are a bit harder. I also did so some time ago [3] (before seeing the ICFP talk even; I found it very cool that I had pretty much the same solution :)). Regards, [1] https://www.youtube.com/watch?v=rhWMhTjQzsU&index=22&list=PL4UWOFngo5DVBqifWX6ZlXJ7idxWaOP69 [2] https://www.youtube.com/watch?v=pNBPCnZEdSs [3] http://fstaals.net/RedBlackTree.html -- - Frank From rasen.dubi at gmail.com Mon Mar 30 18:42:05 2015 From: rasen.dubi at gmail.com (Alexey Shmalko) Date: Mon, 30 Mar 2015 21:42:05 +0300 Subject: [Haskell-cafe] Is it possible for cabal sandboxes to use $HOME/.cabal/lib? In-Reply-To: References: Message-ID: Hi all, Not sure, but is this possible to copy your home cabal sandbox to ./.cabal-sandbox? Then you'll have all your default packages available and won't build them again. On Mon, Mar 30, 2015 at 8:02 AM, Aldo Davide wrote: > Hi Yuji, > > The --sandbox option is used to specify the sandbox location. I want my > sandbox to be in ./.cabal-sandbox, i.e. the default location. > > To clarify, I want to be able to create multiple independent sandboxes, > that take advantage of the packages installed in $HOME/.cabal, just like > how they take advantage of the system-wide install packages. > > *Sent:* Monday, March 30, 2015 at 5:48 AM > *From:* "Yuji Yamamoto" > *To:* "Aldo Davide" > *Cc:* "Haskell Cafe" > *Subject:* Re: [Haskell-cafe] Is it possible for cabal sandboxes to use > $HOME/.cabal/lib? > Hi Aldo, > > Maybe what you want to do is "cabal sandbox init > --sandbox=$HOME/.cabal/lib/". > Specify "--sandbox=" option. > > 2015-03-30 13:05 GMT+09:00 Aldo Davide : >> >> Hi all, >> >> There are some packages that I use again and again and I would like to >> install them once (but not in a system-wide location) and then have cabal >> sandboxes use that install, instead of installing them in every sandbox, >> which is time consuming. Is there a way do that? For example, I noticed >> that cabal, when operating inside a sandbox, can still find the packages >> installed system-wide, but not the ones in $HOME/.cabal/lib. Can I change >> that? >> >> Thanks >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > > -- > ???? > twitter: @igrep > Facebook: http://www.facebook.com/igrep > Google+: https://plus.google.com/u/0/+YujiYamamoto_igrep > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rasen.dubi at gmail.com Mon Mar 30 18:49:15 2015 From: rasen.dubi at gmail.com (Alexey Shmalko) Date: Mon, 30 Mar 2015 21:49:15 +0300 Subject: [Haskell-cafe] GHC 7.10.1 on OS X In-Reply-To: References: Message-ID: Hello, Yongqian, Can you give more info on the problem? Which package are you trying to build? Can you also include output of cabal build -v3. Regards, Alexey On Mon, Mar 30, 2015 at 8:32 PM, Yongqian Li wrote: > Does anyone know how to resolve this issue? When I do a "cabal build", I > get > > error: unknown directive > .macosx_version_min 10, 0 > ^ > > : > Error running clang! you need clang installed to use theLLVM backend > (or GHC tried to execute clang incorrectly) > > : > ghc: phase `Clang (Assembler)' failed (exitcode = 1) > > > > However, my clang is fine, as is my LLVM: > > % clang --version > Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) > Target: x86_64-apple-darwin14.1.0 > Thread model: posix > > > % opt --version > LLVM (http://llvm.org/): > LLVM version 3.5.1 > Optimized build with assertions. > Built Jan 15 2015 (18:24:46). > Default target: x86_64-apple-darwin14.1.0 > Host CPU: core-avx2 > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marcin.jan.mrotek at gmail.com Mon Mar 30 19:01:43 2015 From: marcin.jan.mrotek at gmail.com (Marcin Mrotek) Date: Mon, 30 Mar 2015 21:01:43 +0200 Subject: [Haskell-cafe] Enforcing data structures invariant in the type system In-Reply-To: References: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> Message-ID: Hello, > I appreciate this suggestion! > Agda has been on the todo list for a while. Which do you suggest to start > from, choosing between agda and idris? Are there any major differences? I admit I only have experience in using Agda, I've name-checked Idris after only reading the docs (the last time I tried to install the compiler, cabal didn't let mi do it because of package conflits; now I tried again and it's doing just fine). Idris is newer and, apparently, more oriented towards practical programming than theorem proving, that's all I know. > I?ve read a paper about liquid haskell some time ago and I find it amazing. > What I?d like to ask now is: is liquid haskell strictly more expressive than the > haskell type system or is ?only? a more convenient way of writing the constraints > in a way that can be efficiently solved? It depends on what you mean by "Haskell's type system". It's more capable than Haskell's type system without extensions, and less than full-on dependent typing (delibrately so, because dependent type equivalence is undecidable). I don't know where exactly does Haskell-with-GHC-extensions type system lie. I think it's the same as, let's say, Agda's, only requiring more kludges when moving back and forth between type- and value-level, but I'm not sure. I'm just a "self"-taught programmer, not a computer scientist ;) Best regards, Marcin Mrotek From allbery.b at gmail.com Mon Mar 30 19:11:10 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 30 Mar 2015 15:11:10 -0400 Subject: [Haskell-cafe] Is it possible for cabal sandboxes to use $HOME/.cabal/lib? In-Reply-To: References: Message-ID: On Mon, Mar 30, 2015 at 2:42 PM, Alexey Shmalko wrote: > Not sure, but is this possible to copy your home cabal sandbox to > ./.cabal-sandbox? Then you'll have all your default packages available and > won't build them again. > You'd need to fix paths in the package database and `cabal hc-pkg recache` (if that works; might need cabal exec). -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Mon Mar 30 19:42:16 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Mon, 30 Mar 2015 21:42:16 +0200 Subject: [Haskell-cafe] Generalizing "unlift" functions with monad-control In-Reply-To: References: Message-ID: Hi Michael, The problem seems to be that the constraint you want isn't (b ~ StT t b) for some specific b, you want (forall b. b ~ StT t b). It's not possible to say this directly, but after some trying I got something ugly that works. Perhaps it can be the inspiration for something nicer? {-# LANGUAGE RankNTypes #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE ScopedTypeVariables #-} import Control.Monad.Trans.Control import Control.Monad.Trans.Reader newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n b } newtype ForallStId t = ForallStId (forall a. StTEq t a) data StTEq (t :: (* -> *) -> * -> *) a where StTEq :: a ~ StT t a => StTEq t a askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) askRun = liftWith (return . Unlift) askRunG :: forall t m. ( MonadTransControl t , Monad m ) => ForallStId t -> t m (Unlift t) askRunG x = liftWith $ \runT -> return $ Unlift ( (case x of ForallStId (StTEq :: StTEq t b) -> runT) :: forall b n. Monad n => t n b -> n b ) askRun' :: Monad m => ReaderT r m (Unlift (ReaderT r)) askRun' = askRunG (ForallStId StTEq) The constraints package allows you to define Forall constraints, but that needs something of kind (* -> Constraint) and I can't figure out how to get something like (b ~ StT t b) in that form: we don't have 'data constraints'. Hope this helps you along, and please let me know if you find a nicer way to do this. Regards, Erik On Mon, Mar 30, 2015 at 7:33 AM, Michael Snoyman wrote: > I'm trying to extract an "unlift" function from monad-control, which would > allow stripping off a layer of a transformer stack in some cases. It's easy > to see that this works well for ReaderT, e.g.: > > {-# LANGUAGE RankNTypes #-} > {-# LANGUAGE TypeFamilies #-} > import Control.Monad.Trans.Control > import Control.Monad.Trans.Reader > > newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n b } > > askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) > askRun = liftWith (return . Unlift) > > The reason this works is that the `StT` associated type for `ReaderT` just > returns the original type, i.e. `type instance StT (ReaderT r) m a = a`. In > theory, we should be able to generalize `askRun` to any transformer for > which that applies. However, I can't figure out any way to express that > generalized type signature in a way that GHC accepts it. It seems like the > following should do the trick: > > askRunG :: ( MonadTransControl t > , Monad m > , b ~ StT t b > ) > => t m (Unlift t) > askRunG = liftWith (return . Unlift) > > However, I get the following error message when trying this: > > foo.hs:11:12: > Occurs check: cannot construct the infinite type: b0 ~ StT t b0 > The type variable ?b0? is ambiguous > In the ambiguity check for the type signature for ?askRunG?: > askRunG :: forall (t :: (* -> *) -> * -> *) (m :: * -> *) b. > (MonadTransControl t, Monad m, b ~ StT t b) => > t m (Unlift t) > To defer the ambiguity check to use sites, enable AllowAmbiguousTypes > In the type signature for ?askRunG?: > askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) => > t m (Unlift t) > > Adding AllowAmbiguousTypes to the mix provides: > > foo.hs:17:30: > Could not deduce (b1 ~ StT t b1) > from the context (MonadTransControl t, Monad m, b ~ StT t b) > bound by the type signature for > askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) => > t m (Unlift t) > at foo.hs:(12,12)-(16,25) > ?b1? is a rigid type variable bound by > the type forall (n1 :: * -> *) b2. > Monad n1 => > t n1 b2 -> n1 (StT t b2) > at foo.hs:1:1 > Expected type: Run t -> Unlift t > Actual type: (forall (n :: * -> *) b. Monad n => t n b -> n b) > -> Unlift t > Relevant bindings include > askRunG :: t m (Unlift t) (bound at foo.hs:17:1) > In the second argument of ?(.)?, namely ?Unlift? > In the first argument of ?liftWith?, namely ?(return . Unlift)? > > I've tested with both GHC 7.8.4 and 7.10.1. Any suggestions? > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From rasen.dubi at gmail.com Mon Mar 30 20:04:27 2015 From: rasen.dubi at gmail.com (Alexey Shmalko) Date: Mon, 30 Mar 2015 23:04:27 +0300 Subject: [Haskell-cafe] Is it possible for cabal sandboxes to use $HOME/.cabal/lib? In-Reply-To: References: Message-ID: Ok. Seems that I get this method working. Just copied .cabal-sandbox and caba.sandbox.config over new location. Replaced all occurrences of the old path to the new one in cabal.sandbox.config and .cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d/*.conf. After that I executed `cabal sandbox hc-pkg recache` and everything seems to work. Doesn't seem like a sane solution, but can be used if absolutely needed. On Mon, Mar 30, 2015 at 10:11 PM, Brandon Allbery wrote: > On Mon, Mar 30, 2015 at 2:42 PM, Alexey Shmalko > wrote: > >> Not sure, but is this possible to copy your home cabal sandbox to >> ./.cabal-sandbox? Then you'll have all your default packages available and >> won't build them again. >> > > You'd need to fix paths in the package database and `cabal hc-pkg recache` > (if that works; might need cabal exec). > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Mon Mar 30 20:23:17 2015 From: martin.drautzburg at web.de (martin) Date: Mon, 30 Mar 2015 22:23:17 +0200 Subject: [Haskell-cafe] Semantics of temporal data Message-ID: <5519B0B5.1080509@web.de> Hello all, I wrote a Temporal datatype data Temporal a = Temporal { td :: a, -- "temporal default" tc :: [Change a] -- "temporal changes" } deriving (Eq, Show) data Change a = Chg { ct :: Time, -- "change time" cv :: a -- "change value" } deriving (Eq,Show) I got into semantic trouble when trying to write "join" for Temporal (Temporal a). If I have a Temporal Temporal, then each change's value is a Temporal. The question is: what significance does the temporal default have? In my implementation, when I look at this Chg t0 (Temporal default0 changes0) Chg t1 (Temporal default1 changes1) --<-- you are here Chg t2 (Temporal default2 changes2) I accept the changes1 which are >= t1 and less than t2. So far so good. But I also take the default1 and prepend it to the resuling list of changes with a change time of t1 (unless the first of the changes1 occurs also at t1). But by comparing results with a handwritten <*>, QuickCheck revealed that this is not in line with <*> = ap x >>= f = join $ fmap f x It appears to me that the defaults of the inner Temporal lose most of their meaning. The effective default is the change value of the last accepted change from the previous (t0) iteration. This would make some sense. If I have a summer schedule which lists the location of a single train over time, and it sais it is usually "nowhere", but at July 1st is shall be in Manchester. If I ask this schedule, where the train will be before July 1st it'll say "nowhere". Now if I prepend the summer schedule with a spring schedule, then there will be a last location of that train in the spring schedule (say Brighton), i.e. before the summer schedule becomes effective. Hence at the beginning of the summer, the train won't be "nowhere" but in Brighton. Does this make some sense? Please feel free to comment. BTW: I am really impressed that haskell pointed out this semantic issue to me. This could have gone unnoticed for months in other languages. From aldodavide at gmx.com Mon Mar 30 20:57:51 2015 From: aldodavide at gmx.com (Aldo Davide) Date: Mon, 30 Mar 2015 22:57:51 +0200 Subject: [Haskell-cafe] Is it possible for cabal sandboxes to use $HOME/.cabal/lib? In-Reply-To: References: , Message-ID: So basically, I think it would be useful for cabal to be able to support an arbitrary list of directories, e.g.: /home/user/projects/foo/.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d /home/user/.ghc/x86_64-linux-7.8.4/package.conf.d /usr/lib64/ghc-7.8.4/package.conf.d Whenever a package is needed, then it would look it up in all of those directories. If a new package is to be installed, it would be installed in the topmost directory. In other words, it would overlay these directories one on top of the other, with the topmost one being used for read-write and the other ones being read-only. I understand that many people think that an implementation of nix-style packages would solve those issues, but I think the approach I describe above has its own merits. Sent:?Monday, March 30, 2015 at 9:04 PM From:?"Alexey Shmalko" To:?"Brandon Allbery" Cc:?"Aldo Davide" , "Haskell Cafe" Subject:?Re: [Haskell-cafe] Is it possible for cabal sandboxes to use $HOME/.cabal/lib? Ok. Seems that I get this method working. ? Just copied .cabal-sandbox and caba.sandbox.config over new location. Replaced all occurrences of the old path to the new one in cabal.sandbox.config and .cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d/*.conf. After that I executed `cabal sandbox hc-pkg recache` and everything seems to work. ? Doesn't seem like a sane solution, but can be used if absolutely needed. ? On Mon, Mar 30, 2015 at 10:11 PM, Brandon Allbery wrote: On Mon, Mar 30, 2015 at 2:42 PM, Alexey Shmalko wrote: Not sure, but is this possible to copy your home cabal sandbox to ./.cabal-sandbox? Then you'll have all your default packages available and won't build them again. ? You'd need to fix paths in the package database and `cabal hc-pkg recache` (if that works; might need cabal exec). ?-- brandon s allbery kf8nh ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sine nomine associates allbery.b at gmail.com[allbery.b at gmail.com] ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ballbery at sinenomine.net[ballbery at sinenomine.net] unix, openafs, kerberos, infrastructure, xmonad ? ? ? ?http://sinenomine.net[http://sinenomine.net] From amos.robinson at gmail.com Mon Mar 30 21:05:01 2015 From: amos.robinson at gmail.com (Amos Robinson) Date: Mon, 30 Mar 2015 21:05:01 +0000 Subject: [Haskell-cafe] Parallel Profiling In-Reply-To: <0CD0B231-DF22-4D83-8334-E44540D1993E@steinitz.org> References: <0CD0B231-DF22-4D83-8334-E44540D1993E@steinitz.org> Message-ID: Hi Dominic, A few years ago we wrote a program for analysing DPH runs, dph-event-seer. It provides a few general analyses like percent of time with N threads running, time between wake-ups etc. You might find it interesting, but I haven't actually looked at ghc-events-analyse, so I don't know what it provides. I'm sorry, but to compile it without DPH you'd have to modify it to remove DphOps*. https://github.com/ghc/packages-dph/blob/master/dph-event-seer/src/Main.hs Amos On Tue, 31 Mar 2015 at 04:38 Dominic Steinitz wrote: > Does anyone know of any tools for analysing parallel program performance? > > I am trying to use threadscope but it keeps crashing with my 100M log file > and ghc-events-analyze is not going to help as I have many hundreds of > threads all carrying out the same computation. I think I?d like a library > that would allow me to construct my own analyses rather than display them > via GTK. There is ghc-events but that seems to be just for parsing the logs > and I couldn?t find anything that used it in the way I would like to (apart > from threadscope and ghc-events-analyze of course). > > Thanks > > Dominic Steinitz > dominic at steinitz.org > http://idontgetoutmuch.wordpress.com > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From strake888 at gmail.com Tue Mar 31 00:41:52 2015 From: strake888 at gmail.com (M Farkas-Dyck) Date: Mon, 30 Mar 2015 19:41:52 -0500 Subject: [Haskell-cafe] Semantics of temporal data In-Reply-To: <5519B0B5.1080509@web.de> References: <5519B0B5.1080509@web.de> Message-ID: <20150331004152.GA6032@mintha> On 30/03/2015 at 22:23:17 +0200, martin wrote: > Hello all, > > I wrote a Temporal datatype > > data Temporal a = Temporal { > td :: a, -- "temporal default" > tc :: [Change a] -- "temporal changes" > } deriving (Eq, Show) > > data Change a = Chg { > ct :: Time, -- "change time" > cv :: a -- "change value" > } deriving (Eq,Show) > > I got into semantic trouble when trying to write "join" for Temporal (Temporal a). > It appears to me that the defaults of the inner Temporal lose most of their meaning. The effective default is the change > value of the last accepted change from the previous (t0) iteration. > Does this make some sense? Please feel free to comment. Yes, as the default value is essentially a change at the lower bound of time, 0 or -? or whenever it is, so if we join Temporal x [Change t1 (Temporal y _)] the change to y in the inner Temporal would happen at earliest possible time, so assuming t1 is later than this y ought to be ignored, I think. From martin.drautzburg at web.de Tue Mar 31 05:14:12 2015 From: martin.drautzburg at web.de (martin) Date: Tue, 31 Mar 2015 07:14:12 +0200 Subject: [Haskell-cafe] Semantics of temporal data In-Reply-To: <20150331004152.GA6032@mintha> References: <5519B0B5.1080509@web.de> <20150331004152.GA6032@mintha> Message-ID: <551A2D24.1090908@web.de> Am 03/31/2015 um 02:41 AM schrieb M Farkas-Dyck: > On 30/03/2015 at 22:23:17 +0200, martin wrote: > >> It appears to me that the defaults of the inner Temporal lose most of their meaning. The effective default is the change >> value of the last accepted change from the previous (t0) iteration. > >> Does this make some sense? Please feel free to comment. > > Yes, as the default value is essentially a change at the lower bound of time, 0 or -? or whenever it is, so if we join > > Temporal x [Change t1 (Temporal y _)] > > the change to y in the inner Temporal would happen at earliest possible time, so assuming t1 is later than this y ought to be ignored, I think. That neatly sums it up (and will make my code more concise). Thanks. From michael at snoyman.com Tue Mar 31 06:32:06 2015 From: michael at snoyman.com (Michael Snoyman) Date: Tue, 31 Mar 2015 06:32:06 +0000 Subject: [Haskell-cafe] Generalizing "unlift" functions with monad-control In-Reply-To: References: Message-ID: Those are some impressive type gymnastics :) Unfortunately, I still don't think I'm able to write the generic function the way I wanted to, so I'll be stuck with a typeclass. However, I may be able to provide your helper types/functions to make it easier for people to declare their own instances. On Mon, Mar 30, 2015 at 10:42 PM Erik Hesselink wrote: > Hi Michael, > > The problem seems to be that the constraint you want isn't (b ~ StT t > b) for some specific b, you want (forall b. b ~ StT t b). It's not > possible to say this directly, but after some trying I got something > ugly that works. Perhaps it can be the inspiration for something > nicer? > > {-# LANGUAGE RankNTypes #-} > {-# LANGUAGE KindSignatures #-} > {-# LANGUAGE GADTs #-} > {-# LANGUAGE ScopedTypeVariables #-} > > import Control.Monad.Trans.Control > import Control.Monad.Trans.Reader > > newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n b } > > newtype ForallStId t = ForallStId (forall a. StTEq t a) > > data StTEq (t :: (* -> *) -> * -> *) a where > StTEq :: a ~ StT t a => StTEq t a > > askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) > askRun = liftWith (return . Unlift) > > askRunG :: forall t m. > ( MonadTransControl t > , Monad m > ) > => ForallStId t -> t m (Unlift t) > askRunG x = liftWith $ \runT -> > return $ Unlift ( (case x of ForallStId (StTEq :: StTEq t b) -> > runT) :: forall b n. Monad n => t n b -> n b ) > > askRun' :: Monad m => ReaderT r m (Unlift (ReaderT r)) > askRun' = askRunG (ForallStId StTEq) > > The constraints package allows you to define Forall constraints, but > that needs something of kind (* -> Constraint) and I can't figure out > how to get something like (b ~ StT t b) in that form: we don't have > 'data constraints'. > > Hope this helps you along, and please let me know if you find a nicer > way to do this. > > Regards, > > Erik > > On Mon, Mar 30, 2015 at 7:33 AM, Michael Snoyman > wrote: > > I'm trying to extract an "unlift" function from monad-control, which > would > > allow stripping off a layer of a transformer stack in some cases. It's > easy > > to see that this works well for ReaderT, e.g.: > > > > {-# LANGUAGE RankNTypes #-} > > {-# LANGUAGE TypeFamilies #-} > > import Control.Monad.Trans.Control > > import Control.Monad.Trans.Reader > > > > newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n > b } > > > > askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) > > askRun = liftWith (return . Unlift) > > > > The reason this works is that the `StT` associated type for `ReaderT` > just > > returns the original type, i.e. `type instance StT (ReaderT r) m a = a`. > In > > theory, we should be able to generalize `askRun` to any transformer for > > which that applies. However, I can't figure out any way to express that > > generalized type signature in a way that GHC accepts it. It seems like > the > > following should do the trick: > > > > askRunG :: ( MonadTransControl t > > , Monad m > > , b ~ StT t b > > ) > > => t m (Unlift t) > > askRunG = liftWith (return . Unlift) > > > > However, I get the following error message when trying this: > > > > foo.hs:11:12: > > Occurs check: cannot construct the infinite type: b0 ~ StT t b0 > > The type variable ?b0? is ambiguous > > In the ambiguity check for the type signature for ?askRunG?: > > askRunG :: forall (t :: (* -> *) -> * -> *) (m :: * -> *) b. > > (MonadTransControl t, Monad m, b ~ StT t b) => > > t m (Unlift t) > > To defer the ambiguity check to use sites, enable AllowAmbiguousTypes > > In the type signature for ?askRunG?: > > askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) => > > t m (Unlift t) > > > > Adding AllowAmbiguousTypes to the mix provides: > > > > foo.hs:17:30: > > Could not deduce (b1 ~ StT t b1) > > from the context (MonadTransControl t, Monad m, b ~ StT t b) > > bound by the type signature for > > askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) > => > > t m (Unlift t) > > at foo.hs:(12,12)-(16,25) > > ?b1? is a rigid type variable bound by > > the type forall (n1 :: * -> *) b2. > > Monad n1 => > > t n1 b2 -> n1 (StT t b2) > > at foo.hs:1:1 > > Expected type: Run t -> Unlift t > > Actual type: (forall (n :: * -> *) b. Monad n => t n b -> n b) > > -> Unlift t > > Relevant bindings include > > askRunG :: t m (Unlift t) (bound at foo.hs:17:1) > > In the second argument of ?(.)?, namely ?Unlift? > > In the first argument of ?liftWith?, namely ?(return . Unlift)? > > > > I've tested with both GHC 7.8.4 and 7.10.1. Any suggestions? > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Tue Mar 31 08:27:56 2015 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Tue, 31 Mar 2015 11:27:56 +0300 Subject: [Haskell-cafe] Semantics of temporal data In-Reply-To: <551A2D24.1090908@web.de> References: <5519B0B5.1080509@web.de> <20150331004152.GA6032@mintha> <551A2D24.1090908@web.de> Message-ID: <56D3AFD7-3666-40D6-92FC-FB9C609671C6@iki.fi> Your Temporal type looks semantically very similar to FRP?s Behaviour. Following http://conal.net/papers/push-pull-frp/ : We could specify the time domain as `Maybe Time`, where - `Nothing` is ?before everything - distant past?, needed for ?temporal default?, - `Just t` are finite values of time newtype Behaviour a = Behaviour (Maybe Time -> a) It?s quite straightforward to verify that your Temporal and this Behaviour are isomorphic, assuming that `Change`s are sorted by time, and there aren?t consecutive duplicates. I find this ?higher-order? formulation easier to reason about, as it?s `(->) Maybe Time`, for which we have lot?s of machinery already defined (e.g. Monad). So you could verify direct join implementation on `Temporal` by: join_prop :: Temporal (Temporal Int) -> Property join_prop temp = join temporal == fromBehaviour (join (toBehaviour temporal)) One might need to use weaker equality here though. > On 31 Mar 2015, at 08:14, martin wrote: > > Am 03/31/2015 um 02:41 AM schrieb M Farkas-Dyck: >> On 30/03/2015 at 22:23:17 +0200, martin wrote: > >> >>> It appears to me that the defaults of the inner Temporal lose most of their meaning. The effective default is the change >>> value of the last accepted change from the previous (t0) iteration. >> >>> Does this make some sense? Please feel free to comment. >> >> Yes, as the default value is essentially a change at the lower bound of time, 0 or -? or whenever it is, so if we join >> >> Temporal x [Change t1 (Temporal y _)] >> >> the change to y in the inner Temporal would happen at earliest possible time, so assuming t1 is later than this y ought to be ignored, I think. > > That neatly sums it up (and will make my code more concise). Thanks. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From konn.jinro at gmail.com Tue Mar 31 08:59:52 2015 From: konn.jinro at gmail.com (Hiromi ISHII) Date: Tue, 31 Mar 2015 17:59:52 +0900 Subject: [Haskell-cafe] Generalizing "unlift" functions with monad-control In-Reply-To: References: Message-ID: <2A84F536-F0DE-46B5-9AFD-8C8D1BB68EAD@gmail.com> Hi Michael, Erik, > The constraints package allows you to define Forall constraints, but > that needs something of kind (* -> Constraint) and I can't figure out > how to get something like (b ~ StT t b) in that form: we don't have > 'data constraints'. I think we can do it with 'constraints' package using type class as below: ```haskell import Control.Monad.Trans.Control (MonadTransControl (liftWith), StT) import Control.Monad.Trans.Reader (ReaderT) import Data.Constraint ((:-), (\\)) import Data.Constraint.Forall (Forall, inst) class (StT t a ~ a) => Identical t a instance (StT t a ~ a) => Identical t a type Unliftable t = Forall (Identical t) newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n b } mkUnlift :: forall t m a . (Forall (Identical t), Monad m) => (forall n b. Monad n => t n b -> n (StT t b)) -> t m a -> m a mkUnlift r act = r act \\ (inst :: Forall (Identical t) :- Identical t a) askRunG :: forall t m. (MonadTransControl t, Unliftable t, Monad m) => t m (Unlift t) askRunG = liftWith unlifter where unlifter :: (forall n b. Monad n => t n b -> n (StT t b)) -> m (Unlift t) unlifter r = return $ Unlift (mkUnlift r) askRun :: Monad m => ReaderT a m (Unlift (ReaderT a)) askRun = askRunG ``` This compiles successfuly in my environment, and things seems to be done correctly, because we can derive ReaderT version from `askRunG`. In above, we defined `Unliftable t` constraint sysnonym for `Forall (Identical t)` just for convenience. Using this constraint synonym needs `ConstraintKinds` even for library users, it might be appropreate to define it as follows: ``` class Forall (Identical t) => Unliftable t instance Forall (Identical t) => Unliftable t ``` This definiton is the same trick as `Identical` constraint. We can choose which case to take for `Unliftable`, but `Identical` type class should be defined in this way, to get `Forall` works correctly. (This is due to 'constarints' package's current implementation; don't ask me why :-)) > 2015/03/31 15:32?Michael Snoyman ????? > > Those are some impressive type gymnastics :) Unfortunately, I still don't think I'm able to write the generic function the way I wanted to, so I'll be stuck with a typeclass. However, I may be able to provide your helper types/functions to make it easier for people to declare their own instances. > > On Mon, Mar 30, 2015 at 10:42 PM Erik Hesselink wrote: > Hi Michael, > > The problem seems to be that the constraint you want isn't (b ~ StT t > b) for some specific b, you want (forall b. b ~ StT t b). It's not > possible to say this directly, but after some trying I got something > ugly that works. Perhaps it can be the inspiration for something > nicer? > > {-# LANGUAGE RankNTypes #-} > {-# LANGUAGE KindSignatures #-} > {-# LANGUAGE GADTs #-} > {-# LANGUAGE ScopedTypeVariables #-} > > import Control.Monad.Trans.Control > import Control.Monad.Trans.Reader > > newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n b } > > newtype ForallStId t = ForallStId (forall a. StTEq t a) > > data StTEq (t :: (* -> *) -> * -> *) a where > StTEq :: a ~ StT t a => StTEq t a > > askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) > askRun = liftWith (return . Unlift) > > askRunG :: forall t m. > ( MonadTransControl t > , Monad m > ) > => ForallStId t -> t m (Unlift t) > askRunG x = liftWith $ \runT -> > return $ Unlift ( (case x of ForallStId (StTEq :: StTEq t b) -> > runT) :: forall b n. Monad n => t n b -> n b ) > > askRun' :: Monad m => ReaderT r m (Unlift (ReaderT r)) > askRun' = askRunG (ForallStId StTEq) > > The constraints package allows you to define Forall constraints, but > that needs something of kind (* -> Constraint) and I can't figure out > how to get something like (b ~ StT t b) in that form: we don't have > 'data constraints'. > > Hope this helps you along, and please let me know if you find a nicer > way to do this. > > Regards, > > Erik > > On Mon, Mar 30, 2015 at 7:33 AM, Michael Snoyman wrote: > > I'm trying to extract an "unlift" function from monad-control, which would > > allow stripping off a layer of a transformer stack in some cases. It's easy > > to see that this works well for ReaderT, e.g.: > > > > {-# LANGUAGE RankNTypes #-} > > {-# LANGUAGE TypeFamilies #-} > > import Control.Monad.Trans.Control > > import Control.Monad.Trans.Reader > > > > newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n b } > > > > askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) > > askRun = liftWith (return . Unlift) > > > > The reason this works is that the `StT` associated type for `ReaderT` just > > returns the original type, i.e. `type instance StT (ReaderT r) m a = a`. In > > theory, we should be able to generalize `askRun` to any transformer for > > which that applies. However, I can't figure out any way to express that > > generalized type signature in a way that GHC accepts it. It seems like the > > following should do the trick: > > > > askRunG :: ( MonadTransControl t > > , Monad m > > , b ~ StT t b > > ) > > => t m (Unlift t) > > askRunG = liftWith (return . Unlift) > > > > However, I get the following error message when trying this: > > > > foo.hs:11:12: > > Occurs check: cannot construct the infinite type: b0 ~ StT t b0 > > The type variable ?b0? is ambiguous > > In the ambiguity check for the type signature for ?askRunG?: > > askRunG :: forall (t :: (* -> *) -> * -> *) (m :: * -> *) b. > > (MonadTransControl t, Monad m, b ~ StT t b) => > > t m (Unlift t) > > To defer the ambiguity check to use sites, enable AllowAmbiguousTypes > > In the type signature for ?askRunG?: > > askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) => > > t m (Unlift t) > > > > Adding AllowAmbiguousTypes to the mix provides: > > > > foo.hs:17:30: > > Could not deduce (b1 ~ StT t b1) > > from the context (MonadTransControl t, Monad m, b ~ StT t b) > > bound by the type signature for > > askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) => > > t m (Unlift t) > > at foo.hs:(12,12)-(16,25) > > ?b1? is a rigid type variable bound by > > the type forall (n1 :: * -> *) b2. > > Monad n1 => > > t n1 b2 -> n1 (StT t b2) > > at foo.hs:1:1 > > Expected type: Run t -> Unlift t > > Actual type: (forall (n :: * -> *) b. Monad n => t n b -> n b) > > -> Unlift t > > Relevant bindings include > > askRunG :: t m (Unlift t) (bound at foo.hs:17:1) > > In the second argument of ?(.)?, namely ?Unlift? > > In the first argument of ?liftWith?, namely ?(return . Unlift)? > > > > I've tested with both GHC 7.8.4 and 7.10.1. Any suggestions? > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe ----- ?? ?? --------------------------- konn.jinro at gmail.com ????????????? ???? ???????? ---------------------------------------------- From konn.jinro at gmail.com Tue Mar 31 09:03:21 2015 From: konn.jinro at gmail.com (Hiromi ISHII) Date: Tue, 31 Mar 2015 18:03:21 +0900 Subject: [Haskell-cafe] Generalizing "unlift" functions with monad-control In-Reply-To: References: Message-ID: P.S. oops, I missed to attach the appropreate language extensions. You have to specify following exntensions to get my example works: ```haskell {-# LANGUAGE ConstraintKinds, FlexibleContexts, FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses, RankNTypes, ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies, TypeOperators #-} ``` -- Hiromi ISHII konn.jinro at gmail.com From hesselink at gmail.com Tue Mar 31 09:05:37 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Tue, 31 Mar 2015 11:05:37 +0200 Subject: [Haskell-cafe] Generalizing "unlift" functions with monad-control In-Reply-To: <2A84F536-F0DE-46B5-9AFD-8C8D1BB68EAD@gmail.com> References: <2A84F536-F0DE-46B5-9AFD-8C8D1BB68EAD@gmail.com> Message-ID: This looks much better! I don't know why I didn't find it, I did experiment with type classes a bit... Regards, Erik On Tue, Mar 31, 2015 at 10:59 AM, Hiromi ISHII wrote: > Hi Michael, Erik, > >> The constraints package allows you to define Forall constraints, but >> that needs something of kind (* -> Constraint) and I can't figure out >> how to get something like (b ~ StT t b) in that form: we don't have >> 'data constraints'. > > I think we can do it with 'constraints' package using type class as below: > > ```haskell > import Control.Monad.Trans.Control (MonadTransControl (liftWith), StT) > import Control.Monad.Trans.Reader (ReaderT) > import Data.Constraint ((:-), (\\)) > import Data.Constraint.Forall (Forall, inst) > > class (StT t a ~ a) => Identical t a > instance (StT t a ~ a) => Identical t a > > type Unliftable t = Forall (Identical t) > > newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n b } > > mkUnlift :: forall t m a . (Forall (Identical t), Monad m) > => (forall n b. Monad n => t n b -> n (StT t b)) -> t m a -> m a > mkUnlift r act = r act \\ (inst :: Forall (Identical t) :- Identical t a) > > askRunG :: forall t m. (MonadTransControl t, Unliftable t, Monad m) => t m (Unlift t) > askRunG = liftWith unlifter > where > unlifter :: (forall n b. Monad n => t n b -> n (StT t b)) -> m (Unlift t) > unlifter r = return $ Unlift (mkUnlift r) > > askRun :: Monad m => ReaderT a m (Unlift (ReaderT a)) > askRun = askRunG > ``` > > This compiles successfuly in my environment, and things seems to be done correctly, > because we can derive ReaderT version from `askRunG`. > > In above, we defined `Unliftable t` constraint sysnonym for `Forall (Identical t)` just for convenience. > Using this constraint synonym needs `ConstraintKinds` even for library users, it might be > appropreate to define it as follows: > > ``` > class Forall (Identical t) => Unliftable t > instance Forall (Identical t) => Unliftable t > ``` > > This definiton is the same trick as `Identical` constraint. > We can choose which case to take for `Unliftable`, but `Identical` type class > should be defined in this way, to get `Forall` works correctly. > (This is due to 'constarints' package's current implementation; > don't ask me why :-)) > >> 2015/03/31 15:32?Michael Snoyman ????? >> >> Those are some impressive type gymnastics :) Unfortunately, I still don't think I'm able to write the generic function the way I wanted to, so I'll be stuck with a typeclass. However, I may be able to provide your helper types/functions to make it easier for people to declare their own instances. >> >> On Mon, Mar 30, 2015 at 10:42 PM Erik Hesselink wrote: >> Hi Michael, >> >> The problem seems to be that the constraint you want isn't (b ~ StT t >> b) for some specific b, you want (forall b. b ~ StT t b). It's not >> possible to say this directly, but after some trying I got something >> ugly that works. Perhaps it can be the inspiration for something >> nicer? >> >> {-# LANGUAGE RankNTypes #-} >> {-# LANGUAGE KindSignatures #-} >> {-# LANGUAGE GADTs #-} >> {-# LANGUAGE ScopedTypeVariables #-} >> >> import Control.Monad.Trans.Control >> import Control.Monad.Trans.Reader >> >> newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n b } >> >> newtype ForallStId t = ForallStId (forall a. StTEq t a) >> >> data StTEq (t :: (* -> *) -> * -> *) a where >> StTEq :: a ~ StT t a => StTEq t a >> >> askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) >> askRun = liftWith (return . Unlift) >> >> askRunG :: forall t m. >> ( MonadTransControl t >> , Monad m >> ) >> => ForallStId t -> t m (Unlift t) >> askRunG x = liftWith $ \runT -> >> return $ Unlift ( (case x of ForallStId (StTEq :: StTEq t b) -> >> runT) :: forall b n. Monad n => t n b -> n b ) >> >> askRun' :: Monad m => ReaderT r m (Unlift (ReaderT r)) >> askRun' = askRunG (ForallStId StTEq) >> >> The constraints package allows you to define Forall constraints, but >> that needs something of kind (* -> Constraint) and I can't figure out >> how to get something like (b ~ StT t b) in that form: we don't have >> 'data constraints'. >> >> Hope this helps you along, and please let me know if you find a nicer >> way to do this. >> >> Regards, >> >> Erik >> >> On Mon, Mar 30, 2015 at 7:33 AM, Michael Snoyman wrote: >> > I'm trying to extract an "unlift" function from monad-control, which would >> > allow stripping off a layer of a transformer stack in some cases. It's easy >> > to see that this works well for ReaderT, e.g.: >> > >> > {-# LANGUAGE RankNTypes #-} >> > {-# LANGUAGE TypeFamilies #-} >> > import Control.Monad.Trans.Control >> > import Control.Monad.Trans.Reader >> > >> > newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n b } >> > >> > askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) >> > askRun = liftWith (return . Unlift) >> > >> > The reason this works is that the `StT` associated type for `ReaderT` just >> > returns the original type, i.e. `type instance StT (ReaderT r) m a = a`. In >> > theory, we should be able to generalize `askRun` to any transformer for >> > which that applies. However, I can't figure out any way to express that >> > generalized type signature in a way that GHC accepts it. It seems like the >> > following should do the trick: >> > >> > askRunG :: ( MonadTransControl t >> > , Monad m >> > , b ~ StT t b >> > ) >> > => t m (Unlift t) >> > askRunG = liftWith (return . Unlift) >> > >> > However, I get the following error message when trying this: >> > >> > foo.hs:11:12: >> > Occurs check: cannot construct the infinite type: b0 ~ StT t b0 >> > The type variable ?b0? is ambiguous >> > In the ambiguity check for the type signature for ?askRunG?: >> > askRunG :: forall (t :: (* -> *) -> * -> *) (m :: * -> *) b. >> > (MonadTransControl t, Monad m, b ~ StT t b) => >> > t m (Unlift t) >> > To defer the ambiguity check to use sites, enable AllowAmbiguousTypes >> > In the type signature for ?askRunG?: >> > askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) => >> > t m (Unlift t) >> > >> > Adding AllowAmbiguousTypes to the mix provides: >> > >> > foo.hs:17:30: >> > Could not deduce (b1 ~ StT t b1) >> > from the context (MonadTransControl t, Monad m, b ~ StT t b) >> > bound by the type signature for >> > askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) => >> > t m (Unlift t) >> > at foo.hs:(12,12)-(16,25) >> > ?b1? is a rigid type variable bound by >> > the type forall (n1 :: * -> *) b2. >> > Monad n1 => >> > t n1 b2 -> n1 (StT t b2) >> > at foo.hs:1:1 >> > Expected type: Run t -> Unlift t >> > Actual type: (forall (n :: * -> *) b. Monad n => t n b -> n b) >> > -> Unlift t >> > Relevant bindings include >> > askRunG :: t m (Unlift t) (bound at foo.hs:17:1) >> > In the second argument of ?(.)?, namely ?Unlift? >> > In the first argument of ?liftWith?, namely ?(return . Unlift)? >> > >> > I've tested with both GHC 7.8.4 and 7.10.1. Any suggestions? >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > ----- ?? ?? --------------------------- > konn.jinro at gmail.com > ????????????? > ???? ???????? > ---------------------------------------------- > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From adam at bergmark.nl Tue Mar 31 10:33:24 2015 From: adam at bergmark.nl (Adam Bergmark) Date: Tue, 31 Mar 2015 12:33:24 +0200 Subject: [Haskell-cafe] Hackage trustee proposal: Curating the Hackage package collection Message-ID: Dear Haskell Community, For some time Hackage has contained a user group called "Trustees", http://hackage.haskell.org/packages/trustees/ . Description: The role of trustees is to help to curate the whole package collection. Trustees have a limited ability to edit package information, for the entire package database (as opposed to package maintainers who have full control over individual packages). Trustees can edit .cabal files, edit other package metadata and upload documentation but they cannot upload new package versions." In short, making sure that packages keep building and filling the gap between unreachable maintainers and package take-overs. Up until now we have been very careful with changes since we haven't had a defined process. Spurred by SPJ and others we have been working on a proposal for how we should operate. You can find the proposal here: https://gist.github.com/bergmark/76cafefb300546e9b90e We would now like your feedback! Some specific things from the proposal that we'd like your opinion on: * Section 1: No opt-out for restricting bounds * Section 2: Opt-out rather than opt-in procedure for loosening version constraints * Section 2: Do you care whether you are notified before or after a version constraint is loosened? * Section 3: The time frame for publishing simple source changes * Section 3: What exactly should constitute a "simple source change" We also have a github repository where YOU can file issues about broken packages, you can start doing this right now! https://github.com/haskell-infra/hackage-trustees/ Please share this with as many people as possible. We are looking forward to hear your thoughts! Sincerely, Adam Bergmark -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Tue Mar 31 10:46:11 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Tue, 31 Mar 2015 13:46:11 +0300 Subject: [Haskell-cafe] Hackage trustee proposal: Curating the Hackage package collection In-Reply-To: References: Message-ID: <551A7AF3.2030309@ro-che.info> This is still very conservative, but definitely a step in the right direction. On 31/03/15 13:33, Adam Bergmark wrote: > Dear Haskell Community, > > For some time Hackage has contained a user group called "Trustees", > http://hackage.haskell.org/packages/trustees/ . > > > Description: The role of trustees is to help to curate the whole > package collection. Trustees have a limited ability to edit package > information, for the entire package database (as opposed to package > maintainers who have full control over individual packages). Trustees > can edit .cabal files, edit other package metadata and upload > documentation but they cannot upload new package versions." > > In short, making sure that packages keep building and filling the gap > between unreachable maintainers and package take-overs. > > Up until now we have been very careful with changes since we haven't > had a defined process. Spurred by SPJ and others we have been working > on a proposal for how we should operate. > > You can find the proposal here: > https://gist.github.com/bergmark/76cafefb300546e9b90e > > > We would now like your feedback! > > Some specific things from the proposal that we'd like your opinion on: > > * Section 1: No opt-out for restricting bounds > * Section 2: Opt-out rather than opt-in procedure for loosening version > constraints > * Section 2: Do you care whether you are notified before or after a > version constraint is loosened? > * Section 3: The time frame for publishing simple source changes > * Section 3: What exactly should constitute a "simple source change" > > > We also have a github repository where YOU can file issues about > broken packages, you can start doing this right now! > https://github.com/haskell-infra/hackage-trustees/ > > > Please share this with as many people as possible. > We are looking forward to hear your thoughts! > > Sincerely, > Adam Bergmark > > > > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > From simons at cryp.to Tue Mar 31 11:14:15 2015 From: simons at cryp.to (Peter Simons) Date: Tue, 31 Mar 2015 13:14:15 +0200 Subject: [Haskell-cafe] GHC update from 7.8.4 to 7.10.1 breaks 1, 500 packages in NixOS Message-ID: <874mp1v2pk.fsf@write-only.cryp.to> Hi guys, the Nixpkgs distribution [1] contains all of Hackage -- 7,898 packages at the time of this writing --, and we regularly build these packages with GHC 7.8.4 in our CI environment [2] running NixOS Linux. About 3,000 of these builds are disabled outright, because we know they won't succeed anyway (i.e. they have dependencies we cannot fulfill), but the remaining 5,000 packages compile successfully most of the time. Now, a few days ago, we created a separate build job [2] that compiles the same package set with GHC 7.10.1, and the result is interesting: with the newer compiler, approximately 1,500 packages are broken compared to the state with 7.8.4. A detailed list of broken packages can be found at [4]. Keep in mind that those figures only approximate reality. For instance, we patch packages sometimes to make their builds succeed even though the pristine version would not, and so far much more effort has gone into fixing 7.8.4 builds than we spent on fixing 7.10.1 builds. Also, some packages may compile fine when you run "cabal install " on your workstation, but those builds may fail in the context of NixOS for whatever reason. If anyone were to repeat this experiment on Darwin, Windows, Ubuntu, or Red Hat, the results would be different from our numbers! Still, based on the information we have, it's probably fair to say that the GHC 7.10.1 update breaks approximately 30% of all Haskell builds that worked with 7.8.4. Best regards, Peter [1] https://github.com/nixos/nixpkgs [2] http://hydra.cryp.to/jobset/nixpkgs/haskell-updates [3] http://hydra.cryp.to/jobset/nixpkgs/haskell-updates-ghc7101 [4] http://hydra.cryp.to/eval/304489#tabs-still-fail From sumit.sahrawat.apm13 at iitbhu.ac.in Tue Mar 31 11:23:04 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Tue, 31 Mar 2015 16:53:04 +0530 Subject: [Haskell-cafe] Hackage trustee proposal: Curating the Hackage package collection In-Reply-To: <551A7AF3.2030309@ro-che.info> References: <551A7AF3.2030309@ro-che.info> Message-ID: As Roman said, that definitely is a step in the right direction, but as hackage grows, it might not be possible for a small group of trustees to do all the work. I have some points that might be good to add: 1. The maintainers also get the same abilities as the trustees (edit .cabal files, edit other package metadata etc.) 2. The trustees can then notify the maintainers (if the changes are considerable) or make the changes themselves otherwise. 3. This also allows the maintainers to edit packages in case they don't build, effectively removing the issue of what a "small source change" is. On 31 March 2015 at 16:16, Roman Cheplyaka wrote: > This is still very conservative, but definitely a step in the right > direction. > > On 31/03/15 13:33, Adam Bergmark wrote: > > Dear Haskell Community, > > > > For some time Hackage has contained a user group called "Trustees", > > http://hackage.haskell.org/packages/trustees/ . > > > > > > Description: The role of trustees is to help to curate the whole > > package collection. Trustees have a limited ability to edit package > > information, for the entire package database (as opposed to package > > maintainers who have full control over individual packages). Trustees > > can edit .cabal files, edit other package metadata and upload > > documentation but they cannot upload new package versions." > > > > In short, making sure that packages keep building and filling the gap > > between unreachable maintainers and package take-overs. > > > > Up until now we have been very careful with changes since we haven't > > had a defined process. Spurred by SPJ and others we have been working > > on a proposal for how we should operate. > > > > You can find the proposal here: > > https://gist.github.com/bergmark/76cafefb300546e9b90e > > > > > > We would now like your feedback! > > > > Some specific things from the proposal that we'd like your opinion on: > > > > * Section 1: No opt-out for restricting bounds > > * Section 2: Opt-out rather than opt-in procedure for loosening version > > constraints > > * Section 2: Do you care whether you are notified before or after a > > version constraint is loosened? > > * Section 3: The time frame for publishing simple source changes > > * Section 3: What exactly should constitute a "simple source change" > > > > > > We also have a github repository where YOU can file issues about > > broken packages, you can start doing this right now! > > https://github.com/haskell-infra/hackage-trustees/ > > > > > > Please share this with as many people as possible. > > We are looking forward to hear your thoughts! > > > > Sincerely, > > Adam Bergmark > > > > > > > > _______________________________________________ > > Libraries mailing list > > Libraries at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Tue Mar 31 12:23:44 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Tue, 31 Mar 2015 14:23:44 +0200 Subject: [Haskell-cafe] GHC update from 7.8.4 to 7.10.1 breaks 1, 500 packages in NixOS In-Reply-To: <874mp1v2pk.fsf@write-only.cryp.to> References: <874mp1v2pk.fsf@write-only.cryp.to> Message-ID: Hi Peter, Useful information! Do you have any way to list only packages that actually fail to build, as opposed to also listing packages where the dependencies fail to build? Erik On Tue, Mar 31, 2015 at 1:14 PM, Peter Simons wrote: > Hi guys, > > the Nixpkgs distribution [1] contains all of Hackage -- 7,898 packages at > the time of this writing --, and we regularly build these packages with > GHC 7.8.4 in our CI environment [2] running NixOS Linux. About 3,000 of > these builds are disabled outright, because we know they won't succeed > anyway (i.e. they have dependencies we cannot fulfill), but the remaining > 5,000 packages compile successfully most of the time. > > Now, a few days ago, we created a separate build job [2] that compiles the > same package set with GHC 7.10.1, and the result is interesting: with the > newer compiler, approximately 1,500 packages are broken compared to the > state with 7.8.4. A detailed list of broken packages can be found at [4]. > > Keep in mind that those figures only approximate reality. For instance, we > patch packages sometimes to make their builds succeed even though the > pristine version would not, and so far much more effort has gone into > fixing 7.8.4 builds than we spent on fixing 7.10.1 builds. Also, some > packages may compile fine when you run "cabal install " on your > workstation, but those builds may fail in the context of NixOS for > whatever reason. If anyone were to repeat this experiment on Darwin, > Windows, Ubuntu, or Red Hat, the results would be different from our > numbers! > > Still, based on the information we have, it's probably fair to say that > the GHC 7.10.1 update breaks approximately 30% of all Haskell builds that > worked with 7.8.4. > > Best regards, > Peter > > > > [1] https://github.com/nixos/nixpkgs > [2] http://hydra.cryp.to/jobset/nixpkgs/haskell-updates > [3] http://hydra.cryp.to/jobset/nixpkgs/haskell-updates-ghc7101 > [4] http://hydra.cryp.to/eval/304489#tabs-still-fail > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From oleg.grenrus at iki.fi Tue Mar 31 12:43:10 2015 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Tue, 31 Mar 2015 15:43:10 +0300 Subject: [Haskell-cafe] Hackage trustee proposal: Curating the Hackage package collection In-Reply-To: References: Message-ID: <180C5F5C-16ED-43D2-9CEA-19F2FD650A5F@iki.fi> Some ideas about: What exactly should constitute a "simple source change? - Adding an extension (e.g. FlexibleContexts) to make code compile - Adding an Applicative for Monad (or similar obvious ?intristic? instance addition, e.g Semigroup for Monoids, if Semi-MP is in) - Editing import list (hiding clashing symbols, qualifying) > On 31 Mar 2015, at 13:33, Adam Bergmark wrote: > > Dear Haskell Community, > > For some time Hackage has contained a user group called "Trustees", > http://hackage.haskell.org/packages/trustees/ . > > > Description: The role of trustees is to help to curate the whole > package collection. Trustees have a limited ability to edit package > information, for the entire package database (as opposed to package > maintainers who have full control over individual packages). Trustees > can edit .cabal files, edit other package metadata and upload > documentation but they cannot upload new package versions." > > In short, making sure that packages keep building and filling the gap > between unreachable maintainers and package take-overs. > > Up until now we have been very careful with changes since we haven't > had a defined process. Spurred by SPJ and others we have been working > on a proposal for how we should operate. > > You can find the proposal here: > https://gist.github.com/bergmark/76cafefb300546e9b90e > > > We would now like your feedback! > > Some specific things from the proposal that we'd like your opinion on: > > * Section 1: No opt-out for restricting bounds > * Section 2: Opt-out rather than opt-in procedure for loosening version constraints > * Section 2: Do you care whether you are notified before or after a version constraint is loosened? > * Section 3: The time frame for publishing simple source changes > * Section 3: What exactly should constitute a "simple source change" > > > We also have a github repository where YOU can file issues about > broken packages, you can start doing this right now! > https://github.com/haskell-infra/hackage-trustees/ > > > Please share this with as many people as possible. > We are looking forward to hear your thoughts! > > Sincerely, > Adam Bergmark > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From carter.schonwald at gmail.com Tue Mar 31 12:45:09 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 31 Mar 2015 08:45:09 -0400 Subject: [Haskell-cafe] Hackage trustee proposal: Curating the Hackage package collection In-Reply-To: References: <551A7AF3.2030309@ro-che.info> Message-ID: Maintainers can already edit the meta data for their own packages. As for small source changes, are you proposing that trustees have enough acls to do those by default, or that hackage editing allow source level changes? On Mar 31, 2015 7:23 AM, "Sumit Sahrawat, Maths & Computing, IIT (BHU)" < sumit.sahrawat.apm13 at iitbhu.ac.in> wrote: > As Roman said, that definitely is a step in the right direction, but as > hackage grows, it might not be possible for a small group of trustees to do > all the work. > > I have some points that might be good to add: > > 1. The maintainers also get the same abilities as the trustees (edit > .cabal files, edit other package metadata etc.) > 2. The trustees can then notify the maintainers (if the changes are > considerable) or make the changes themselves otherwise. > 3. This also allows the maintainers to edit packages in case they > don't build, effectively removing the issue of what a "small source change" > is. > > > On 31 March 2015 at 16:16, Roman Cheplyaka wrote: > >> This is still very conservative, but definitely a step in the right >> direction. >> >> On 31/03/15 13:33, Adam Bergmark wrote: >> > Dear Haskell Community, >> > >> > For some time Hackage has contained a user group called "Trustees", >> > http://hackage.haskell.org/packages/trustees/ . >> > >> > >> > Description: The role of trustees is to help to curate the whole >> > package collection. Trustees have a limited ability to edit package >> > information, for the entire package database (as opposed to package >> > maintainers who have full control over individual packages). Trustees >> > can edit .cabal files, edit other package metadata and upload >> > documentation but they cannot upload new package versions." >> > >> > In short, making sure that packages keep building and filling the gap >> > between unreachable maintainers and package take-overs. >> > >> > Up until now we have been very careful with changes since we haven't >> > had a defined process. Spurred by SPJ and others we have been working >> > on a proposal for how we should operate. >> > >> > You can find the proposal here: >> > https://gist.github.com/bergmark/76cafefb300546e9b90e >> > >> > >> > We would now like your feedback! >> > >> > Some specific things from the proposal that we'd like your opinion on: >> > >> > * Section 1: No opt-out for restricting bounds >> > * Section 2: Opt-out rather than opt-in procedure for loosening version >> > constraints >> > * Section 2: Do you care whether you are notified before or after a >> > version constraint is loosened? >> > * Section 3: The time frame for publishing simple source changes >> > * Section 3: What exactly should constitute a "simple source change" >> > >> > >> > We also have a github repository where YOU can file issues about >> > broken packages, you can start doing this right now! >> > https://github.com/haskell-infra/hackage-trustees/ >> > >> > >> > Please share this with as many people as possible. >> > We are looking forward to hear your thoughts! >> > >> > Sincerely, >> > Adam Bergmark >> > >> > >> > >> > _______________________________________________ >> > Libraries mailing list >> > Libraries at haskell.org >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > > > -- > Regards > > Sumit Sahrawat > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eir at cis.upenn.edu Tue Mar 31 13:41:28 2015 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Tue, 31 Mar 2015 09:41:28 -0400 Subject: [Haskell-cafe] Enforcing data structures invariant in the type system In-Reply-To: References: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> Message-ID: I thought I'd weigh in here, as my dissertation is all about how to encoding invariants into Haskell's type system better. Here are some reactions to this thread: - In my opinion, Haskell is very capable of expressing invariants in its type system today -- you don't need to go to Idris or Agda to get there. In certain cases, this encoding can be quite natural and unobtrusive, and sometimes easier to work with than in full-on dependently typed languages. The problem is that it's very hard for a beginner in this space to tell which invariants are easy to encode and which are hard. The red-black tree example is a great one for an "easy-to-encode" invariant. The "Hasochism" paper [1] shows another. On the other hand, my two (successful) attempts at "proving" a sorting algorithm correct are very painful (insertion sort [2] and merge sort [3]). I'm sure one component in the difference in level of elegance is that Conor and Sam are better dependently-typed programmers than I am! [1]: https://personal.cis.strath.ac.uk/conor.mcbride/pub/hasochism.pdf [2]: https://github.com/goldfirere/singletons/blob/master/tests/compile-and-dump/InsertionSort/InsertionSortImp.hs [3]: https://github.com/goldfirere/nyc-hug-oct2014/blob/master/OrdList.hs - The `singletons` package [4], can be helpful in doing dependently typed programming in Haskell, and is cited in references previously mentioned in this thread. But I wouldn't rely on it too much -- once you need lots of singletons (more than, say, for numbers and Bools), your code will get very bogged down. It's either time to come up with a different way of encoding for your invariant, give up on compile-time verification, or switch to Idris. [4]: http://hackage.haskell.org/package/singletons - The error messages are verbose. Haskell really needs a more interactive mode for dependently typed programming! I'll answer one oft-answered question here: A "skolem" is just a *bound* type variable. This is different from other type variables GHC uses during type inference, which are free, *unification* type variables. The point of a unification variable is as a placeholder until GHC figures out the right type. A skolem variable is one that is actually bound in the source code. Here's a tiny example: > data Exists where > MkE :: forall a. a -> Exists > > foo :: Exists -> Bool > foo (MkE x) = not x This reports an error about a skolem(*) variable a not being Bool. Of course, we can't know, in the body of `foo`, that the type of `x` is `Bool` -- `x` has type `a`, for some unknown `a`. In this case `a` is a skolem. (*): Sadly, the error message (in 7.8.3) just says "rigid" without "skolem". But the choice of words in the error message is a little capricious, and other similar cases can say "skolem". - Liquid Haskell goes a very different way than do all of the approaches above. It uses a tool, called an SMT solver, outside of GHC to verify annotations in code. Currently, Liquid Haskell can verify conditions that other approaches can only dream of, including in Agda and Idris. (In particular, LH is very good around integers, something that is otherwise a challenge to reason about in types.) But, LH has two key limitations: 1) It reasons only about refinement types, which are restrictions on existing types. Examples are "odd integers", "lists of Bools with either 2 or 3 elements", "integers equal to 42", and "an integer `y` that is bigger than that other integer `x`". Often, this is exactly what you want. But sometimes it's not. 2) Its power is limited by the solving power of the attached SMT solver. SMT solvers can reason about a lot, but -- of course -- they can't do everything. If the SMT solver can't figure out your code, it's very hard to know what to do to make things work again. However, this rarely comes up in practice. I, personally, look forward to a future (years away) where we can have full dependent types that also use an SMT solver. This will make the easy things easy, but the hard things possible. Richard On Mar 30, 2015, at 3:01 PM, Marcin Mrotek wrote: > Hello, > >> I appreciate this suggestion! >> Agda has been on the todo list for a while. Which do you suggest to start >> from, choosing between agda and idris? Are there any major differences? > > I admit I only have experience in using Agda, I've name-checked Idris > after only reading the docs (the last time I tried to install the > compiler, cabal didn't let mi do it because of package conflits; now I > tried again and it's doing just fine). Idris is newer and, apparently, > more oriented towards practical programming than theorem proving, > that's all I know. > >> I?ve read a paper about liquid haskell some time ago and I find it amazing. >> What I?d like to ask now is: is liquid haskell strictly more expressive than the >> haskell type system or is ?only? a more convenient way of writing the constraints >> in a way that can be efficiently solved? > > It depends on what you mean by "Haskell's type system". It's more > capable than Haskell's type system without extensions, and less than > full-on dependent typing (delibrately so, because dependent type > equivalence is undecidable). I don't know where exactly does > Haskell-with-GHC-extensions type system lie. I think it's the same as, > let's say, Agda's, only requiring more kludges when moving back and > forth between type- and value-level, but I'm not sure. I'm just a > "self"-taught programmer, not a computer scientist ;) > > Best regards, > Marcin Mrotek > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From alexander at plaimi.net Tue Mar 31 13:50:14 2015 From: alexander at plaimi.net (Alexander Berntsen) Date: Tue, 31 Mar 2015 15:50:14 +0200 Subject: [Haskell-cafe] Looking for Haskell contract work Message-ID: <551AA616.9040501@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hallo Haskell friends, My company[0] uses Haskell for most of our work. Speaking of work, we are currently looking for some more of it. If anyone has some work (FSVO "work" that includes hacking, advising, teaching, etc.), please contact me off-list. Thanks! [0] plaimi: . - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREIAAYFAlUaphUACgkQRtClrXBQc7UySwD/digSIVDgS25tRW4zUtfoO/E3 /vWOMwMRnn9nfFcirrAA/0fFsl8WogNG/J2AP188517xcV4zLV1up7YtUsbEWRnh =JbNc -----END PGP SIGNATURE----- From sol at typeful.net Tue Mar 31 13:53:02 2015 From: sol at typeful.net (Simon Hengel) Date: Tue, 31 Mar 2015 21:53:02 +0800 Subject: [Haskell-cafe] ANN: base-compat updated for AMP + request for collaboration Message-ID: <20150331135302.GA7981@x200> Hi, I updated base-compat[1] for the recent AMP/Foldable/Traversable changes and base-4.8.0.0. A new version 0.6.0 is on Hackage. The purpose of base-compat is to provide a way to write code that works with multiple versions of GHC without the need for CPP. The idea is to have .Compat modules (e.g. Control.Exception.Compat) that provide the same interface across all supported versions of GHC (we test GHC 7.* on travis and I test 6.12.3 manually). The main focus of this release is to make Prelude.Compat as complete as possible to help with the AMP/Foldable/Traversable transition. Prelude.Compat now exposes the exact same interface as Prelude from base-4.8.0.0. It can be used together with -XNoImplicitPrelude to write code that works with all supported versions of GHC, e.g.: {-# LANGUAGE NoImplicitPrelude #-} import Prelude.Compat main :: IO () main = mapM_ print (Just 23) Prelude.Compat is complete and we have tests that ensure that the interface is the same for all supported versions of GHC. But other modules still need more work. In the past base-compat did not get the love it deserves, but I'm committed to put more effort into it and make it as complete as possible. Any help with that effort would be greatly appreciated. If you want to help, please open issues and pull requests on GitHub, or send me feedback by email or on IRC (solirc on Freenode). Cheers, Simon [1] http://hackage.haskell.org/package/base-compat From sumit.sahrawat.apm13 at iitbhu.ac.in Tue Mar 31 14:25:33 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Tue, 31 Mar 2015 19:55:33 +0530 Subject: [Haskell-cafe] Hackage trustee proposal: Curating the Hackage package collection In-Reply-To: References: <551A7AF3.2030309@ro-che.info> Message-ID: Carter, Yes, I was talking about allowing maintainers to make source level edits. I don't see any harm in allowing broken packages to be updated as they won't work for anyone otherwise. I am not very inclined towards having the trustees edit packages directly. They themselves didn't do it very much till now, and they shouldn't have to. They can instead contact the maintainer and have him fix the issues. In case the maintainer is missing, they have no choice but to go ahead with the changes. It's a good balance, as having a small group of trustees will ultimately lead to slow response, whereas a large group is not preferable. On 31 March 2015 at 18:15, Carter Schonwald wrote: > Maintainers can already edit the meta data for their own packages. > > As for small source changes, are you proposing that trustees have enough > acls to do those by default, or that hackage editing allow source level > changes? > On Mar 31, 2015 7:23 AM, "Sumit Sahrawat, Maths & Computing, IIT (BHU)" < > sumit.sahrawat.apm13 at iitbhu.ac.in> wrote: > >> As Roman said, that definitely is a step in the right direction, but as >> hackage grows, it might not be possible for a small group of trustees to do >> all the work. >> >> I have some points that might be good to add: >> >> 1. The maintainers also get the same abilities as the trustees (edit >> .cabal files, edit other package metadata etc.) >> 2. The trustees can then notify the maintainers (if the changes are >> considerable) or make the changes themselves otherwise. >> 3. This also allows the maintainers to edit packages in case they >> don't build, effectively removing the issue of what a "small source change" >> is. >> >> >> On 31 March 2015 at 16:16, Roman Cheplyaka wrote: >> >>> This is still very conservative, but definitely a step in the right >>> direction. >>> >>> On 31/03/15 13:33, Adam Bergmark wrote: >>> > Dear Haskell Community, >>> > >>> > For some time Hackage has contained a user group called "Trustees", >>> > http://hackage.haskell.org/packages/trustees/ . >>> > >>> > >>> > Description: The role of trustees is to help to curate the whole >>> > package collection. Trustees have a limited ability to edit package >>> > information, for the entire package database (as opposed to package >>> > maintainers who have full control over individual packages). Trustees >>> > can edit .cabal files, edit other package metadata and upload >>> > documentation but they cannot upload new package versions." >>> > >>> > In short, making sure that packages keep building and filling the gap >>> > between unreachable maintainers and package take-overs. >>> > >>> > Up until now we have been very careful with changes since we haven't >>> > had a defined process. Spurred by SPJ and others we have been working >>> > on a proposal for how we should operate. >>> > >>> > You can find the proposal here: >>> > https://gist.github.com/bergmark/76cafefb300546e9b90e >>> > >>> > >>> > We would now like your feedback! >>> > >>> > Some specific things from the proposal that we'd like your opinion on: >>> > >>> > * Section 1: No opt-out for restricting bounds >>> > * Section 2: Opt-out rather than opt-in procedure for loosening version >>> > constraints >>> > * Section 2: Do you care whether you are notified before or after a >>> > version constraint is loosened? >>> > * Section 3: The time frame for publishing simple source changes >>> > * Section 3: What exactly should constitute a "simple source change" >>> > >>> > >>> > We also have a github repository where YOU can file issues about >>> > broken packages, you can start doing this right now! >>> > https://github.com/haskell-infra/hackage-trustees/ >>> > >>> > >>> > Please share this with as many people as possible. >>> > We are looking forward to hear your thoughts! >>> > >>> > Sincerely, >>> > Adam Bergmark >>> > >>> > >>> > >>> > _______________________________________________ >>> > Libraries mailing list >>> > Libraries at haskell.org >>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>> > >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> >> >> >> -- >> Regards >> >> Sumit Sahrawat >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Tue Mar 31 14:46:32 2015 From: adam at bergmark.nl (Adam Bergmark) Date: Tue, 31 Mar 2015 16:46:32 +0200 Subject: [Haskell-cafe] Hackage trustee proposal: Curating the Hackage package collection In-Reply-To: References: <551A7AF3.2030309@ro-che.info> Message-ID: Sumit, It's unclear to me whether you are referring to publishing new revisions of versions or publishing new versions of packages. We have not discussed treating minor source changes as publishing new revisions, my impression has been that we would upload a new version. Maintainers can of course already do this. The introduction of metadata (.cabal file) revisions has already caused lots of heated discussion, so I wouldn't dare to suggest hackage serving fetching different tarballs on top of that :) On Tue, Mar 31, 2015 at 4:25 PM, Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote: > Carter, > > Yes, I was talking about allowing maintainers to make source level edits. > I don't see any harm in allowing broken packages to be updated as they > won't work for anyone otherwise. > > I am not very inclined towards having the trustees edit packages directly. > They themselves didn't do it very much till now, and they shouldn't have to. > They can instead contact the maintainer and have him fix the issues. In > case the maintainer is missing, they have no choice but to go ahead with > the changes. > Yes, maintainers should always be the go-to people for fixes, in a perfect world trustees would not be needed. - Adam > It's a good balance, as having a small group of trustees will ultimately > lead to slow response, whereas a large group is not preferable. > > On 31 March 2015 at 18:15, Carter Schonwald > wrote: > >> Maintainers can already edit the meta data for their own packages. >> >> As for small source changes, are you proposing that trustees have enough >> acls to do those by default, or that hackage editing allow source level >> changes? >> On Mar 31, 2015 7:23 AM, "Sumit Sahrawat, Maths & Computing, IIT (BHU)" < >> sumit.sahrawat.apm13 at iitbhu.ac.in> wrote: >> >>> As Roman said, that definitely is a step in the right direction, but as >>> hackage grows, it might not be possible for a small group of trustees to do >>> all the work. >>> >>> I have some points that might be good to add: >>> >>> 1. The maintainers also get the same abilities as the trustees (edit >>> .cabal files, edit other package metadata etc.) >>> 2. The trustees can then notify the maintainers (if the changes are >>> considerable) or make the changes themselves otherwise. >>> 3. This also allows the maintainers to edit packages in case they >>> don't build, effectively removing the issue of what a "small source change" >>> is. >>> >>> >>> On 31 March 2015 at 16:16, Roman Cheplyaka wrote: >>> >>>> This is still very conservative, but definitely a step in the right >>>> direction. >>>> >>>> On 31/03/15 13:33, Adam Bergmark wrote: >>>> > Dear Haskell Community, >>>> > >>>> > For some time Hackage has contained a user group called "Trustees", >>>> > http://hackage.haskell.org/packages/trustees/ . >>>> > >>>> > >>>> > Description: The role of trustees is to help to curate the whole >>>> > package collection. Trustees have a limited ability to edit package >>>> > information, for the entire package database (as opposed to package >>>> > maintainers who have full control over individual packages). Trustees >>>> > can edit .cabal files, edit other package metadata and upload >>>> > documentation but they cannot upload new package versions." >>>> > >>>> > In short, making sure that packages keep building and filling the gap >>>> > between unreachable maintainers and package take-overs. >>>> > >>>> > Up until now we have been very careful with changes since we haven't >>>> > had a defined process. Spurred by SPJ and others we have been working >>>> > on a proposal for how we should operate. >>>> > >>>> > You can find the proposal here: >>>> > https://gist.github.com/bergmark/76cafefb300546e9b90e >>>> > >>>> > >>>> > We would now like your feedback! >>>> > >>>> > Some specific things from the proposal that we'd like your opinion on: >>>> > >>>> > * Section 1: No opt-out for restricting bounds >>>> > * Section 2: Opt-out rather than opt-in procedure for loosening >>>> version >>>> > constraints >>>> > * Section 2: Do you care whether you are notified before or after a >>>> > version constraint is loosened? >>>> > * Section 3: The time frame for publishing simple source changes >>>> > * Section 3: What exactly should constitute a "simple source change" >>>> > >>>> > >>>> > We also have a github repository where YOU can file issues about >>>> > broken packages, you can start doing this right now! >>>> > https://github.com/haskell-infra/hackage-trustees/ >>>> > >>>> > >>>> > Please share this with as many people as possible. >>>> > We are looking forward to hear your thoughts! >>>> > >>>> > Sincerely, >>>> > Adam Bergmark >>>> > >>>> > >>>> > >>>> > _______________________________________________ >>>> > Libraries mailing list >>>> > Libraries at haskell.org >>>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>>> > >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>> >>> >>> >>> -- >>> Regards >>> >>> Sumit Sahrawat >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> > > > -- > Regards > > Sumit Sahrawat > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sumit.sahrawat.apm13 at iitbhu.ac.in Tue Mar 31 14:52:00 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Tue, 31 Mar 2015 20:22:00 +0530 Subject: [Haskell-cafe] Hackage trustee proposal: Curating the Hackage package collection In-Reply-To: References: <551A7AF3.2030309@ro-che.info> Message-ID: Seems legit. If trustees can only release new versions, then that's the end of the discussion. I thought that trustees had the ability to revise the versions. Sorry for making a fuss. Best. On 31 March 2015 at 20:16, Adam Bergmark wrote: > Sumit, It's unclear to me whether you are referring to publishing new > revisions of versions or publishing new versions of packages. > > We have not discussed treating minor source changes as publishing new > revisions, my impression has been that we would upload a new version. > Maintainers can of course already do this. > > The introduction of metadata (.cabal file) revisions has already caused > lots of heated discussion, so I wouldn't dare to suggest hackage serving > fetching different tarballs on top of that :) > > On Tue, Mar 31, 2015 at 4:25 PM, Sumit Sahrawat, Maths & Computing, IIT > (BHU) wrote: > >> Carter, >> >> Yes, I was talking about allowing maintainers to make source level edits. >> I don't see any harm in allowing broken packages to be updated as they >> won't work for anyone otherwise. >> >> I am not very inclined towards having the trustees edit packages >> directly. They themselves didn't do it very much till now, and they >> shouldn't have to. >> They can instead contact the maintainer and have him fix the issues. In >> case the maintainer is missing, they have no choice but to go ahead with >> the changes. >> > > Yes, maintainers should always be the go-to people for fixes, in a perfect > world trustees would not be needed. > > - Adam > > > >> It's a good balance, as having a small group of trustees will ultimately >> lead to slow response, whereas a large group is not preferable. >> >> On 31 March 2015 at 18:15, Carter Schonwald >> wrote: >> >>> Maintainers can already edit the meta data for their own packages. >>> >>> As for small source changes, are you proposing that trustees have enough >>> acls to do those by default, or that hackage editing allow source level >>> changes? >>> On Mar 31, 2015 7:23 AM, "Sumit Sahrawat, Maths & Computing, IIT (BHU)" < >>> sumit.sahrawat.apm13 at iitbhu.ac.in> wrote: >>> >>>> As Roman said, that definitely is a step in the right direction, but as >>>> hackage grows, it might not be possible for a small group of trustees to do >>>> all the work. >>>> >>>> I have some points that might be good to add: >>>> >>>> 1. The maintainers also get the same abilities as the trustees (edit >>>> .cabal files, edit other package metadata etc.) >>>> 2. The trustees can then notify the maintainers (if the changes are >>>> considerable) or make the changes themselves otherwise. >>>> 3. This also allows the maintainers to edit packages in case they >>>> don't build, effectively removing the issue of what a "small source change" >>>> is. >>>> >>>> >>>> On 31 March 2015 at 16:16, Roman Cheplyaka wrote: >>>> >>>>> This is still very conservative, but definitely a step in the right >>>>> direction. >>>>> >>>>> On 31/03/15 13:33, Adam Bergmark wrote: >>>>> > Dear Haskell Community, >>>>> > >>>>> > For some time Hackage has contained a user group called "Trustees", >>>>> > http://hackage.haskell.org/packages/trustees/ . >>>>> > >>>>> > >>>>> > Description: The role of trustees is to help to curate the whole >>>>> > package collection. Trustees have a limited ability to edit package >>>>> > information, for the entire package database (as opposed to package >>>>> > maintainers who have full control over individual packages). Trustees >>>>> > can edit .cabal files, edit other package metadata and upload >>>>> > documentation but they cannot upload new package versions." >>>>> > >>>>> > In short, making sure that packages keep building and filling the gap >>>>> > between unreachable maintainers and package take-overs. >>>>> > >>>>> > Up until now we have been very careful with changes since we haven't >>>>> > had a defined process. Spurred by SPJ and others we have been working >>>>> > on a proposal for how we should operate. >>>>> > >>>>> > You can find the proposal here: >>>>> > https://gist.github.com/bergmark/76cafefb300546e9b90e >>>>> > >>>>> > >>>>> > We would now like your feedback! >>>>> > >>>>> > Some specific things from the proposal that we'd like your opinion >>>>> on: >>>>> > >>>>> > * Section 1: No opt-out for restricting bounds >>>>> > * Section 2: Opt-out rather than opt-in procedure for loosening >>>>> version >>>>> > constraints >>>>> > * Section 2: Do you care whether you are notified before or after a >>>>> > version constraint is loosened? >>>>> > * Section 3: The time frame for publishing simple source changes >>>>> > * Section 3: What exactly should constitute a "simple source change" >>>>> > >>>>> > >>>>> > We also have a github repository where YOU can file issues about >>>>> > broken packages, you can start doing this right now! >>>>> > https://github.com/haskell-infra/hackage-trustees/ >>>>> > >>>>> > >>>>> > Please share this with as many people as possible. >>>>> > We are looking forward to hear your thoughts! >>>>> > >>>>> > Sincerely, >>>>> > Adam Bergmark >>>>> > >>>>> > >>>>> > >>>>> > _______________________________________________ >>>>> > Libraries mailing list >>>>> > Libraries at haskell.org >>>>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>>>> > >>>>> >>>>> _______________________________________________ >>>>> Haskell-Cafe mailing list >>>>> Haskell-Cafe at haskell.org >>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>> >>>> >>>> >>>> >>>> -- >>>> Regards >>>> >>>> Sumit Sahrawat >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>>> >> >> >> -- >> Regards >> >> Sumit Sahrawat >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Tue Mar 31 15:37:31 2015 From: michael at snoyman.com (Michael Snoyman) Date: Tue, 31 Mar 2015 15:37:31 +0000 Subject: [Haskell-cafe] Generalizing "unlift" functions with monad-control In-Reply-To: References: <2A84F536-F0DE-46B5-9AFD-8C8D1BB68EAD@gmail.com> Message-ID: Wow, this looks great, thank you! I have to play around with this a bit more to see how it fits in with everything, I'll ping back this thread when I have something worth sharing. On Tue, Mar 31, 2015 at 12:06 PM Erik Hesselink wrote: > This looks much better! I don't know why I didn't find it, I did > experiment with type classes a bit... > > Regards, > > Erik > > On Tue, Mar 31, 2015 at 10:59 AM, Hiromi ISHII > wrote: > > Hi Michael, Erik, > > > >> The constraints package allows you to define Forall constraints, but > >> that needs something of kind (* -> Constraint) and I can't figure out > >> how to get something like (b ~ StT t b) in that form: we don't have > >> 'data constraints'. > > > > I think we can do it with 'constraints' package using type class as > below: > > > > ```haskell > > import Control.Monad.Trans.Control (MonadTransControl (liftWith), StT) > > import Control.Monad.Trans.Reader (ReaderT) > > import Data.Constraint ((:-), (\\)) > > import Data.Constraint.Forall (Forall, inst) > > > > class (StT t a ~ a) => Identical t a > > instance (StT t a ~ a) => Identical t a > > > > type Unliftable t = Forall (Identical t) > > > > newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n > b } > > > > mkUnlift :: forall t m a . (Forall (Identical t), Monad m) > > => (forall n b. Monad n => t n b -> n (StT t b)) -> t m a -> m a > > mkUnlift r act = r act \\ (inst :: Forall (Identical t) :- Identical t a) > > > > askRunG :: forall t m. (MonadTransControl t, Unliftable t, Monad m) => t > m (Unlift t) > > askRunG = liftWith unlifter > > where > > unlifter :: (forall n b. Monad n => t n b -> n (StT t b)) -> m > (Unlift t) > > unlifter r = return $ Unlift (mkUnlift r) > > > > askRun :: Monad m => ReaderT a m (Unlift (ReaderT a)) > > askRun = askRunG > > ``` > > > > This compiles successfuly in my environment, and things seems to be done > correctly, > > because we can derive ReaderT version from `askRunG`. > > > > In above, we defined `Unliftable t` constraint sysnonym for `Forall > (Identical t)` just for convenience. > > Using this constraint synonym needs `ConstraintKinds` even for library > users, it might be > > appropreate to define it as follows: > > > > ``` > > class Forall (Identical t) => Unliftable t > > instance Forall (Identical t) => Unliftable t > > ``` > > > > This definiton is the same trick as `Identical` constraint. > > We can choose which case to take for `Unliftable`, but `Identical` type > class > > should be defined in this way, to get `Forall` works correctly. > > (This is due to 'constarints' package's current implementation; > > don't ask me why :-)) > > > >> 2015/03/31 15:32?Michael Snoyman ????? > >> > >> Those are some impressive type gymnastics :) Unfortunately, I still > don't think I'm able to write the generic function the way I wanted to, so > I'll be stuck with a typeclass. However, I may be able to provide your > helper types/functions to make it easier for people to declare their own > instances. > >> > >> On Mon, Mar 30, 2015 at 10:42 PM Erik Hesselink > wrote: > >> Hi Michael, > >> > >> The problem seems to be that the constraint you want isn't (b ~ StT t > >> b) for some specific b, you want (forall b. b ~ StT t b). It's not > >> possible to say this directly, but after some trying I got something > >> ugly that works. Perhaps it can be the inspiration for something > >> nicer? > >> > >> {-# LANGUAGE RankNTypes #-} > >> {-# LANGUAGE KindSignatures #-} > >> {-# LANGUAGE GADTs #-} > >> {-# LANGUAGE ScopedTypeVariables #-} > >> > >> import Control.Monad.Trans.Control > >> import Control.Monad.Trans.Reader > >> > >> newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> n > b } > >> > >> newtype ForallStId t = ForallStId (forall a. StTEq t a) > >> > >> data StTEq (t :: (* -> *) -> * -> *) a where > >> StTEq :: a ~ StT t a => StTEq t a > >> > >> askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) > >> askRun = liftWith (return . Unlift) > >> > >> askRunG :: forall t m. > >> ( MonadTransControl t > >> , Monad m > >> ) > >> => ForallStId t -> t m (Unlift t) > >> askRunG x = liftWith $ \runT -> > >> return $ Unlift ( (case x of ForallStId (StTEq :: StTEq t b) -> > >> runT) :: forall b n. Monad n => t n b -> n b ) > >> > >> askRun' :: Monad m => ReaderT r m (Unlift (ReaderT r)) > >> askRun' = askRunG (ForallStId StTEq) > >> > >> The constraints package allows you to define Forall constraints, but > >> that needs something of kind (* -> Constraint) and I can't figure out > >> how to get something like (b ~ StT t b) in that form: we don't have > >> 'data constraints'. > >> > >> Hope this helps you along, and please let me know if you find a nicer > >> way to do this. > >> > >> Regards, > >> > >> Erik > >> > >> On Mon, Mar 30, 2015 at 7:33 AM, Michael Snoyman > wrote: > >> > I'm trying to extract an "unlift" function from monad-control, which > would > >> > allow stripping off a layer of a transformer stack in some cases. > It's easy > >> > to see that this works well for ReaderT, e.g.: > >> > > >> > {-# LANGUAGE RankNTypes #-} > >> > {-# LANGUAGE TypeFamilies #-} > >> > import Control.Monad.Trans.Control > >> > import Control.Monad.Trans.Reader > >> > > >> > newtype Unlift t = Unlift { unlift :: forall n b. Monad n => t n b -> > n b } > >> > > >> > askRun :: Monad m => ReaderT r m (Unlift (ReaderT r)) > >> > askRun = liftWith (return . Unlift) > >> > > >> > The reason this works is that the `StT` associated type for `ReaderT` > just > >> > returns the original type, i.e. `type instance StT (ReaderT r) m a = > a`. In > >> > theory, we should be able to generalize `askRun` to any transformer > for > >> > which that applies. However, I can't figure out any way to express > that > >> > generalized type signature in a way that GHC accepts it. It seems > like the > >> > following should do the trick: > >> > > >> > askRunG :: ( MonadTransControl t > >> > , Monad m > >> > , b ~ StT t b > >> > ) > >> > => t m (Unlift t) > >> > askRunG = liftWith (return . Unlift) > >> > > >> > However, I get the following error message when trying this: > >> > > >> > foo.hs:11:12: > >> > Occurs check: cannot construct the infinite type: b0 ~ StT t b0 > >> > The type variable ?b0? is ambiguous > >> > In the ambiguity check for the type signature for ?askRunG?: > >> > askRunG :: forall (t :: (* -> *) -> * -> *) (m :: * -> *) b. > >> > (MonadTransControl t, Monad m, b ~ StT t b) => > >> > t m (Unlift t) > >> > To defer the ambiguity check to use sites, enable > AllowAmbiguousTypes > >> > In the type signature for ?askRunG?: > >> > askRunG :: (MonadTransControl t, Monad m, b ~ StT t b) => > >> > t m (Unlift t) > >> > > >> > Adding AllowAmbiguousTypes to the mix provides: > >> > > >> > foo.hs:17:30: > >> > Could not deduce (b1 ~ StT t b1) > >> > from the context (MonadTransControl t, Monad m, b ~ StT t b) > >> > bound by the type signature for > >> > askRunG :: (MonadTransControl t, Monad m, b ~ StT t > b) => > >> > t m (Unlift t) > >> > at foo.hs:(12,12)-(16,25) > >> > ?b1? is a rigid type variable bound by > >> > the type forall (n1 :: * -> *) b2. > >> > Monad n1 => > >> > t n1 b2 -> n1 (StT t b2) > >> > at foo.hs:1:1 > >> > Expected type: Run t -> Unlift t > >> > Actual type: (forall (n :: * -> *) b. Monad n => t n b -> n b) > >> > -> Unlift t > >> > Relevant bindings include > >> > askRunG :: t m (Unlift t) (bound at foo.hs:17:1) > >> > In the second argument of ?(.)?, namely ?Unlift? > >> > In the first argument of ?liftWith?, namely ?(return . Unlift)? > >> > > >> > I've tested with both GHC 7.8.4 and 7.10.1. Any suggestions? > >> > > >> > _______________________________________________ > >> > Haskell-Cafe mailing list > >> > Haskell-Cafe at haskell.org > >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> > > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > > ----- ?? ?? --------------------------- > > konn.jinro at gmail.com > > ????????????? > > ???? ???????? > > ---------------------------------------------- > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander at plaimi.net Tue Mar 31 15:59:48 2015 From: alexander at plaimi.net (Alexander Berntsen) Date: Tue, 31 Mar 2015 17:59:48 +0200 Subject: [Haskell-cafe] Looking for Haskell contract work In-Reply-To: <551AA616.9040501@plaimi.net> References: <551AA616.9040501@plaimi.net> Message-ID: <551AC474.3030708@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 31/03/15 15:50, Alexander Berntsen wrote: > [0] plaimi: . Typo! Should be . Thank you to those of you who have replied off-list, informing me of my mistake. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREIAAYFAlUaxG8ACgkQRtClrXBQc7XpvQD+PW0wX9UjQ82WeaRdXxRbZGdN b7VzLNMPPLN1INwbUI0BAJBI9HDhuQ/fLf/3YF77PeUhUez/Q8i9sn7nTgrSB4NH =rGfC -----END PGP SIGNATURE----- From aldodavide at gmx.com Tue Mar 31 16:37:29 2015 From: aldodavide at gmx.com (Aldo Davide) Date: Tue, 31 Mar 2015 18:37:29 +0200 Subject: [Haskell-cafe] Template haskell and the dependencies of the generated executable Message-ID: When I use template haskell to generate some code at compile time and splice it in my program, the generated executable still depends on template haskell (in case of -dynamic), or the Template haskell library is included in my executable (in the case of -static). Isn't that unnecessary? For example. Suppose that I use the almost trivial raw-strings-qq package to implement a hello world program: {-# LANGUAGE QuasiQuotes #-} import Text.RawString.QQ (r) main = putStrLn [r|Bonjour tout le monde|] Then the r quasi quoter runs at compile time and generates a string literal. So basically, the program that gets compiled is the following: main = putStrLn "Bonjour tout le monde" Despite that template haskell is only used at compile time, the generated executable (compiled with the -dynamic flags) depends on the following libraries: libHSarray-0.5.0.0-ghc7.8.4.so libHScontainers-0.5.5.1-ghc7.8.4.so libHSdeepseq-1.3.0.2-ghc7.8.4.so libHSpretty-1.1.1.1-ghc7.8.4.so libHSraw-strings-qq-1.0.2-ghc7.8.4.so libHStemplate-haskell-2.9.0.0-ghc7.8.4.so in addition to the ones that the non template haskell version of the program depends. Shouldn't ghc avoid that? From nicola.gigante at gmail.com Tue Mar 31 16:46:08 2015 From: nicola.gigante at gmail.com (Nicola Gigante) Date: Tue, 31 Mar 2015 18:46:08 +0200 Subject: [Haskell-cafe] Enforcing data structures invariant in the type system In-Reply-To: References: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> Message-ID: <51641C42-B65C-46CC-8387-3501AF0A63EE@gmail.com> > Il giorno 31/mar/2015, alle ore 15:41, Richard Eisenberg ha scritto: > > I thought I'd weigh in here, as my dissertation is all about how to encoding invariants into Haskell's type system better. Here are some reactions to this thread: > Hi! is you dissertation available somewhere (or is still work in progress)? > - In my opinion, Haskell is very capable of expressing invariants in its type system today -- you don't need to go to Idris or Agda to get there. In certain cases, this encoding can be quite natural and unobtrusive, and sometimes easier to work with than in full-on dependently typed languages. The problem is that it's very hard for a beginner in this space to tell which invariants are easy to encode and which are hard. The red-black tree example is a great one for an "easy-to-encode" invariant. The "Hasochism" paper [1] shows another. On the other hand, my two (successful) attempts at "proving" a sorting algorithm correct are very painful (insertion sort [2] and merge sort [3]). I'm sure one component in the difference in level of elegance is that Conor and Sam are better dependently-typed programmers than I am! > > [1]: https://personal.cis.strath.ac.uk/conor.mcbride/pub/hasochism.pdf > [2]: https://github.com/goldfirere/singletons/blob/master/tests/compile-and-dump/InsertionSort/InsertionSortImp.hs > [3]: https://github.com/goldfirere/nyc-hug-oct2014/blob/master/OrdList.hs > Very useful material, thanks! > - The `singletons` package [4], can be helpful in doing dependently typed programming in Haskell, and is cited in references previously mentioned in this thread. But I wouldn't rely on it too much -- once you need lots of singletons (more than, say, for numbers and Bools), your code will get very bogged down. It's either time to come up with a different way of encoding for your invariant, give up on compile-time verification, or switch to Idris. > > [4]: http://hackage.haskell.org/package/singletons > I have still to grasp where singletons are required and when they aren?t. The paper you linked above helps somehow. > - The error messages are verbose. Haskell really needs a more interactive mode for dependently typed programming! I'll answer one oft-answered question here: A "skolem" is just a *bound* type variable. This is different from other type variables GHC uses during type inference, which are free, *unification* type variables. The point of a unification variable is as a placeholder until GHC figures out the right type. A skolem variable is one that is actually bound in the source code. Here's a tiny example: > >> data Exists where >> MkE :: forall a. a -> Exists >> >> foo :: Exists -> Bool >> foo (MkE x) = not x > > This reports an error about a skolem(*) variable a not being Bool. Of course, we can't know, in the body of `foo`, that the type of `x` is `Bool` -- `x` has type `a`, for some unknown `a`. In this case `a` is a skolem. > > (*): Sadly, the error message (in 7.8.3) just says "rigid" without "skolem". But the choice of words in the error message is a little capricious, and other similar cases can say "skolem?. > Thank you for the explaination! > - Liquid Haskell goes a very different way than do all of the approaches above. It uses a tool, called an SMT solver, outside of GHC to verify annotations in code. Currently, Liquid Haskell can verify conditions that other approaches can only dream of, including in Agda and Idris. (In particular, LH is very good around integers, something that is otherwise a challenge to reason about in types.) But, LH has two key limitations: > 1) It reasons only about refinement types, which are restrictions on existing types. Examples are "odd integers", "lists of Bools with either 2 or 3 elements", "integers equal to 42", and "an integer `y` that is bigger than that other integer `x`". Often, this is exactly what you want. But sometimes it's not. > 2) Its power is limited by the solving power of the attached SMT solver. SMT solvers can reason about a lot, but -- of course -- they can't do everything. If the SMT solver can't figure out your code, it's very hard to know what to do to make things work again. However, this rarely comes up in practice. > > I, personally, look forward to a future (years away) where we can have full dependent types that also use an SMT solver. This will make the easy things easy, but the hard things possible. > That would be an interesting future without doubts! > Richard Thank you very much, Nicola From mail at joachim-breitner.de Tue Mar 31 17:03:14 2015 From: mail at joachim-breitner.de (Joachim Breitner) Date: Tue, 31 Mar 2015 19:03:14 +0200 Subject: [Haskell-cafe] Opt-in upper-bounds notification service? Message-ID: <1427821394.2274.9.camel@joachim-breitner.de> Hi, I don?t always have a complete oversight of what our ecosystem provides... do we already have a way to (opt-in) get a mail when a dependency of one of my packages was uploaded in a version that is beyond the upper-bound specified by my packages? Currently I get pinged by Michael Snoyberg when that happens, e.g. in https://github.com/fpco/stackage/issues/514, but that?s always a short while after the problem, and I?d like to fix this before anyone manually notices. If someone would hack up such as service, I?d be happy to use it. Greetings, Joachim -- Joachim ?nomeata? Breitner mail at joachim-breitner.de ? http://www.joachim-breitner.de/ Jabber: nomeata at joachim-breitner.de ? GPG-Key: 0xF0FBF51F Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: From omari at smileystation.com Tue Mar 31 17:09:47 2015 From: omari at smileystation.com (Omari Norman) Date: Tue, 31 Mar 2015 13:09:47 -0400 Subject: [Haskell-cafe] Opt-in upper-bounds notification service? In-Reply-To: <1427821394.2274.9.camel@joachim-breitner.de> References: <1427821394.2274.9.camel@joachim-breitner.de> Message-ID: There is this http://packdeps.haskellers.com/ though I don't think it sends mails. That page also links to a Hackage package for this sort of thing. I use the "packdeps" program in my CI script; it fails the build if my dependencies are out of date. You could probably hack up a cron job or something that could use packdeps to check your package daily. On Tue, Mar 31, 2015 at 1:03 PM, Joachim Breitner wrote: > Hi, > > I don?t always have a complete oversight of what our ecosystem > provides... do we already have a way to (opt-in) get a mail when a > dependency of one of my packages was uploaded in a version that is > beyond the upper-bound specified by my packages? > > Currently I get pinged by Michael Snoyberg when that happens, e.g. in > https://github.com/fpco/stackage/issues/514, but that?s always a short > while after the problem, and I?d like to fix this before anyone manually > notices. > > If someone would hack up such as service, I?d be happy to use it. > > Greetings, > Joachim > > -- > Joachim ?nomeata? Breitner > mail at joachim-breitner.de ? http://www.joachim-breitner.de/ > Jabber: nomeata at joachim-breitner.de ? GPG-Key: 0xF0FBF51F > Debian Developer: nomeata at debian.org > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Tue Mar 31 17:16:05 2015 From: michael at snoyman.com (Michael Snoyman) Date: Tue, 31 Mar 2015 17:16:05 +0000 Subject: [Haskell-cafe] Opt-in upper-bounds notification service? In-Reply-To: References: <1427821394.2274.9.camel@joachim-breitner.de> Message-ID: packdeps also offers RSS feeds, which you can subscribe to. At least in the past, there were RSS-to-email services so you could get an email automatically. On Tue, Mar 31, 2015 at 8:10 PM Omari Norman wrote: > There is this > > http://packdeps.haskellers.com/ > > though I don't think it sends mails. That page also links to a Hackage > package for this sort of thing. I use the "packdeps" program in my CI > script; it fails the build if my dependencies are out of date. You could > probably hack up a cron job or something that could use packdeps to check > your package daily. > > > > On Tue, Mar 31, 2015 at 1:03 PM, Joachim Breitner < > mail at joachim-breitner.de> wrote: > >> Hi, >> >> I don?t always have a complete oversight of what our ecosystem >> provides... do we already have a way to (opt-in) get a mail when a >> dependency of one of my packages was uploaded in a version that is >> beyond the upper-bound specified by my packages? >> >> Currently I get pinged by Michael Snoyberg when that happens, e.g. in >> https://github.com/fpco/stackage/issues/514, but that?s always a short >> while after the problem, and I?d like to fix this before anyone manually >> notices. >> >> If someone would hack up such as service, I?d be happy to use it. >> >> Greetings, >> Joachim >> >> -- >> Joachim ?nomeata? Breitner >> mail at joachim-breitner.de ? http://www.joachim-breitner.de/ >> Jabber: nomeata at joachim-breitner.de ? GPG-Key: 0xF0FBF51F >> Debian Developer: nomeata at debian.org >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Tue Mar 31 17:26:27 2015 From: mail at joachim-breitner.de (Joachim Breitner) Date: Tue, 31 Mar 2015 19:26:27 +0200 Subject: [Haskell-cafe] Opt-in upper-bounds notification service? In-Reply-To: References: <1427821394.2274.9.camel@joachim-breitner.de> Message-ID: <1427822787.2274.14.camel@joachim-breitner.de> Hi, Am Dienstag, den 31.03.2015, 17:16 +0000 schrieb Michael Snoyman: > packdeps also offers RSS feeds, which you can subscribe to. At least > in the past, there were RSS-to-email services so you could get an > email automatically. > the RSS feed looks useful (I read my RSS feeds by mail anyway). Now if there was a way to get one feed with all packages of one maintainer, I?d be happy :-) I?ve opened an issue at https://github.com/snoyberg/packdeps/issues/23 Greetings, Joachim -- Joachim ?nomeata? Breitner mail at joachim-breitner.de ? http://www.joachim-breitner.de/ Jabber: nomeata at joachim-breitner.de ? GPG-Key: 0xF0FBF51F Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: From michael at snoyman.com Tue Mar 31 17:33:14 2015 From: michael at snoyman.com (Michael Snoyman) Date: Tue, 31 Mar 2015 17:33:14 +0000 Subject: [Haskell-cafe] Opt-in upper-bounds notification service? In-Reply-To: <1427822787.2274.14.camel@joachim-breitner.de> References: <1427821394.2274.9.camel@joachim-breitner.de> <1427822787.2274.14.camel@joachim-breitner.de> Message-ID: Just use the search field and enter your name, that's what I do. On Tue, Mar 31, 2015, 8:26 PM Joachim Breitner wrote: > Hi, > > Am Dienstag, den 31.03.2015, 17:16 +0000 schrieb Michael Snoyman: > > packdeps also offers RSS feeds, which you can subscribe to. At least > > in the past, there were RSS-to-email services so you could get an > > email automatically. > > > the RSS feed looks useful (I read my RSS feeds by mail anyway). Now if > there was a way to get one feed with all packages of one maintainer, I?d > be happy :-) > > I?ve opened an issue at https://github.com/snoyberg/packdeps/issues/23 > > Greetings, > Joachim > > -- > Joachim ?nomeata? Breitner > mail at joachim-breitner.de ? http://www.joachim-breitner.de/ > Jabber: nomeata at joachim-breitner.de ? GPG-Key: 0xF0FBF51F > Debian Developer: nomeata at debian.org > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From waldmann at imn.htwk-leipzig.de Tue Mar 31 17:42:20 2015 From: waldmann at imn.htwk-leipzig.de (Johannes Waldmann) Date: Tue, 31 Mar 2015 17:42:20 +0000 (UTC) Subject: [Haskell-cafe] Data.EnumMap ? Message-ID: Dear Cafe, in containers, we have Data.IntMap/IntSet . Because of the underlying implementation (patricia trees), keys/elements indeed have to be Int (we need their bits). This is a conflict with type-safety: I try to avoid Int, and use some newtype T = T Int instead. E.g., I want to distinguish several different indices for the same structure, like row and column numbers in (sparse) matrices, or vertices in bipartite graphs. So, I made these trivial wrappers EnumMap and EnumSet: https://github.com/jwaldmann/satchmo-solver/tree/master/src/Data Is this reasonable (do from/toEnum really have zero cost)? Would this be a useful addition to containers? - J.W. From chpatrick at gmail.com Tue Mar 31 17:53:00 2015 From: chpatrick at gmail.com (Patrick Chilton) Date: Tue, 31 Mar 2015 18:53:00 +0100 Subject: [Haskell-cafe] Data.EnumMap ? In-Reply-To: References: Message-ID: Wouldn't you get the same result with using unordered-containers and a Hashable instance for your Enums? See: https://hackage.haskell.org/package/hashable-1.2.2.0/docs/Data-Hashable.html#g:8 Patrick On Tue, Mar 31, 2015 at 6:42 PM, Johannes Waldmann < waldmann at imn.htwk-leipzig.de> wrote: > Dear Cafe, > > in containers, we have Data.IntMap/IntSet . > Because of the underlying implementation (patricia trees), > keys/elements indeed have to be Int (we need their bits). > > This is a conflict with type-safety: I try to avoid Int, > and use some newtype T = T Int instead. > E.g., I want to distinguish several different indices > for the same structure, like row and column numbers > in (sparse) matrices, or vertices in bipartite graphs. > > So, I made these trivial wrappers EnumMap and EnumSet: > https://github.com/jwaldmann/satchmo-solver/tree/master/src/Data > > Is this reasonable (do from/toEnum really have zero cost)? > Would this be a useful addition to containers? > > - J.W. > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andres.loeh at gmail.com Tue Mar 31 17:53:18 2015 From: andres.loeh at gmail.com (=?UTF-8?Q?Andres_L=C3=B6h?=) Date: Tue, 31 Mar 2015 19:53:18 +0200 Subject: [Haskell-cafe] Data.EnumMap ? In-Reply-To: References: Message-ID: Hi. Independently of your proposal, there already is https://hackage.haskell.org/package/EnumMap Cheers, Andres On Tue, Mar 31, 2015 at 7:42 PM, Johannes Waldmann wrote: > Dear Cafe, > > in containers, we have Data.IntMap/IntSet . > Because of the underlying implementation (patricia trees), > keys/elements indeed have to be Int (we need their bits). > > This is a conflict with type-safety: I try to avoid Int, > and use some newtype T = T Int instead. > E.g., I want to distinguish several different indices > for the same structure, like row and column numbers > in (sparse) matrices, or vertices in bipartite graphs. > > So, I made these trivial wrappers EnumMap and EnumSet: > https://github.com/jwaldmann/satchmo-solver/tree/master/src/Data > > Is this reasonable (do from/toEnum really have zero cost)? > Would this be a useful addition to containers? > > - J.W. > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From waldmann at imn.htwk-leipzig.de Tue Mar 31 18:06:14 2015 From: waldmann at imn.htwk-leipzig.de (Johannes Waldmann) Date: Tue, 31 Mar 2015 18:06:14 +0000 (UTC) Subject: [Haskell-cafe] Data.EnumMap ? References: Message-ID: @Andres > https://hackage.haskell.org/package/EnumMap I was not aware. But that looks like an actual copy of the IntMap code, so it does not get maintained/updated? That's why I was thinking of a wrapper module only. @Patrick > the same result with using unordered-containers and a Hashable instance? type-wise, yes, but it's a different implementation, so "same performance" should be benchmarked. - J.W. From ekmett at gmail.com Tue Mar 31 18:24:52 2015 From: ekmett at gmail.com (Edward Kmett) Date: Tue, 31 Mar 2015 14:24:52 -0400 Subject: [Haskell-cafe] Hackage trustee proposal: Curating the Hackage package collection In-Reply-To: References: <551A7AF3.2030309@ro-che.info> Message-ID: The only thing a trustee (or maintainer) can revise on an existing version is they can tighten or relax constraints for the cabal file. This can be used when a bound proved in practice to be too liberal or was insufficiently liberal to support the latest version of its dependencies without any semantic changes. Anything more (such as adding an instance for a superclass), fixing an import collision, etc. requires an new version. -Edward On Tue, Mar 31, 2015 at 10:52 AM, Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote: > Seems legit. If trustees can only release new versions, then that's the > end of the discussion. I thought that trustees had the ability to revise > the versions. > Sorry for making a fuss. > > Best. > > On 31 March 2015 at 20:16, Adam Bergmark wrote: > >> Sumit, It's unclear to me whether you are referring to publishing new >> revisions of versions or publishing new versions of packages. >> >> We have not discussed treating minor source changes as publishing new >> revisions, my impression has been that we would upload a new version. >> Maintainers can of course already do this. >> >> The introduction of metadata (.cabal file) revisions has already caused >> lots of heated discussion, so I wouldn't dare to suggest hackage serving >> fetching different tarballs on top of that :) >> >> On Tue, Mar 31, 2015 at 4:25 PM, Sumit Sahrawat, Maths & Computing, IIT >> (BHU) wrote: >> >>> Carter, >>> >>> Yes, I was talking about allowing maintainers to make source level edits. >>> I don't see any harm in allowing broken packages to be updated as they >>> won't work for anyone otherwise. >>> >>> I am not very inclined towards having the trustees edit packages >>> directly. They themselves didn't do it very much till now, and they >>> shouldn't have to. >>> They can instead contact the maintainer and have him fix the issues. In >>> case the maintainer is missing, they have no choice but to go ahead with >>> the changes. >>> >> >> Yes, maintainers should always be the go-to people for fixes, in a >> perfect world trustees would not be needed. >> >> - Adam >> >> >> >>> It's a good balance, as having a small group of trustees will ultimately >>> lead to slow response, whereas a large group is not preferable. >>> >>> On 31 March 2015 at 18:15, Carter Schonwald >>> wrote: >>> >>>> Maintainers can already edit the meta data for their own packages. >>>> >>>> As for small source changes, are you proposing that trustees have >>>> enough acls to do those by default, or that hackage editing allow source >>>> level changes? >>>> On Mar 31, 2015 7:23 AM, "Sumit Sahrawat, Maths & Computing, IIT (BHU)" >>>> wrote: >>>> >>>>> As Roman said, that definitely is a step in the right direction, but >>>>> as hackage grows, it might not be possible for a small group of trustees to >>>>> do all the work. >>>>> >>>>> I have some points that might be good to add: >>>>> >>>>> 1. The maintainers also get the same abilities as the trustees (edit >>>>> .cabal files, edit other package metadata etc.) >>>>> 2. The trustees can then notify the maintainers (if the changes are >>>>> considerable) or make the changes themselves otherwise. >>>>> 3. This also allows the maintainers to edit packages in case they >>>>> don't build, effectively removing the issue of what a "small source change" >>>>> is. >>>>> >>>>> >>>>> On 31 March 2015 at 16:16, Roman Cheplyaka wrote: >>>>> >>>>>> This is still very conservative, but definitely a step in the right >>>>>> direction. >>>>>> >>>>>> On 31/03/15 13:33, Adam Bergmark wrote: >>>>>> > Dear Haskell Community, >>>>>> > >>>>>> > For some time Hackage has contained a user group called "Trustees", >>>>>> > http://hackage.haskell.org/packages/trustees/ . >>>>>> > >>>>>> > >>>>>> > Description: The role of trustees is to help to curate the whole >>>>>> > package collection. Trustees have a limited ability to edit package >>>>>> > information, for the entire package database (as opposed to package >>>>>> > maintainers who have full control over individual packages). >>>>>> Trustees >>>>>> > can edit .cabal files, edit other package metadata and upload >>>>>> > documentation but they cannot upload new package versions." >>>>>> > >>>>>> > In short, making sure that packages keep building and filling the >>>>>> gap >>>>>> > between unreachable maintainers and package take-overs. >>>>>> > >>>>>> > Up until now we have been very careful with changes since we haven't >>>>>> > had a defined process. Spurred by SPJ and others we have been >>>>>> working >>>>>> > on a proposal for how we should operate. >>>>>> > >>>>>> > You can find the proposal here: >>>>>> > https://gist.github.com/bergmark/76cafefb300546e9b90e >>>>>> > >>>>>> > >>>>>> > We would now like your feedback! >>>>>> > >>>>>> > Some specific things from the proposal that we'd like your opinion >>>>>> on: >>>>>> > >>>>>> > * Section 1: No opt-out for restricting bounds >>>>>> > * Section 2: Opt-out rather than opt-in procedure for loosening >>>>>> version >>>>>> > constraints >>>>>> > * Section 2: Do you care whether you are notified before or after a >>>>>> > version constraint is loosened? >>>>>> > * Section 3: The time frame for publishing simple source changes >>>>>> > * Section 3: What exactly should constitute a "simple source change" >>>>>> > >>>>>> > >>>>>> > We also have a github repository where YOU can file issues about >>>>>> > broken packages, you can start doing this right now! >>>>>> > https://github.com/haskell-infra/hackage-trustees/ >>>>>> > >>>>>> > >>>>>> > Please share this with as many people as possible. >>>>>> > We are looking forward to hear your thoughts! >>>>>> > >>>>>> > Sincerely, >>>>>> > Adam Bergmark >>>>>> > >>>>>> > >>>>>> > >>>>>> > _______________________________________________ >>>>>> > Libraries mailing list >>>>>> > Libraries at haskell.org >>>>>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>>>>> > >>>>>> >>>>>> _______________________________________________ >>>>>> Haskell-Cafe mailing list >>>>>> Haskell-Cafe at haskell.org >>>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Regards >>>>> >>>>> Sumit Sahrawat >>>>> >>>>> _______________________________________________ >>>>> Haskell-Cafe mailing list >>>>> Haskell-Cafe at haskell.org >>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>> >>>>> >>> >>> >>> -- >>> Regards >>> >>> Sumit Sahrawat >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> > > > -- > Regards > > Sumit Sahrawat > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at well-typed.com Tue Mar 31 19:15:43 2015 From: adam at well-typed.com (Adam Gundry) Date: Tue, 31 Mar 2015 20:15:43 +0100 Subject: [Haskell-cafe] Data.EnumMap ? In-Reply-To: References: Message-ID: <551AF25F.3040908@well-typed.com> Dear Johannes, On 31/03/15 19:06, Johannes Waldmann wrote: > @Andres > >> https://hackage.haskell.org/package/EnumMap > > I was not aware. But that looks like an actual copy of the IntMap code, > so it does not get maintained/updated? > That's why I was thinking of a wrapper module only. There's also https://hackage.haskell.org/package/enummapset https://wiki.haskell.org/EnumSet_EnumMap so this must be a good idea, since it's come up so many times. :-) I've not looked at the performance overhead of this approach, but I have used something quite similar, which uses Coercible instead of Enum. Of course, that works only for newtypes of Int, but it is guaranteed to be zero-cost. Adam -- Adam Gundry, Haskell Consultant Well-Typed LLP, http://www.well-typed.com/ From waldmann at imn.htwk-leipzig.de Tue Mar 31 19:41:27 2015 From: waldmann at imn.htwk-leipzig.de (Johannes Waldmann) Date: Tue, 31 Mar 2015 19:41:27 +0000 (UTC) Subject: [Haskell-cafe] Data.EnumMap ? References: <551AF25F.3040908@well-typed.com> Message-ID: Adam Gundry well-typed.com> writes: > https://hackage.haskell.org/package/enummapset Ah. That's the wrapper I want. > so this must be a good idea, since it's come up so many times. Can we then please put it in containers? NB: The name (EnumMap) seems wrong, though. The module will be imported qualified anyways, so the type should just be Map. Then, changing the implementation (if the key type implements Ord, Enum, and Hashable) is really just changing the import. But then, it's at least consistently wrong - e.g., in line with Data.HashMap. Thanks, Johannes. From eir at cis.upenn.edu Tue Mar 31 20:08:38 2015 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Tue, 31 Mar 2015 16:08:38 -0400 Subject: [Haskell-cafe] Enforcing data structures invariant in the type system In-Reply-To: <51641C42-B65C-46CC-8387-3501AF0A63EE@gmail.com> References: <77C2D507-3778-44F3-9502-1EBEC9A1450D@gmail.com> <51641C42-B65C-46CC-8387-3501AF0A63EE@gmail.com> Message-ID: On Mar 31, 2015, at 12:46 PM, Nicola Gigante wrote: > Hi! is you dissertation available somewhere (or is still work in progress)? It's work not-yet-in-progress. Though (I think) I have a clear idea of where it's going, I have yet to write a proposal. The proposal is due in about a month and a half, and I expect the work to be done by summer 2016. If things go well, expect more announcements in this space when there are things to announce. :) Richard