[Haskell-cafe] Haskellers in Minsk, Belarus?
Hi, I just read an article (sorry, it is in russian: http://habrahabr.ru/post/196454/ ). The idea I found interesting: even in big citied developers complain that nothing happens at their location, but when you try to make an event -- only few of them want to participate. I never participate in events. What is wrong with me/us? So, any haskellers in Minsk, Belarus? What about beer, coffee or co-hacking? I don't have solid idea how to organize an event, but I'm sure haskellers are interesting people, both personally and professionally. Thanks, Yuras ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] enumerators: exception that can't be catched
Hi, Isn't it by design? Consider the next code: import Data.Enumerator (($$), (>>==)) import qualified Data.Enumerator as E import qualified Data.Enumerator.List as EL import Control.Exception import Control.Monad.IO.Class main :: IO () main = do res <- E.run $ myEnum $$ EL.take 5 `E.catchError` (\_ -> liftIO (print "exception") >> return []) print res myEnum :: Monad m => E.Enumerator Int m b -- myEnum (E.Continue k) = k (E.Chunks [1, 2]) >>== myEnum -- (1) -- myEnum (E.Continue k) = E.throwError (ErrorCall "EEE") -- (2) myEnum step = E.returnI step If uncomment (1), then myEnum will generate infinite list like [1, 2, 1, 2, ...]. If uncomment (2), then it will throw exception, and it can't be caught. Is it a correct behavior? Or I have a bug in "myEnum" implementation? It makes some sense for me: when enumerator throws error, then there is no way to proceed, and "E.run" returns Left immediately. So, "throwError" in enumerator can't be caught. Is it correct? Then it seems to be a design bug in websockets -- it is not possible to know from the WebSockets monad that client closed connection. Thanks, Yuras On Thu, 2013-08-29 at 14:04 +0300, Yuras Shumovich wrote: > Hi, > > Thank you for the reply. > > Unlikely it is the case (if I understand it correctly). The exception is > thrown by "enumSocket", I added traces to prove that. And it is > propagated to > "runWithSocket" ( > http://hackage.haskell.org/packages/archive/websockets/0.7.4.0/doc/html/src/Network-WebSockets-Socket.html#runWithSocket > ), so that "Data.Enumerator.run" returns "Left". So actually it is not an IO > exception, but it is thrown via "throwError". > > Looks like I don't have other options except to reimplement websockets > protocol myself :( > > Thanks, > Yuras > > On Tue, 2013-08-27 at 15:40 -0400, Ben Doyle wrote: > > This is partially guesswork, but the code to catchWSError looks > > dubious: > > > > > > catchWsError :: WebSockets p a > > -> (SomeException -> WebSockets p a) > > -> WebSockets p a > > catchWsError act c = WebSockets $ do > > env <- ask > > let it = peelWebSockets env $ act > > cit = peelWebSockets env . c > > lift $ it `E.catchError` cit > > where > > peelWebSockets env = flip runReaderT env . unWebSockets > > > > Look at `cit`. It runs the recovery function, then hands the underlying > > Iteratee the existing environment. That's fine if `act` is at fault, but > > there are Iteratee- and IO-ish things in WebSocketsEnv---if one of > > `envSink` or `envSendBuilder` is causing the exception, it'll just get > > re-thrown after `E.catchError`. (I think. That's the guesswork part.) > > So check how `envSendBuilder` is built up, and see if there's a way it > > could throw an exception on client disconnect. > > > > > > On Tue, Aug 27, 2013 at 10:28 AM, Yuras Shumovich > > wrote: > > Hello, > > > > I'm debugging an issue in "websockets" package, > > https://github.com/jaspervdj/websockets/issues/42 > > > > I'm not familiar with "enumerator" package (websockets are > > based on it), > > so I'm looking for help. The exception is throws inside > > "enumSocket" > > enumerator using > > "throwError" ( > > http://hackage.haskell.org/packages/archive/network-enumerator/0.1.5/doc/html/src/Network-Socket-Enumerator.html#enumSocket > > ), but I can't catch it with "catchError". It is propagated to "run" > > function: > >: recv: resource vanished (Connection reset by > > peer) > > > > The question is: how is it possible? could it be a bug in > > "enumerator" > > package? > > > > Thanks, > > Yuras > > > > > > ___ > > Haskell-Cafe mailing list > > Haskell-Cafe@haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] enumerators: exception that can't be catched
Hi, Thank you for the reply. Unlikely it is the case (if I understand it correctly). The exception is thrown by "enumSocket", I added traces to prove that. And it is propagated to "runWithSocket" ( http://hackage.haskell.org/packages/archive/websockets/0.7.4.0/doc/html/src/Network-WebSockets-Socket.html#runWithSocket ), so that "Data.Enumerator.run" returns "Left". So actually it is not an IO exception, but it is thrown via "throwError". Looks like I don't have other options except to reimplement websockets protocol myself :( Thanks, Yuras On Tue, 2013-08-27 at 15:40 -0400, Ben Doyle wrote: > This is partially guesswork, but the code to catchWSError looks > dubious: > > > catchWsError :: WebSockets p a > -> (SomeException -> WebSockets p a) > -> WebSockets p a > catchWsError act c = WebSockets $ do > env <- ask > let it = peelWebSockets env $ act > cit = peelWebSockets env . c > lift $ it `E.catchError` cit > where > peelWebSockets env = flip runReaderT env . unWebSockets > > Look at `cit`. It runs the recovery function, then hands the underlying > Iteratee the existing environment. That's fine if `act` is at fault, but > there are Iteratee- and IO-ish things in WebSocketsEnv---if one of `envSink` > or `envSendBuilder` is causing the exception, it'll just get re-thrown after > `E.catchError`. (I think. That's the guesswork part.) > So check how `envSendBuilder` is built up, and see if there's a way it could > throw an exception on client disconnect. > > > On Tue, Aug 27, 2013 at 10:28 AM, Yuras Shumovich > wrote: > Hello, > > I'm debugging an issue in "websockets" package, > https://github.com/jaspervdj/websockets/issues/42 > > I'm not familiar with "enumerator" package (websockets are > based on it), > so I'm looking for help. The exception is throws inside > "enumSocket" > enumerator using > "throwError" ( > http://hackage.haskell.org/packages/archive/network-enumerator/0.1.5/doc/html/src/Network-Socket-Enumerator.html#enumSocket > ), but I can't catch it with "catchError". It is propagated to "run" > function: >: recv: resource vanished (Connection reset by > peer) > > The question is: how is it possible? could it be a bug in > "enumerator" > package? > > Thanks, > Yuras > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] enumerators: exception that can't be catched
Hello, I'm debugging an issue in "websockets" package, https://github.com/jaspervdj/websockets/issues/42 I'm not familiar with "enumerator" package (websockets are based on it), so I'm looking for help. The exception is throws inside "enumSocket" enumerator using "throwError" ( http://hackage.haskell.org/packages/archive/network-enumerator/0.1.5/doc/html/src/Network-Socket-Enumerator.html#enumSocket ), but I can't catch it with "catchError". It is propagated to "run" function: : recv: resource vanished (Connection reset by peer) The question is: how is it possible? could it be a bug in "enumerator" package? Thanks, Yuras ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Prolog-style patterns
Hi, On Mon, 2013-04-08 at 07:06 -0700, Conal Elliott wrote: > What you're suggesting is called "non-linear patterns", and it's a > perfectly sensible, well-defined feature in a language with > pattern-matching. As you point out, non-linearity allows for more direct & > succinct programming. I've often wished for this feature when writing > optimizations on data types, especially for syntactic types (languages). AFAIK pattern-match overlap checking is well defined for linear patterns, but it is not fully implemented and buggy in ghc (I found ~10 open tickets, most of them are pretty old). Will not it be a nightmare to implement and maintain checker for overlapping/unused clauses for non-linear patterns? We already have a number of language extensions without good warnings (and even worse -- with incorrect warnings): view patterns, overloaded literals, GADTs, etc. Thanks, Yuras ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: pdf-toolbox
Hello, I have uploaded the first release of my pdf toolbox, a collection of tools for processing PDF files. It supports both parsing and generating of pdf files. It consists of two libraries: - core ( http://hackage.haskell.org/package/pdf-toolbox-core ) contains low level tools. - document ( http://hackage.haskell.org/package/pdf-toolbox-document ) contains pretty limited set of middle level tools. (Also there is the 3d library, pdf-toolbox-content. It contains tools for processing pdf page content, e.g. text extraction. It is not released yet, but you can find it on github.) The initial plan was to create higher level tools before releasing on hackage, but I found it hard to design good high level API without wide rage on use cases. So I decided to release it earlier in order to receive feedback. You can find few examples here: https://github.com/Yuras/pdf-toolbox/tree/master/examples Thanks, Yuras ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] websockets client
Hi, websockets package has basic support for client-side applications: http://hackage.haskell.org/packages/archive/websockets/0.7.2.1/doc/html/Network-WebSockets.html#g:12 AFAIK it is the only available option right now (except implementing it yourself.) Thanks, Yuras On Thu, 2013-02-21 at 16:09 -0500, Stephen Olsen wrote: > Are there any good websockets client libraries for haskell. I've been > searching for one but can only come up with server implementations. > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] multi-thread and lazy evaluation
Hi, AFAIK it is (partially?) fixed in HEAD, see http://hackage.haskell.org/trac/ghc/ticket/367 It works for me with -fno-omit-yields Thanks, Yuras On Tue, 2012-12-25 at 19:35 +0100, timothyho...@seznam.cz wrote: > I'm not sure that there is anything "great" about this bug. It seems to me > to be a rather severe demonstration of a somewhat already known design flaw > in the runtime :( > > Could you please comment on the actual bug rather than replying here so that > the devs see that this behaviour has been confirmed? > > Tim > > > -- Původní zpráva -- > Od: Corentin Dupont > Datum: 25. 12. 2012 > Předmět: Re: [Haskell-cafe] multi-thread and lazy evaluation > > " > > Great, with me compiled with ghc -threaded the bug shows up. > > However, runnning "main" in ghci doesn't show the bug (it finishes > correctly). > > I have GHC 7.4.1. > > > > Corentin > > > > On Tue, Dec 25, 2012 at 3:34 PM, (mailto:timothyho...@seznam.cz)> wrote: > " > This seems like a bug in GHC. But it has nothing to do with MVars. I've > narrowed this down and filed a bug report here: > > http://hackage.haskell.org/trac/ghc/ticket/7528 > (http://hackage.haskell.org/trac/ghc/ticket/7528) > > Timothy > > > -- Původní zpráva -- > Od: Yuras Shumovich mailto:shumovi...@gmail.com)> > > > Datum: 24. 12. 2012 > Předmět: Re: [Haskell-cafe] multi-thread and lazy evaluation > > > > > "On Mon, 2012-12-24 at 16:16 +0100, timothyho...@seznam.cz > (mailto:timothyho...@seznam.cz) wrote: > > The real question is, does this mean that GHC is stopping the world every > > time it puts an MVar? > > No, GHC rts only locks the MVar itself. > See here: > http://hackage.haskell.org/trac/ghc/browser/rts/PrimOps.cmm#L1358 > (http://hackage.haskell.org/trac/ghc/browser/rts/PrimOps.cmm#L1358) > > Yuras" > > > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org(mailto:Haskell-Cafe@haskell.org) > http://www.haskell.org/mailman/listinfo/haskell-cafe > (http://www.haskell.org/mailman/listinfo/haskell-cafe) > > " > > > " ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] multi-thread and lazy evaluation
On Mon, 2012-12-24 at 16:16 +0100, timothyho...@seznam.cz wrote: > The real question is, does this mean that GHC is stopping the world every > time it puts an MVar? No, GHC rts only locks the MVar itself. See here: http://hackage.haskell.org/trac/ghc/browser/rts/PrimOps.cmm#L1358 Yuras ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal dependencies
On Sat, 2012-10-06 at 22:40 +0200, José Lopes wrote: > OK. Got it! > > Do you have any suggestions to install xmobar in this particular case? In case of executables I usually rm -rf ~/.ghc, cabal install, and rm -rf ~/.ghc again. Executables are still here (in ~/.cabal/bin), but all libraries are lost. Warning: it may break your development environment, so make sure you know what you are doing. Better solution could be sandbox tools like cabal-dev. They alloy you to setup development environment per project. > > Thanks, > José > > On 06-10-2012 19:08, Yuras Shumovich wrote: > > On Sat, 2012-10-06 at 18:25 +0200, José Lopes wrote: > >> OK. > >> > >> But, wouldn't it be possible for xmobar to use mtl-2.0.1.0 and for > >> parsec to use mtl-2.1.1, while xmobar would use this parsec version? > >> In this case, I am assuming that mtl-2.0.1.0 and mtl-2.1.1 are > >> considered two different libraries. > > Usually it leads to "strange" compilation errors. > > > > E.g. > > Package A: > >data AA = AA String > >func0 :: Int -> AA > >func0 n = AA $ replicate n "A" > >func1 :: AA -> Int > >func1 (AA str) = length str > > > > Package B: > >import A > >func2 :: AA -> Int > >func2 aa = func1 + 1 > > > > Package C: > > > >import A > >import B > >func3 :: Int -> Int > >func3 n = func2 $ func0 n > > > > If C and B are compiled with different versions of C, > > then func3 will not compile. Compiler will say that > > AA returned by func0 doesn't match AA expected by func2 > > > > More real examples: > > http://stackoverflow.com/questions/11068272/acid-state-monadstate-instance-for-update > > http://stackoverflow.com/questions/12576817/couldnt-match-expected-type-with-actual-type-error-when-using-codec-bmp/12577025#12577025 > > > > > >> Thanks, > >> José > > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal dependencies
On Sat, 2012-10-06 at 18:25 +0200, José Lopes wrote: > OK. > > But, wouldn't it be possible for xmobar to use mtl-2.0.1.0 and for > parsec to use mtl-2.1.1, while xmobar would use this parsec version? > In this case, I am assuming that mtl-2.0.1.0 and mtl-2.1.1 are > considered two different libraries. Usually it leads to "strange" compilation errors. E.g. Package A: data AA = AA String func0 :: Int -> AA func0 n = AA $ replicate n "A" func1 :: AA -> Int func1 (AA str) = length str Package B: import A func2 :: AA -> Int func2 aa = func1 + 1 Package C: import A import B func3 :: Int -> Int func3 n = func2 $ func0 n If C and B are compiled with different versions of C, then func3 will not compile. Compiler will say that AA returned by func0 doesn't match AA expected by func2 More real examples: http://stackoverflow.com/questions/11068272/acid-state-monadstate-instance-for-update http://stackoverflow.com/questions/12576817/couldnt-match-expected-type-with-actual-type-error-when-using-codec-bmp/12577025#12577025 > > Thanks, > José ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal dependencies
On Sat, 2012-10-06 at 17:02 +0200, José Lopes wrote: > Hello, Hello > > I'm trying to understand Cabal dependencies. > Why does the following situation happen? xmobar-0.15 depends on mtl-2.0.* and needs parsec All packages that will be broken, depends on parsec. But parsec is compiled with mtl-2.1.1 To install xmobar, cabal needs to reinstall parsec with mtl-2.0.1.0 Thanks, Yuras > > # cabal install xmobar --dry-run > Resolving dependencies... > In order, the following would be installed: > parsec-3.1.3 (reinstall) changes: mtl-2.1.1 -> 2.0.1.0 > xmobar-0.15 (new package) > Warning: The following packages are likely to be broken by the reinstalls: > Best regards, > José > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: bindings-gobject-0.4
Hello, I uploaded new release of bindings-gobject, low level binding to gobject library: http://hackage.haskell.org/package/bindings-gobject-0.4 (I maintain it now) Now it exposes internals of GObject and GObjectClass, so it is possible to create custom GObject subclasses from haskell land. Source repository contains basic example: https://github.com/Yuras/bindings-gobject/blob/master/examples/custom-object/main.hs The use case I'm personally is interested in is implementing custom SourceCompletionProvider for gtksourceview2. I hope it will be useful for other applications. Right now we don't (afaik) have low level bindings to gtk and gtksourceview. But once we will have them, it will be possible to create custom controls in haskell and even expose them to C (C++, python, etc) land. Thanks, Yuras ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How do I marshall a pointer over SendMessage LPARAM or WPARAM?
On Wed, 2012-07-18 at 18:22 +0200, Simon Peter Nicholls wrote: > Some "sending" code: > > Foreign.C.String.withCWString "frustrator" $ \s -> do > let wParam = System.Win32.Types.castPtrToUINT s :: > System.Win32.Types.WPARAM > Graphics.Win32.sendMessage wnd Graphics.Win32.wM_APP wParam 0 > > wndProc "receiving" code: > > | wmsg == Graphics.Win32.wM_APP = do > s <- peekCWString $ System.Win32.Types.castUINTToPtr wParam > putStrLn s > return 0 > >From the docs ( http://hackage.haskell.org/packages/archive/base/4.5.1.0/doc/html/Foreign-C-String.html#v:withCWString ): > the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this I'm noy a windows guru, but I assume that `sendMessage` just puts the message into a queue and exits. So, you receive a pointer to already deallocated memory. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE : Leksah 0.12
Hi, I can confirm the issue with gtksourceview2.h Also I have the next error with leksah-server: src/IDE/Core/CTypes.hs:548:10: Duplicate instance declarations: instance NFData Version -- Defined at src/IDE/Core/CTypes.hs:548:10-23 instance NFData Version -- Defined in Control.DeepSeq ghc-7.0.4 deepseq-1.3.0.0 arch-x86_64 libgtksourceview2.0-dev is installed Thanks, Yuras ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghc HEAD
2010/9/7 Johannes Waldmann : > I was compiling ghc-6.13.20100831 from source (*) > and then compiling repa-examples with that, > and the generated executable says (when called with +RTS -N2): > > Most RTS options are disabled. Link with -rtsopts to enable them. > > Where? How? When? (Did I make some error earlier?) > AFAIK RTS options are disabled by default now due to security problems. see http://hackage.haskell.org/trac/ghc/ticket/3910 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] autocomplete using hoogle
Hello, Just want to share some results of my weekend hacking. It is clear that haskell type checker can help to build a list of suggestions for autocomplete (very old idea). I tried to create a very basic prototype to play with the idea. The approach I used: The task can be divided into the next two parts: - find the most general type of the word we are trying to complete that will satisfy the type checker - find all the symbols that "match" the found type The first task can be solved using ghc. Just replace the word with "()" and ghc will tell you something like Couldn't match expected type `m String' against inferred type `()' The second task can be solved using hoogle. Just ask it to find everything that matches "base :: type", where base -- already known part of the word; type -- the type that ghc expects. Source code is attached (linux only at a moment) haskell.vim -- very basic ftplugin for vim Place it into your ~/.vim/ftplugin directory (don't forget to backup an existent file if any) complete.hs -- simple script that does actual work. How to use it. cd to the cabal package you are working on at a moment mkdir dist/hscomplete copy complete.hs file to the dist/hscomplete edit complete.hs (at least change the package name, it is hard coded) create hoogle database for your package: cabal haddock --hoogle hoogle --convert=dist/doc/html//.hoo +base +directory +... (all packages you depend on) start vim (you should be in the directory where .cabal file is placed!) Use C-X C-O to auto complete Example: cabalized package "tmp" contains two modules Data.Tmp and Data.Tmp1 Data.Tmp1 imports Data.Tmp Data/Tmp.hs contains veryLongLongName1 :: Int veryLongLongName1 = 1 veryLongLongName2 :: Char veryLongLongName2 = 'c' veryLongLongName3 :: String veryLongLongName3 = "Hello" vim src/Data/Tmp1.hs import Data.Tmp tmp1 :: Monad m => [a] -> m Int tmp1 a = very suggests veryLongLongName1 tmp2 :: Monad m => [a] -> m Char tmp2 a = very suggests veryLongLongName2 and veryLongLongName3 tmp3 :: Monad m => [a] -> m String tmp3 a = very suggests veryLongLongName3 Warning: not ready for real use (no error handling, a lot of hard codes, slow, etc). Just for playing Yuras haskell.vim Description: Binary data module Main where import System.IO import System.Process import System.Environment import Text.Regex import Data.Maybe import Debug.Trace basedir = "dist/hscomplete" logfile = basedir ++ "/log" inputfile = basedir ++ "/haskell.hs" outputfile = basedir ++ "/results" hssourcedir = "src" packagename = "tmp" hooglepackages = "+base +directory +process" main :: IO () main = withFile logfile WriteMode complete complete :: Handle -> IO () complete log = do hPutStrLn log "log" [line', col', base] <- getArgs let line = read line' :: Int let col = read col' :: Int hPutStrLn log $ show line ++ ":" ++ show col ++ ":" ++ base content <- fmap (fixContent line col) $ readFile inputfile writeFile (basedir ++ "/main.hs") content (ec, _, stderr) <- readProcessWithExitCode "ghc" ["--make", basedir ++ "/main.hs", "-i" ++ hssourcedir] [] hPutStr log stderr let re1 = mkRegex "Couldn't match expected type `([^']*)'" let re2 = mkRegex "against inferred type `\\(\\)'" let m1 = matchRegex re1 stderr let m2 = matchRegex re2 stderr hPutStrLn log $ "match: " ++ show m1 ++ " " ++ show m2 if isJust m1 && isJust m2 && length (fromJust m1) == 1 then do (ec, stdout, _) <- readProcessWithExitCode "hoogle" (hoogleOpts ++ [base ++ " :: " ++ (head $ fromJust m1)]) [] let ls = map (head . drop 1 . take 2 . words) $ lines stdout hPutStrLn log (show ls) hPutStrLn log $ show (filter (filterBase base) ls) withFile outputfile WriteMode (\h -> mapM_ (hPutStrLn h) $ filter (filterBase base) ls) else writeFile outputfile "" hPutStrLn log "OK" hoogleOpts = ["--data=dist/doc/html/" ++ packagename ++ "/" ++ packagename ++ ".hoo"] ++ [hooglepackages] --XXX fixContent :: Int -> Int -> String -> String fixContent line col cont = trace (show ln) $ concat $ map (++ "\n") $ pre ++ post where ls = lines cont pre = take (line - 1) ls ++ [ln'] post = tail post' post' = drop (line - 1) ls ln = head post' ln' = take (col - 1) ln ++ "() " ++ drop col ln filterBase :: String -> String -> Bool filterBase base str = ls > lb && str' == base where lb = length base ls = length str str' = take lb str ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: Haddock version 2.8.0
2010/9/2 Mark Lentczner : > On Sep 2, 2010, at 5:00 AM, David Waern wrote: > If you'd like to see the new look in action, I've generated some pages for a > few packages here: > http://www.ozonehouse.com/mark/snap-xhtml/ Is it possible to switch back from frame version to non frame version? The "Frames" button disappears in frame mode... Also style changing works only inside the main frame. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany)
2010/8/27 sylvain : > Hi, > > the results given by the same research at the world level is worrisome: > the interest in Haskell is steadily declining since 2004. Why was > Haskell not successful conquering the hearts? Is it doomed to fail or is > there still a chance? > > http://www.google.com/insights/search/#q=haskell&cmpt=q > Compare with http://www.google.com/insights/search/#q=programming&cmpt=q or http://www.google.com/insights/search/#q=java&cmpt=q So don't worry :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there a pure Haskell gzip/bzip compression module out there?
2010/8/12 Max Bolingbroke : > On 12 August 2010 12:10, C K Kashyap wrote: > http://hackage.haskell.org/packages/archive/zlib/0.4.0.2/doc/html/Codec-Compression-GZip.html It is not pure haskell implementation. As I know there are no pure implementation. But why not to use binding to foreign library? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] subversion with haskell
Hi, Try the next: % env EXTRA_CPPFLAGS="-I/usr/local/include/subversion-1" \ EXTRA_LDFLAGS="-L/usr/local/lib" \ runhaskell Setup.hs configure % runhaskell Setup.hs build % runhaskell Setup.hs install (and read the installation instructions included into the tarball :) ) 2010/8/5 Andrew U. Frank : > i found the file in usr/include/subversion-1 (i use an ubuntu (debian) > installation form). but the cabal installer (i.e. the configure script) > does not find the file. > > can you give me a hint where it could search and where i could copy the > file to. i tried to read the configure script, but cannot see, where it > searches. i am not familiar with cpp and do not understand what the hint > 'extra cpp flags' could mean. > > thanks for your help! > > andrew > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] subversion with haskell
Hi, As reported by the configure script, file svn_error.h is missing. It presence in latest svn api (http://subversion.apache.org/docs/api/latest/svn__error_8h.html) It can be installed in some unusual location, you can try "find / -name svn_error.h" If you are using debian based system, you can try apt-file to find the correspondent package. 2010/8/5 Andrew U. Frank : > hackage contains a package Hs2SVN > > HsSVN seems to do what i need, but unfortunately, i cannot install it - > i have the error : > > checking for stdint.h... yes > checking for unistd.h... yes > checking svn_error.h usability... no > checking svn_error.h presence... no > checking for svn_error.h... no > configure: error: SVN headers are required. Hint: EXTRA_CPPFLAGS > cabal: Error: some packages failed to install: > HsSVN-0.4.3 failed during the configure step. The exception was: > ExitFailure 1 > > > i installed all development packages i could see related to svn > - which > one is really needed? can you clarify and point me in the right > direction? (and put the information in the package cabal file so > it is copied to hackage) > > thank you > andrew > > > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Fix plugins package.
> > I got another error: > --> error start <-- > [ 8 of 15] Compiling System.MkTemp ( src/System/MkTemp.hs, > dist/build/System/MkTemp.o ) > > src/System/MkTemp.hs:214:26: > Couldn't match expected type `IOError' > against inferred type `Maybe FilePath -> IOException' > In the first argument of `ioError', namely `err' > In the expression: ioError err > In the expression: > if b then ioError err else openFile f ReadWriteMode > cabal: Error: some packages failed to install: > plugins-1.4.1 failed during the building phase. The exception was: > ExitFailure 1 > --> error end <-- I checked out sources and tried it myself. You need: [mkTemp:217] err = IOError Nothing AlreadyExists "open0600" "already exists" Nothing Nothing if you will get error in readBinIface', then [Load.hs:725] e <- newHscEnv undefined undefined if you will get error in loadFunction__, then [Load.hs: 441] ptr@(Ptr addr) <- withCString symbol c_lookupSymbol It should compile now, but I don't know will it work or no. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Fix plugins package.
> Another error : > > --> error start <-- > Preprocessing library plugins-1.4.1... > Building plugins-1.4.1... > [ 7 of 15] Compiling System.Plugins.Env ( src/System/Plugins/Env.hs, > dist/build/System/Plugins/Env.o ) > > src/System/Plugins/Env.hs:315:45: > Couldn't match expected type `PackageDBStack' > against inferred type `PackageDB' > In the second argument of `getInstalledPackages', namely > `(SpecificPackageDB f)' > In a stmt of a 'do' expression: > pkgIndex <- getInstalledPackages silent (SpecificPackageDB f) pc > In the expression: > do { pc <- configureAllKnownPrograms > silent defaultProgramConfiguration; > pkgIndex <- getInstalledPackages silent (SpecificPackageDB f) pc; > return $ allPackages pkgIndex } > cabal: Error: some packages failed to install: > plugins-1.4.1 failed during the building phase. The exception was: > ExitFailure 1 > --> error end <-- It looks like it is not the last error :) Try this: pkgIndex <- getInstalledPackages silent [SpecificPackageDB f] pc Not sure it will work as expected after that, but you can just try :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Fix plugins package.
>> src/System/Plugins/Process.hs:59:4: >> Warning: A do-notation statement discarded a result of type >> GHC.Conc.ThreadId. >> Suppress this warning by saying "_ <- forkIO >> ((>>) >> E.evaluate (length >> errput) >> return GHC.Unit.())", >> or by using the flag -fno-warn-unused-do-bind >> [ 3 of 15] Compiling System.Plugins.Parser ( src/System/Plugins/Parser.hs, >> dist/build/System/Plugins/Parser.o ) >> >> src/System/Plugins/Parser.hs:31:0: >> Warning: The import of `Data.Either' is redundant >> except perhaps to import instances from `Data.Either' >> To import instances alone, use: import Data.Either() >> [ 4 of 15] Compiling System.Plugins.PackageAPI ( >> src/System/Plugins/PackageAPI.hs, >> dist/build/System/Plugins/PackageAPI.o ) >> >> src/System/Plugins/PackageAPI.hs:61:24: Not in scope: `package' >> >> src/System/Plugins/PackageAPI.hs:62:25: Not in scope: `package' >> ... You can just replace 'package' with 'sourcePackageId' ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Occurs check error, help!
2010/3/20 boblettoj : > > Ah yes, that makes sense now, however i have another problem, here is the > updated code: > > --function used to shuffle cards > --list equals random member of array plus the rest of the array > --i is randomly generated from range of length equal to that of cards. > shuffle :: Int -> [a] -> [a] > shuffle i [] = [] > shuffle i cards = [(cards!!i) : > (shuffle (randomR(0, ((length cards)-2))) > (delete (cards!!i) cards))] > > and the message: > cards.hs:32:11: > Couldn't match expected type `Int' > against inferred type `g -> (Int, g)' > In the first argument of `shuffle', namely > `(randomR (0, ((length cards) - 2)))' > In the second argument of `(:)', namely > `(shuffle > (randomR (0, ((length cards) - 2))) (delete (cards !! i) > cards))' > In the expression: > (cards !! i) > : (shuffle > (randomR (0, ((length cards) - 2))) (delete (cards !! i) > cards)) > > Doesn't RandomR return an Int? No, see docs http://haskell.org/hoogle/?hoogle=randomR > thanks > -- > View this message in context: > http://old.nabble.com/Occurs-check-error%2C-help%21-tp27966341p27967762.html > Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Occurs check error, help!
Hi, > shuffle :: int -> [a] -> [a] > shuffle i [cards] = ... So 'cards' is of type 'a' : cards :: a > ... = (cards!!i) So 'cards' is a list of something: cards :: [b] > ... = (cards!!i) + ... (+) :: b -> b -> b, the result of the 'shuffle' should be of type [a], so b :: [a], cards :: [[a]] 2010/3/20 boblettoj : > > Hi i am writing a shuffle function which takes in a random number i and a > list and then produces a jumbled up version of the list at the end. Here is > what i have at the moment (i'm not sure if it works yet as it won't compile! > > --function used to shuffle cards > --list equals random member of array plus the rest of the array > --i is randomly generated from range of length equal to that of cards. > shuffle :: int -> [a] -> [a] > shuffle i [] = [] > shuffle i [cards] = (cards!!i) + > (shuffle (randomR (0, ((length cards)-2))) > (delete (cards!!i) cards)) > > > I get this error message when i try to compile: > > Occurs check: cannot construct the infinite type: a = [[a]] > > I'm very new to haskell so you'll have to excuse any ignorance! > thanks > -- > View this message in context: > http://old.nabble.com/Occurs-check-error%2C-help%21-tp27966341p27966341.html > Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Binaries using shared libraries with cabal-install
Hi, As I know it doesn't work for executables, see http://hackage.haskell.org/trac/hackage/ticket/600 2010/3/15 Mathijs Kwik : > Hi all, > > I'm using cabal-install 0.8.0 on ghc 6.12.1 on linux > I switched on shared library support on cabal. > > Does this enable -dynamic and -fPIC during compilation and -dynamic > -shared during linking? > Or does it work a little differently? > > I noticed everything works for libraries. .so files get created, and > using ldd on them shows they depend on other haskell shared libraries. > But for binaries, it seems it still compiles them with everything included. > ldd'ing them shows no haskell-library dependencies and their size is > quite big as well. > > Is it possible to tell cabal-install I want binaries to use shared libs > instead? > And is there a way to specify which RTS to link binaries with? (debug, > threaded, normal) > Or a way to defer linking to an RTS so I can do this on execution > using LD_PRELOAD ? > > Thanks for any help > Mathijs > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] grapefruit on windows or osX
If you are using binary gtk2hs installer for windows, then you have to install the same ghc version the installer was built for. As I know there are no gtk2hs build for ghc-6.10.4. You can build it manually (using msys), but it is complicated task. 2010/2/21 : > I'm unable to get grapefruit going on osx or windows because (I think) I > can't get the underlying GTK installed. > > Most recently I can't install gtk2hs over 6.10.4 because the installer > tells me my haskell install isn't working and I should reinstall 6.10.1. > It invites me to continue anyway and fix the DLL path myself. > > I continued and it doesn't work; cabal install grapefruit-ui-gtk still > fails because it can't find a version of 'gtk'. The gtk demo program > does work. > > Is the situation impossible, or do I just have to somehow tell something > about some path? > > Hope that's all clear, and thanks in advance. > > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to find unused exported symbols?
Hmm... It looks like a useful tool to implement. (Of course it does not make sense for libraries, only for executables) It can be easily implemented using haskell-src-exts package. 2010/2/15 John D. Ramsdell : > I would like to find symbols exported from each module in a program > that are not used outside the module. I'm worried my program is > accumulating cruft. I'm looking for suggestions on how to find unused > exported symbols. Do I have to analyse .hi files? Thanks in advance. > > John > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] running HGL on OSX
> Loading package X11-1.5.0.0 ... can't load .so/.DLL for: X11 > (dlopen(libX11.dylib, 9): image not found) try DYLD_LIBRARY_PATH=/usr/X11R6/lib ghci graphics.hs http://hackage.haskell.org/trac/ghc/ticket/1019 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] hsWidgets: yet another GUI library
Hello First of all, sorry my pure english... My aim was to prove that haskell GUI library can be: - pure: does not use any kind of mutable variables - statically typed: does not use existential types, Data.Dynamic, etc. - easy to use: simple things should be simple - easy to extend: writing new widgets should be as simple as possible The result is here: http://community.haskell.org/~YurasShumovich/hsWidgets/ Usage example: http://community.haskell.org/~YurasShumovich/hsWidgets/src/Test.hs The library is based on X11 and is tested on Linux and Mac OS. It is only an experiment in haskell GUI design, so it is mainly useless (currently only label, button and button with label are implemented) and looks ugly. Your comments and ideas are highly welcome. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe