News aggregator

implicit call stacks and calling function

haskell-cafe - Mon, 03/07/2016 - 9:35pm
I noticed this when I started using the new implicit call stacks feature. I didn't bring it up because I figure it probably had a good reason and was too late to change anyway, but the recent talk about HasCallStack reminded me and I'm curious. When you do GHC.Stack.getCallStack you get a [(String, SrcPos)]. The SrcPos is the position of the calling function, but the String is the callee function. So you can't get the name of the calling function. Instead, you get the name of the function with the call stack annotation. That's not so useful because in say a logging function, I'm interested in the caller's name. I don't need the name of the logging function, it's just something boring like "info" or "warn"! When I switched from a custom preprocessor that sort of implemented SRCLOC_ANNOTATE, it was definitely nice to lose the custom local hackery, but not so nice to lose the caller's name. For tests I used an unsafe mutable global via unsafePerformIO, otherwise failed tests can't report the name of the
Categories: Offsite Discussion

[ANN] brick-users discussion list

General haskell list - Mon, 03/07/2016 - 7:56pm
Hi, If you use the 'brick' library then you might like to know that there is now a library discussion list for it: https://groups.google.com/d/forum/brick-users
Categories: Incoming News

Magnus Therning: Final version of JSON to sum type

Planet Haskell - Mon, 03/07/2016 - 6:00pm

After some feedback on my previous post I ended up with the following implementation.

instance FromJSON V.VersionRange where parseJSON = withObject "VersionRange" go where go o = V.thisVersion <$> o .: "ThisVersion" <|> V.laterVersion <$> o .: "LaterVersion" <|> V.earlierVersion <$> o .: "EarlierVersion" <|> V.WildcardVersion <$> o .: "WildcardVersion" <|> nullaryOp V.anyVersion <$> o .: "AnyVersion" <|> binaryOp V.unionVersionRanges <$> o .: "UnionVersionRanges" <|> binaryOp V.intersectVersionRanges <$> o .: "IntersectVersionRanges" <|> V.VersionRangeParens <$> o .: "VersionRangeParens" nullaryOp :: a -> Value -> a nullaryOp = const binaryOp f [a, b] = f a b

Thanks David for your suggestions.

Categories: Offsite Blogs

Tagged instances for Aeson overlapped

haskell-cafe - Mon, 03/07/2016 - 4:37pm
Hello, I tried to compile my project with GHC 8 (from HEAD). And I got One of instances should be removed probably. I suppose that instance for removing should be instance in Data.Tagged. But version in Aeson should be PolyKinded. What do you think? Best regards, Dmitry _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Trouble on Travis CI with recent cabal versions

haskell-cafe - Mon, 03/07/2016 - 10:19am
For my OpenGLRaw project, I'm using a .travis.yml generated by Herbert's https://github.com/hvr/multi-ghc-travis and the corresponding https://launchpad.net/~hvr/+archive/ubuntu/ghc PPA. Recently things broke on Travis CI, and there are a few strange things: * The cabal-install-head package seems to be based on cabal 1.23, which is older than cabal-install-1.24. Is this intended? * The OpenGLRaw package has no test suite, and this seems to be OK for cabal-install-head ( https://travis-ci.org/haskell-opengl/OpenGLRaw/jobs/114109605#L929), while cabal-install-1.24 fails in the "cabal test" step ( https://travis-ci.org/haskell-opengl/OpenGLRaw/jobs/114109606#L1022). This is a regression: I think that "cabal test" for a package without a test suite should be a no-op, at least that used to be the case. * Why does "cabal test" say "Re-configuring with test suites enabled. If this fails, please run configure manually." when "cabal configure" has already been run (including --enable-tests)? This looks li
Categories: Offsite Discussion

1-to-many preprocessor in stack/Cabal builds

haskell-cafe - Mon, 03/07/2016 - 8:53am
Hi, I'm writing a package which uses custom preprocessor for creating some of the source files. It takes one IDL file as input and writes several .hs modules, depending on IDL contents. I need to compile this modules with a few normal ones and link them as a library, preferably with generated modules exposed. It doesn't look like a complex task and never was in with make/etc, but I run into some problems now. Obviously, cabal supports 1-to-1 preprocessors to create one Haskell module from one source file (alex, happy, etc), but I can't find anything for 1-to-many preprocessors. So, I decided to use hookedPrograms and hooks and do it myself. The call to preprocessor in the postConf hook worked just fine and created source files and module list. Cabal pre-* hooks seems to be right place to read this module list and use it, but are presenting two problems: can only modify other-modules, not exposed-modules, which is tolerable, and there is no access to build configuration. The latter is fatal, I need to know
Categories: Offsite Discussion

PolyKind for Fixed and HasResolution from Data.Fixed

haskell-cafe - Sun, 03/06/2016 - 7:29pm
Hi all! If we define HasResolution and Fixed like that: class HasResolution (a :: k) where resolution :: p a -> Integer newtype Fixed (a :: k) = Fixed Integer We can do something like that: instance KnownNat a => HasResolution a where resolution = natVal 2.3 :: Fixed 1
Categories: Offsite Discussion

GADTs and Exponentiated Functors

haskell-cafe - Sun, 03/06/2016 - 2:11pm
Hi, I have been recently playing around with GADTs, using them to keep track of how many times a functor has been applied. This provides a solution to what seems to be a long standing problem, summarized here: https://byorgey.wordpress.com/2007/08/16/mapping-over-a-nested-functor/ If the nesting depth is part of the type, it is possible to apply fmap automatically as needed. This allows you to write fairly elegant expressions like: data Person = Person { name :: String, age :: Integer, gender :: String, status :: String } deriving Show let persons = fromList' [Person {name="Alice", age=20, gender="F", status="Good"}, Person {name="Bob", age=18, gender="M", status="Good"}, Person {name="Chuck", age=16, gender="M", status="Bad"}] :: NList N1 Person persons `select` age
Categories: Offsite Discussion

Test email

libraries list - Thu, 03/03/2016 - 7:54pm
Please disregard -- sorry for the noise. Gershom
Categories: Offsite Discussion

New gtk2hs 0.12.4 release

gtk2hs - Wed, 11/21/2012 - 12:56pm

Thanks to John Lato and Duncan Coutts for the latest bugfix release! The latest packages should be buildable on GHC 7.6, and the cairo package should behave a bit nicer in ghci on Windows. Thanks to all!

~d

Categories: Incoming News