[Haskell-cafe] Looking for Haskell job at China.
Hi all, I'm a Chinese haskeller, i'm looking for haskell job at *China*. Please contact me if any Chinese company interested me. Below is my skills: * Java : (2007-06 ~ 2008-09) Worked on a variety of commercial J2ME games, masterpiece <> : http://goo.gl/lcJF * Elisp : (2008-07 ~ 2009-05) Emacs expert, developed over a large number of Emacs extensions : http://goo.gl/DNLj My best-known Emacs extensions are: AutoInstall (automatic installation of Emacs extensions): http://goo.gl/ogBY MultiTerm (terminal emulator): http://goo.gl/PwpO Yaoddmuse (OddmuseWiki editor): http://goo.gl/cUrA ElispFormat (Elisp formatter): http://goo.gl/nVzb Irfc (RFC document reader): http://goo.gl/XZwi ... too much :) Other emacs extensions and elisp code, please see my EmacsWiki homepage: http://goo.gl/DNLj * Haskell : (2009-05 ~ 2010) Haskell/Gtk+ expert. Developer of gtk2hs (Haskell binding to GTK+) : http://goo.gl/AhJw Development of a large number of Haskell libraries: http://goo.gl/CoV0 I'm developing my own Haskell operating system : Video: http://www.youtube.com/watch?v=weS6zys3U8k Homepage: http://hackage.haskell.org/package/manatee Screenshots:http://goo.gl/MkVw Framework: http://goo.gl/otfb http://goo.gl/DMFW Source Repository: http://goo.gl/CoV0 I have finish below modules in my Haskell OS: Webkit-Browser: http://goo.gl/uoaX Editor: http://goo.gl/ouDR File Manager: http://goo.gl/x8Xi Picture Viewer: http://goo.gl/EYih PDF reader: http://goo.gl/8jCK Process Manager: http://goo.gl/ISOr Music Player: http://goo.gl/TMeD IRC client: http://goo.gl/kY6v News reader: http://goo.gl/BYVp Download-Manager: http://goo.gl/30tTN Terminal-Emulator: http://goo.gl/VMyaN Below are modules in developing: Mail-Client, IDE framework Thanks, -- Andy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OT: Monad co-tutorial: the Compilation Monad
On Friday 17 December 2010 13:45:38, Larry Evans wrote: > WARNING: I clicked on that link in my thunderbird news reader > and got a page which was something about registering domains. > It was nothing about Neil's slides. > > I then tried directing my Firfox browser to: > > http://community.haskell.org/ > > but got the same web page. > > Am I doing something wrong or has somehow community.haskell.org been > hijacked somehow? > > -Larry > It seems the haskell.org domain hasn't been renewed on time. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why is Haskell flagging this?
On Friday 17 December 2010 18:04:20, michael rice wrote: > I don't understand this error message. Haskell appears not to understand > that 1 is a Num. > > Prelude> :t 1 > 1 :: (Num t) => t > Prelude> :t [1,2,3,4,5] > [1,2,3,4,5] :: (Num t) => [t] > Prelude> > > Michael > > === > > f :: [Int] -> IO [Int] > f lst = do return lst > > main = do let lst = f [1,2,3,4,5] > fmap (+1) lst The fmap is relative to IO, your code is equivalent to do let lst = (return [1,2,3,4,5]) fmap (+1) lst ~> fmap (+1) (return [1,2,3,4,5]) ~> do lst <- return [1,2,3,4,5] return $ (+1) lst but there's no instance Num [Int] in scope You probably meant do let lst = f [1,2,3,4,5] fmap (map (+1)) lst > > === > > Prelude> :l test > [1 of 1] Compiling Main ( test.hs, interpreted ) > > test.hs:5:17: > No instance for (Num [Int]) > arising from the literal `1' at test.hs:5:17 > Possible fix: add an instance declaration for (Num [Int]) > In the second argument of `(+)', namely `1' > In the first argument of `fmap', namely `(+ 1)' > In the expression: fmap (+ 1) lst > Failed, modules loaded: none. > Prelude> ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why is Haskell flagging this?
Paul Graham refers to all those features as "orthogonality" ("On Lisp", pg. 63) and you're right, Haskell has it in spades, but it takes time to understand all of it and even more time to use it effectively. One almost needs a checklist. But I think I'm catching on. I programmed this craps simulation last week. It's a problem from "Problems For Computer Solution", Gruenberger & Jaffray, 1965, The RAND Corp. import Control.Monad.State import System.Random type GeneratorState = State StdGen data Craps a = Roll a | Win a | Lose a deriving (Show) f :: Craps [Int] -> GeneratorState (Craps [Int]) f (Roll []) = do g0 <- get let (d1,g1) = randomR (1,6) g0 (d2,g2) = randomR (1,6) g1 t1 = d1+d2 put g2 case t1 of 2 -> return (Lose [t1]) 3 -> return (Lose [t1]) 7 -> return (Win [t1]) 11 -> return (Win [t1]) _ -> do g2 <- get let (d3,g3) = randomR (1,6) g2 (d4,g4) = randomR (1,6) g3 t2 = d3+d4 put g4 if t2 == t1 then do return (Win [t1,t2]) else if t2 == 7 then do return (Lose [t1,t2]) else f (Roll [t2,t1]) f (Roll l) = do g0 <- get let (d1,g1) = randomR (1,6) g0 (d2,g2) = randomR (1,6) g1 t = d1+d2 if t == (last l) then do put g2 return (Win (reverse (t:l))) else if t == 7 then do put g2 return (Lose (reverse (t:l))) else do put g2 f (Roll (t:l)) progressive (z@(x:xs),n) (Win _) = let b = x + (last xs) in (init xs,n+b) progressive (z@(x:xs),n) (Lose _) = let b = x + (last xs) in (z ++ [b],n-b) *Main> let r = evalState (sequence $ replicate 6 (f (Roll []))) (mkStdGen 987) *Main> r [Win [8,12,10,3,8],Win [5,9,10,11,12,11,8,9,5],Win [7],Lose [9,7],Win [5,5],Win [5,2,6,4,6,8,5]] *Main> foldl progressive ([1..10],0) r ([6],49) Function f generates the roll cycle outcomes which are then folded with the progressive betting system. In the final answer, the [6] is what's left of the original betting list [1..10]. The betting list is used to determine the bet: always bet the (first + last) of betting list. If a win, delete the first and last. If a loss, add loss to end of betting list. The 49 is winnings, initially 0. There's no explanation in the book of what should happen if the betting list becomes empty, or a singleton, but that could be fixed by making it longer. Comments, criticism, and better ways of doing it are welcome. Michael --- On Fri, 12/17/10, David Leimbach wrote: From: David Leimbach Subject: Re: [Haskell-cafe] Why is Haskell flagging this? To: "michael rice" Cc: haskell-cafe@haskell.org, "Daniel Fischer" Date: Friday, December 17, 2010, 7:45 PM No problem. Haskell is a different animal than even other functional languages in my experience, and it takes time to get used to the coolness in the type system, the lazy evaluation, the point free style, functional composition and all the other interesting techniques you now have at your fingertips for writing very expressive code :-). Do that for a while then go back to algol based languages, and wonder why the heck anyone uses those on purpose :-). (yeah there's good reasons to use them, but it starts to feel confining) Dave On Fri, Dec 17, 2010 at 4:28 PM, michael rice wrote: Hi, all. Plenty of answers. Thank you. Putting the list in the IO monad was deliberate. Another one I was looking at was f :: String -> IO String f s = do return s main = do ios <- f "hello" fmap tail ios which worked fine So, the big error was trying to add 1 + [1,2,3,4,5]. I considered that I needed an additional fmap and thought I had tried fmap (fmap (1+)) iol but must have messed it up, because I got an error. I guess I was on the right track. I like to try various combinations to test my understanding. It's kind of embarrassing when I get stumped by something simple like this, but that's how one learns. Thanks again, Michael --- On Fri, 12/17/10, Daniel Fischer wrote: From: Daniel Fischer Subject: Re: [Haskell-cafe] Why is Haskell flagging this? To: haskell-cafe@haskell.org Cc: "michael rice" Date: Friday, December 17, 20
[Haskell-cafe] Making type-incompatible strategies interchangeable
# Imagine an activity which may be performed either by a computer, or # by a human (alternatively, either locally, or remotely across a # network). From Haskell's type system's perspective, these two will # look completely different (most obviously, the human (or the # network) is wrapped in IO). How can they be made interchangeable ? # To demonstrate what I mean, I offer the following concrete toy # example, in Python. # It's a harness for playing the trivial higher-lower number guessing # game, with interchangeable strategies for either player. In this # example I provide two strategies (Computer / ask Human via IO) for # each role (asker and guesser). # How can this sort of interchangeability of computations which are # conceptually identical, but incompatible from the types perspective, # be expressed in Haskell? from random import randint # A simple game harness. It is given the two players, and mediates the # interaction between them. def game(asker, guesser): feedback = None count = 0 while not feedback == 0: guess = guesser(feedback) feedback = asker(guess) print "Guess: %s, Answer: %s" % (guess, feedback) count += 1 print "Got it in", count # A couple of decorators to smoothe the use of the generators which # are used to implement the players. def hide_send(generator_function): def proxy(*args, **kwds): return generator_function(*args, **kwds).send return proxy def advance(hidden_send_proxy): def proxy(*args, **kwds): send = hidden_send_proxy(*args, **kwds) send(None) return send return proxy # Artificial player who knows the secret @advance @hide_send def higher_lower_asker_C(low=0, high=100): secret = randint(low, high) guess = yield while True: guess = yield cmp(guess, secret) # Artificial player trying to guess the secret @hide_send def higher_lower_guesser_C(low=0, high=100): while True: guess = (low + high) // 2 feedback = yield guess if feedback < 0: low = guess else: high = guess # Interface to human who knows the secret @advance @hide_send def higher_lower_asker_H(): guess = yield # No feedback before first guess while True: print "My guess is", guess print "Please reply with one letter: is my guess (l)ow, (c)orrect or (h)igh ?" guess = yield {'l':-1, 'c':0, 'h':1 }[raw_input()] # Interface to human trying to guess @hide_send def higher_lower_guesser_H(): while True: feedback = yield input("What is your guess? ") print {-1:"Too low.", 0:"Correct!", +1:"Too high."}[feedback] # Given the above preparation, the game can now be played in all 4 # possible permutations of Computer/Human vs. Computer/Human. game(higher_lower_asker_C(), higher_lower_guesser_C()) game(higher_lower_asker_H(), higher_lower_guesser_C()) game(higher_lower_asker_C(), higher_lower_guesser_H()) game(higher_lower_asker_H(), higher_lower_guesser_H()) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why is Haskell flagging this?
Hi, all. Plenty of answers. Thank you. Putting the list in the IO monad was deliberate. Another one I was looking at was f :: String -> IO String f s = do return s main = do ios <- f "hello" fmap tail ios which worked fine So, the big error was trying to add 1 + [1,2,3,4,5]. I considered that I needed an additional fmap and thought I had tried fmap (fmap (1+)) iol but must have messed it up, because I got an error. I guess I was on the right track. I like to try various combinations to test my understanding. It's kind of embarrassing when I get stumped by something simple like this, but that's how one learns. Thanks again, Michael --- On Fri, 12/17/10, Daniel Fischer wrote: From: Daniel Fischer Subject: Re: [Haskell-cafe] Why is Haskell flagging this? To: haskell-cafe@haskell.org Cc: "michael rice" Date: Friday, December 17, 2010, 4:24 PM On Friday 17 December 2010 18:04:20, michael rice wrote: > I don't understand this error message. Haskell appears not to understand > that 1 is a Num. > > Prelude> :t 1 > 1 :: (Num t) => t > Prelude> :t [1,2,3,4,5] > [1,2,3,4,5] :: (Num t) => [t] > Prelude> > > Michael > > === > > f :: [Int] -> IO [Int] > f lst = do return lst > > main = do let lst = f [1,2,3,4,5] > fmap (+1) lst The fmap is relative to IO, your code is equivalent to do let lst = (return [1,2,3,4,5]) fmap (+1) lst ~> fmap (+1) (return [1,2,3,4,5]) ~> do lst <- return [1,2,3,4,5] return $ (+1) lst but there's no instance Num [Int] in scope You probably meant do let lst = f [1,2,3,4,5] fmap (map (+1)) lst > > === > > Prelude> :l test > [1 of 1] Compiling Main ( test.hs, interpreted ) > > test.hs:5:17: > No instance for (Num [Int]) > arising from the literal `1' at test.hs:5:17 > Possible fix: add an instance declaration for (Num [Int]) > In the second argument of `(+)', namely `1' > In the first argument of `fmap', namely `(+ 1)' > In the expression: fmap (+ 1) lst > Failed, modules loaded: none. > Prelude> --- On Fri, 12/17/10, Daniel Fischer wrote: From: Daniel Fischer Subject: Re: [Haskell-cafe] Why is Haskell flagging this? To: haskell-cafe@haskell.org Cc: "michael rice" Date: Friday, December 17, 2010, 4:24 PM On Friday 17 December 2010 18:04:20, michael rice wrote: > I don't understand this error message. Haskell appears not to understand > that 1 is a Num. > > Prelude> :t 1 > 1 :: (Num t) => t > Prelude> :t [1,2,3,4,5] > [1,2,3,4,5] :: (Num t) => [t] > Prelude> > > Michael > > === > > f :: [Int] -> IO [Int] > f lst = do return lst > > main = do let lst = f [1,2,3,4,5] > fmap (+1) lst The fmap is relative to IO, your code is equivalent to do let lst = (return [1,2,3,4,5]) fmap (+1) lst ~> fmap (+1) (return [1,2,3,4,5]) ~> do lst <- return [1,2,3,4,5] return $ (+1) lst but there's no instance Num [Int] in scope You probably meant do let lst = f [1,2,3,4,5] fmap (map (+1)) lst > > === > > Prelude> :l test > [1 of 1] Compiling Main ( test.hs, interpreted ) > > test.hs:5:17: > No instance for (Num [Int]) > arising from the literal `1' at test.hs:5:17 > Possible fix: add an instance declaration for (Num [Int]) > In the second argument of `(+)', namely `1' > In the first argument of `fmap', namely `(+ 1)' > In the expression: fmap (+ 1) lst > Failed, modules loaded: none. > Prelude> ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why is Haskell flagging this?
On 17 Dec 2010, at 20:04, michael rice wrote: > I don't understand this error message. Haskell appears not to understand that > 1 is a Num. As it clearly states in the error message, it doesn't understand that [Int] is a Num - and it's not. "No instance for Num something" usually indicates that you're trying to use an integer literal - in this case, "1" - as this "something". The problem is that your "lst" has the type "IO [Int]" (which is the same as "IO ([] Int)"). "fmap" has the type "(a -> b) -> f a -> f b", so, it tries to unify the type of "(+1)" with "[Int] -> something" - which, probably, isn't what you've meant. In fact, I'm pretty sure you wanted "lst" to have the type "[Int]" (= "[] Int"), without "IO". You can do that using "<-" instead of "let": main = do lst <- fst [1,2,3,4,5] return (fmap (+1) lst) > > Prelude> :t 1 > 1 :: (Num t) => t > Prelude> :t [1,2,3,4,5] > [1,2,3,4,5] :: (Num t) => [t] > Prelude> > > Michael > > === > > f :: [Int] -> IO [Int] > f lst = do return lst > > main = do let lst = f [1,2,3,4,5] > fmap (+1) lst > > === > > Prelude> :l test > [1 of 1] Compiling Main ( test.hs, interpreted ) > > test.hs:5:17: > No instance for (Num [Int]) > arising from the literal `1' at test.hs:5:17 > Possible fix: add an instance declaration for (Num [Int]) > In the second argument of `(+)', namely `1' > In the first argument of `fmap', namely `(+ 1)' > In the expression: fmap (+ 1) lst > Failed, modules loaded: none. > Prelude> > > ___ > 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] Why is Haskell flagging this?
On Fri, Dec 17, 2010 at 09:04:20AM -0800, michael rice wrote: > I don't understand this error message. Haskell appears not to understand that > 1 is a Num. > > Prelude> :t 1 > 1 :: (Num t) => t > Prelude> :t [1,2,3,4,5] > [1,2,3,4,5] :: (Num t) => [t] > Prelude> > > Michael > > === > > f :: [Int] -> IO [Int] > f lst = do return lst > > main = do let lst = f [1,2,3,4,5] > fmap (+1) lst 'f' operates on '[Int]', but '(+1)' operates on 'Int'... Does the following do what you want? main = do let lst = f [1,2,3,4,5] in fmap (map (+1)) lst > > === > > Prelude> :l test > [1 of 1] Compiling Main ( test.hs, interpreted ) > > test.hs:5:17: > No instance for (Num [Int]) > arising from the literal `1' at test.hs:5:17 > Possible fix: add an instance declaration for (Num [Int]) > In the second argument of `(+)', namely `1' > In the first argument of `fmap', namely `(+ 1)' > In the expression: fmap (+ 1) lst > Failed, modules loaded: none. > Prelude> > > > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- You've been warned. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Why is Haskell flagging this?
I don't understand this error message. Haskell appears not to understand that 1 is a Num. Prelude> :t 1 1 :: (Num t) => t Prelude> :t [1,2,3,4,5] [1,2,3,4,5] :: (Num t) => [t] Prelude> Michael === f :: [Int] -> IO [Int] f lst = do return lst main = do let lst = f [1,2,3,4,5] fmap (+1) lst === Prelude> :l test [1 of 1] Compiling Main ( test.hs, interpreted ) test.hs:5:17: No instance for (Num [Int]) arising from the literal `1' at test.hs:5:17 Possible fix: add an instance declaration for (Num [Int]) In the second argument of `(+)', namely `1' In the first argument of `fmap', namely `(+ 1)' In the expression: fmap (+ 1) lst Failed, modules loaded: none. Prelude> ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] DNS problems at haskell.org?
Hello. For a couple of friends of mine, hackage.haskell.org happens to resolve to something strange (parked domain), though haskell.org works ok. This might be something to tell to haskell.org admins. Find below an example tracert (messages in Russian have been translated). C:\Program Files (x86)\Far2>tracert hackage.haskell.org Tracing to hackage.haskell.org [209.62.105.19], max hops = 30 1 8 ms 4 ms 4 ms bsr01.nn.ertelecom.ru [91.144.184.69] 2 **2 ms net184-77.nn.ertelecom.ru [91.144.184.77] 313 ms 9 ms 9 ms NNOV-D2-HQ-XX---1-3-0.499.main.synterra.ru [83.229.187.17] 4 9 ms29 ms 9 ms 83.229.226.101 510 ms 9 ms 9 ms m9-cr01-te4-3.msk.stream-internet.net [195.34.38.37] 6 142 ms 142 ms 142 ms ss-crs-1-be3.msk.stream-internet.net [195.34.53.86] 7 142 ms 142 ms 142 ms mar-crs-1-be6.msk.stream-internet.net [195.34.59.141] 8 143 ms 142 ms 142 ms oct-crs-1-be1.spb.stream-internet.net [195.34.53.194] 9 143 ms 142 ms 142 ms bro-cr01-be3.stk.stream-internet.net [212.188.1.194] 1066 ms66 ms66 ms tct-cr01-te5-1.ams.stream-internet.net [195.34.53.14] 11 142 ms 307 ms 207 ms sd-cr01-te2-1.nyc.stream-internet.net [195.34.59.114] 12 *** Request timed out 13 179 ms 179 ms 179 ms e8-2.ibr03.dllstx3.networklayer.com [70.87.253.189] 14 190 ms 189 ms 190 ms e1-1.ibr01.hstntx2.networklayer.com [70.87.253.50] 15 190 ms 190 ms 190 ms te2-2.dsr02.hstntx2.networklayer.com [74.55.252.38] 16 184 ms 185 ms 184 ms po2.car3.hstntx2.networklayer.com [74.55.252.106] 17 189 ms 189 ms 189 ms ev1s-209-62-105-19.theplanet.com [209.62.105.19] Trace finished C:\Program Files (x86)\Far2>tracert haskell.org Tracing to haskell.org [78.46.100.180], max hops = 30 1 4 ms 3 ms 2 ms bsr01.nn.ertelecom.ru [91.144.184.69] 2 *2 ms 2 ms net184-77.nn.ertelecom.ru [91.144.184.77] 310 ms 9 ms 9 ms NNOV-D2-HQ-XX---1-3-0.499.main.synterra.ru [83.229.187.17] 4 9 ms 9 ms11 ms 83.229.226.101 510 ms 9 ms 9 ms m9-cr01-te4-3.msk.stream-internet.net [195.34.38.37] 655 ms55 ms55 ms ss-crs-1-be3.msk.stream-internet.net [195.34.53.86] 753 ms52 ms52 ms m9-crs-1-be9.msk.stream-internet.net [195.34.59.250] 855 ms55 ms55 ms bor-crs-1-be1.spb.stream-internet.net [195.34.53.126] 952 ms52 ms52 ms anc-cr01-po3.ff.stream-internet.net [195.34.53.102] 1052 ms52 ms52 ms anc-cr02-po1.ff.stream-internet.net [212.188.0.122] 1156 ms56 ms56 ms decix2-gw.hetzner.de [80.81.193.164] 1260 ms60 ms60 ms hos-bb1.juniper1.fs.hetzner.de [213.239.240.242] 1364 ms61 ms63 ms hos-tr1.ex3k10.rz12.hetzner.de [213.239.228.139] 1460 ms60 ms62 ms lambda.haskell.org [78.46.100.180] Trace finished -- Eugene Kirpichov Senior Software Engineer, Grid Dynamics http://www.griddynamics.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (Read r) => IO (Maybe r)
On 17 December 2010 13:59, Jacek Generowicz wrote: > > What are some interesting, idiomatic ways of writing something similar to > the following > λ> :m + Safe λ> let getValidatedInteger = getLine >>= maybe (do putStrLn "That doesn't seem to be an integer. Try again."; getValidatedInteger) return . readMay :: IO Integer Loading package safe-0.3 ... linking ... done. λ> getValidatedInteger a That doesn't seem to be an integer. Try again. 1 1 λ> ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (Read r) => IO (Maybe r)
Hi, What are some interesting, idiomatic ways of writing something similar to the following, using a) Only standard utilities b) Non-standard utilities getValidatedInteger = do maybeInt <- maybeGet case maybeInt of Just int -> return int Nothing -> do putStrLn "That doesn't seem to be an integer. Try again." getValidatedInteger maybeGet :: (Read r) => IO (Maybe r) maybeGet = getLine >>= return . maybeReadS maybeReadS text = case reads text of [(int, rest)] | all (== ' ') rest -> Just int _ -> Nothing ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OT: Monad co-tutorial: the Compilation Monad
On 12/17/10 01:32, Max Bolingbroke wrote: [snip] > I can't speak for your monad based approach, but you may be interested > in Neil Mitchell's Haskell DSL for build systems, called Shake: > http://community.haskell.org/~ndm/downloads/slides-shake_a_better_make-01_oct_2010.pdf > WARNING: I clicked on that link in my thunderbird news reader and got a page which was something about registering domains. It was nothing about Neil's slides. I then tried directing my Firfox browser to: http://community.haskell.org/ but got the same web page. Am I doing something wrong or has somehow community.haskell.org been hijacked somehow? -Larry ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Behaviour of System.Directory.getModificationTime
Thanks for your answers. I am a little bit surprised, I thought timestamps were on the milliseconds scale. @Krzysztof: Yes, you are right, an event-based interface is far superior to the basic polling approach I took. At present, a couple seconds granularity is fine with my use case so I don't care too much getting more precise notifications, but I'd rather be notified by the kernel than going through the hassle of polling it myself. I played a bit with inotify (through a Java binding) a year ago and found it a bit cumbersome to wield as one has to monitor explicitly all nodes in a tree. Maybe I am wrong. Moreover, I am not aware of a portable way of doing this. I would appreciate pointers and advices on these matters. Thanks again, arnaud 2010/12/16 Krzysztof Skrzętnicki : > If this is not a toy program I would really suggest using something that is > builtin in the OS of choice. On Linux there is inotify > (http://en.wikipedia.org/wiki/Inotify), but I'm pretty sure that other OSes > have similar interfaces. The "modification time" method seems really fragile > and I probably not very efficient as well. > Best regards, > Krzysztof Skrzętnicki > > On Thu, Dec 16, 2010 at 17:50, Arnaud Bailly wrote: >> >> actually, IRL the code works as expected. Might it be possible that >> the speed of test execution is greater than the granularity of the >> system's modification timestamp? >> >> ___ >> 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] handling multiple versions of a data structure
I've recently been playing with code for versioning data types. It's based on happstacks implementation, but uses type families to make it more modular. I've got some proof of concept code on github [1]. We're also writing a small library based on this at typLAB, which we'll probably release as well. Erik [1] https://gist.github.com/704109 On Thu, Dec 16, 2010 at 19:26, Dmitry V'yal wrote: > Greetings, > > while developing my neural net simulator I stumbled upon a problem. > > I have a data type NeuralNet and use Show and Read instances for saving and > loading configurations. As time passed, I changed the data type, so the > program can no longer load files saved in previous versions. > > I want fix it. My current idea looks as follows. I'm going to create a bunch > of types NN1, NN2, NN3..NNn for different versions and write converters c12 > :: N1 -> N2, c23 :: N2 -> N3 and so on. > > But how to organize the whole process of parsing String into NNn so it's > easy to change formats? > Something based on using a list of parsers > [read, c43 . read, c43 . c23 . read, c43, c23 . c12 . read, c43 . c32 . c21 > . read] > > looks rather verbose and grows quadratically with N. > > I'm sure there must be a more elegant way. Any ideas? > > Dmitry > > ___ > 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] Haskell, Step by Step, Tutorial, Developing a Whole Application
Mathijs Kwik writes: > It's indeed hard to really explain what I feel is missing. I think the basics are well covered, with lots of introductory and tutorial material available. The advanced stuff is very abstract and general, and the difficult part is developing an intuition for how and when to apply the different patterns. Anyway - *I* would like lectures on video. I guess I'm just much better at learning from lectures than from text, but I've recently started to watch on-line lectures¹, and this is great, as you get lecturers from world-leading institutinos which you can watch whenever convenient. Are there any video material on either advanced functional programming, or functional progamming in the large? This would be really great. Of course, a video lecture has some advantages (you can pause it to get a cup of coffee or look up some stuff), but also disadvantages (you can't ask the lecturer, and there's usually no exercises or other stuff). So I think it'd be ideal to combine each lecture with a Stack Overflow-like forum - it seems this could add a lot of value. But I digress. Any videos out there? -k ¹ So far, I've been through: 1. Teaching College level science from MIT, really great stuff http://ocw.mit.edu/courses/chemistry/5-95j-teaching-college-level-science-and-engineering-spring-2009/video-discussions/lecture-1-general-principles-of-teaching/ 2. As suggested by Alberto G. Corona in an earlier thread, a Yale course on evolution, giving a very nice - if not very deep - overview of the field, with lots of fun examples. http://www.youtube.com/view_play_list?p=6299F3195349CCDA 3. TED talks. http://ted.com/ - I guess you know about these. 4. Oh, yes, I've also been watching Greg Meredith's videos, which are fun, but perhaps aimed at a somewhat different target. -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] tplot and splot - analyst's swiss army knifes for visualizing log files
Eugene Kirpichov schrieb: > Hi cafe, > > I've published a large presentation about two Haskell-based tools of > mine - tplot and splot. > > Their motto is "visualize system behavior from logs with a shell one-liner". > Based on my experience, they usually seem to live up to this motto. > > > http://www.slideshare.net/jkff/two-visualization-tools > > > [attention attractor: the presentation has *really a lot* of pictures] ... and complete TeX code attached! :-) However can I also view a simple PDF document of the presentation? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OT: Monad co-tutorial: the Compilation Monad
There is also Nix (http://nixos.org/) which is based on somewhat related ideas. On Fri, Dec 17, 2010 at 8:32 AM, Max Bolingbroke wrote: > On 17 December 2010 00:59, Gregg Reynolds wrote: >> My real goal is to think about better >> language for software build systems, since what we have now is pretty weak, >> in my view. > > I can't speak for your monad based approach, but you may be interested > in Neil Mitchell's Haskell DSL for build systems, called Shake: > http://community.haskell.org/~ndm/downloads/slides-shake_a_better_make-01_oct_2010.pdf > > I have an open source implementation of it which has all the core > functionality at http://github.com/batterseapower/openshake. (Warning: > the code is quite ugly at the moment) > > Cheers, > Max > > ___ > 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] GHC 7.0.1 developer challenges
"John D. Ramsdell" writes: >> In absence of any explicit limits, I think a sensible default is to set >> maximum total memory use to something like 80%-90% of physical RAM. > This would be a poor choice on Linux systems. As I've argued > previously in this thread, the best choice is to limit the GHC runtime > to the free memory and the reclaimable memory of the machine. Well - it depends, I think. In principle, I would like to be conservative (i.e. set the limit as high as possible), since a too low limit could possibly make my program fail. > On the laptop I'm using right now, physical memory is 1G. Free memory > is 278M, and free plus reclaimable memory is 590M. I'm just running > Firefox and X, so the OS as allocated a lot of memory to caches. But lots of the memory in use is likely to be inactive (not in the current working set of any application), and will be pushed to swap if you start asking for more. Which is often what you want. If I interpret these numbers correctly, my laptop is using 1.5G on stuff that is basically idle - word processor documents, PDF displayers, a ton of web pages (with all the flash carefully filtered out), emacs buffers, a half-finished inkscape graphic, and so on. Most of this could easily go to swap. > Note that if you limit the GHC runtime to free plus reclaimable > memory, and some other process is chewing up memory, the GHC limit > would be small. Or if you run two copies of your program - then one would get all the memory, and the other none. > But this would ensure both do not thrash, a good thing, right? Unless the second program actually *needs* the memory. So I still think the 80% rule is pretty good - it's simple, and although it isn't optimal in all cases, it's conservative in that any larger bound is almost certainly going to thrash. You could probably invent more advanced memory behavior on top of that, say switching to compacting GC if you detect thrashing. -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe