News aggregator

`cabal repl` problems

haskell-cafe - Sat, 11/08/2014 - 5:39pm
Hi all, I have a Cabal project that has library, executable and several test parts. I'd like to be able to load one of the test parts into GHCi using `cabal repl`. However, I'm having some problems: (To be more specific, I have these parts in my Cabal file: - library - executable myapp - test-suite test - test-suite doctests) - `cabal repl test` tries to load test suite into GHCi but it doesn't ask me which test suite I want to load. For example, in my Cabal file I have `test-suite test` and `test-suite doctests`. `cabal test doctests` runs only doctests but I can't use similar command for repl, like `cabal repl doctests`. - `cabal repl test` tries to load the library, but using wrong set of dependencies. It uses `build-depends` field of `test-suite test` but it loads `library` sources. Note that `hs-source-dirs` field of `test-suite test` and `library` are different, and I have my library in `test-suite test` as a dependency. So the problem is that it tries to load `library` part using the source, inste
Categories: Offsite Discussion

GHC Weekly News - 2014/11/07

Haskell on Reddit - Sat, 11/08/2014 - 3:15pm
Categories: Incoming News

Question about foldl implemented as foldr: what's the type of the scan function?

Haskell on Reddit - Sat, 11/08/2014 - 11:26am

I have the following implementation of foldl using foldr:

myFoldl :: (a -> b -> a) -> a -> [b] -> a myFoldl f base xs = foldr scan id xs base where --scan :: b -> (a -> a) -> a -> a scan b g x = g (f x b)

What is the type of scan?

The above code will compile and works as expected, however, if I uncomment the type declaration for scan, then the code does not compile. I used a type hole and GHC told me that the commented out type decleration is the correct type for scan, so I guess a secondary question is why was GHC wrong when I was using the type hole?

submitted by Buttons840
[link] [4 comments]
Categories: Incoming News

hugs 98 - haskell 98 interpreter - Sat, 11/08/2014 - 10:44am
Categories: Offsite Blogs

nhc98 - small haskell 98 compiler - Sat, 11/08/2014 - 10:43am
Categories: Offsite Blogs

Where do the applicative laws come from?

Haskell on Reddit - Sat, 11/08/2014 - 10:36am

I'm now studying applicative funtors in haskell. As we all know, applicative functors have to obey a set of laws, namely:

[identity] pure id <*> v = v

[composition] pure (.) <*> u <*> v <*> w = u <*> (v <*> w)

[homomorphism] pure f <*> pure x = pure (f x)

[interchange] u <*> pure y = pure ($ y) <*> u

I'm wondering why these laws? Do they have their roots in category theory? What makes these laws so "good" or "special", namely, what can we gain from these laws?

submitted by rialmat
[link] [15 comments]
Categories: Incoming News

dirkz/haskell-cis-194 - Sat, 11/08/2014 - 9:33am
Categories: Offsite Blogs

Typing Haskell in Haskell - Sat, 11/08/2014 - 9:26am
Categories: Offsite Blogs

ICFP 2015: Call for Papers

General haskell list - Fri, 11/07/2014 - 6:45pm
===================================================================== 20th ACM SIGPLAN International Conference on Functional Programming ICFP 2015 Vancouver, Canada, August 31 - September 2, 2015 ===================================================================== Important Dates ~~~~~~~~~~~~~~~ Submissions due: Friday, February 27 2015, 23:59 UTC-11 Author response: Tuesday, April 21, 2015 through Thursday, 23 April, 2015 Notification: Friday, May 1, 2015 Final copy due: Friday, June 12, 2015 Scope ~~~~~ ICFP 2015 seeks original papers on the art and science of functional programming. Submissions are invited on all topics from principles to practice, from foundations to features, and from abstraction to application. The scope includes all languages that encourage functional programming, including both purely applicative and imperative languages, as well as languages with objects, concurrency, or parallelism. To
Categories: Incoming News

Proposal: Change the signature of mkWeakMVar

libraries list - Fri, 11/07/2014 - 6:16pm
We've had a ticket languishing in the trac for a couple of years that probably belongs as a libraries proposal: To summarize it here: In base 4.6 addMVarFinalizer is deprecated in favour of mkWeakMVar of type mkWeakMVar :: MVar a -> IO () -> IO (Weak (MVar a)) This type makes it inherently non-compositional. For instance, if we have a larger datatype T that contains an MVar somewhere inside then there in no way to define mkWeakT in terms of mkWeakMVar; instead, mkWeakT would have to be defined along the lines of mkWeakT :: T a -> IO () -> IO (Weak (T a)) mkWeakT m< at >(MkT (MVar m#) _) f = IO $ \s -> case mkWeak# m# m f s of (# s1, w #) -> (# s1, Weak w #) It would be better if the type of mkWeakMVar would change to mkWeakMVar :: MVar a -> v -> Maybe (IO ()) -> IO (Weak v) (i.e., following mkWeak rather than mkWeakPtr). (The same comment goes for related functions such as mkWeakIORef.) I'm personally in favor of the change,
Categories: Offsite Discussion

Discussion: remove the Applicative superclass from Alternative

libraries list - Fri, 11/07/2014 - 3:36am
Currently, Applicative is a superclass of Alternative. Unfortunately, the *only* laws for Alternative are the monoid laws. Sensible sets of laws have been proposed in the past, but unfortunately *none* of them cover all the current important instances. Thus we have a rather awkward situation where Alternative is a subclass of Applicative, but there's no real way to take advantage of that fact. There are essentially no useful functions that would end up with signatures that look like p :: (Applicative f, Alternative f) => ... I'm wondering, therefore, what people think of the idea of making Alternative entirely independent—just a version of Monoid with a different kind. class Alternative f where empty :: f a (<|>) :: f a -> f a -> f a A second option would be to go with a Functor superclass for Alternative; that might save some typing over the independent Alternative, and it comes with the free theorem fmap f empty = empty _______________________________________________ Libraries mailing list Libra
Categories: Offsite Discussion

Question about the PVP regarding changing A.B when no entities are removed/changed

libraries list - Thu, 11/06/2014 - 1:06pm
Hello all, The PVP <> seems to allow changing the A.B version numbers in a package even when no entities are removed/changed; the phrasing is (my emphasis): if only new bindings, types, classes, non-orphan instances or modules (but However, it seems to require changing the C nonetheless: but the new C *must* be greater than the old C As an example, I (mistakenly) released generic-deriving-1.7.0 <> after having added one function to it, bumping it from 1.6.3. If my interpretation of the PVP is correct, this change didn't follow the PVP only because I did not increase the C. Had I named it 1.7.4, it would have followed the PVP. (Oddly enough, 0.5.4 would have followed the PVP too!) I think this is a bit odd. Shouldn't we either: 1) Require that A.B remain the same when no entities are removed/changed, or 2) Only require the C to be greater if the A.B remained the same? Thanks, Pedro
Categories: Offsite Discussion

Proposal: add liftA4 and liftA5 to match liftM4 and liftM5

libraries list - Thu, 11/06/2014 - 4:24am
Since Applicative is supposed to be important now, I figure we should get these in. _______________________________________________ Libraries mailing list Libraries< at >
Categories: Offsite Discussion

Annotations: status and documentation

glasgow-user - Wed, 11/05/2014 - 10:21pm
I would like to be able to retrieve user-supplied annotations in Template Haskell. The 7.8 user manual doesn't mention this ability. However, I see this Trac page: Where it appears that this feature may exist in 7.8. I will gladly tinker with annotations and update the user manual if someone will help me understand what the situation is. On a related note, it looks like this patch pointed to from the Wiki page for annotations got ignored. Should i submit it to phabricator? Thanks, Greg Weber _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users< at >
Categories: Offsite Discussion

asum really needs to go into the Foldable class (or something)

libraries list - Wed, 11/05/2014 - 6:42pm
The current definition is "biased", using foldr and <|> instead of foldMap and the new Alt. This is a bit awkward in the post-BBP world, but we also don't want to just debias it across the board, because if the Foldable is holding lists, the debiased version will be very bad. More generally, there are a number of Foldable members that are very awkward, pleading for MPTC, because the sane implementations depend on both the container type and the element type. I know we're pushing right up against the deadline for 7.10.1, but the current situation is making me very nervous. David _______________________________________________ Libraries mailing list Libraries< at >
Categories: Offsite Discussion