News aggregator

MPTC vs. constructor class

haskell-cafe - Fri, 03/11/2016 - 8:13pm
I've been messing around with type-aligned sequences for a while, and I'm currently exploring the design space of classes for them. The type-aligned package uses this: class TASequence s where tempty :: s c x x Source tsingleton :: c x y -> s c x y
Categories: Offsite Discussion

Prelude.head: empty list

haskell-cafe - Fri, 03/11/2016 - 5:56pm
In a rather large program I made some changes, and now I get the runtime error: ampersand.exe: Prelude.head: empty list Of course I know that head is partial, and should be used with care. It is used many times (we have 100+ modules in the program). Is there an elegant way to get some information about where the specific call to head is being made? Thanks! _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

GHC API arguments via cabal/stack?

haskell-cafe - Fri, 03/11/2016 - 11:27am
Hi all, I'm working on a little program that uses GHC as a library to do some static analysis on a project I'm working on. It runs things as far as the typechecker (so there's no Template Haskell remaining) and then does the analysis on the resulting AST. Here is how I'm calling GHC at the moment: runAnalyser :: FilePath -> [String] -> [String] -> IO [(Module, [Fact], [Assertion])] runAnalyser srcDir args modules = do defaultErrorHandler defaultFatalMessager defaultFlushOut $ do runGhc (Just libdir) $ do dflags <- getSessionDynFlags (dflags', leftover, warnings) <- parseDynamicFlagsCmdLine dflags (map noLoc $ args ++ modules) setSessionDynFlags dflags' setTargets =<< forM modules (\exampleModule -> guessTarget (exampleModuleFile srcDir exampleModule) Nothing) load LoadAllTargets execWriterT $ forM_ modules $ \exampleModule -> do modSum <- lift $ getModSummary $ mkModuleName exampleModule
Categories: Offsite Discussion

CfP WPTE 2016 (affiliated with FSCD 2016)

General haskell list - Fri, 03/11/2016 - 10:50am
[We apologize if you have received multiple copies of this message] [Please disseminate] ======================================================================================== CALL FOR PAPERS Third International Workshop on Rewriting Techniques for Program Transformations and Evaluation WPTE 2016 affiliated with FSCD 2016 23 June, 2016, Porto, Portugal ======================================================================================== Aims and Scope ============== The aim of WPTE is to bring together the researchers working on program transformations, evaluation, and operationally-based programming language semantics, using rewriting methods, in order to share the techniques and recent developments and to exchange ideas to encourage further activation of research in this area. The previous WPTE were held in V
Categories: Incoming News

Zoom instance for Coroutine

haskell-cafe - Fri, 03/11/2016 - 9:35am
Hello, I am using monad-coroutine <> package and have something like Coroutine (Await Int) (State MyState) Int (simplified version, for example purpose). MyState is deeply nested and I do a lot of modifications in it. Previously (with different data types) I was able to use zoom from lens <>in order to simplify the typing/view of code which operates on some subtree of the state, e.g.: zoom (company.assets) $ do something.a = someComputation anotherthing.b = False this.that = "someString" The problem I am having is that I cannot come up with instance Zoom for the Coroutine and was wondering if anyone is able to help me with that? Best regards, Konstantin _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >
Categories: Offsite Discussion

Alternative Proxy

libraries list - Thu, 03/10/2016 - 12:49am
This is the only possible it should exist instance Alternative Proxy where empty = Proxy _ <|> _ Proxy _______________________________________________ Libraries mailing list Libraries< at >
Categories: Offsite Discussion

Implement traverseMaybe in Data.Map, Data.IntMap, etc

libraries list - Tue, 03/08/2016 - 10:43am
As far as I know, the most general form of a function that allows traversing and filtering is: type Filter s t a b = foall f. Applicative f => (a -> f (Maybe b)) -> s -> f t In my witherable[0] package, I defined `Witherable` as a subclass of `Traversable` to provide such operation for various containers. class T.Traversable t => Witherable t where wither :: Applicative f => (a -> f (Maybe b)) -> t a -> f (t b) ... However, the `wither` for `Map` is currently inefficient because it is defined in terms of `traverse` and `mapMaybe`, so it traverses the container twice. Efficient implementation.would have to use the hidden constructors. I would like to propose adding `traverseMaybe` and `traverseMaybeWithKey` for `Data.Map`, `Data.IntMap`, and their strict variants (I'm suggesting more conservative name because wither might sound too unusual or poetic for a standard library. I like 'wither' though). A possible implementation would be like this: traverseMaybeWithKey :: Applicative f => (k -> a ->
Categories: Offsite Discussion

Add `take`/`drop`/`splitAt` to `Data.Map`/`Data.Set`

libraries list - Tue, 03/08/2016 - 2:14am
I would like to propose adding `take`/`drop`/`splitAt` to both `Data.Map` and `Data.Set` as originally requested in: <> The motivation behind this proposal is three-fold: * for convenience - these functions are commonly used to implement pagination or previews of maps/sets * for type accuracy - the public API impose an unnecessary `Ord` constraint * for efficiency - these can be implemented more efficiently using the internal API Currently the only way you can implement this functionality via the public API is to use `lookupIndex`/`elemAt` + `split`. For example, one way to implement `Data.Set.take` is: take :: Ord a => Int -> Set a -> Set a take n m | n < 0 = empty | size m <= n = m | otherwise = lt where (lt, _) = split k m k = elemAt n m {-# INLINE take #-} This implementation incurs an unnecessary `Ord` constraint due to a roundabout way of computing `take`: this ext
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!


Categories: Incoming News