Available formats: content-negotiated html turtle (see SIOC for the vocabulary)
Back to channel and daily index: content-negotiated html turtle
These logs are provided as an experiment in indexing discussions using IRCHub.py, Irc2RDF.hs, and SIOC.
| 00:01:28 | <pumpkin> | mmorrow: I almost have the thing compiling again |
| 00:13:05 | <pumpkin> | mmorrow: |
| 00:13:13 | <pumpkin> | I tried adding 5 and 7, and it gave me 14 :( |
| 00:13:25 | <pumpkin> | ugh |
| 00:14:03 | <bremner> | > 5+7 |
| 00:14:04 | <lambdabot> | 12 |
| 00:14:13 | <pumpkin> | yeah, might be a problem, eh |
| 00:14:30 | <pumpkin> | I know why it's happening, too, but I don't know how to fix it |
| 00:16:55 | <dmwit> | 5 == 7 |
| 00:17:00 | <dmwit> | problem solved |
| 00:19:33 | <gwern> | > let 5 = 7 in 5+5 |
| 00:19:35 | <lambdabot> | 10 |
| 00:19:49 | <gwern> | hm. I thought that used to work |
| 00:20:01 | <dmwit> | > let 5 + 7 = 14 in 5 + 7 |
| 00:20:02 | <lambdabot> | 14 |
| 00:20:18 | <gwern> | oh, I remembered it backwards |
| 00:20:52 | <pumpkin> | :) |
| 00:21:02 | <pumpkin> | unfortunately that doesn't fix my problem |
| 00:21:18 | <CSWookie> | Thank you, TomMD heatsink dino- others... I had to tuck a kid in. |
| 00:21:48 | <pumpkin> | I think I know what I have to do |
| 00:21:52 | <pumpkin> | ACTION sighs some more |
| 00:22:00 | <jmillikin> | > let 5 + 7 = 14 in 5 + 7 + 6 |
| 00:22:01 | <lambdabot> | * Exception: <interactive>:1:165-174: Non-exhaustive patterns in function + |
| 00:22:13 | <dmwit> | ACTION points out it's pumpkin's fault for playing with unsafe* |
| 00:22:19 | <pumpkin> | dmwit: I'm not! |
| 00:22:31 | <pumpkin> | dmwit: not one occurrence of unsafe* in my file anywhere! |
| 00:22:35 | <dmwit> | Why not? |
| 00:22:36 | <pumpkin> | ;) |
| 00:22:42 | <dcoutts> | TomMD: you mentioned some time ago some state/serialisation problem with the hackage-server since moving to happstack. What was the problem exactly and how do I reproduce it? |
| 00:23:02 | <pumpkin> | dmwit: I use lots of MagicHash to make up for it though |
| 00:23:03 | <pumpkin> | :( |
| 00:23:07 | <dmwit> | hehehe |
| 00:23:39 | <pumpkin> | that flag should be illegal |
| 00:28:57 | <gwern> | everybody loves hash |
| 00:33:23 | <kniu> | @src words |
| 00:33:24 | <lambdabot> | words s = case dropWhile isSpace s of |
| 00:33:25 | <lambdabot> | "" -> [] |
| 00:33:25 | <lambdabot> | s' -> w : words s'' where (w, s'') = break isSpace s' |
| 01:12:12 | <pumpkin> | quiet in here |
| 01:12:50 | <ray> | there is no more haskell to discuss |
| 01:13:18 | <physique> | haskell has been deprecated |
| 01:15:18 | <luqui> | we decided that haskell was too good for computers, so now we just do it on paper |
| 01:15:18 | <lambdabot> | luqui: You have 1 new message. '/msg lambdabot @messages' to read it. |
| 01:22:00 | <blackdog> | was there a pragma to use bytestring literals in GHC? |
| 01:22:10 | <TomMD> | OverloadedStrings |
| 01:22:22 | <blackdog> | ah, cheers |
| 01:22:28 | <pumpkin> | {-# LANGUAGE OverloadedStrings #-} |
| 01:35:36 | <heatsink> | In Cabal, is there a way to include extra object files in Distribution.Simple.Build.build? |
| 01:37:51 | <donnelly> | object files? there's 'extra-source-files' |
| 01:39:46 | <heatsink> | I don't think that's used when linking. |
| 01:40:29 | <Adamant> | Distribution.Haskell.Compile.Compile.compile |
| 01:42:13 | <Paradox924X> | Any reason why an application running fine on a computer running arch segfaults on another using jaunty with this error (from gdb)?: |
| 01:42:15 | <Paradox924X> | strcpy () at ../sysdeps/x86_64/strcpy.S:74 |
| 01:42:15 | <Paradox924X> | 74 ../sysdeps/x86_64/strcpy.S: No such file or directory. |
| 01:42:15 | <Paradox924X> | in ../sysdeps/x86_64/strcpy.S |
| 01:43:21 | <Paradox924X> | ghc 6.10.3 on both |
| 01:44:18 | <Cale> | Paradox924X: Is one of the machines 64 bit and the other 32? |
| 01:44:27 | <Paradox924X> | nope, they're both 64bit |
| 01:45:28 | <Paradox924X> | I tried it in a 32bit choot as well just in case |
| 01:45:40 | <Paradox924X> | but pretty much same error except i686 instead of x86_64 |
| 01:45:45 | <Cale> | That's a strange looking error. Are you transferring the binary directly or have you tried recompiling? |
| 01:45:58 | <Paradox924X> | I recompiled myself |
| 01:49:01 | <Paradox924X> | and the backtrace in gdb shows it goes back to my_inet_ntoa() from libmysqlclient.so.(16|15) and further back into s9ZA_info(), if that helps |
| 01:50:09 | <alexsuraci> | or |
| 01:50:09 | <alexsuraci> | well |
| 01:50:13 | <alexsuraci> | er, wrong chan |
| 01:50:14 | <alexsuraci> | <_< |
| 01:50:55 | <Cale> | Paradox924X: libmysqlclient sounds like a C library. |
| 01:51:12 | <Paradox924X> | I believe it is |
| 01:51:21 | <Paradox924X> | this app uses hdbc-mysql |
| 01:51:37 | <Cale> | Paradox924X: Perhaps the version it expects is somehow different? |
| 01:51:42 | <Cale> | I'm not really sure. |
| 01:51:52 | <SamB> | Paradox924X: do you get arguments for my_inet_ntoa? |
| 01:52:41 | <Paradox924X> | no, no symbol table information available |
| 01:54:01 | <pumpkin> | , let (&&&) f g = \x -> (f x, g x) in (read :: String -> Integer) . map intToDigit . uncurry (++) . ((reverse . takeWhile (/=0)) &&& (reverse . dropWhile (==0) . dropWhile (/=0))) . map (round . realPart) . ifft . map (^2) . fft . map (:+0) $ [0, 0, 0, 0, 0, 0, 1, 2, 1, 1, 0, 0, 0, 0, 0, |
| 01:54:02 | <lunabot> | luna: parse error on input `)' |
| 01:54:13 | <pumpkin> | , let (&&&) f g = \x -> (f x, g x) in (read :: String -> Integer) . map intToDigit . uncurry (++) . ((reverse . takeWhile (/=0)) &&& (reverse . dropWhile (==0) . dropWhile (/=0))) . map (round . realPart) . ifft . map (^2) . fft . map (:+0) $ [0, 0, 0, 0, 0, 0, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0] |
| 01:54:14 | <lunabot> | 1466521 |
| 01:54:59 | <pumpkin> | , let (&&&) f g = \x -> (f x, g x) in (read :: String -> Integer) . map intToDigit . uncurry (++) . ((reverse . takeWhile (/=0)) &&& (reverse . dropWhile (==0) . dropWhile (/=0))) . map (round . realPart) . ifft . map (^2) . fft . map (:+0) $ [0, 0, 0, 0, 0, 0, 4, 2, 7, 3, 0, 0, 0, 0, 0, 0] |
| 01:55:00 | <lunabot> | luna: Char.intToDigit: not a digit 16 |
| 01:55:09 | <pumpkin> | , let (&&&) f g = \x -> (f x, g x) in (read :: String -> Integer) . map intToDigit . uncurry (++) . ((reverse . takeWhile (/=0)) &&& (reverse . dropWhile (==0) . dropWhile (/=0))) . map (round . realPart) . ifft . map (^2) . fft . map (:+0) $ [0, 0, 0, 0, 0, 0, 4, 2, 1, 3, 0, 0, 0, 0, 0, 0] |
| 01:55:11 | <lunabot> | luna: Char.intToDigit: not a digit 16 |
| 01:55:13 | <pumpkin> | boo :P |
| 01:55:23 | <pumpkin> | ACTION needs to implement "carry" |
| 01:56:48 | <pumpkin> | at least my first example worked |
| 02:00:39 | <pumpkin> | , let (&&&) f g = \x -> (f x, g x) in (read :: String -> Integer) . map intToDigit . uncurry (++) . ((reverse . takeWhile (/=0)) &&& (reverse . dropWhile (==0) . dropWhile (/=0))) . map (round . realPart) . ifft . map (^2) . fft . map (:+0) $ [0, 0, 0, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0] |
| 02:00:41 | <lunabot> | 4888521 |
| 02:00:55 | <dmwit> | Holy paragraph code, Batman! |
| 02:01:02 | <pumpkin> | :) |
| 02:01:12 | <pumpkin> | isn't it pretty? |
| 02:01:18 | <byorgey> | o.O |
| 02:01:24 | <Tsion> | Pretty as barf |
| 02:01:25 | <pumpkin> | yeah, didn't think so :P |
| 02:01:29 | <byorgey> | what does it... do? |
| 02:01:35 | <pumpkin> | squares a number! |
| 02:01:43 | <pumpkin> | duh! ;) |
| 02:01:45 | <byorgey> | ...I see. |
| 02:01:54 | <dmwit> | Style points for being totally point-free... except for the definition of (&&&). |
| 02:01:57 | <luqui> | :t fft |
| 02:01:58 | <byorgey> | ACTION nods sagely |
| 02:01:58 | <lambdabot> | Not in scope: `fft' |
| 02:02:03 | <pumpkin> | squares a very restricted set of numbers, really |
| 02:02:06 | <luqui> | :t ifft |
| 02:02:07 | <lambdabot> | Not in scope: `ifft' |
| 02:02:20 | <luqui> | ,t fft |
| 02:02:21 | <lunabot> | luna: Couldn't match expected type `([Data.Complex.Complex |
| 02:02:24 | <pumpkin> | dmwit: yeah, I needed &&& to be truly point-free, and lunabot doesn't have it |
| 02:02:31 | <pumpkin> | :( |
| 02:02:37 | <dmwit> | ACTION notices a map (^2) in there... surely it's cheating to implement squaring with squaring. |
| 02:02:44 | <pumpkin> | lol |
| 02:03:03 | <pumpkin> | yeah, but I'm squaring each digit, which makes it okay |
| 02:03:08 | <dmwit> | =) |
| 02:03:25 | <luqui> | &&&, |||, +++, *** should all be prelude |
| 02:03:30 | <pumpkin> | yeah |
| 02:03:36 | <luqui> | they are essential to product and coproduct types |
| 02:03:37 | <dmwit> | , let f &&& g = \x -> (f x, g x) in succ &&& pred $ 43 |
| 02:03:39 | <lunabot> | (44,42) |
| 02:04:12 | <pumpkin> | that is what happens when I don't want to do the dishes |
| 02:04:31 | <pumpkin> | not sure where I'll get my bouts of inspiration from once I move into the new apartment with a dishwasher |
| 02:04:31 | <dmwit> | luqui: Well, they're in Prelude.Dmwit. ;-) |
| 02:08:28 | <pumpkin> | anyone want to fix my function? |
| 02:08:33 | <pumpkin> | I've had enough of it |
| 02:08:48 | <TomMD> | > fix function |
| 02:08:50 | <lambdabot> | Not in scope: `function' |
| 02:09:02 | <TomMD> | lambdabot is lazy today, sorry. |
| 02:09:06 | <pumpkin> | aw |
| 02:09:15 | <TomMD> | paste it if you'd like. |
| 02:09:33 | <pumpkin> | just the nasty beast I ran in lunabot a minute ago :) |
| 02:09:40 | <pumpkin> | it only squares some numbers! |
| 02:09:56 | <TomMD> | Oh, screw that ;-) |
| 02:10:01 | <pumpkin> | :( |
| 02:10:07 | <TomMD> | it is a nasty beast. |
| 02:10:53 | <dmwit> | > fix my function |
| 02:10:55 | <lambdabot> | 42 |
| 02:11:08 | <TomMD> | ha, yes, that is good. |
| 02:11:49 | <TomMD> | @remember dmwit > fix my function [lambdabot: 42] |
| 02:11:50 | <lambdabot> | Okay. |
| 02:12:31 | <pumpkin> | ACTION wonders about realWorld# |
| 02:12:44 | <TomMD> | Real world unboxed? |
| 02:13:02 | <TomMD> | Well, you'd have no pointers. Sounds tough. |
| 02:13:10 | <pumpkin> | I can't find it anywhere |
| 02:13:12 | <pumpkin> | but I know it exists |
| 02:13:26 | <pumpkin> | well, I can find it in compiler/basicTypes/MkId.lhs |
| 02:14:04 | <luqui> | :t my |
| 02:14:06 | <lambdabot> | forall b1 b t. (Num t) => b1 -> b -> t |
| 02:14:09 | <luqui> | :t function |
| 02:14:10 | <lambdabot> | forall a. a |
| 02:14:18 | <pumpkin> | > my 1 2 |
| 02:14:20 | <lambdabot> | 42 |
| 02:14:26 | <pumpkin> | :o |
| 02:14:33 | <pumpkin> | > function 4 |
| 02:14:35 | <lambdabot> | * Exception: Prelude.undefined |
| 02:14:36 | <pumpkin> | > function= |
| 02:14:38 | <lambdabot> | <no location info>: parse error on input `=' |
| 02:14:44 | <pumpkin> | the shock, the horror! |
| 02:14:50 | <dmwit> | =) |
| 02:15:15 | <dmwit> | I figured, if I wasn't going to use it, why define it at all? =) |
| 02:15:37 | <TomMD> | > my function |
| 02:15:38 | <lambdabot> | Overlapping instances for GHC.Show.Show (b -> t) |
| 02:15:38 | <lambdabot> | arising from a use of `... |
| 02:15:44 | <TomMD> | > fix my function |
| 02:15:45 | <lambdabot> | 42 |
| 02:16:28 | <dmwit> | > my (my function) function |
| 02:16:30 | <lambdabot> | 42 |
| 02:16:38 | <mike-burns> | > my final answer |
| 02:16:40 | <lambdabot> | Not in scope: `final'Not in scope: `answer' |
| 02:17:57 | <luqui> | > my ?final ?answer |
| 02:17:58 | <lambdabot> | Unbound implicit parameters (?answer::b, ?final::b1) |
| 02:17:58 | <lambdabot> | arising from a use ... |
| 02:18:58 | <dmwit> | Man, implicit parameters are definitely a weird corner of the language. |
| 02:19:11 | <dmwit> | I wonder if there's any actual code floating around that needs them. |
| 02:19:49 | <luqui> | i used to use them a lot, until my enlightenment :-p |
| 02:20:03 | <Tsion> | What is the fix function for? |
| 02:20:10 | <dmwit> | recursion |
| 02:20:15 | <luqui> | > fix (1:) |
| 02:20:16 | <lambdabot> | [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,... |
| 02:20:28 | <dmwit> | Tsion: You know about the Y combinator? |
| 02:20:44 | <luqui> | > fix (\self x -> if x == 0 then 1 else x * self (x-1)) 10 |
| 02:20:45 | <lambdabot> | 3628800 |
| 02:20:48 | <Tsion> | dmwit: No |
| 02:20:53 | <luqui> | > product [1..10] |
| 02:20:55 | <lambdabot> | 3628800 |
| 02:21:24 | <dmwit> | Tsion: Well, the reason the Y combinator is neat is because it lets you do recursive things in languages without recursion. |
| 02:21:38 | <dmwit> | Tsion: Specifically, if a name isn't in scope in its own binding, that makes it tricky to do recursion. |
| 02:21:48 | <dmwit> | Tsion: Consider the standard fibonacci definition. |
| 02:22:01 | <dmwit> | fibonacci n | n > 2 = fibonacci (n-1) + fibonacci (n-2) |
| 02:22:22 | <dmwit> | In a language where "fibonacci" isn't in scope on the right-hand side, you wouldn't be able to write that function in that way. |
| 02:22:28 | <Tsion> | right |
| 02:22:32 | <dmwit> | The "fix" combinator is the answer to that. |
| 02:22:39 | <dmwit> | It lets you write that case as |
| 02:23:10 | <dmwit> | fibonacci = fix (\fibRecurse n -> if n > 2 then fibRecurse (n-1) + fibRecurse (n-2) else baseCase) |
| 02:23:26 | <dmwit> | You'll notice that fibonacci is not used in the RHS any more. |
| 02:23:29 | <dmwit> | And the definition of fix: |
| 02:23:31 | <dmwit> | ?src fix |
| 02:23:31 | <lambdabot> | fix f = let x = f x in x |
| 02:23:45 | <dmwit> | also doesn't use "fix" in its RHS. |
| 02:24:00 | <luqui> | (but it does use x in its own RHS) |
| 02:24:02 | <dmwit> | (although it does use 'x' in the RHS of the let, so it's cheating slightly) |
| 02:24:25 | <luqui> | fix f = \f. (\x. x x) (\x. f (x x)) |
| 02:24:26 | <Tsion> | Cool, thanks for the explaination dmwit :) |
| 02:24:34 | <dmwit> | Anyway, the true Y combinator doesn't have that cheat (but can't be expressed in Haskell). |
| 02:24:34 | <luqui> | that's the proper definition :-) |
| 02:25:33 | <pumpkin> | > loop (take 5 . snd &&& repeat . fst) 5 |
| 02:25:35 | <lambdabot> | [5,5,5,5,5] |
| 02:25:37 | <TomMD> | Tsion: If you are interested in this and want to dive into some simple lambda calculus I'll probably be pushing a version of Tim Sheards Lambda Calculator onto Hackage soon. |
| 02:25:52 | <TomMD> | Tsion: But thats only if you are _really_ interested. |
| 02:25:55 | <luqui> | :t loop |
| 02:25:56 | <lambdabot> | forall (a :: * -> * -> *) b d c. (ArrowLoop a) => a (b, d) (c, d) -> a b c |
| 02:26:18 | <Tsion> | I read a bit about labmda calculus on wikipedia, but there's not too much there |
| 02:26:29 | <TomMD> | Its a simple language. |
| 02:26:48 | <Tsion> | lambda* |
| 02:27:04 | <luqui> | God *is* untyped pure lambda calculus |
| 02:28:09 | <TomMD> | Are you sure he isn't a turing machine? |
| 02:28:12 | <heatsink> | What mailing list is appropriate for questions about making Cabal packages? |
| 02:29:38 | <TomMD> | heatsink: If you've already seen examples, read the webpage and still have questions then I'd suggest haskell-cafe or cabal-devel both at haskell.org. |
| 02:29:54 | <TomMD> | I suppose cabal-devel if you feel you've found a deficency. |
| 02:30:50 | <heatsink> | Alright, thanks |
| 02:31:16 | <pumpkin> | bonus points if someone comes up with something cool and concise using Kleisli and loop |
| 02:31:17 | <heatsink> | I subscribed to haskell-cafe briefly, but it's too much for me to keep up with. |
| 02:32:03 | <dmwit> | ?instances mfix |
| 02:32:04 | <lambdabot> | Couldn't find class `mfix'. Try @instances-importing |
| 02:32:07 | <dmwit> | um |
| 02:32:10 | <dmwit> | ?instances MonadFix |
| 02:32:12 | <lambdabot> | ((->) r), Either e, ErrorT e m, IO, Maybe, RWS r w s, RWST r w s m, Reader r, ReaderT r m, ST s, State s, StateT s m, Writer w, WriterT w m, [] |
| 02:32:12 | <dmwit> | duh |
| 02:32:13 | <Saizan> | dmwit: you can write the Y combinator with the help of a recursive type, newtype Rec a = In { out :: Rec a -> a } |
| 02:33:08 | <ClaudiusMaximus> | i've been working on a lazy untyped lambda calculus graph reduction stuff lately |
| 02:33:11 | <dmwit> | That type looks difficult to inhabit without using fix in the first place. |
| 02:33:45 | <dmwit> | :t mfix |
| 02:33:46 | <lambdabot> | forall a (m :: * -> *). (MonadFix m) => (a -> m a) -> m a |
| 02:34:21 | <dmwit> | > execState (mfix (\a -> put (1:a) >> get)) [] |
| 02:34:22 | <lambdabot> | [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,... |
| 02:34:34 | <pumpkin> | luqui: why flip mod? |
| 02:34:40 | <dmwit> | :t Kleisli |
| 02:34:41 | <lambdabot> | forall a (m :: * -> *) b. (a -> m b) -> Kleisli m a b |
| 02:34:55 | <pumpkin> | it works nicely with x `mod` 5 |
| 02:35:57 | <pumpkin> | I guess you can approximate mfix easily with loop and Kleisli |
| 02:37:27 | <kniu> | I thought this would never happen, |
| 02:37:39 | <kniu> | but a runtime error is giving me trouble. |
| 02:38:48 | <heatsink> | kniu: You need dependent types. |
| 02:39:27 | <pumpkin> | or you need to use the power of haskell types to their fullest! |
| 02:39:28 | <kniu> | I thought this would never happen, |
| 02:39:29 | <Saizan> | dmwit: http://r6.ca/blog/20060919T084800Z.html |
| 02:39:39 | <kniu> | but typechecking is taking forever to finish. |
| 02:40:11 | <luqui> | pumpkin, (`mod` 5) makes more sense as a function in its own right than (5 `mod`) |
| 02:40:18 | <pumpkin> | true |
| 02:40:23 | <luqui> | i.e., whenever I have curried mod in the past, it has always been on its second argument |
| 02:40:39 | <pumpkin> | I guess mod was written that way to be used infix |
| 02:40:41 | <pumpkin> | and only for that reason |
| 02:40:44 | <luqui> | yeah |
| 02:40:47 | <luqui> | probably |
| 02:43:42 | <SamB> | pumpkin: you mean there are other ways too call it ? |
| 02:47:40 | <pumpkin> | :o |
| 02:50:39 | <outchanter> | it's also the same ordering as div |
| 02:53:11 | <hackagebot> | Added by GregoryCrosswhite, Mon Jun 8 02:52:13 UTC 2009.: Haskell values that cannot be evaluated immediately. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/procrastinating-variable-1.0 |
| 02:55:42 | <gwern> | I know I asked for hackagebot to print the synopses as well, but I didn't intend the date to come with it... |
| 02:56:12 | <hackagebot> | Added by DmitryGolubovsky, Mon Jun 8 02:55:59 UTC 2009.: Parser and Pretty Printer for the Web IDL Language http://hackage.haskell.org/cgi-bin/hackage-scripts/package/webidl-0.1.1 |
| 02:58:15 | <luqui> | outchanter, arguably div should be swapped as well. it allows the pretty definition: div = (*) . recip |
| 02:59:12 | <luqui> | which allows base factorization to be expressed as liftA2 (&&&) div mod |
| 02:59:23 | <luqui> | (which would be prettier if we could lift infix) |
| 02:59:56 | <luqui> | div <^ (&&&) ^> mod, in Beelsebob's style |
| 03:01:14 | <hackagebot> | Added by GregoryCrosswhite, Mon Jun 8 03:00:14 UTC 2009.: Haskell values that cannot be evaluated immediately. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/procrastinating-variable-1.0.1 |
| 03:03:55 | <luqui> | > liftA2 (&&&) (flip div) (flip mod) 10 25 |
| 03:03:56 | <lambdabot> | (2,5) |
| 03:05:32 | <dmwit> | > divMod 25 10 |
| 03:05:34 | <lambdabot> | (2,5) |
| 03:08:09 | <luqui> | (uncurry (+) . first . (*)) (2,5) |
| 03:08:13 | <luqui> | > (uncurry (+) . first . (*)) (2,5) |
| 03:08:15 | <lambdabot> | Couldn't match expected type `(a, a)' |
| 03:10:38 | <outchanter> | > reverse $ unfoldr (\x -> if x == 0 then Nothing else (Just.swap.divMod) x 10) 12345 |
| 03:10:40 | <lambdabot> | Not in scope: `Just.swap' |
| 03:11:01 | <luqui> | > (fmap (uncurry (+)) . first . (*)) 10 (2,5) |
| 03:11:03 | <lambdabot> | 25 |
| 03:11:06 | <outchanter> | > reverse $ unfoldr (\x -> if x == 0 then Nothing else (Just . swap . divMod) x 10) 12345 |
| 03:11:07 | <lambdabot> | Not in scope: `swap' |
| 03:11:24 | <kniu> | I'm writing a repl. |
| 03:11:42 | <kniu> | Is there a getLine equivalent that does backspaces? |
| 03:11:46 | <luqui> | > liftA2 (.) (fmap (uncurry (+)) . first . (*)) (liftA2 (&&&) div mod) 10 25 |
| 03:11:47 | <lambdabot> | 10 |
| 03:11:59 | <luqui> | > liftA2 (.) (fmap (uncurry (+)) . first . (*)) (liftA2 (&&&) (flip div) (flip mod)) 10 25 |
| 03:12:00 | <lambdabot> | 25 |
| 03:12:14 | <outchanter> | > reverse $ unfoldr (\x -> if x == 0 then Nothing else (Just.swap.divMod) x 10) 12345 where swap (x, y) = (y, x) |
| 03:12:17 | <lambdabot> | <no location info>: parse error on input `where' |
| 03:12:48 | <luqui> | @check \x -> liftA2 (.) (fmap (uncurry (+)) . first . (*)) (liftA2 (&&&) (flip div) (flip mod)) 10 x == x |
| 03:12:50 | <lambdabot> | "OK, passed 500 tests." |
| 03:12:55 | <Cale> | > let swap (x, y) = (y, x) in reverse $ unfoldr (\x -> if x == 0 then Nothing else (Just.swap.divMod) x 10) 12345 |
| 03:12:56 | <lambdabot> | Not in scope: `Just.swap' |
| 03:13:03 | <Cale> | > let swap (x, y) = (y, x) in reverse $ unfoldr (\x -> if x == 0 then Nothing else (Just . swap . divMod) x 10) 12345 |
| 03:13:05 | <lambdabot> | Couldn't match expected type `(t, t1)' |
| 03:14:38 | <Cale> | > let swap (x, y) = (y, x) in reverse $ unfoldr (\x -> if x == 0 then Nothing else (Just . swap $ divMod x 10)) 12345 |
| 03:14:40 | <lambdabot> | [1,2,3,4,5] |
| 03:15:16 | <outchanter> | ah, thanks |
| 03:15:21 | <Cale> | > reverse . map (`mod` 10) . takeWhile (/= 0) . iterate (`div` 10) $ 12345 |
| 03:15:23 | <lambdabot> | [1,2,3,4,5] |
| 03:16:21 | <luqui> | ACTION wonders if that can be prettily pointfree on "10" also |
| 03:17:20 | <SamB> | @pl let swap (x, y) = (y, x) in reverse $ unfoldr (\x -> if x == 0 then Nothing else (Just . swap $ divMod x 10)) 12345 |
| 03:17:20 | <lambdabot> | reverse (unfoldr (ap (flip if' Nothing . (0 ==)) (Just . uncurry (flip (,)) . flip divMod 10)) 12345) |
| 03:17:40 | <Cale> | > reverse . map (`mod` 10) . takeWhile (/= 0) . iterate (`div` 10) $ 10 |
| 03:17:42 | <lambdabot> | [1,0] |
| 03:17:54 | <outchanter> | @pl reverse . map (`mod` 10) . takeWhile (/= 0) . iterate (`div` 10) $ 12345 |
| 03:17:55 | <lambdabot> | reverse (map (`mod` 10) (takeWhile (0 /=) (iterate (`div` 10) 12345))) |
| 03:18:06 | <Cale> | heh |
| 03:18:25 | <outchanter> | @pl (\x -> reverse . map (`mod` x) . takeWhile (/= 0) . iterate (`div` x) $ 12345) 10 |
| 03:18:26 | <lambdabot> | reverse (map (`mod` 10) (takeWhile (0 /=) (iterate (`div` 10) 12345))) |
| 03:18:38 | <outchanter> | that's cheating! |
| 03:18:44 | <Cale> | luqui: oh, I see what you mean |
| 03:19:00 | <luqui> | woah... @pl does beta conversion? |
| 03:19:03 | <Cale> | @pl (\x -> reverse . map (`mod` x) . takeWhile (/= 0) . iterate (`div` x)) |
| 03:19:04 | <lambdabot> | (reverse .) . ap ((.) . map . flip mod) ((takeWhile (0 /=) .) . iterate . flip div) |
| 03:19:19 | <luqui> | @pl (\x -> x x) (\x -> x x) |
| 03:19:23 | <lambdabot> | ap id id (ap id id) |
| 03:19:23 | <lambdabot> | optimization suspended, use @pl-resume to continue. |
| 03:19:31 | <Cale> | outchanter: you shouldn't apply the function if you don't want @pl to simplify it away |
| 03:19:40 | <outchanter> | fair enough |
| 03:20:02 | <luqui> | @pl (\x -> x x) (\x -> x x x) |
| 03:20:06 | <lambdabot> | ap id id (ap (ap id id) id) |
| 03:20:06 | <lambdabot> | optimization suspended, use @pl-resume to continue. |
| 03:22:28 | <SamB> | @pl-resume |
| 03:22:34 | <lambdabot> | pointless: sorry, nothing to resume. |
| 03:23:03 | <luqui> | i think that's minimal anyhow |
| 03:23:10 | <lambdabot> | luqui: You have 1 new message. '/msg lambdabot @messages' to read it. |
| 03:23:47 | <luqui> | lambdabot, i know. did you just reboot or something? |
| 03:24:23 | <SamB> | @pl (\x -> x x) (\x -> x x x) |
| 03:24:27 | <lambdabot> | ap id id (ap (ap id id) id) |
| 03:24:27 | <lambdabot> | optimization suspended, use @pl-resume to continue. |
| 03:24:29 | <SamB> | @pl-resume |
| 03:24:36 | <lambdabot> | ap id id (ap (ap id id) id) |
| 03:24:36 | <lambdabot> | optimization suspended, use @pl-resume to continue. |
| 03:24:49 | <pumpkin> | that's got an extra x! :P |
| 03:25:37 | <luqui> | pumpkin, yeah, the extra x causes the term to grow with each reduction |
| 03:25:50 | <pumpkin> | it has the same effect on @pl without it |
| 03:25:59 | <pumpkin> | but yeah |
| 03:26:21 | <luqui> | pumpkin, no, pl internally is probably using a decent amount of memory trying to optimize it |
| 03:26:24 | <lambdabot> | luqui: You have 1 new message. '/msg lambdabot @messages' to read it. |
| 03:26:26 | <luqui> | that it wouldn't use with the usual one |
| 03:26:32 | <pumpkin> | @pl (\x -> x x) (\x -> x x) |
| 03:26:42 | <lambdabot> | ap id id (ap id id) |
| 03:26:43 | <pumpkin> | @pl-resume |
| 03:26:44 | <luqui> | maybe that's why it keeps rebooting... |
| 03:26:48 | <lambdabot> | optimization suspended, use @pl-resume to continue. |
| 03:26:58 | <lambdabot> | ap id id (ap id id) |
| 03:27:04 | <lambdabot> | Plugin `pl' failed with: thread killed |
| 03:27:07 | <pumpkin> | I crash lambdabot regularly with that one, I'm pretty sure it's the exact same issue :) |
| 03:27:51 | <pumpkin> | ACTION admires the photos someone invited haskell-cafe to see |
| 03:28:00 | <selmanj> | Question, when I run haddock on my Main.hs file, i get "parse error on input `module'", which is the first non-commented line in the file. Any ideas why this would happen? |
| 03:28:05 | <kniu> | 7.hs:14:1: `read' is not a (visible) method of class `Read' |
| 03:28:14 | <SamB> | pumpkin: but has haskell-cafe seen them yet? |
| 03:28:16 | <kniu> | what methods must I write to instance Read, then? |
| 03:28:21 | <pumpkin> | SamB: not sure! |
| 03:28:45 | <SamB> | kniu: try doing :i Read |
| 03:29:03 | <kniu> | huh? |
| 03:29:09 | <pumpkin> | in ghci |
| 03:29:43 | <kniu> | oh |
| 03:29:44 | <Cale> | selmanj: haddock has rules about the syntax of comments as well... my guess would be that it doesn't like the comment you have before |
| 03:30:06 | <selmanj> | Cale: hmm, i didn't know that. I'll double check it, thanks |
| 03:30:52 | <kniu> | man, that's confusing. |
| 03:31:01 | <kniu> | what's ReadS? |
| 03:31:21 | <pumpkin> | mmorrow: did you see my wonderful squarer before? |
| 03:31:31 | <Cale> | type ReadS a = String -> [(a,String)] |
| 03:32:04 | <Cale> | It takes a string and produces a list of values of type a resulting from possible parses, each along with the remaining string left over |
| 03:32:26 | <malouin> | Does this function exist somewhere: foo :: Maybe String -> IO () ... foo Just str = ioError $ userError str ? |
| 03:32:32 | <Cale> | (usually the list will either be empty or have one element, which is the case for all the Prelude and derived instances) |
| 03:32:34 | <selmanj> | Cale: the entirety of the comment is "-- | The main function of the code. This is the starting point.". |
| 03:32:40 | <luqui> | > reads "\"Hello\" world" :: ReadS String |
| 03:32:44 | <lambdabot> | Couldn't match expected type `Text.ParserCombinators.ReadP.ReadS |
| 03:32:44 | <lambdabot> | luqui: You have 1 new message. '/msg lambdabot @messages' to read it. |
| 03:32:54 | <luqui> | > reads "\"Hello\" world" :: [(String, String)] |
| 03:32:55 | <lambdabot> | [("Hello"," world")] |
| 03:33:01 | <Cale> | selmanj: hmm, I don't see anything wrong with that. |
| 03:33:23 | <selmanj> | Cale: ooh, think i found it |
| 03:33:35 | <selmanj> | Cale: above that line i have a subversion Id, ie -- $Id$ |
| 03:33:39 | <selmanj> | that seems to be messing with haddock |
| 03:34:01 | <Cale> | ah, hmm |
| 03:38:40 | <RamzaB> | How do you create data structure like a binary tree in Haskell if variables are not "variable"? |
| 03:39:15 | <kniu> | make a new tree every time you modify/add/delete an element. |
| 03:39:55 | <luqui> | RamzaB, I don't understand your question. Those two things seem to be independent... |
| 03:40:07 | <luqui> | ("how do you create data structure like a list ...") |
| 03:40:14 | <luqui> | like this: x = 1:2:3:[] |
| 03:40:19 | <RamzaB> | thats going to be kind of slow if the tree is big? |
| 03:40:37 | <RamzaB> | list is like a built-in data structure in haskell right? how do you create your own |
| 03:40:39 | <luqui> | RamzaB, turns out not to be if you're smart with laziness |
| 03:40:54 | <luqui> | data List a = Nil | Cons a (List a) -- my own list |
| 03:40:57 | <sjanssen> | RamzaB: luckily, asymptotics save us. In a balanced binary tree, only O(log n) new nodes have to be created |
| 03:41:15 | <sjanssen> | (per insert) |
| 03:41:51 | <RamzaB> | sjanssen, I dont understand that |
| 03:42:18 | <sjanssen> | RamzaB: you know that in a balanced binary tree, it is O(log n) from the root to any node, right? |
| 03:42:20 | <luqui> | RamzaB, if you "modify" only in the right branch of the tree, you don't have to copy the left branch |
| 03:43:03 | <sjanssen> | RamzaB: we only have to modify the branches we follow, the others can remain unchanged |
| 03:43:14 | <RamzaB> | ok, but you're going to have to balance the tree manually, then thats going to be slow if u have to copy the tree everytime right? |
| 03:43:29 | <kniu> | you're not copying the entire tree. |
| 03:43:43 | <luqui> | you maintain invariants so that the tree stays balanced after every operation |
| 03:43:45 | <sjanssen> | RamzaB: balancing the tree will also only require O(log n) steps |
| 03:46:25 | <hackagebot> | Added by DinoMorelli, Mon Jun 8 03:46:11 UTC 2009.: Simple functions for loading config files http://hackage.haskell.org/cgi-bin/hackage-scripts/package/fez-conf-1.0.1 |
| 03:47:52 | <Cale> | data Tree a = Empty | Branch a (Tree a) (Tree a) |
| 03:48:26 | <Cale> | Just figured I should write that since I think it was perhaps what he was looking for. |
| 03:51:39 | <ClaudiusMaximus> | anyone know of any incremental graph layout libraries? i want to generate video of lazy evaluation... |
| 03:52:22 | <ClaudiusMaximus> | ...and i fear my naive attempt at spitting out .dot files for graphviz will lead to horrible flickering chaos |
| 03:52:47 | <kniu> | k, so I got this repl function. |
| 03:53:01 | <kniu> | prints " >" every line, reads the input, evals, prints. |
| 03:53:03 | <kniu> | works fine. |
| 03:53:13 | <kniu> | repl :: IO () |
| 03:53:16 | <kniu> | BUT |
| 03:53:16 | <SamB> | ClaudiusMaximus: so, you want not just incremental, but animated |
| 03:53:28 | <SamB> | smoothly |
| 03:53:40 | <SamB> | never heard of anything like that, but ... |
| 03:53:40 | <kniu> | I write main = repl, and compile it, the program starts printing "> " at the wrong place. |
| 03:53:48 | <kpreid> | I was working on that once |
| 03:54:12 | <Cale> | kniu: How is it written? |
| 03:54:14 | <SamB> | I bet you can hack something up involving interpolation between graphviz layouts, or something ;-) |
| 03:54:15 | <Tsion> | kniu: what wrong place? |
| 03:54:17 | <kpreid> | I got a program which would take input to add nodes and edges, and display them in space with a repulsion rule |
| 03:54:27 | <kniu> | it prints "> " AFTER getLine |
| 03:54:27 | <dino-> | kniu: Buffering of stdout perhaps |
| 03:54:31 | <Cale> | kniu: It could have something to do with the default buffering being different. |
| 03:54:34 | <sjanssen> | kniu: you're getting different behavior in ghci vs. a compiled program? Check your buffering |
| 03:54:40 | <kniu> | well, dang. |
| 03:54:52 | <SamB> | I have no idea how ugly the interpolation-between-graphviz-layouts approach would be ... |
| 03:54:54 | <RevGreen> | this language is too hard |
| 03:54:56 | <kniu> | is there a fflush(stdout); equivalent in haskell? |
| 03:54:56 | <RevGreen> | I give up |
| 03:54:58 | <RevGreen> | back to MATLIB |
| 03:55:02 | <ClaudiusMaximus> | SamB: i basically need small changes in input graph to lead to small changes in output layout - beyond that i don't need anything fancy (it would make the video too long) |
| 03:55:12 | <Cale> | kniu: hFlush stdout |
| 03:55:16 | <dino-> | I end up doing this a lot in cli programs early: mapM_ (flip hSetBuffering NoBuffering) [ stdout, stderr ] |
| 03:55:18 | <kniu> | thanks. |
| 03:55:19 | <Cale> | kniu: Or just: hSetBuffering stdout NoBuffering |
| 03:55:27 | <RevGreen> | of course |
| 03:55:29 | <kniu> | oh? |
| 03:55:31 | <RevGreen> | NoBuffering |
| 03:55:34 | <RevGreen> | I didn't think about that |
| 03:55:36 | <SamB> | ClaudiusMaximus: I suppose you could feed the previous layed-out graph back into graphviz along with the changed nodes ... |
| 03:55:55 | <SamB> | but, hmm, you'd have to remove the other nodes ... |
| 03:56:07 | <SamB> | well ..., there was some graphviz package on hackage that should make it a lot easier |
| 03:56:11 | <Cale> | (You'll need to import System.IO in either case) |
| 03:58:57 | <ClaudiusMaximus> | SamB: sounds like it'd be a nightmare in any case.. |
| 03:59:33 | <SamB> | hmm, http://hackage.haskell.org/packages/archive/graphviz/2009.5.1/doc/html/Data-GraphViz.html#v%3AgraphToGraph is the function I was thinking of |
| 03:59:40 | <SamB> | but it's not quite what you'd want |
| 04:00:00 | <SamB> | you'd want something that would allow positional information to be passed *in* as well |
| 04:00:48 | <ClaudiusMaximus> | kpreid: sounds like something i might like to take a look at |
| 04:03:11 | <kpreid> | ClaudiusMaximus: well, it was rather unfinished. I didn't publish it. if you're still interested let me know *tomorrow* and I'll see about it |
| 04:13:47 | <bos> | sigfpe warps my brain, as usual |
| 04:15:48 | <SamB_XP> | personally, I think I find SIGSEGV from vm86() more interesting |
| 04:16:30 | <TheColonial> | Hi guys, can someone give me a hand with an exercise i'm trying to do with Applicative functors? |
| 04:16:59 | <Cale> | okay |
| 04:17:00 | <Berengal> | TheColonial: Sure we can. What's the problem? |
| 04:17:26 | <TheColonial> | Berengal: Thanks :) I'm trying to get my head around how they work, so I thought I'd attempt to implement an Applicative functor for a tree like structure. defined: |
| 04:17:43 | <TheColonial> | data Tree a = Node a [Tree a] deriving (Show) |
| 04:17:52 | <TheColonial> | simple stuff right? |
| 04:18:06 | <TheColonial> | so i have figured out the functor, and I understand that... |
| 04:18:17 | <TheColonial> | data Tree a = Node a [Tree a] deriving (Show) |
| 04:18:19 | <TheColonial> | oops |
| 04:18:40 | <TheColonial> | instance Functor Tree where |
| 04:18:42 | <TheColonial> | fmap f (Node n ns) = Node (f n) (map (fmap f) ns) |
| 04:18:47 | <TheColonial> | that's what i came up with |
| 04:18:56 | <TheColonial> | now i'm trying to tackle applicative functors |
| 04:19:11 | <TheColonial> | at first i thought that i would end up with a tree of trees.. but that's obviously wrong :) |
| 04:19:27 | <pumpkin> | :t (<*>) |
| 04:19:29 | <lambdabot> | forall (f :: * -> *) a b. (Applicative f) => f (a -> b) -> f a -> f b |
| 04:19:37 | <TheColonial> | so i'm struggling to visualise a valid end result before i can even attempt to write the applicative functor |
| 04:19:45 | <pumpkin> | so you have a tree of functions, and want a function that takes trees to trees |
| 04:19:58 | <TheColonial> | pumpkin: Thanks, I have that down already... hence I knew tree of trees was wrong :) |
| 04:20:14 | <TheColonial> | well, as an exercise yes.. but i dont even know if it's a valid thing to do! |
| 04:20:20 | <TheColonial> | yup, I'm a noob :) |
| 04:20:51 | <Cale> | There are a few ways you could try to handle it. Probably the simplest one would be the "zipping" approach. |
| 04:21:27 | <TheColonial> | aye, that's what i thought |
| 04:21:30 | <TheColonial> | but first... |
| 04:21:43 | <TheColonial> | i need to see what the result of the following would be: |
| 04:21:48 | <TheColonial> | x = Node 1 [Node 2 []] |
| 04:21:50 | <TheColonial> | y = Node 3 [Node 4 []] |
| 04:22:06 | <TheColonial> | (+) <$> x <*> y |
| 04:22:14 | <TheColonial> | that is what Im finding confusing :) |
| 04:22:33 | <TheColonial> | would anyone be able to guess what the result might look like? |
| 04:22:36 | <Berengal> | It could be Node 4 [Node 6 []] |
| 04:22:45 | <aavogt> | instance Applicative Tree where (Node f _) <*> t = fmap f t -- does this pass the laws? |
| 04:22:54 | <Cale> | Yeah, with the zipping approach, it would be pointwise. |
| 04:23:08 | <dmwit> | aavogt: What's pure? |
| 04:23:13 | <dmwit> | aavogt: All the laws use pure. =) |
| 04:23:18 | <TheColonial> | aavogt: doesn't that ignore the full list of functions? |
| 04:23:22 | <TheColonial> | s/list/tree |
| 04:23:42 | <aavogt> | right, pure = flip Node [] |
| 04:23:55 | <dibblego> | TheColonial, do x' <- x; y' <- y; return (x + y) |
| 04:24:28 | <dmwit> | aavogt: It doesn't pass the pure (.) <*> u <*> v <*> w = u <*> (v <*> w) law, I think. |
| 04:24:40 | <aavogt> | TheColonial: yep |
| 04:24:50 | <dmwit> | err.. |
| 04:24:55 | <TheColonial> | aavogt: is that how it should work? |
| 04:25:03 | <TheColonial> | aavogt: i thought it'd have to parse the whole tree? |
| 04:25:51 | <jmcarthur> | there is no law that requires that |
| 04:25:53 | <dmwit> | aavogt: Actually, that law passes, but u <*> pure y = pure ($ y) <*> u -- this one doesn't pass. |
| 04:25:55 | <TheColonial> | ok guys i'm a bit lost :) |
| 04:26:16 | <dmwit> | TheColonial: Ignore aavogt and go with the zipping idea. ;-) |
| 04:26:23 | <aavogt> | TheColonial: I think the "zipping" approach suggested by Cale is probably a more useful instance. The one I suggested seems to break some laws... |
| 04:26:57 | <TheColonial> | dmwit: aavogt: ok... would you be able to show me what my example would result it in if I had the correct implementation? :) |
| 04:27:05 | <TheColonial> | that's what I'm struggling to visualise more than anything |
| 04:27:14 | <dmwit> | TheColonial: See Berengal's answer above, he got it right. |
| 04:27:31 | <TheColonial> | ok, so how did he get that result? it doesn't make sense to me (yup, i feel stupid) |
| 04:27:53 | <jmcarthur> | TheColonial: there is often more than one way to define the semantics of a type class instance for some type. the suggested semantics is zipping |
| 04:28:08 | <jmcarthur> | where zipping is simple left-to-right application of functions to arguments |
| 04:28:12 | <TheColonial> | ah i see it, perhaps if i give another example.... let's pretend that y had another element |
| 04:28:15 | <dmwit> | One way to think of it is to imagine laying the trees on top of each other, then applying the functions in the top-most tree to the values in the bottom tree. |
| 04:28:46 | <dmwit> | If there are places where there's a tree only on top or only on bottom, the result doesn't have any tree there. |
| 04:28:55 | <TheColonial> | dmwit: right, i see, so in other words, if using the zipping approach, wed simply ignore those leaves which don't have respective functions and vice versa? |
| 04:29:03 | <dmwit> | right |
| 04:29:04 | <TheColonial> | thank you :) |
| 04:29:07 | <mriou> | hi, question about monad transformers |
| 04:29:14 | <mriou> | I'm defining a stack with more than one StateT and would like to use deriving on the new type |
| 04:29:17 | <TheColonial> | i'll be back with my attempt for scrutiny! |
| 04:29:26 | <Berengal> | TheColonial: Also, the 'pure' function needs to create an infinitely wide and infinitely deep tree |
| 04:29:33 | <mriou> | how can I derive several times MonadState (... deriving (MonadState Foo, MonadState Bar)) ? |
| 04:29:37 | <dmwit> | mriou: Fundeps mean you only get to derive MonadState once, I'm afraid. |
| 04:29:55 | <jmcarthur> | mriou: MonadState (Foo, Bar) might be nicer |
| 04:29:58 | <mriou> | dmwit: thought so, but it was worth checking :) |
| 04:30:29 | <dmwit> | Yep, jmcarthur's suggestion is nice (though you have to write the instance yourself, then). |
| 04:30:35 | <mriou> | jmcarthur: yeah. that might end up being easier |
| 04:31:09 | <mriou> | just wanted to try the full-on monadic transformer thing first :) |
| 04:31:32 | <dmwit> | You can still use a monad transformer with two StateTs in it. |
| 04:32:17 | <dmwit> | instance MonadState (Foo, Bar) (StateT Foo (StateT Bar Id)) where get = liftM2 (,) get (lift get) |
| 04:32:22 | <jmcarthur> | mriou: it's typical to not use the transformer stack directly, but to abstract it as a new type and define specific operations on it. you could hide one StateT behind such an abstraction and then still be able to put another StateT on top |
| 04:32:27 | <mriou> | dmwit: but I won't be able to make it an instance of MonadState that could access both states, right? |
| 04:32:35 | <dmwit> | mriou: ;-) |
| 04:32:40 | <dmwit> | I type the answers faster than you type the questions. =) |
| 04:33:04 | <mriou> | dmwit he he that's useful |
| 04:33:14 | <dmwit> | 'course, you have to mess with some newtype wrapping and unwrapping |
| 04:33:16 | <dmwit> | But you get the idea. |
| 04:33:30 | <mriou> | dmwit I think so yes |
| 04:34:35 | <mriou> | jmcarthur: in practice, which approach is "better", declare new types for each state or the (Foo, Bar) trick? |
| 04:35:11 | <jmcarthur> | mriou: depends on whether it makes sense for the MonadState to be exposed or not |
| 04:35:46 | <dmwit> | If you have a choice, I strongly recommend collapsing all your StateTs into one. |
| 04:35:54 | <jmcarthur> | and you don't necessarily have to make a new type for each state, just a new type for each abstraction |
| 04:35:55 | <dmwit> | Of course, you don't always have the luxury of choice. =) |
| 04:36:05 | <mriou> | dmwit: why? performance? |
| 04:36:14 | <jmcarthur> | simplicity |
| 04:36:18 | <dmwit> | mriou: Nah, because you can get the compiler to write more of your code for you. |
| 04:36:43 | <mriou> | ok, makes sense |
| 04:37:02 | <jmcarthur> | mriou: you could consider your state to be a record of values, rather than a single value |
| 04:37:36 | <jmcarthur> | even though it is just a single value |
| 04:37:54 | <mriou> | jmcarthur: yes, it's actually a global state that has several 'entries' |
| 04:38:32 | <mriou> | so I guess in that sense it's appropriate to consider it as a single state, same lifecycle |
| 04:39:05 | <mriou> | jmcarthur, dmwit thanks a lot for the help |
| 04:42:32 | <TheColonial> | Berengal: Infintely wide and deep? why is that? |
| 04:42:48 | <Berengal> | TheColonial: What else would it be? |
| 04:43:00 | <TheColonial> | Berengal: touche :) |
| 04:43:22 | <Berengal> | pure x = let tree = Node x (repeat tree) in tree |
| 04:44:16 | <kniu> | sometimes, I wish Haskell discriminates between let, let*, letrec and letrec* |
| 04:45:02 | <idnar> | I have no idea what that means |
| 04:45:50 | <pumpkin> | kniu: why? |
| 04:45:50 | <Axman6> | wth is letrec? |
| 04:46:07 | <jmcarthur> | recursive let |
| 04:46:12 | <luqui> | let*? |
| 04:46:17 | <jmcarthur> | i dunno what that is |
| 04:46:17 | <luqui> | multiple bindings? |
| 04:46:25 | <kniu> | let* is sequential. |
| 04:46:35 | <Cale> | A french painter? No, no, that was Lautrec. |
| 04:46:38 | <jmcarthur> | that makes no sense in haskell context to me... |
| 04:46:50 | <jmcarthur> | sequential let, that is |
| 04:46:57 | <luqui> | let* x = x + 1 -- uses the x from the outer scope? |
| 04:47:09 | <kniu> | I just like being able to differentiate between which context I want the right hand values to come from. |
| 04:47:15 | <jmcarthur> | oh |
| 04:47:33 | <jmcarthur> | eh, i don't have a problem with the way let is right now, i think |
| 04:47:34 | <Cale> | kniu: Well, you can always just not shadow things :) |
| 04:47:45 | <jmcarthur> | -Wall complains about shadowing anyway |
| 04:47:45 | <Berengal> | 'let* foo = x; bar = foo; foo = bar + 1' would be about the same as 'let foo = x in let bar = foo in let foo = bar + 1' |
| 04:47:46 | <luqui> | what is the difference between let and let*? |
| 04:47:49 | <Cale> | So long as you don't reuse variables, there's no difference. |
| 04:47:54 | <kniu> | It sucks having to come up with new names for stuff. |
| 04:47:55 | <roconnor> | ACTION wishes all do was mdo |
| 04:48:33 | <luqui> | roconnor, so x <- f x would be an error for non MonadFixes? |
| 04:48:38 | <luqui> | makes sense |
| 04:48:45 | <Berengal> | kniu: This is what ' is for |
| 04:48:46 | <roconnor> | x <- f x would add a MonadFix contraint |
| 04:48:54 | <luqui> | kniu, I still don't know what the difference between let and let* would be |
| 04:49:01 | <kniu> | I thought more guys in here would know Scheme. |
| 04:49:15 | <kniu> | luqui, let in Scheme doesn't do recursion. |
| 04:49:16 | <pumpkin> | I took SCIP a few years ago |
| 04:49:18 | <SamB_XP> | kniu: we tend to forget those complicated nasty little details |
| 04:49:26 | <luqui> | kniu, I didn't say letrec anywhere... |
| 04:49:30 | <pumpkin> | SICP even |
| 04:49:35 | <luqui> | kniu, both of those are nonrecursive |
| 04:49:43 | <kniu> | it's equivalent to ((lambda (v1 v2 v3 ...) body) x1 x2 x3) |
| 04:49:49 | <Cale> | I always thought it was ugly how scheme had so many variations on let, when all you need is the recursive one. |
| 04:49:59 | <luqui> | kniu, which is? let or let*? |
| 04:50:01 | <kniu> | let |
| 04:50:15 | <luqui> | kniu, and let* does them one at a time? |
| 04:50:17 | <roconnor> | luqui: apparently let isn't even sequential |
| 04:50:21 | <SamB_XP> | Cale: and how were they going to do that in a strict imperative langauge ? |
| 04:50:25 | <roconnor> | it is simultaneous |
| 04:50:31 | <kniu> | let* is equivalent to ((lambda (v1) (lambda (v2) (...))) x1 x2 ...) |
| 04:50:39 | <Cale> | SamB_XP: hm? |
| 04:50:51 | <SamB_XP> | Cale: that's what scheme *is*, you know |
| 04:50:53 | <luqui> | oh, so let x = 42; y = x does not define y = 42 |
| 04:50:56 | <Axman6> | > let !x = x + 1 in x - 1 |
| 04:50:57 | <lambdabot> | Recursive bang-pattern bindings aren't allowed: { !x = x + 1 } |
| 04:51:06 | <Axman6> | :( |
| 04:51:08 | <kniu> | but let* x = 42; y = x does. |
| 04:51:09 | <Cale> | SamB_XP: Well, if you want, but I still don't see your point. |
| 04:51:10 | <Axman6> | > let x = x + 1 in x - 1 |
| 04:51:15 | <lambdabot> | mueval-core: Prelude.read: no parse |
| 04:51:16 | <lambdabot> | mueval: ExitFailure 1 |
| 04:51:22 | <Axman6> | > let x = x + 1 in x - 1 :: Int8 |
| 04:51:27 | <lambdabot> | mueval-core: Prelude.read: no parse |
| 04:51:28 | <lambdabot> | mueval: ExitFailure 1 |
| 04:51:33 | <Axman6> | ok, as expected |
| 04:51:39 | <luqui> | kniu, eh, I like it better with only one semantics |
| 04:51:41 | <SamB_XP> | I guess I just haven't seen too many strict imperative languages where the norm was letrec |
| 04:51:56 | <jmcarthur> | huh? |
| 04:51:56 | <luqui> | then when I'm reading, if I see x = ..., I don't have to scan for the binder to know what it means |
| 04:52:03 | <luqui> | i just scan outward until I find a definition |
| 04:52:18 | <Cale> | Explicitly having a separate non-recursive let just seems pointless to me. |
| 04:52:20 | <jmcarthur> | i haven't seen any strict imperative languages where the norm *isn't* some equivalent to letrec |
| 04:52:34 | <pumpkin> | @pl nonrecursive let |
| 04:52:34 | <lambdabot> | (line 1, column 14): |
| 04:52:35 | <lambdabot> | unexpected reserved word "let" or "l" |
| 04:52:35 | <lambdabot> | expecting variable, "(", operator or end of input |
| 04:52:35 | <luqui> | jmcarthur, huh? |
| 04:52:41 | <Cale> | I mean, sure, you theoretically need a powerful fixpoint operator to implement recursive let |
| 04:52:53 | <luqui> | jmcarthur, i've never seen an imperative language do letrec. |
| 04:53:03 | <jmcarthur> | C, Ruby, etc. etc. all function definitions allow recursion |
| 04:53:14 | <SamB_XP> | jmcarthur: ... that's not let! |
| 04:53:15 | <luqui> | jmcarthur, oh, you're talking about functions. yeah. |
| 04:53:17 | <roconnor> | Cale: can you do let ((x y) (y x)) to "swap" x and y? |
| 04:53:45 | <luqui> | let (x',y') = (y,x) :-) |
| 04:53:54 | <jmcarthur> | eh, okay, i guess i missed that i made a very loose analogy |
| 04:53:57 | <Cale> | See luqui's answer :) |
| 04:54:06 | <roconnor> | Cale: in scheme I mean |
| 04:54:17 | <pumpkin> | in ruby I can do that |
| 04:54:28 | <Cale> | roconnor: I think so. |
| 04:54:44 | <roconnor> | I guess that is why they have separate let and let* |
| 04:54:49 | <Cale> | (though I think it's just confusing to do that) |
| 04:56:26 | <Cale> | > (define x 1) |
| 04:56:26 | <Cale> | > (define y 2) |
| 04:56:26 | <Cale> | > (let ((x y) (y x)) (list x y)) |
| 04:56:26 | <Cale> | (2 1) |
| 04:56:29 | <lambdabot> | <no location info>: parse error on input `)' |
| 04:56:29 | <lambdabot> | Not in scope: `define' |
| 04:56:29 | <lambdabot> | Not in scope: `define' |
| 04:56:36 | <Cale> | oops, sorry :) |
| 04:56:59 | <Cale> | But yes, it works, though I don't see why you'd ever actually want to do that. |
| 04:57:45 | <Cale> | It's so much clearer when you don't shadow variables. |
| 04:58:32 | <luqui> | also it pushes the headslap idea for noobs farther down the line, since it appears that let x = x+1 works as intended |
| 04:59:02 | <SamB_XP> | Cale: that's probably why sparse warns about that |
| 05:26:55 | <supermanchhakchh> | main = do |
| 05:26:55 | <supermanchhakchh> | h <- connectTo server (PortNumber (fromIntegral port)) |
| 05:26:55 | <supermanchhakchh> | hSetBuffering h NoBuffering |
| 05:26:55 | <supermanchhakchh> | t <- hGetContents h |
| 05:26:55 | <supermanchhakchh> | print t |
| 05:27:07 | <supermanchhakchh> | ANY DEMALE WHO WANTS TO CHAT |
| 05:27:34 | <Axman6> | lambdabot is a demale |
| 05:27:41 | <supermanchhakchh> | ANY FEMALE WHO WANTS TO CHAT |
| 05:27:44 | <supermanchhakchh> | SORRY |
| 05:27:51 | <Axman6> | @vixen supermanchhakchh is hot for you |
| 05:27:52 | <lambdabot> | *giggles* |
| 05:28:58 | <sjanssen> | supermanchhakchh: uh, what? |
| 05:29:29 | <Axman6> | :t (&&&) |
| 05:29:29 | <Cale> | haha |
| 05:29:30 | <lambdabot> | forall (a :: * -> * -> *) b c c'. (Arrow a) => a b c -> a b c' -> a b (c, c') |
| 05:29:41 | <supermanchhakchh> | JUST WANT TO MEET CHICKS |
| 05:29:47 | <Nigga[Jew]> | i have a large penis and lots of money |
| 05:29:48 | <supermanchhakchh> | WHO CAN MAKE ME HAPPY |
| 05:29:51 | <Nigga[Jew]> | nigga jew powers! |
| 05:30:53 | <sjanssen> | supermanchhakchh: is this some sort of joke I don't get? Please keep the discussion on Haskell |
| 05:31:17 | <Axman6> | #haskell is certaily not the place to meet chicks |
| 05:31:28 | <ClaudiusMaximus> | afaik you shouldn't use the PortNumber constructor (use PortNumber's Num instance instead) |
| 05:32:04 | <supermanchhakchh> | SORY |
| 05:32:14 | <Axman6> | that was very odd |
| 05:32:32 | <Axman6> | :t (&) |
| 05:32:33 | <Tsion> | Haskell doesn't get people like that very often? |
| 05:32:33 | <lambdabot> | Not in scope: `&' |
| 05:32:39 | <Axman6> | nope |
| 05:32:42 | <Cale> | Tsion: Hardly ever. |
| 05:32:50 | <Axman6> | first time i've seen it that i can remember |
| 05:32:59 | <sjanssen> | Tsion: we get a few people that clearly clicked the wrong channel |
| 05:33:06 | <sjanssen> | but this one pasted some on-topic stuff first |
| 05:33:20 | <Axman6> | yeah, that was very confusing |
| 05:34:58 | <MMcGee> | Can someone help me with an excercise from YAHT? |
| 05:35:21 | <luqui> | MMcGee, just ask |
| 05:35:47 | <MMcGee> | data Tuple a b c d e = One a |
| 05:35:47 | <MMcGee> | | Two a b |
| 05:35:47 | <MMcGee> | | Three a b c |
| 05:35:47 | <MMcGee> | | Four a b c d |
| 05:36:07 | <MMcGee> | it asks you to write a function to convert this to a haskell n-tuple |
| 05:36:13 | <MMcGee> | n being the size of the data tuple |
| 05:36:18 | <MMcGee> | using either |
| 05:36:29 | <Axman6> | ouch |
| 05:36:38 | <MMcGee> | im looking at the answer and i dont understand how they have nested left/right |
| 05:36:51 | <MMcGee> | fromTuple :: Tuple a b c d -> Either (Either a (a,b)) (Either (a,b,c) (a,b,c,d)) |
| 05:36:55 | <MMcGee> | i can understand the type |
| 05:36:56 | <MMcGee> | but then |
| 05:37:01 | <MMcGee> | fromTuple (One a ) = Left (Left a |
| 05:37:16 | <MMcGee> | what exactly is Left ( Left a ) doing here? |
| 05:37:26 | <Axman6> | @src Either |
| 05:37:26 | <lambdabot> | Source not found. Take a stress pill and think things over. |
| 05:37:39 | <Axman6> | um |
| 05:37:56 | <inimino> | ACTION offers Axman6 a stress pill |
| 05:38:08 | <Axman6> | MMcGee: that's the Either (Either a .. part of the type signature |
| 05:38:46 | <MMcGee> | But isnt a just an instance of Tuple, not an Either? |
| 05:38:54 | <MMcGee> | how can we get the left of a "One" |
| 05:39:19 | <Axman6> | i'm not sure what you mean |
| 05:39:50 | <Axman6> | i thing the definition for Two would be fromTuple (Two a b) = Left (Right (a,b)) right? |
| 05:39:58 | <MMcGee> | yeah |
| 05:39:59 | <johnnowak> | MMcGee: it's not getting the left of 'a', it's creating an Either type from 'a' |
| 05:40:00 | <Axman6> | MMcGee: do you understand the Either type? |
| 05:40:10 | <MMcGee> | i think so |
| 05:40:16 | <MMcGee> | so "Left" is making a new instance? |
| 05:40:24 | <Axman6> | it's a constructor |
| 05:40:31 | <johnnowak> | you could say that. It's a constructor, not an accessor. |
| 05:40:35 | <Axman6> | data Either a b = Left a | Right b |
| 05:40:43 | <MMcGee> | but wouldnt the function return an instance of the either type rather than a tuple? |
| 05:40:54 | <johnnowak> | MMcGee: yes, Left returns an either |
| 05:40:57 | <MMcGee> | if Left (Left a) was constructing an Either? |
| 05:41:02 | <Axman6> | MMcGee: yes, it's returning Eithers, with typles in the, |
| 05:41:09 | <MMcGee> | the function returns a haskell tuple though? |
| 05:41:10 | <Axman6> | it's constructing two eithers reallty |
| 05:41:14 | <Axman6> | no |
| 05:41:21 | <MMcGee> | oh :/ |
| 05:41:28 | <johnnowak> | fromTuple returns an either |
| 05:41:44 | <MMcGee> | Right |
| 05:41:44 | <Axman6> | look at the type again |
| 05:41:45 | <Axman6> | fromTuple :: Tuple a b c d -> Either (Either a (a,b)) (Either (a,b,c) (a,b,c,d)) |
| 05:42:10 | <Axman6> | it returns an Either with with a nother Either inside |
| 05:42:45 | <ryant5000> | so, i'm interested in writing a video game using FRP; what's the best FRP implementation to use? |
| 05:42:57 | <ryant5000> | i've seen Yampa, Grapefruit, and Reactive |
| 05:43:00 | <MMcGee> | so how would we get the tuple out of the return value from the fromTuple function? |
| 05:43:04 | <Axman6> | so you have four choices: Left (Left a), Left (Right (a,b)), Right (Left (a,b,c)), or Right (Right (a,b,c,d)) |
| 05:43:21 | <Axman6> | MMcGee: you can't really |
| 05:43:26 | <luqui> | ryant5000, i haven't seen an frp which is good for a "whole program" |
| 05:43:42 | <luqui> | ryant5000, but it's good at localized stuff, like the behavior of a single entity |
| 05:43:47 | <Axman6> | you can't have a function that can return both say (a,b) and (a,b,c) |
| 05:43:53 | <luqui> | ryant5000, Yampa being the most mature, though I haven't played with grapefruit |
| 05:44:02 | <luqui> | ryant5000, don't touch reactive yet unless you're a researcher |
| 05:44:10 | <MMcGee> | ok, thanks |
| 05:44:30 | <Axman6> | it'd have to have a type like Tuple a b c d -> a | (a,b) | (a,b,c) | (a,b,c,d), which you can't do in haskell |
| 05:44:38 | <MMcGee> | right |
| 05:44:57 | <MMcGee> | but i dont get why exactly we would want this function then |
| 05:44:57 | <ryant5000> | luqui: well, i'm not a researcher by trade, but i didn't have much difficulty understanding Conal's paper on Reactive |
| 05:45:05 | <MMcGee> | if its returning one of four things, and we cant tell which? |
| 05:45:23 | <luqui> | ryant5000, i mean as far as the stability of the library. it's a very cool idea, but it needs work to be viable. |
| 05:45:50 | <luqui> | ryant5000, the implementation is beautiful, but not ready. whereas the others are much more ready, and much less beautiful |
| 05:46:25 | <Axman6> | MMcGee: well, the function is wort of useless, but it highlights being able to return alternatives i guess |
| 05:47:07 | <Axman6> | sort* |
| 05:47:15 | <MMcGee> | ok, i get it now |
| 05:47:28 | <ryant5000> | luqui: hm... well, i'm starting a (for-profit) game studio based on Haskell; so i see two main alternatives here: either get a short-term benefit from using a well-developed one, or make an investment in a less-well-developed (but more promising) one, which becomes a long-term asset (to my company as well as the haskell community) |
| 05:48:01 | <luqui> | ryant5000, see Anygma for prior art |
| 05:48:09 | <ryant5000> | luqui: so i guess the question is: how much work does it need to be viable? |
| 05:48:29 | <luqui> | ryant5000, the software world is just barely becoming ready for FRP. i wouldn't put any financial investment on it. |
| 05:48:58 | <luqui> | ryant5000, you can try reactive, but it is unknown how much work it will take |
| 05:49:05 | <thoughtpolice> | AFAIK, the main thing holding up reactive was an issue with ghc/unamb, which has been fixed since ghc 6.10.2 - but I still can't get much stuff to work using it, e.g. reactive-fieldtrip |
| 05:49:20 | <luqui> | ryant5000, use good software engineering to build in a backup plan, at the very least |
| 05:49:22 | <thoughtpolice> | since then I just don't think conal has had as much time to put into it |
| 05:49:39 | <ryant5000> | luqui: yeah, that's definitely important |
| 05:49:56 | <luqui> | thoughtpolice, unamb is what we think the problem is. but there's no guarantee that that's the only problem |
| 05:49:57 | <ryant5000> | luqui: most of the most difficult parts of a game probably wouldn't be written in reactive style anyway |
| 05:50:09 | <luqui> | ryant5000, why not? |
| 05:51:01 | <ryant5000> | luqui: hm; well, i was assuming that physics steps could be pretty easily isolated from the reactive paradigm |
| 05:51:04 | <Axman6> | hmm, anyonw know of a nice definition for a FIFO stack datatype? |
| 05:51:06 | <luqui> | ryant5000, my vision is to be able to write a game without ever touching the IO monad. |
| 05:51:12 | <Axman6> | seems that Chans could be used quite easily for this |
| 05:51:14 | <luqui> | ryant5000, (all software, really) |
| 05:51:26 | <ryant5000> | luqui: oh, i'm not proposing more IO |
| 05:51:43 | <ryant5000> | luqui: i'm proposing more traditionally-pure code |
| 05:51:52 | <luqui> | ryant5000, but... that's another story. just, keep it real. I started wanting to make a game in FRP, became an FRP researcher, and am now a foundations researcher |
| 05:51:59 | <luqui> | FRP research extremely frustrating |
| 05:52:26 | <luqui> | (this sentence no verb) |
| 05:52:29 | <ryant5000> | lol |
| 05:52:35 | <ryant5000> | (made sense anyway) |
| 05:53:07 | <ryant5000> | well, hm |
| 05:53:47 | <ryant5000> | so, what are the main issues? |
| 05:53:51 | <ryant5000> | efficiency? |
| 05:54:05 | <luqui> | ryant5000, there is a very very strong efficiency/expressivity tradeoff |
| 05:54:37 | <luqui> | particularly, the desired *asymptotic* complexity is hard to achieve |
| 05:54:43 | <luqui> | i.e. make reasonable programs not leak memory/time |
| 05:54:47 | <ryant5000> | you mean particularly in FRP? |
| 05:54:48 | <ryant5000> | ah ok |
| 05:56:40 | <luqui> | and there are all sorts of almost-possible things which would make it all better |
| 05:57:12 | <luqui> | so it leads you on... :-) |
| 05:57:34 | <luqui> | i think focusing on purity is very important, but trying to make an FRP library is probably going to run you into walls |
| 05:57:52 | <luqui> | model the precise kind of purity you need, rather than trying to encapsulate it all into a unified framework |
| 05:58:49 | <luqui> | that's what i'd do, at least |
| 05:58:53 | <ryant5000> | yeah, i've often thought that Haskell's notion that there's a single universal definition of "purity" was rather odd |
| 05:59:17 | <luqui> | ryant5000, huh? it defines what it means by that term |
| 05:59:32 | <ryant5000> | well, i'm sure the tech docs are quite clear |
| 05:59:36 | <ryant5000> | and the papers and such |
| 05:59:41 | <luqui> | enough to give all values an extensional mathematical semantics |
| 05:59:53 | <dolio> | I suspect the report doesn't say much about "purity" at all. |
| 06:00:23 | <dolio> | Not that I've done any specific reading of it for that purpose. |
| 06:01:00 | <ryant5000> | well... i suppose i'm just disputing haskell's choice of a definition of purity |
| 06:01:17 | <luqui> | ryant5000, feel free to define it however you like. :-) |
| 06:01:31 | <sjanssen> | ryant5000: what do you mean? |
| 06:01:32 | <ryant5000> | i do :P |
| 06:01:37 | <dolio> | What I'm saying is, I don't think "Haskell" has a definition of "purity". |
| 06:01:46 | <dolio> | :) |
| 06:01:57 | <dolio> | Amr Sabry has one that applies to Haskell, though. |
| 06:02:17 | <ryant5000> | gah, i didn't mean to start a debate really; i'm not trying to say that anyone's incorrect |
| 06:02:23 | <dolio> | More or less. You'll get argument from some people, of course. |
| 06:02:47 | <luqui> | ryant5000, sure. we're just wondering why you would dispute that... |
| 06:03:07 | <ryant5000> | well, particularly the absence of time from the domain of discourse |
| 06:03:33 | <luqui> | ryant5000, absense of time *and* space |
| 06:03:35 | <ryant5000> | observational equivalence only gets you as far as you can observe |
| 06:03:37 | <ryant5000> | yeah |
| 06:03:52 | <pumpkin> | and heat emitted, and energy consumption! |
| 06:03:54 | <luqui> | ryant5000, because including those things mucks up your reasoning when you're *not* interested in them |
| 06:04:01 | <ryant5000> | right |
| 06:04:04 | <pumpkin> | (which may or may not be proportional to the other ones) |
| 06:04:15 | <ryant5000> | so what i've been wondering about recently is whether there'd be some way of modularly including or excluding those things |
| 06:04:32 | <luqui> | ryant5000, dana's strategy: use layers of expressivity, with the lowest layer talking about all those real world issues, and take them away one at a time |
| 06:04:33 | <ryant5000> | in the same way that typeclasses can be applied to type signatures |
| 06:04:47 | <luqui> | ryant5000, you'd first have to come up with *any* way to talk about them |
| 06:04:53 | <luqui> | which is an open problem in CS research for sure |
| 06:04:53 | <ryant5000> | that's true :P |
| 06:05:29 | <luqui> | i am a huge fan of the extensional denotational semantics for talking about a wide variety of things though |
| 06:05:47 | <luqui> | and i hope to use it as a reasoning tool (not execution) for talking about the harder things |
| 06:05:48 | <ryant5000> | anyway, i'm not so happy about the type system choosing the things that the programmer cares about for him |
| 06:05:56 | <ryant5000> | ah, that sounds interesting |
| 06:06:35 | <luqui> | it's all pie-in-the-sky right now though :-) |
| 06:06:35 | <pumpkin> | it's the most easily quantifiable |
| 06:06:58 | <pumpkin> | you return what you explicitly say you return... the rest are "covert channels" :P |
| 06:07:04 | <ryant5000> | everything starts out pie-in-the-sky :P |
| 06:07:36 | <ryant5000> | pumpkin: lol; covert channels are *exactly* what ever programming system needs :P |
| 06:07:40 | <ryant5000> | *every |
| 06:07:52 | <pumpkin> | I admit, it'd be nice for a system that can prove things about them too |
| 06:08:00 | <pumpkin> | no more timing attacks on crypto implementations and the like |
| 06:08:15 | <ryant5000> | well, i'd be surprised if you could completely eliminate covert channels |
| 06:08:20 | <pumpkin> | me too :) |
| 06:08:49 | <ryant5000> | but you can certainly know some things about them |
| 06:09:11 | <ryant5000> | i suppose i'm mostly just begging for more CS research :P |
| 06:09:23 | <luqui> | i'm an advocate of systems which know enough about themselves to be able to prove lots of stuff |
| 06:09:28 | <luqui> | (and not prove it if you don't want to) |
| 06:10:00 | <luqui> | eg. types are nothing essential; they're just properties of typeless functions |
| 06:10:54 | <ryant5000> | right |
| 06:11:11 | <ryant5000> | some of which proofs might be very useful to the compiler in producing code |
| 06:11:17 | <ryant5000> | (e.g.: the size of a datastructure) |
| 06:12:12 | <Neut> | hey, |
| 06:12:19 | <Neut> | can someone explain what is wrong with this statement: |
| 06:12:25 | <Neut> | toEnum 69 |
| 06:12:31 | <Neut> | || toEnum '69' |
| 06:12:41 | <pumpkin> | ? |
| 06:12:47 | <luqui> | ;t toEnum 69 |
| 06:12:51 | <Cale> | :t toEnum |
| 06:12:53 | <pumpkin> | 69 isn't a character literal |
| 06:12:53 | <Neut> | if I try to evaulate that in ghci for example |
| 06:12:53 | <lambdabot> | forall a. (Enum a) => Int -> a |
| 06:13:00 | <pumpkin> | "69" maybe? |
| 06:13:11 | <pumpkin> | but even then, [] isn't an instance of Enum is it? |
| 06:13:13 | <Cale> | toEnum turns an Int into any enumerable type |
| 06:13:16 | <luqui> | Neut, are you looking for "read"? |
| 06:13:21 | <Cale> | > toEnum '69' :: Char |
| 06:13:22 | <lambdabot> | <no location info>: |
| 06:13:23 | <lambdabot> | lexical error in string/character literal at chara... |
| 06:13:23 | <luqui> | > read "42" :: Int |
| 06:13:25 | <lambdabot> | 42 |
| 06:13:32 | <Cale> | > toEnum 69 :: Char |
| 06:13:34 | <lambdabot> | 'E' |
| 06:13:49 | <Axman6> | :t toEnum |
| 06:13:50 | <lambdabot> | forall a. (Enum a) => Int -> a |
| 06:14:02 | <Cale> | > fromEnum 'E' |
| 06:14:03 | <lambdabot> | 69 |
| 06:14:08 | <Neut> | got it |
| 06:14:10 | <Neut> | thanks |
| 06:23:20 | <jordandanford> | hi, I'm new to Haskell, and I'm having a bit of trouble with types and typeclasses |
| 06:23:55 | <jordandanford> | I'm trying to write a function that compares test answers (such as "abcbada") with a reference and returns how many are correct |
| 06:24:34 | <jordandanford> | the function looks like this |
| 06:24:35 | <jordandanford> | http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2589#a2589 |
| 06:25:22 | <luqui> | jordandanford, try using length, filter, and zipWith |
| 06:25:29 | <Axman6> | what you'll want it something like: score x y = foldr (\b acc -> if b then acc + 1 else acc) 0 $ zipWith (\a b -> a == b) x y |
| 06:25:30 | <luqui> | that accumulator fold isn't really neessary |
| 06:26:15 | <Axman6> | ACTION would just use score x y = length . filter id . zipWith (==) x $ y |
| 06:26:18 | <jordandanford> | luqui: can you be more specific, please? |
| 06:26:38 | <luqui> | jordandanford, well i don't want to do it for you. your zipWith looks good |
| 06:26:49 | <luqui> | you just want to filter out all the ones that are true, and then count them |
| 06:27:00 | <jordandanford> | okay |
| 06:27:16 | <jordandanford> | just out of curiosity, why isn't my version working? |
| 06:27:22 | <jordandanford> | I get the this error: http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2591#a2591 |
| 06:27:28 | <luqui> | oh your currying is a little too aggressive |
| 06:27:44 | <luqui> | changing score to score x y, and zipWith (...) to zipWith (...) x y would do it |
| 06:27:47 | <luqui> | as Axman6 said |
| 06:27:55 | <jordandanford> | really? |
| 06:27:59 | <luqui> | i think so |
| 06:28:02 | <Axman6> | yeah |
| 06:28:03 | <Cale> | jordandanford: yeah |
| 06:28:24 | <jordandanford> | I've been reading 'Learn You a Haskell...' and there are a lot fo similar examples |
| 06:28:27 | <jordandanford> | *of |
| 06:28:37 | <luqui> | the problem is $ |
| 06:28:51 | <luqui> | if you were currying over one argument, you would have to change that to . |
| 06:29:14 | <luqui> | but since you are currying over 2, you'd need a 2 argument composition (fmap (.) I think), which is getting too complex to be clean |
| 06:29:21 | <jordandanford> | oh, okay |
| 06:30:04 | <Cale> | If you can write your function like f x = u . v $ x, then you can also write f = u . v |
| 06:30:55 | <Axman6> | but you can't write f x y = u $ v x y as f = u . v |
| 06:31:24 | <jordandanford> | I see |
| 06:31:46 | <Cale> | Though you could write it like f x = u . v x |
| 06:31:56 | <Cale> | But that's liable to be confusing :) |
| 06:32:02 | <jbauman> | :t (. (.)) |
| 06:32:03 | <Axman6> | indeed |
| 06:32:03 | <lambdabot> | forall c b c1 a. (((a -> b) -> a -> c1) -> c) -> (b -> c1) -> c |
| 06:32:11 | <Axman6> | bad jbauman |
| 06:32:21 | <Cale> | Or if you want more confusing, you could go with f = (u .) . v |
| 06:32:29 | <jbauman> | ACTION hides in corner |
| 06:32:30 | <jordandanford> | okay, too much |
| 06:32:32 | <jordandanford> | :) |
| 06:32:44 | <luqui> | :t curry $ length . filter id . uncurry (zipWith (==)) |
| 06:32:46 | <lambdabot> | forall a. (Eq a) => [a] -> [a] -> Int |
| 06:32:55 | <luqui> | we're just being nerds |
| 06:33:46 | <jordandanford> | haha I noticed |
| 06:33:58 | <Cale> | jordandanford: Though, yeah, length . filter id is probably clearer than that fold |
| 06:34:07 | <jordandanford> | okay, thanks |
| 06:35:23 | <Axman6> | ACTION was quite proud he came up with that length . filter id thing |
| 06:35:38 | <jordandanford> | it's very crafty |
| 06:36:30 | <luqui> | :t (length . filter id <$>) . zipWith (==) |
| 06:36:31 | <lambdabot> | forall a. (Eq a) => [a] -> [a] -> Int |
| 06:36:46 | <jordandanford> | okay well I'm gonna go try out some more stuff |
| 06:36:47 | <pumpkin> | why use <$> there and not just . ? |
| 06:36:54 | <jordandanford> | thank you all! |
| 06:37:03 | <luqui> | pumpkin, beats me. |
| 06:37:08 | <pumpkin> | :) |
| 06:37:11 | <luqui> | i would most like to use "result" |
| 06:37:43 | <luqui> | er i'm not sure. i feel like this should have a really super mega clean solution |
| 06:37:59 | <luqui> | but i can't get rid of the two argument cruft |
| 06:38:26 | <pumpkin> | :t transpose |
| 06:38:27 | <lambdabot> | forall a. [[a]] -> [[a]] |
| 06:38:32 | <pumpkin> | :P |
| 06:38:38 | <pumpkin> | that'd make it even uglier though |
| 06:38:59 | <luqui> | transpose is the universal black magic function? :-) |
| 06:38:59 | <jbauman> | luqui, this is why we have to switch to stack-based languages :P |
| 06:39:05 | <pumpkin> | how about a parallel list comprehension? |
| 06:39:21 | <pumpkin> | with a guard |
| 06:39:25 | <luqui> | pumpkin, i don't want to mention either argument |
| 06:39:33 | <luqui> | just eta expanding isn't too bad |
| 06:39:38 | <luqui> | but i want it pointfree :-) |
| 06:39:53 | <pumpkin> | onoes |
| 06:40:10 | <luqui> | yeah i'm becoming a pointfree whore. |
| 06:40:15 | <luqui> | but only when it's beautiful |
| 06:40:19 | <luqui> | :-) |
| 06:41:28 | <luqui> | :t let o = fmap.fmap in length `o` filter id `o` zipWith (==) |
| 06:41:29 | <lambdabot> | Couldn't match expected type `Bool' against inferred type `[a]' |
| 06:41:29 | <lambdabot> | In the first argument of `filter', namely `id' |
| 06:41:29 | <lambdabot> | In the second argument of `o', namely `filter id' |
| 06:42:22 | <Axman6> | @check (fmap fmap fmap) == (fmap . fmap) |
| 06:42:23 | <lambdabot> | No instance for (GHC.Classes.Eq ((a -> b) -> f (f1 a) -> f (f1 b))) |
| 06:42:24 | <lambdabot> | aris... |
| 06:42:27 | <Axman6> | :( |
| 06:42:29 | <kniu> | All this time I didn't know how to use exceptions in Haskell. |
| 06:42:37 | <luqui> | kniu, good! |
| 06:42:44 | <luqui> | exceptions are for losers |
| 06:42:51 | <Axman6> | and should eb avoided |
| 06:43:09 | <Axman6> | produce code that connot produce exceptions, rather than code that can handle the possible ones |
| 06:43:13 | <luqui> | i do know how to use them, but haven't used them for at least six months |
| 06:43:34 | <Axman6> | my AVar package uses them, i think it does a pretty good job |
| 06:43:48 | <Axman6> | i don't think that anyone has even used my AVar package though :( |
| 06:44:04 | <jbauman> | Axman6, but what if exceptional conditions arise? |
| 06:44:14 | <luqui> | jbauman, for example? |
| 06:44:30 | <Axman6> | jbauman: how can they when you've written the code to not produce such conditions |
| 06:44:35 | <jbauman> | can't think of anything at the moment :) |
| 06:44:47 | <luqui> | Axman6, exactly! :-) |
| 06:44:49 | <Axman6> | 1/0? |
| 06:44:55 | <jbauman> | Axman6, the external conditions may be out of your control |
| 06:45:05 | <Axman6> | but that's not your problem |
| 06:45:15 | <luqui> | jbauman, if you could raise the exception, you could check for the condition |
| 06:45:18 | <jbauman> | it's often made to be my problem |
| 06:45:31 | <jbauman> | luqui, and...? |
| 06:45:32 | <luqui> | speaking in abstractions is no good here |
| 06:45:46 | <jbauman> | true enough |
| 06:45:50 | <luqui> | these arguments arise from an imperative mindset |
| 06:45:52 | <BMeph> | luqui: We should see about "drafting" edwardk into making a fork of one of the FRP systems using comonads. ;) |
| 06:45:58 | <nbsd_in_prod> | ok how is haskell different from standard ml? |
| 06:46:08 | <luqui> | nbsd_in_prod, it is lazy |
| 06:46:10 | <Axman6> | it's much more pure i believe |
| 06:46:14 | <nbsd_in_prod> | build a world of warcarft clone in haskell |
| 06:46:20 | <nbsd_in_prod> | just to show it off |
| 06:46:25 | <Axman6> | why? |
| 06:46:38 | <luqui> | why would we use a beautiful, simple language to write a horrible, complicate game |
| 06:46:43 | <jbauman> | nbsd_in_prod, are you volunteering to do that? |
| 06:46:52 | <nbsd_in_prod> | common lisp and haskell seem to be the most powerful programming languages? |
| 06:47:07 | <nbsd_in_prod> | I will test out the game and rate the art of the monsters. |
| 06:47:09 | <luqui> | BMeph, ... if comonads really are any good for FRP. I'm not convinced... |
| 06:47:09 | <MMcGee> | hah |
| 06:47:34 | <nbsd_in_prod> | how is erlang different from haskell and common lisp? |
| 06:47:53 | <Axman6> | it's designed with large scale concurrency in mind |
| 06:47:54 | <luqui> | erlang isn't terribly functional afaik |
| 06:48:12 | <luqui> | i.e. does not work smoothly with HOFs |
| 06:48:13 | <Axman6> | luqui: i think it is, doesn't have ,utable variables |
| 06:48:17 | <Axman6> | m* |
| 06:48:25 | <luqui> | but i know little about erlang |
| 06:48:39 | <BMeph> | luqui: I'd like to get some practice using them, but the "category-extras" module is pretty hefty.... =8*O |
| 06:49:00 | <luqui> | the biggest, baddest way haskell differs from every other popular language to me is: Haskell's semantics are denotational (composable)! |
| 06:49:24 | <luqui> | BMeph, just rewrite the class yourself, why not? |
| 06:49:45 | <luqui> | or are you talking about everything that is built on top of them? |
| 06:50:13 | <luqui> | anyway, i'm not sure *Haskell* is good enough for FRP |
| 06:50:40 | <luqui> | because it is trying to endow time upon a language which abstracts time away |
| 06:51:01 | <luqui> | routing water from a leak into your sink |
| 06:51:28 | <BMeph> | luqui: Does it really abstract it away, or was it simply overlooked as a controllable variable? ;) |
| 06:51:40 | <luqui> | BMeph, same diff |
| 06:52:02 | <kniu> | well, dang. |
| 06:52:13 | <kniu> | I thought I had some beautiful purely functional code, |
| 06:52:22 | <BMeph> | luqui: Well, the first argument implies that the exclusion of time was deliberate. ;) |
| 06:52:44 | <luqui> | BMeph, i'm pretty sure that SPJ & co. were aware of the concept of time when designing the language |
| 06:52:46 | <kniu> | but I'm threading one associative list through a whole bunch of functions, I kind of want to put it in a state monad. |
| 06:53:01 | <dmwit> | If it never changes, consider Reader instead! =) |
| 06:53:08 | <Axman6> | kniu: well stick it in the state monad then :P |
| 06:53:15 | <kniu> | one hand: stay monad-free, pass the damn state explicitly, |
| 06:53:33 | <kniu> | other hand: put it in a monad, lose pretty looking purity. |
| 06:53:42 | <luqui> | the state monad is *for* pure code which threads a parameter. |
| 06:53:46 | <dmwit> | And on the other hand... there is no other hand! |
| 06:53:55 | <Axman6> | yeah, State is totally pure |
| 06:53:58 | <luqui> | kniu, you don't have to use "do" to write monadic code |
| 06:54:02 | <Axman6> | @src State |
| 06:54:03 | <lambdabot> | Source not found. This mission is too important for me to allow you to jeopardize it. |
| 06:54:06 | <Axman6> | gah |
| 06:54:10 | <Axman6> | why do you hate me luqui |
| 06:54:13 | <Axman6> | uh, lambdabot |
| 06:54:14 | <luqui> | kniu, use =<< and <=< |
| 06:54:20 | <kniu> | wha |
| 06:54:24 | <kniu> | :t (=<<) |
| 06:54:25 | <Axman6> | if you hate me luqui, it'd be interested to know why too |
| 06:54:26 | <lambdabot> | forall a (m :: * -> *) b. (Monad m) => (a -> m b) -> m a -> m b |
| 06:54:27 | <dmwit> | luqui: <3 |
| 06:54:30 | <luqui> | Axman6, because you confuse me with a bot! |
| 06:54:35 | <Axman6> | :( |
| 06:54:37 | <luqui> | :-) |
| 06:54:38 | <dmwit> | luqui: Thank you for not suggesting (>>=) and (>=>). =) |
| 06:54:49 | <kniu> | :t (<=<) |
| 06:54:51 | <lambdabot> | forall b (m :: * -> *) c a. (Monad m) => (b -> m c) -> (a -> m b) -> a -> m c |
| 06:54:57 | <dmwit> | kniu: Compare: |
| 06:54:58 | <dmwit> | :t (.) |
| 06:55:00 | <lambdabot> | forall b c a. (b -> c) -> (a -> b) -> a -> c |
| 06:55:01 | <luqui> | kniu, composition of monadic functions |
| 06:55:08 | <kniu> | how come I never seen these functions before? |
| 06:55:17 | <dmwit> | Because people have bad taste! |
| 06:55:26 | <Axman6> | because you never asked |
| 06:55:41 | <luqui> | ACTION loves kleisli composition |
| 06:55:44 | <flux> | :t (>=>) |
| 06:55:45 | <lambdabot> | forall a (m :: * -> *) b c. (Monad m) => (a -> m b) -> (b -> m c) -> a -> m c |
| 06:55:54 | <dolio> | <=< doesn't have a lot of strictly necessary uses. |
| 06:55:59 | <Axman6> | @src (>=>) |
| 06:55:59 | <lambdabot> | Source not found. :( |
| 06:56:05 | <Axman6> | god damn lambdabot |
| 06:56:08 | <dolio> | It's a lot like how you don't have to use (.) when you have the current ($). |
| 06:56:13 | <Axman6> | @src (>>=) |
| 06:56:13 | <lambdabot> | Source not found. My pet ferret can type better than you! |
| 06:56:29 | <Axman6> | @src map |
| 06:56:29 | <lambdabot> | map _ [] = [] |
| 06:56:29 | <lambdabot> | map f (x:xs) = f x : map f xs |
| 06:56:30 | <Axman6> | ... |
| 06:56:34 | <Axman6> | thank you! |
| 06:56:38 | <kniu> | wait, those things are just >>= and >=> backwards. |
| 06:56:39 | <nbsd_in_prod> | FRP being fantasy roleplaying game? |
| 06:56:47 | <Axman6> | kniu: yes |
| 06:57:31 | <dmwit> | Axman6: What were you expecting for (>>=)? |
| 06:57:44 | <Axman6> | that's a good question really |
| 06:57:57 | <Axman6> | still, i haven't been able to get any source from lambdabot all day |
| 06:58:04 | <dmwit> | heh |
| 06:58:21 | <nbsd_in_prod> | so ok |
| 06:58:28 | <nbsd_in_prod> | I learned a bit of lisp. |
| 06:58:32 | <pumpkin> | <=< is nice in some pointfree cases |
| 06:58:36 | <Axman6> | nbsd_in_prod: FRP = functional reactive programming |
| 06:58:40 | <pumpkin> | but I don't like the forward-pointing ones |
| 06:58:48 | <nbsd_in_prod> | but the tutorial kinda ground to a halt becaus eI couldn't figure out one of the exercises. |
| 06:58:55 | <luqui> | right to left, top to bottom :-) |
| 06:59:13 | <nbsd_in_prod> | functional reactive programming? is that anything like even driven programming? |
| 06:59:20 | <dmwit> | luqui: Just like normal Hebrew, amirite? |
| 06:59:20 | <Axman6> | btw, karnaugh maps are awesome |
| 06:59:53 | <Axman6> | nbsd_in_prod: i think so, basically it lets you use pure code to react to events (i could be wrong, i've never used it or enquited too deeply) |
| 07:00:01 | <luqui> | I wish I could find the karnaugh map for love |
| 07:00:43 | <Axman6> | luqui: it uses 7 variables :( |
| 07:00:56 | <dmwit> | and changes with the moooooon |
| 07:01:01 | <luqui> | nbsd_in_prod, it's just functional programming for talking about time |
| 07:01:02 | <Axman6> | yup |
| 07:01:23 | <luqui> | nbsd_in_prod, for example, functions of time (Behaviors), and pairs of values with a time (Events) |
| 07:01:36 | <luqui> | nbsd_in_prod, beautifully simple to describe, horribly awful to implement |
| 07:01:54 | <Cale> | Events are sequences of time/value pairs rather |
| 07:02:07 | <luqui> | Cale, er, yeah, I meant Futures. |
| 07:02:19 | <RyanT50001> | is there much funding for FRP? |
| 07:02:21 | <luqui> | the duality between Behaviors and Futures is so deep that I kind of forget about Events |
| 07:03:53 | <luqui> | RyanT50001, not as far as I know. |
| 07:04:28 | <RyanT50001> | hm |
| 07:04:39 | <RyanT50001> | how much is needed? |
| 07:05:06 | <RyanT50001> | i.e.: a ballpark amount of effort to make FRP useful in some industry |
| 07:05:59 | <luqui> | ACTION isn't good with money |
| 07:06:08 | <RyanT50001> | how about researcher-years? |
| 07:06:28 | <bos> | It's had quite a few years already and shows not so many signs of life yet. |
| 07:06:29 | <luqui> | it's kind of like physics |
| 07:06:51 | <luqui> | like asking in 1895 how long it will take to develop quantum mechanics in some respect |
| 07:07:01 | <luqui> | develop what? they reply |
| 07:07:21 | <erikc> | how does FRP differ from something like Maya's hypergraph anyway, it seems to me like it's already in use |
| 07:07:23 | <luqui> | i think there needs to be a breakthrough, it's not just about cranking away |
| 07:07:25 | <RyanT50001> | yeah, i understand the basic problem with estimating the difficulty of fundamental research |
| 07:07:42 | <outchanter1> | erikc: or the Gimp's GEGL |
| 07:08:32 | <outchanter> | maybe those are like Greenspun's law applied to FRP |
| 07:08:36 | <RyanT50001> | i'm mostly trying to figure out whether this is the kind of thing that could be tackled as a research-oriented startup company |
| 07:09:05 | <RyanT50001> | *tackled by |
| 07:09:35 | <erikc> | outchanter :), yea, unreal 3's kismet applies too http://upload.wikimedia.org/wikipedia/en/e/e6/Kismet_Roboblitz.PNG |
| 07:10:20 | <luqui> | RyanT50001, I would talk to conal elliott about such things |
| 07:10:29 | <RyanT50001> | which really depends on whether investors can be convinced that (1) the technology is on the cusp of completion; (2) the technology will lead to some kind of large profit |
| 07:10:41 | <RyanT50001> | luqui: i certainly intend to |
| 07:10:50 | <luqui> | RyanT50001, also see Anygma for prior art (as before) |
| 07:11:00 | <RyanT50001> | i wasn't able to find much info on Anygma |
| 07:11:04 | <RyanT50001> | i mean, i found their site |
| 07:11:07 | <luqui> | RyanT50001, talk to Beelsebob |
| 07:11:15 | <luqui> | he still works there I think |
| 07:11:18 | <RyanT50001> | ah, ok |
| 07:11:25 | <RyanT50001> | thanks |
| 07:12:11 | <WorkyBob> | ACTION wanders in |
| 07:12:34 | <WorkyBob> | ACTION pokes luqui in the spleens, and RyanT50001 somewhere less painfull |
| 07:12:45 | <RyanT50001> | haha |
| 07:15:38 | <Pellwurst> | does anyone know a good tutorial concerning makefiles for haskell |
| 07:16:39 | <mgsloan> | multiset is to set as list is to ??? |
| 07:17:40 | <kniu> | a catch function should catch ALL exceptions coming from its first argument, right? |
| 07:18:11 | <mornfall> | mgsloan: Hmm? |
| 07:18:13 | <outchanter> | mgsloan: lists can already hold multiple copies |
| 07:18:28 | <mgsloan> | I'm thinking of a list which _can't_ |
| 07:18:41 | <mgsloan> | I guess you could call it an ordered set |
| 07:18:46 | <dolio> | I'm not sure that has a name. |
| 07:19:04 | <mgsloan> | sorry, this isn't a very haskellish question, I'm just thinking about orthogonal features of data structures |
| 07:19:10 | <outchanter> | set+permutation? |
| 07:19:10 | <dmwit> | Pellwurst: Almost no Haskell projects use make. |
| 07:19:25 | <dmwit> | Pellwurst: ghc --make is good enough for one-offs, and for more serious projects, cabal is quite nice. |
| 07:19:36 | <mgsloan> | outchanter - yeah, that's a good way of looking at it |
| 07:31:46 | <luqui> | outchanter, another thing to think about is that an associative commutative operator creates a set, whereas an associative operator creates a list |
| 07:31:53 | <luqui> | s/set/multiset/ |
| 07:32:16 | <luqui> | an assoc. comm. idempotent operator creates a set, so what's an assoc. idempotent operator |
| 07:32:53 | <luqui> | it could be a list with no subsequences of identical elements, although the list still might have duplicate elements |
| 07:33:53 | <Neut> | Can someone help me fix up the type issues with this code, |
| 07:33:54 | <Neut> | http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2592#a2592 |
| 07:34:26 | <outchanter> | luqui: I'm having trouble seeing what the point of that would be :-P unless you're doing run length encoding without the lengths... |
| 07:34:45 | <dmwit> | Neut: isSpace is in the standard libraries. |
| 07:34:52 | <dmwit> | :t isSpace |
| 07:34:54 | <lambdabot> | Char -> Bool |
| 07:34:54 | <Neut> | oh nice |
| 07:34:57 | <dmwit> | ?index isSpace |
| 07:34:58 | <lambdabot> | Data.Char |
| 07:35:09 | <dmwit> | Neut: As for fixing it, you likely want (==) rather than elem. |
| 07:35:20 | <luqui> | outchanter, yeah i dunno. just trying to draw an analogy from a different angle |
| 07:35:25 | <dmwit> | Neut: (Since n is a Char, not a list.) |
| 07:35:41 | <luqui> | outchanter, maybe you have a list of idempotent transitions |
| 07:36:03 | <Neut> | dmwit: thanks |
| 07:38:55 | <dmwit> | > map (\x -> if isAlpha x then chr (ord x + 2) else x) "G fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 07:38:57 | <lambdabot> | "I hope you didnt tr{nil{te it |y h{nd." |
| 07:39:03 | <Neut> | yeah |
| 07:39:06 | <dmwit> | indeed |
| 07:39:07 | <Neut> | there is one more thing I need to work out |
| 07:39:32 | <dmwit> | Python Challenge? |
| 07:39:44 | <Neut> | yeah but im doing it in haskell |
| 07:39:49 | <dmwit> | right |
| 07:39:50 | <Neut> | exams coming up |
| 07:39:57 | <Neut> | just got one more kink |
| 07:39:59 | <Neut> | dont do it please lol |
| 07:40:16 | <dmwit> | They're mostly quite do-able. The pickle one is tricky, since there's (obviously) no pickle library for Haskell. |
| 07:40:24 | <nikkos99> | whats up |
| 07:40:29 | <dmwit> | ?wn up |
| 07:40:32 | <lambdabot> | Error: connect: does not exist (Connection refused) |
| 07:40:38 | <dmwit> | =( |
| 07:42:11 | <luqui> | ask wolfram alpha |
| 07:44:10 | <outchanter> | luqui: I suppose so. Isn't there a groupBy function for that? |
| 07:45:25 | <luqui> | map head . groupBy $ [1,2,2,3,3,3,5,5,5,5,5] |
| 07:45:30 | <luqui> | > map head . groupBy $ [1,2,2,3,3,3,5,5,5,5,5] |
| 07:45:31 | <lambdabot> | Couldn't match expected type `[[a]]' |
| 07:45:51 | <outchanter> | :t groupBy |
| 07:45:52 | <luqui> | outchanter, you might want to maintain it as an invariant. (i dunno, picking from thin air here) |
| 07:45:53 | <lambdabot> | forall a. (a -> a -> Bool) -> [a] -> [[a]] |
| 07:45:55 | <luqui> | > map head . group $ [1,2,2,3,3,3,5,5,5,5,5] |
| 07:45:57 | <lambdabot> | [1,2,3,5] |
| 07:47:09 | <Neut> | dmwit: if I add something like this, |
| 07:47:23 | <Neut> | | x == '{' = 'a' : decrypt xs |
| 07:47:26 | <Neut> | why doesn't it work? |
| 07:47:47 | <dmwit> | Well, it isn't '{' before the decryption, now, is it? ;-) |
| 07:49:33 | <Neut> | w00t |
| 07:50:28 | <Neut> | granted its an ugly fix - it works |
| 07:51:10 | <luqui> | I get the feeling you can do something with cycle ['a'..'z'] |
| 07:51:16 | <luqui> | but i don't know what... |
| 07:51:57 | <dmwit> | > let translation = zip ['a'..'z'] (drop 2 . cycle $ ['a'..'z']) in map (`lookup` translation) "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 07:51:59 | <lambdabot> | [Just 'i',Nothing,Just 'h',Just 'o',Just 'p',Just 'e',Nothing,Just 'y',Just... |
| 07:52:12 | <dmwit> | err... right |
| 07:52:57 | <dmwit> | > let translate x = fromMaybe ' ' (lookup (toLower x) translation); translation = zip ['a'..'z'] (drop 2 . cycle $ ['a'..'z']) in map translate "G fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 07:52:59 | <lambdabot> | "i hope you didnt tranilate it by hand " |
| 07:53:14 | <dmwit> | > let translate x = fromMaybe x (lookup (toLower x) translation); translation = zip ['a'..'z'] (drop 2 . cycle $ ['a'..'z']) in map translate "G fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 07:53:16 | <lambdabot> | "i hope you didnt tranilate it by hand." |
| 07:54:43 | <Neut> | nice,, |
| 07:55:43 | <Twey> | > let alphabet = ['a'..'z']; translate c = if isAlpha c then alphabet !! (ord c + 2 `mod` length alphabet) else c in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb. |
| 07:55:44 | <lambdabot> | <no location info>: |
| 07:55:44 | <lambdabot> | lexical error in string/character literal at end o... |
| 07:55:46 | <Twey> | Gah |
| 07:55:50 | <Twey> | > let alphabet = ['a'..'z']; translate c = if isAlpha c then alphabet !! (ord c + 2 `mod` length alphabet) else c in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 07:55:51 | <lambdabot> | "* Exception: Prelude.(!!): index too large |
| 07:55:55 | <Twey> | :( |
| 07:56:01 | <Twey> | Oh, d'oh |
| 07:56:25 | <Twey> | > let alphabet = ['a'..'z']; translate c = if isAlpha c then alphabet !! (ord c + 2 - 'a' `mod` length alphabet) else c in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 07:56:27 | <lambdabot> | Couldn't match expected type `GHC.Types.Char' |
| 07:57:06 | <Twey> | > let alphabet = ['a'..'z']; translate c = if isAlpha c then alphabet !! ((ord $ c - 'a') + 2 `mod` length alphabet) else c in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 07:57:08 | <lambdabot> | No instance for (GHC.Num.Num GHC.Types.Char) |
| 07:57:08 | <lambdabot> | arising from a use of `GHC.... |
| 07:57:31 | <Twey> | > let alphabet = ['a'..'z']; translate c = if isAlpha c then alphabet !! ((ord c - ord 'a') + 2 `mod` length alphabet) else c in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 07:57:33 | <lambdabot> | "i hope you didnt tr* Exception: Prelude.(!!): index too large |
| 07:57:38 | <Twey> | ACTION ponders. |
| 07:57:43 | <Twey> | Almost there! |
| 07:57:51 | <mkfort> | so close |
| 07:58:56 | <Twey> | Hm |
| 07:59:06 | <Twey> | So why isn't the `mod` causing it to wrap around? |
| 07:59:27 | <Twey> | 'y' + 2 = 'z' + 1, then `mod` length alphabet should be 'a' |
| 07:59:55 | <Twey> | I'm doing something stupid, but it's too early to puzzle it out :-P |
| 08:01:02 | <Beelsebob1> | ACTION wonders where the best place to make a request that people don't put OpenGL or GLUT in the description of games/3D tools is – it makes trying to find the OpenGL or GLUT modules on Hackage hard, and seems to be the only pair of libraries that people feel the need to mention when writing a description |
| 08:01:24 | <Twey> | Heh |
| 08:01:33 | <shachaf> | Twey: You're using both ord/chr (ASCII) and indices in a list. |
| 08:01:57 | <shachaf> | Why not use one or the other? :-) |
| 08:02:32 | <Twey> | True |
| 08:03:33 | <Twey> | > let translate c = if not isAlpha c then c else chr (ord c + 2 `mod` 26) + 'a' in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 08:03:34 | <lambdabot> | Couldn't match expected type `GHC.Bool.Bool' |
| 08:03:42 | <mmorrow> | pumpkin: nice squarer :) |
| 08:03:49 | <pumpkin> | mmorrow: yay! |
| 08:03:58 | <pumpkin> | mmorrow: unfortunately it only works on very restricted inputs |
| 08:03:58 | <Twey> | ... huh |
| 08:04:18 | <Twey> | Oh |
| 08:04:23 | <Twey> | > let translate c = if not $ isAlpha c then c else chr (ord c + 2 `mod` 26) + 'a' in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 08:04:24 | <lambdabot> | No instance for (GHC.Num.Num GHC.Types.Char) |
| 08:04:25 | <lambdabot> | arising from a use of `GHC.... |
| 08:04:30 | <Twey> | Damn, I'm bad today |
| 08:04:36 | <Twey> | Why can't we add Chars? |
| 08:04:41 | <Twey> | That would be useful. |
| 08:05:01 | <mmorrow> | pumpkin: if we just had the polynomial representation of Integer sorted out, and conversion functions both ways, it'd be easy to implem fft Integer mult |
| 08:05:03 | <Twey> | > 'a' + chr 2 |
| 08:05:04 | <lambdabot> | No instance for (GHC.Num.Num GHC.Types.Char) |
| 08:05:04 | <lambdabot> | arising from a use of `GHC.... |
| 08:05:07 | <pumpkin> | yeah |
| 08:05:34 | <mmorrow> | ACTION pokes Cale |
| 08:05:39 | <Twey> | > let translate c = if not $ isAlpha c then c else chr $ (ord c + 2 `mod` 26) + ord 'a' in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 08:05:41 | <lambdabot> | "\202 \201\208\209\198 \218\208\214 \197\202\197\207\213 \213\211\220\207\2... |
| 08:05:45 | <Twey> | Oh blimey |
| 08:05:54 | <Twey> | I give up *goes to get breakfast instead* |
| 08:06:05 | <shachaf> | Aw. |
| 08:06:11 | <Cale> | mmorrow: yeah? |
| 08:06:19 | <shachaf> | ord c + 2 is ASCII -- it's way bigger than 26. |
| 08:06:26 | <Twey> | Ah, yeah. |
| 08:06:32 | <pumpkin> | mmorrow: any reason you don't have control.arrow loaded in lunabot btw? |
| 08:06:48 | <mmorrow> | Cale: do you know off-hand the way that e.g. represents Integers as polynomials, and how to write conversion functions both ways? |
| 08:07:00 | <mmorrow> | err, *..that e.g. gmp ... |
| 08:07:23 | <Twey> | shachaf: But, I `mod`ed it down |
| 08:07:41 | <Cale> | The only thing I can imagine is just the usual thing that Integers are polynomials in some base. |
| 08:07:51 | <mmorrow> | Cale: yes exactly |
| 08:07:52 | <shachaf> | > ord 'a' + 2 |
| 08:07:54 | <lambdabot> | 99 |
| 08:07:59 | <shachaf> | > (ord 'a' + 2) `mod` 26 |
| 08:08:00 | <lambdabot> | 21 |
| 08:08:06 | <pumpkin> | mmorrow: I think we just need to deal with "carry" essentially |
| 08:08:10 | <mmorrow> | ACTION is having a brain block |
| 08:08:13 | <Twey> | Which may give me a horribly incorrect answer *nod* |
| 08:08:16 | <shachaf> | > chr ((ord 'a' + 2) `mod` 26) |
| 08:08:18 | <lambdabot> | '\NAK' |
| 08:08:26 | <mmorrow> | pumpkin: oh, hmm |
| 08:08:27 | <Twey> | > let translate c = if not $ isAlpha c then c else chr $ (ord c + 2 - ord 'a' `mod` 26) + ord 'a' in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 08:08:29 | <lambdabot> | "\183 \182\189\190\179 \199\189\195 \178\183\178\188\194 \194\192\201\188\1... |
| 08:08:44 | <Cale> | d_0 b^0 + d_1 b^1 + ... + d_n b^n |
| 08:08:49 | <yitz> | > let translate = zipWith (\x y -> if isAlpha y then y else x) <*> map (toEnum . (+2) . fromEnum) in translate "g fmnc wms bgblr |
| 08:08:50 | <lambdabot> | <no location info>: |
| 08:08:51 | <lambdabot> | lexical error in string/character literal at end o... |
| 08:08:51 | <Twey> | Hmph |
| 08:08:54 | <pumpkin> | , let (&&&) f g = \x -> (f x, g x) in uncurry (++) . ((reverse . takeWhile (/=0)) &&& (reverse . dropWhile (==0) . dropWhile (/=0))) . map (round . realPart) . ifft . map (^2) . fft . map (:+0) $ [0, 0, 0, 0, 0, 0, 4, 2, 1, 1, 0, 0, 0, 0, 0, 0] |
| 08:08:56 | <lunabot> | [16,16,12,12,5,2,1] |
| 08:08:57 | <mmorrow> | newtype Integer = I [Int] |
| 08:08:59 | <yitz> | > let translate = zipWith (\x y -> if isAlpha y then y else x) <*> map (toEnum . (+2) . fromEnum) in translate "g fmnc wms bgblr..." |
| 08:09:01 | <lambdabot> | "i hope you didnt..." |
| 08:09:06 | <yitz> | > let translate = zipWith (\x y -> if isAlpha y then y else x) <*> map (toEnum . (+2) . fromEnum) in translate "g fmnc wms bgbl'r..." |
| 08:09:07 | <Cale> | If b = 10, and each d_k is a digit from 0 to 9, that's the usual base 10 representation. |
| 08:09:08 | <lambdabot> | "i hope you didn't..." |
| 08:09:08 | <pumpkin> | mmorrow: clearly those 16s aren't valid decimal |
| 08:09:15 | <mmorrow> | heh |
| 08:09:19 | <Twey> | yitz: Nic :-D |
| 08:09:21 | <Twey> | Nice** |
| 08:09:29 | <yitz> | Twey: tnx |
| 08:09:37 | <Twey> | That works? |
| 08:09:40 | <pumpkin> | mmorrow: but the 5 2 1 suffix there is the correct suffix of 4211^2 |
| 08:09:43 | <yitz> | appears to |
| 08:09:46 | <pumpkin> | > 4211^2 |
| 08:09:48 | <lambdabot> | 17732521 |
| 08:10:03 | <Twey> | > toEnum . (+2) . fromEnum $ 'y' |
| 08:10:04 | <lambdabot> | * Exception: Prelude.Enum.().toEnum: bad argument |
| 08:10:14 | <shachaf> | > let translate = zipWith (\x y -> if isAlpha y then y else x) <*> map (toEnum . (+2) . fromEnum) in translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." -- Error error. |
| 08:10:15 | <lambdabot> | "i hope you didnt trynilyte it zy hynd." |
| 08:10:24 | <mmorrow> | Cale: what i'm blocking on is how the write the conversion functions ([Int] -> {-real-} Integer), and (Integer -> {-coeffs-} [Int]) |
| 08:10:26 | <Twey> | Ah :) |
| 08:10:45 | <Cale> | If b = 2^32, say, and each d_k is a number from 0 to 2^32 - 1, then you have something suitable for representing Integers. |
| 08:10:54 | <pumpkin> | mmorrow: map digitToInt . show for the latter one? :P |
| 08:11:01 | <mmorrow> | pumpkin: heh |
| 08:11:10 | <mmorrow> | base-2!! |
| 08:11:12 | <pumpkin> | lol |
| 08:11:21 | <shachaf> | Twey: (By the way, the only thing wrong with yours was missing parentheses.) |
| 08:11:24 | <pumpkin> | or base 2^64 |
| 08:11:32 | <mmorrow> | heh |
| 08:11:34 | <Cale> | So, it's basically the same as interpreting a number written in some base or finding the base b digits of a number |
| 08:12:28 | <Twey> | > let translate c = if not $ isAlpha c then c else chr ((((ord c + 2) - ord 'a') `mod` 26) + ord 'a') in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 08:12:29 | <lambdabot> | "i hope you didnt tranilate it by hand." |
| 08:12:37 | <Twey> | Huh. |
| 08:13:02 | <pumpkin> | > sum . zipWith (*) (iterate (10*) 1) . reverse $ [16,16,12,12,5,2,1] |
| 08:13:03 | <lambdabot> | 17732521 |
| 08:13:09 | <Twey> | > ord 'g' + 2 - ord 'a' |
| 08:13:10 | <lambdabot> | 8 |
| 08:13:10 | <pumpkin> | mmorrow: |
| 08:13:18 | <Twey> | > ord 'g' + 2 - ord 'a' `mod` 26 |
| 08:13:20 | <lambdabot> | 86 |
| 08:13:25 | <Twey> | Huh. |
| 08:13:37 | <Twey> | I thought `` was lower-precedence than anything but $ |
| 08:13:49 | <Cale> | [Int] -> Integer would be something like foldl (\a x -> b*a + fromIntegral x) 0 |
| 08:13:53 | <mmorrow> | what about base 2^32 (or 2^64) |
| 08:13:54 | <mmorrow> | woo |
| 08:14:03 | <shachaf> | > 1 `mod` 26 |
| 08:14:04 | <pumpkin> | , let (&&&) f g = \x -> (f x, g x) in sum . zipWith (*) (iterate (10*) 1) . reverse . uncurry (++) . ((reverse . takeWhile (/=0)) &&& (reverse . dropWhile (==0) . dropWhile (/=0))) . map (round . realPart) . ifft . map (^2) . fft . map (:+0) $ [0, 0, 0, 0, 0, 0, 4, 2, 1, 1, 0, 0, 0, 0, 0, 0] |
| 08:14:04 | <shachaf> | > 26 + 1 `mod` 26 |
| 08:14:05 | <lambdabot> | 1 |
| 08:14:06 | <lambdabot> | 27 |
| 08:14:06 | <lunabot> | 17732521 |
| 08:14:09 | <pumpkin> | there we go :) |
| 08:14:17 | <pumpkin> | now I can haz zquarez |
| 08:14:28 | <mmorrow> | wee |
| 08:14:30 | <Twey> | > let translate c = if not $ isAlpha c then c else chr $ ((ord c + 2 - ord 'a') `mod` 26) + ord 'a' in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 08:14:31 | <lambdabot> | "i hope you didnt tranilate it by hand." |
| 08:14:49 | <yitz> | Twey: mod is declared as infixl 7 |
| 08:14:49 | <pumpkin> | now I just need to automatically pad the input list to a power of two |
| 08:14:58 | <Twey> | Oh |
| 08:15:01 | <Twey> | mod is special |
| 08:15:18 | <yitz> | Twey: not really, you can declare fixity for any function |
| 08:15:18 | <Twey> | > let translate c = if not $ isAlpha c then c else chr $ (ord c + 2 - ord 'a') `mod` 26 + ord 'a' in map translate "g fmnc wms bgblr rpylgjyrc gr zw fylb." |
| 08:15:19 | <lambdabot> | "i hope you didnt tranilate it by hand." |
| 08:15:25 | <pumpkin> | mmorrow: almost ready for inclusion in integer-simple! :P |
| 08:15:41 | <pumpkin> | I wonder at what point using doubles for the fft loses precision at the integer level |
| 08:15:54 | <pumpkin> | we should probably use the discrete version |
| 08:16:21 | <mmorrow> | pumpkin: i have a whole directory of fft C implems somewhere i collected from random places online.. |
| 08:16:27 | <mmorrow> | ACTION digs them up |
| 08:16:27 | <pumpkin> | :o |
| 08:16:33 | <pumpkin> | FFeTish |
| 08:16:37 | <mmorrow> | haha |
| 08:16:56 | <Neut> | Twey/yitz - thanks for showing me how mediocre my solution is :D |
| 08:17:00 | <pumpkin> | if you have an implementation of the NTT that'd be handy too |
| 08:17:25 | <mmorrow> | in particular, we probably want to use a Real variant since we're not starting with Complex nums for the input |
| 08:17:41 | <Twey> | ACTION is tempted to call the function ‘tranilate’ |
| 08:17:42 | <mmorrow> | then you only have to do half the work |
| 08:17:57 | <pumpkin> | true, but most real FFTs return the result in a weird interleaved fashion iirc |
| 08:18:05 | <Neut> | btw Twey, my solution has the 's' not the 'i' |
| 08:18:16 | <mmorrow> | pumpkin: yeah, and we've gotta sort out how to rearrange the result |
| 08:18:24 | <pumpkin> | I still think the discrete one would be best |
| 08:18:31 | <pumpkin> | no conversion to/from double |
| 08:18:38 | <mmorrow> | pumpkin: what do you mean by, oh |
| 08:18:43 | <pumpkin> | I guess we could benchmark different ones |
| 08:18:48 | <Twey> | Neut: How did you do that? |
| 08:19:00 | <Neut> | 1 sec |
| 08:19:23 | <pumpkin> | (http://en.wikipedia.org/wiki/Number-theoretic_transform ) |
| 08:19:29 | <mmorrow> | pumpkin: i've never done anything with one that uses int arithmetic, not sure how it's done |
| 08:19:30 | <kyevan> | > length [31, 34, 36, 37, 38, 39, 42, 46, 40, 59, 50] |
| 08:19:32 | <lambdabot> | 11 |
| 08:19:34 | <Neut> | dont laugh => http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2595#a2595 |
| 08:19:34 | <mmorrow> | (one := fft) |
| 08:19:47 | <pumpkin> | same basic idea, using modular exponentiation instead of complex |
| 08:19:48 | <kyevan> | (blame that one on me being too sleepy to count :P) |
| 08:19:58 | <mmorrow> | pumpkin: ah, hmm |
| 08:20:33 | <Neut> | Twey: I didnt use mod (couldnt get it to work) so i just put cases in |
| 08:20:48 | <pumpkin> | CPUs need a modular exponentiation instruction! |
| 08:20:50 | <pumpkin> | 'tis useful :P |
| 08:21:07 | <Twey> | Neut: o.@ |
| 08:21:20 | <Neut> | ? |
| 08:21:20 | <pumpkin> | and multiplicative inverse mod x :P and discrete logarithm ;) |
| 08:21:44 | <mmorrow> | ACTION found his ffts, makes a darcs repo |
| 08:21:48 | <pumpkin> | yay |
| 08:21:52 | <Twey> | But how does this handle the i? |
| 08:21:57 | <pumpkin> | fft galore |
| 08:22:10 | <yitz> | Neut: some of those asciiGet x's should be just x, I think. |
| 08:22:15 | <Neut> | it doesnt handle it specially |
| 08:22:21 | <mmorrow> | here's a classic comment: |
| 08:22:29 | <mmorrow> | and correction of some Fortran code. I have tested it somewhat ... |
| 08:22:33 | <yitz> | Neut: and btw it's a nice clear way of doing things, no laughter here. |
| 08:22:36 | <pumpkin> | , let (&&&) f g = \x -> (f x, g x) in sum . zipWith (*) (iterate (10*) 1) . reverse . uncurry (++) . ((reverse . takeWhile (/=0)) &&& (reverse . dropWhile (==0) . dropWhile (/=0))) . map (round . realPart) . ifft . map (^2) . fft . map (:+0) $ [0, 0, 0, 1, 5, 0, 4, 2, 1, 1, 0, 7, 2, 0, 0, 0] |
| 08:22:38 | <lunabot> | 62738941026509485 |
| 08:22:40 | <mmorrow> | /* Here is a C function for doing a real fft (split radix). It is a translation and correction of some Fortran code. I have tested it somewhat .. |
| 08:22:44 | <pumpkin> | lol |
| 08:22:49 | <Twey> | Haha |
| 08:22:59 | <Neut> | yitz: they need to be ascii'd first though before they can be decrypted |
| 08:23:01 | <Neut> | dont they? |
| 08:23:13 | <pumpkin> | oh no, I think that square got truncated |
| 08:23:19 | <Twey> | Neut: Which case handles the i, then? |
| 08:23:23 | <pumpkin> | it needz m0ar padding |
| 08:23:39 | <yitz> | Neut: you're saying that if it's { *after* decryption, change it to an a. |
| 08:23:53 | <Neut> | Twey: nothing special - I dont know why it makes it an 's' and yours doesn't, I was just commenting t'is all |
| 08:24:13 | <yitz> | Twey: that i/s business is weird |
| 08:24:37 | <pumpkin> | ah well, I should finish grading this damn homework |
| 08:24:44 | <shachaf> | It has no excuse to make it an 's'. |
| 08:24:49 | <pumpkin> | and quit wasting time with multiplication algorithms |
| 08:25:17 | <pumpkin> | mmorrow: another option is to use the fastest known multiplication algorithm you dug up yesterday! we might be able to approach GMP yet :P |
| 08:25:20 | <Neut> | > length [a..z] |
| 08:25:22 | <lambdabot> | * Exception: not a number |
| 08:25:31 | <yitz> | ACTION notes that pumpkins multiply slowly, but grow quickly. |
| 08:25:32 | <Neut> | > length ['a'..'z'] |
| 08:25:34 | <lambdabot> | 26 |
| 08:25:49 | <pumpkin> | yitz: :o |
| 08:25:52 | <Neut> | > length ['a'..'s'] |
| 08:25:53 | <pumpkin> | yitz: you callin me fat! |
| 08:25:54 | <lambdabot> | 19 |
| 08:25:57 | <Axman6> | yitz: a lot like a CPU? |
| 08:26:04 | <Neut> | length ['a'..'i'] |
| 08:26:14 | <Neut> | > length ['a'..'i'] |
| 08:26:15 | <lambdabot> | 9 |
| 08:26:19 | <yitz> | pumpkin: I didn't mention verticle or horizontal or intellectual orientation |
| 08:26:29 | <pumpkin> | > ((-) `on` ord) 'a' 'i' |
| 08:26:31 | <lambdabot> | -8 |
| 08:26:37 | <shachaf> | ...What? |
| 08:26:46 | <shachaf> | g-h-i. g *should* become an i. |
| 08:26:49 | <pumpkin> | ACTION sobs at yitz' insensitivity |
| 08:26:55 | <pumpkin> | :P |
| 08:27:06 | <Axman6> | pumpkin: quiet fatty! |
| 08:27:18 | <pumpkin> | :'( |
| 08:27:31 | <yitz> | pumpkin: sorry, really, no offense intended. |
| 08:27:50 | <pumpkin> | yitz: I'm just playing, sorry :P I guess tone isn't very clear on IRC :) |
| 08:28:19 | <mmorrow> | pumpkin: ok, here's a repo with two fft implems + a dir containing code for some "cwp lib" (dunno), i've got more code somewhere but i don't think it's on this laptop.. anyways: http://moonpatio.com/repos/MISC/fft-misc/ |
| 08:28:37 | <mmorrow> | this one is lightning fast http://moonpatio.com/repos/MISC/fft-misc/rsplitfft.c |
| 08:28:49 | <pumpkin> | ack, in-place though |
| 08:28:58 | <mmorrow> | yeah |
| 08:29:00 | <yitz> | pumpkin: your nick makes you sound like a former perl programmer though, so that does open you up to some occasional jabs. |
| 08:29:49 | <pumpkin> | mmorrow: wow, that code definitely looks like it was translated from fortran! :P |
| 08:29:55 | <mmorrow> | haha |
| 08:29:56 | <pumpkin> | the comment does not surprise me |
| 08:30:14 | <mmorrow> | this comment is classic too: |
| 08:30:22 | <mmorrow> | /* Currently it uses Fortran style: x[1] is first element not x[0]. I couldn't |
| 08:30:22 | <mmorrow> | figure out a simple way to convert to C style. I guess it's not a |
| 08:30:22 | <mmorrow> | catastrophe to waste one element (x[0]). |
| 08:30:22 | <mmorrow> | */ |
| 08:30:29 | <pumpkin> | lol |
| 08:30:33 | <mmorrow> | the catastrophe!! |
| 08:31:19 | <pumpkin> | I wonder how much faster fftw is than that |
| 08:31:39 | <yitz> | ACTION is wary of the fft-based multiplication algos, and suspects that ffi is just obfuscating some underlying algebra. |
| 08:32:12 | <pumpkin> | yitz: convolution of the polynomial coefficients? :P |
| 08:32:36 | <mmorrow> | yitz: fft is just a linear-map of vector spaces (vector space of (C -> C)) |
| 08:32:45 | <yitz> | pumpkin: probably more complicated than that |
| 08:33:03 | <pumpkin> | yitz: yet they make the difference between an hour and fifteen minutes to compute 123456789^54321 and about 6 seconds |
| 08:33:16 | <pumpkin> | , 123456789^54321 |
| 08:33:18 | <lunabot> | 1531351230839406576305221343465325013324448746668945797218855545067222412... |
| 08:33:26 | <yitz> | mmorrow: no reason that C should be involved here though. except for the stupid design of current cpu architectures. |
| 08:33:33 | <pumpkin> | , length . show $ 123456789^54321 |
| 08:33:35 | <lunabot> | 439540 |
| 08:33:50 | <pumpkin> | yitz: oh, I wasn't planning on doing it in c, sorry I misunderstood |
| 08:33:55 | <mmorrow> | yitz: but until then.. :) |
| 08:34:04 | <pumpkin> | or you meant complex? |
| 08:34:13 | <yitz> | ACTION sighs pentively |
| 08:34:20 | <pumpkin> | lol |
| 08:35:18 | <cizra> | Hi. I've got a parametrized type Point Double Double. How do I make a type alias Vector for it? I tried type Vector = Point and type Vector = Point Double Double, but neither one works right. |
| 08:35:24 | <mmorrow> | the speed *and* the style point both be retained though, if we just use haskell to /generate/ C which does out ffts :) |
| 08:35:30 | <mmorrow> | *style pointS |
| 08:35:36 | <mmorrow> | can |
| 08:35:45 | <mmorrow> | s/out/our/ |
| 08:35:54 | <mmorrow> | </corrections> |
| 08:35:56 | <mmorrow> | </html> |
| 08:36:34 | <mmorrow> | (or just spit out SSE* vectorized asm!!) |
| 08:36:51 | <doserj> | cizra: how does the data declaration look like? data Point a = Point a a? then type Vector = Point Double should work. |
| 08:37:06 | <cizra> | data Point = Point Double Double |
| 08:37:20 | <doserj> | then type Vector = Point |
| 08:37:29 | <pumpkin> | mmorrow: yeah, that'd be nice |
| 08:37:44 | <cizra> | doserj: It doesn't work: using Vector as a type gives 3-9.hs:19:39: Not in scope: data constructor `Vector' |
| 08:37:45 | <pumpkin> | mmorrow: or rewrite fftw in haskell instead of ocaml and claim all the fame and glory :P |
| 08:38:09 | <doserj> | cizra: that's a different problem then. how do you use Vector? |
| 08:38:32 | <yitz> | cizra: how about type Vector a b = Point a b |
| 08:38:38 | <mmorrow> | pumpkin: have you seen the (newest of the?) fftw paper? |
| 08:38:43 | <cizra> | toVector :: Point -> Point -> Vector |
| 08:38:43 | <cizra> | toVector (Point x0 y0) (Point x1 y1) = Vector (x1 - x0) (y1 - y0) |
| 08:38:48 | <pumpkin> | mmorrow: nope, why? |
| 08:39:04 | <cizra> | yitz: Nope, same error. |
| 08:39:09 | <doserj> | cizra: toVector (Point x0 y0) (Point x1 y1) = Point (x1 - x0) (y1 - y0) |
| 08:39:19 | <doserj> | Vector is a type, not a data constructor |
| 08:39:19 | <mmorrow> | pumpkin: http://www.fftw.org/fftw-paper-ieee.pdf |
| 08:39:40 | <mmorrow> | pumpkin: it's a nice overview of whattf fftw is doing |
| 08:39:51 | <pumpkin> | cool |
| 08:39:54 | <yitz> | cizra: oh wait, you're trying to use it as a data constructor? |
| 08:40:08 | <cizra> | Cool, it works now. |
| 08:40:13 | <doserj> | cizra: and maybe you want Vector to be a newtype, instead of a type synonym |
| 08:40:19 | <cizra> | Umm. Will aliased types provide me with type safety? |
| 08:40:26 | <doserj> | cizra: no |
| 08:40:34 | <cizra> | OK, I'll make a new type then. |
| 08:40:48 | <pozic> | Does cabal have an option to only install the documentation? |
| 08:40:49 | <cizra> | I got confused what's a point and what's a vector and decided to separate them to clear my head. |
| 08:41:04 | <dcoutts> | pozic: cabal install foobar --enable-documentation |
| 08:41:12 | <pozic> | dcoutts: that also installs foobar, no? |
| 08:41:29 | <pozic> | dcoutts: (which is not what I want. ) |
| 08:41:34 | <dcoutts> | pozic: oh, "only", I missed that |
| 08:41:38 | <yitz> | pumpkin: an hour and fifteen minutes? |
| 08:41:45 | <yitz> | ?? |
| 08:42:01 | <dcoutts> | pozic: http://hackage.haskell.org/trac/hackage/ticket/225 |
| 08:42:07 | <pumpkin> | yitz: yup, the integer-simple using quadratic multiplication of bigints in my test a couple of days ago |
| 08:42:20 | <pumpkin> | using gmp it took a few seconds |
| 08:42:42 | <pumpkin> | and I killed the integer-simple one after 1:15 so it might've taken a lot longer |
| 08:42:55 | <outchanter> | fft is an O(nlogn) algorithm |
| 08:43:00 | <pumpkin> | yup |
| 08:43:06 | <yitz> | pumpkin: that was karatsuba? |
| 08:43:09 | <pumpkin> | but naive multiplication is n^2 |
| 08:43:15 | <pumpkin> | karatsuba? |
| 08:43:20 | <outchanter> | so is naive discrete fourier transform |
| 08:43:31 | <yitz> | @google karatsuba multiplication |
| 08:43:36 | <lambdabot> | http://en.wikipedia.org/wiki/Karatsuba_algorithm |
| 08:43:36 | <lambdabot> | Title: Karatsuba algorithm - Wikipedia, the free encyclopedia |
| 08:43:49 | <mgsloan> | is there indiscrete forier transform? |
| 08:44:00 | <cizra> | yea |
| 08:44:09 | <cizra> | Done with integrals n' such. Scary stuff. |
| 08:44:12 | <mgsloan> | so no discrete timesamples? hrmm |
| 08:44:14 | <mgsloan> | wierd |
| 08:44:16 | <mmorrow> | mgsloan: *continuous |
| 08:44:48 | <mgsloan> | continuous derivatives too? |
| 08:44:50 | <pumpkin> | yitz: it looks like just naive multiplication to me, but you can find the source at http://darcs.haskell.org/packages/integer-simple/GHC/Integer.hs if you don't mind MagicHash |
| 08:45:05 | <mgsloan> | (at least the first one for gods sakes!) |
| 08:45:22 | <outchanter> | yitz: there's a good explanation of the fast Fourier transform in ch2 of this book: http://www.cs.berkeley.edu/~vazirani/algorithms.html |
| 08:45:24 | <mgsloan> | then again I guess as n approaches infinity |
| 08:45:56 | <mgsloan> | it can approximate discontinuities in the dirivative perfectly |
| 08:46:44 | <mmorrow> | mgsloan: oh, do you mean a computing the continuous fourier transform? |
| 08:47:08 | <yitz> | outchanter: fft-based bigint multiplication is only worth it for very, very large integers. Many thousands of digits. gmp uses naive multiplication for fairly small ints, then karatsuba, then thom (I think), possible other stuff, and only resorts to fft for really huge things. |
| 08:47:19 | <mmorrow> | mgsloan: i guess if the case is one where you can symbolically computed the result.. |
| 08:47:44 | <mmorrow> | (result := a * cos .. + .. * sin + ....... |
| 08:47:46 | <mmorrow> | ) |
| 08:47:46 | <yitz> | thom-3 or something. |
| 08:48:13 | <outchanter> | makes sense, asymptotically most efficient doesn't always translate to most efficient for small cases |
| 08:48:35 | <mmorrow> | , 10000000^100000 |
| 08:48:37 | <lunabot> | 1000000000000000000000000000000000000000000000000000000000000000000000000... |
| 08:48:44 | <mmorrow> | , 10000000^1000000 |
| 08:48:50 | <lunabot> | Killed. |
| 08:48:51 | <pumpkin> | yitz: well, that integer I tried it on had 400000 digits |
| 08:49:07 | <mmorrow> | , length . show $ , 10000000^100000 |
| 08:49:08 | <lunabot> | luna: A section must be enclosed in parentheses thus: (length . show $) |
| 08:49:13 | <mmorrow> | , length . show $ 10000000^100000 |
| 08:49:15 | <lunabot> | 700001 |
| 08:49:28 | <pumpkin> | :o |
| 08:49:34 | <yitz> | pumpkin: wasn't that integer-simple thing just a test of the capability of the infrastructure to plug in gmp alternatives to ghc? I don't think it was ever meant to actually multiply anything. |
| 08:49:57 | <pumpkin> | yitz: yeah, but he wanted to see how practical it'd be as a real integer library too, I think |
| 08:50:30 | <yitz> | pumpkin: the answer is: not. |
| 08:50:46 | <pumpkin> | I know :) |
| 08:51:08 | <yitz> | pumpkin: python uses just naive + karatsuba, it works fine in practice. |
| 08:51:33 | <mmorrow> | yitz: isn't all of pythons stuff in C anyways ? |
| 08:51:33 | <pumpkin> | maybe we should stick karatsuba onto it and see what happens, then |
| 08:51:35 | <yitz> | pumpkin: I think naive up to about 2^1000, then karatsuba |
| 08:51:47 | <yitz> | pumpkin: yeah, should be pretty easy. |
| 08:51:56 | <pumpkin> | even the fft multiplication is pretty easy |
| 08:51:57 | <cizra> | Can I use a function with guards with a let-expression? |
| 08:51:57 | <yitz> | mmorrow: yeah |
| 08:51:59 | <pumpkin> | we could do all three |
| 08:52:04 | <pumpkin> | but then we'd need to play around with the boundaries |
| 08:52:10 | <mmorrow> | yeah, fft mult isn't very hard to implem.. |
| 08:52:18 | <cizra> | Or, alternatively, is there a variant of the case expression that allows arbitrary boolean conditions? |
| 08:52:59 | <yitz> | pumpkin: yeah. that's most of the work, how do you set the boundaries. it's not trivial. the gmp people have published papers about various kinds of tests. |
| 08:53:20 | <pumpkin> | yeah :/ |
| 08:53:57 | <yitz> | pumpkin: but for most everyday apps, the simple approach python uses seems to work fine. |
| 08:54:15 | <cizra> | Ohhh. I can use the where clause instead. |
| 08:54:23 | <doserj> | > let f x | x>0 = True | x <= 0 = False in f 3 |
| 08:54:24 | <lambdabot> | True |
| 08:54:37 | <pumpkin> | yeah, it'd be nice to have a viable pure haskell alternative for people who don't want GMP's license and can live with a slightly slower library for everyday use |
| 08:54:41 | <hackagebot> | Added by FrederickRoss, Mon Jun 8 08:53:30 UTC 2009.: POSIX serial port wrapper http://hackage.haskell.org/cgi-bin/hackage-scripts/package/serial-0.2 |
| 08:54:41 | <doserj> | cizra: is that what you need? |
| 08:54:56 | <mmorrow> | yitz: the stopper is though, there's a test in ghc's testsuite that does something like "factorial 10000000" ;) |
| 08:55:06 | <fasta> | Is there anything one can do against? can't load .so/.DLL for: pthread (/usr/lib/libpthread.so: invalid ELF header) without a solution for http://hackage.haskell.org/trac/ghc/ticket/2615 ? |
| 08:55:10 | <pumpkin> | yeah :/ |
| 08:55:30 | <outchanter> | wikipedia says "In practice the Schönhage–Strassen [fft based] algorithm starts to outperform older methods such as Karatsuba and Toom–Cook multiplication for numbers beyond 2215 to 2217 (10,000 to 40,000 decimal digits)" http://en.wikipedia.org/wiki/Sch%C3%B6nhage-Strassen_algorithm |
| 08:55:30 | <mmorrow> | (w/ a^100000000 you only need to do 2 ffts, but with factorial n, you need to do 2*n ffts..) |
| 08:55:31 | <pumpkin> | that's the one real failure left in my gmpless ghc tree |
| 08:56:03 | <outchanter> | sorry, that should be 2^2^15, not 2215 |
| 08:56:04 | <mmorrow> | err, sorry that should be n+1 ffts |
| 08:56:09 | <cizra> | doserj: no. I needed something like f x { let a = computeA } | a > 0 = Zero; | a < 0 = Negative etc. |
| 08:56:19 | <cizra> | doserj: But I got around with the "where" expression. |
| 08:56:47 | <fasta> | dcoutts: You asked that question 4 years ago :) Sun May 16 17:48:07 EDT 2004 |
| 08:57:06 | <fasta> | dcoutts: er 5 |
| 08:57:16 | <nomeata> | Hi. A bit off topic: As I regular do Haskell, I kind of think in haskell terms. But now I have to do C++. The STL contains a Pair<a,b> construct, but what is the equivalent to Maybe? A simple pointer won’t do, becaues it won’t be copied correctly automatically etc. |
| 08:57:24 | <yitz> | mmorrow: hard code that one in the multiplication code. |
| 08:57:36 | <doserj> | cizra: that's exactly what where is there for :) |
| 08:58:01 | <Twey> | nomeata: Exceptions |
| 08:58:10 | <dcoutts> | fasta: you can just omit the -pthread flag |
| 08:58:23 | <yitz> | nomeata: null |
| 08:58:27 | <fasta> | dcoutts: I am not using the -pthread flag. |
| 08:58:28 | <Twey> | Idiomatically, you just return the value and throw an exception if it goes wrong |
| 08:58:35 | <Twey> | There's also null, yes |
| 08:58:57 | <dcoutts> | fasta: or -lpthread, either in your package or any dependent package |
| 08:59:03 | <mmorrow> | yitz: heh |
| 08:59:11 | <nomeata> | Twey: right, but is there a ready made container that takes care of the memory management issues? Or should I create my own one? |
| 09:00:39 | <Twey> | nomeata: No. |
| 09:00:50 | <Twey> | The C++ way is to handle it yourself, every time. |
| 09:00:51 | <yitz> | isn't there autoptr or something like that? |
| 09:00:57 | <Twey> | There are a couple of solutions |
| 09:01:05 | <Twey> | Smart pointers, garbage collection |
| 09:01:05 | <yitz> | in STL |
| 09:01:16 | <Twey> | But they're not generally used |
| 09:01:29 | <fasta> | dcoutts: so, I should delete the pthreads entry in the extra-libraries field in the cabal file? There is no other mention of pthreads. |
| 09:01:57 | <yitz> | Twey: yeah, I used autoptr for a while. It did help, but it wasn't a complete solution. |
| 09:02:07 | <dcoutts> | fasta: that should do it |
| 09:02:11 | <nomeata> | yitz: thx for the pointer (hehe), I’ll look at it |
| 09:02:13 | <outchanter> | Boost.org has reference counting smart pointers |
| 09:02:41 | <yitz> | nomeata: glad you got the point. |
| 09:02:46 | <Twey> | Heh |
| 09:02:55 | <outchanter> | and there is the Boehm-somebody garbage collector ... but at that point you should probably switch to D |
| 09:04:08 | <fasta> | dcoutts: it does. Should I contact the author of the package to request the change? Or is this some temporary problem in ghc? |
| 09:04:38 | <TheColonial> | aavogt: Berengal: thanks for your help earlier guys. I've got what I needed. cheers. |
| 09:04:44 | <kalven> | nomeata: you'll get better help with this in ##c++ |
| 09:04:47 | <dcoutts> | fasta: it's not temporary, but pthreads may be required on other platforms, it's a bit of a mess. |
| 09:04:56 | <Twey> | ACTION looks at kalven. |
| 09:05:11 | <fasta> | dcoutts: other platforms would include Windows? |
| 09:05:51 | <dcoutts> | fasta: no, other unix systems |
| 09:06:11 | <fasta> | dcoutts: ok, then it is not a problem for now. Thanks |
| 09:06:27 | <dcoutts> | fasta: windows lacks pthreads entirely |
| 09:06:38 | <dhun> | I wrote my first, not totally useless Haskell program. only problem it is 100 times longes and 20 slower than the python version, but it also more correct, lets see if I will to better in future |
| 09:07:09 | <fasta> | dcoutts: ok, so hsmagick doesn't work on Windows? |
| 09:07:23 | <dcoutts> | fasta: no idea |
| 09:07:25 | <mmorrow> | fasta: hsmagick needs pthreads!?! |
| 09:07:42 | <fasta> | mmorrow: it says so in the dependencies. |
| 09:07:46 | <mmorrow> | fasta: (isn't that just an ffi binding to imagemagick?) |
| 09:07:51 | <mmorrow> | fasta: weird |
| 09:08:04 | <fasta> | mmorrow: yes, I think it is. |
| 09:08:53 | <Twey> | dhun: Hehe, what was it? |
| 09:09:18 | <dhun> | its a parser for wikilinks "[[blah]]", it can also do nested ones |
| 09:09:30 | <dcoutts> | mmorrow, fasta: actually it looks messed up to me. It has "pkgconfig-depends: GraphicsMagick >= 1.3.3" but then also "extra-libraries: tiff jasper jpeg png wmflite bz2 z m pthread" which are almost certainly all already listed by pkg-config for GraphicsMagick |
| 09:09:46 | <yitz> | dhun: paste |
| 09:09:49 | <yitz> | @hpaste |
| 09:09:49 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 09:09:55 | <mux> | just for the record, using the -pthread is the posixly correct way to build with pthreads (as opposed to -lpthread) |
| 09:10:28 | <fasta> | mux: what's so special about pthread that it is not -lphread? |
| 09:11:29 | <mux> | the only thing special about it is that the standards say this is how you are supposed to build with pthreads :-) |
| 09:11:44 | <mux> | in practice, using -pthread may define necessary flags that wouldn't be define if you had used -lpthread |
| 09:11:50 | <mux> | (I mean CPP flags) |
| 09:11:58 | <yitz> | dcoutts: shouldn't it anyway list libs it needs itself, even if they are also listed by GraphicsMagick? But yeah, the graphics format ones certainly look wrong. |
| 09:12:21 | <dcoutts> | yitz: yes, if it needs them itself (which I doubt) zlib etc? |
| 09:12:31 | <yitz> | dcoutts: you never know. |
| 09:13:44 | <dhun> | http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/haskell |
| 09:14:46 | <hackagebot> | Added by FrederickRoss, Mon Jun 8 09:14:09 UTC 2009.: POSIX serial port wrapper http://hackage.haskell.org/cgi-bin/hackage-scripts/package/serial-0.2.1 |
| 09:15:51 | <dcoutts> | yitz: actually you can check easily by looking at the foreign imports |
| 09:16:02 | <mmorrow> | pumpkin: hehe, convolution function with unrolled special cases for input vector up to length=30 |
| 09:16:10 | <mmorrow> | pumpkin: err, the link: http://moonpatio.com/repos/MISC/fft-misc/cwp/convolution.c |
| 09:16:29 | <dcoutts> | it only imports C function from magick/api.h which we can reasonably assume to be defined in it's own lib, rather than in zlib etc |
| 09:16:30 | <pumpkin> | wow, crazy |
| 09:18:14 | <mmorrow> | saxpy (among other): http://moonpatio.com/repos/MISC/fft-misc/cwp/sblas.c |
| 09:18:39 | <mmorrow> | (also a dblas.c in there... handay) |
| 09:19:23 | <dhun> | yitz pasted: http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/haskell |
| 09:23:26 | <yitz> | dhun: it does look like it could be simplified a bit, but isn't Parsec overkill for this? |
| 09:24:16 | <yitz> | dhun: did you try Parsec's "between" operator? |
| 09:24:21 | <dhun> | no |
| 09:26:10 | <dhun> | maybe it could work |
| 09:27:01 | <cizra> | How to find the smallest item in a list, functionally? |
| 09:27:17 | <ClaudiusMaximus> | :t minimum |
| 09:27:18 | <lambdabot> | forall a. (Ord a) => [a] -> a |
| 09:27:20 | <cizra> | I could write a recursive function that remembers the current best, but that looks kinda ugly |
| 09:27:34 | <pumpkin> | foldr1' min |
| 09:27:38 | <pumpkin> | minus the tick |
| 09:27:47 | <mmorrow> | @src minimum |
| 09:27:47 | <lambdabot> | minimum [] = undefined |
| 09:27:48 | <lambdabot> | minimum xs = foldl1 min xs |
| 09:27:56 | <Cale> | foldl1' you mean :) |
| 09:28:10 | <pumpkin> | how does it differ in this case? |
| 09:28:19 | <Cale> | foldr1' doesn't exist |
| 09:28:23 | <cizra> | Mm.. OK. But if my data type isn't trivially orderable? |
| 09:28:28 | <pumpkin> | Cale: I said minus the tick :P |
| 09:28:34 | <Cale> | pumpkin: ah |
| 09:28:39 | <pumpkin> | I started with foldl1', and then partially corrected to foldr1 |
| 09:28:41 | <mmorrow> | and you want left for the same reason you want left with (+) |
| 09:29:03 | <Cale> | cizra: Then you need to zip in some information which indicates how you're going to order it |
| 09:29:04 | <mmorrow> | (result depends on traversal of entire list) |
| 09:29:07 | <cizra> | I want to sort a list of 2d points by their y value (lower first) (RWH exercise 3-12) |
| 09:29:13 | <dhun> | yitz the thing I am struggling with, it that I always want to falls back to characters if nothing else works but I want don't want "[[" to be parsed into characters |
| 09:29:15 | <Cale> | :t minimumBy |
| 09:29:17 | <lambdabot> | forall a. (a -> a -> Ordering) -> [a] -> a |
| 09:29:20 | <cizra> | Aha! |
| 09:29:21 | <cizra> | Thanks! |
| 09:29:27 | <Cale> | :t minimumBy (comparing snd) |
| 09:29:28 | <lambdabot> | forall a b. (Ord b) => [(a, b)] -> (a, b) |
| 09:29:46 | <Cale> | comparing is a handy function from Data.Org |
| 09:29:49 | <Cale> | Ord* |
| 09:30:09 | <Cale> | comparing p x y = compare (p x) (p y) |
| 09:30:18 | <mmorrow> | pumpkin: oooh, this is interesting |
| 09:30:21 | <mmorrow> | pumpkin: http://www.fftw.org/pldi99.pdf |
| 09:30:44 | <pumpkin> | mmorrow: that's what fftw is isn't it? |
| 09:30:58 | <pumpkin> | but yeah, I've been wondering how it actually works |
| 09:31:01 | <mmorrow> | pumpkin: yes, but that paper describes the codegen in-depth |
| 09:31:27 | <mmorrow> | (well, i guess you could always read the code..) |
| 09:31:32 | <pumpkin> | it's a simple idea at the highest level I think though? |
| 09:31:40 | <mmorrow> | pumpkin: totally |
| 09:31:49 | <Cale> | cizra: These a -> a -> Ordering functions also have a very useful instance of Monoid. If f and g are two such comparison functions, then f `mappend` g will take f's comparison result unless it was EQ, in which case it will give g's comparison result. |
| 09:32:09 | <Cale> | cizra: So we can write things like... |
| 09:32:38 | <Cale> | > sortBy (comparing length `mappend` compare) (words "here are a bunch of words to sort by length and then alphabetically") |
| 09:32:39 | <lambdabot> | ["a","by","of","to","and","are","here","sort","then","bunch","words","lengt... |
| 09:32:41 | <mmorrow> | pumpkin: but the sequence of graph transformations + rewriting that fftw seems to use in the fft compiler isn't trivial |
| 09:33:35 | <dhun> | yitz if I use between on "[[bla" it will fail. But the fallback to characters will happen and I will get "[[bla" as list of chars, but I to parse to Wikilink, that is tagged broken |
| 09:33:50 | <earthy> | ooh, that's really useful |
| 09:34:36 | <mmorrow> | pumpkin: (and that most-recently-linked to paper has ml code implementing the /compiler/ part) |
| 09:35:16 | <mmorrow> | hehe, he defines mapM and (>>=) in ocaml |
| 09:35:32 | <cizra> | Cale: Umm. That sounds like black magic. But it's interesting. |
| 09:35:39 | <pumpkin> | :o |
| 09:35:42 | <cizra> | ACTION tries to remember the Algebra course |
| 09:35:48 | <Cale> | cizra: It's not really black magic :) |
| 09:35:50 | <pumpkin> | mmorrow: we should translate it to haskell just to piss off harrop |
| 09:35:55 | <mmorrow> | pumpkin: yes!! |
| 09:36:08 | <cizra> | Cale: What do you mean by "instance of Monoid"? Monoid in the algebra sense, a set with a couple of operations defined on it? |
| 09:36:20 | <Cale> | Yeah, or in this case, a type |
| 09:36:28 | <cizra> | Type ~= set |
| 09:36:30 | <yitz> | dhun: (try wikilink >>= Wikilink) <|> (try (string "[[" >>= Fail) <|> (anyChar >>= C) |
| 09:36:36 | <Cale> | A type with one associative operation which has an identity |
| 09:36:48 | <yitz> | dhun: maybe S String instead of C Char to be more efficient? |
| 09:36:57 | <Cale> | In this case, the operation is called mappend, and the identity is called mempty |
| 09:36:59 | <cizra> | Cale: And in our case, the operation is ordering? |
| 09:37:04 | <Cale> | They are unfortunate names ;) |
| 09:37:15 | <cizra> | oh. hm |
| 09:37:29 | <Cale> | Well, first of all, these Ordering values have a Monoid instance |
| 09:37:43 | <dhun> | so a>>=b is equivalent to do {a; b} ? |
| 09:38:12 | <mmorrow> | do x <- a; b x |
| 09:38:13 | <cizra> | Cale: What does it mean to "have a Monoid instance"? |
| 09:38:24 | <Cale> | instance Monoid Ordering where |
| 09:38:31 | <Cale> | mempty = EQ |
| 09:38:50 | <Cale> | LT `mappend` y = LT |
| 09:38:57 | <Cale> | GT `mappend` y = GT |
| 09:39:02 | <Cale> | EQ `mappend` y = y |
| 09:39:07 | <yitz> | dhun: do x <- a; b x is shorthand for a >>= b |
| 09:39:16 | <Cale> | cizra: Do you know about typeclasses? |
| 09:39:18 | <cizra> | OK, we're yak shaving here. I'm not familiar with the "instance" keyword. |
| 09:39:22 | <Cale> | ah, okay |
| 09:39:34 | <cizra> | I know about how Ord, Eq and the like work, more or less. |
| 09:39:35 | <dhun> | ok |
| 09:39:43 | <cizra> | .. intuitively. |
| 09:39:54 | <Cale> | okay, so Ord, Eq, etc are not built in. |
| 09:40:04 | <Cale> | They're defined in the Prelude library |
| 09:40:07 | <Cale> | class Eq a where |
| 09:40:14 | <Cale> | (==) :: a -> a -> Bool |
| 09:40:20 | <Cale> | class Ord a where |
| 09:40:27 | <Cale> | compare :: a -> a -> Ordering |
| 09:40:40 | <Cale> | are the abbreviated versions of the classes |
| 09:40:51 | <Cale> | @src Eq |
| 09:40:52 | <lambdabot> | class Eq a where |
| 09:40:52 | <lambdabot> | (==), (/=) :: a -> a -> Bool |
| 09:40:52 | <cizra> | Hmm. Supposing I want to make my Points Ord, what should I do? |
| 09:40:55 | <Cale> | @src Ord |
| 09:40:55 | <lambdabot> | class (Eq a) => Ord a where |
| 09:40:55 | <lambdabot> | compare :: a -> a -> Ordering |
| 09:40:55 | <lambdabot> | (<), (<=), (>), (>=) :: a -> a -> Bool |
| 09:40:55 | <lambdabot> | max, min :: a -> a -> a |
| 09:41:10 | <cizra> | Define the (==) for my Point? |
| 09:41:19 | <Cale> | Yeah, in order to do that, you write an instance |
| 09:41:19 | <cizra> | oops, Eq, I meant |
| 09:41:24 | <Cale> | instance Eq Point where |
| 09:41:30 | <Cale> | p == q = ... |
| 09:41:40 | <cizra> | OK, I see. |
| 09:42:02 | <cizra> | Scrolling back up... 12:17 < Cale> instance Monoid Ordering where |
| 09:42:20 | <Cale> | So that's a monoid instance for Ordering values |
| 09:42:24 | <cizra> | Hmm. What is Ordering? |
| 09:42:26 | <Cale> | @src Ordering |
| 09:42:26 | <lambdabot> | data Ordering = LT | EQ | GT |
| 09:42:29 | <cizra> | aha |
| 09:42:34 | <Cale> | It's the result of an order comparison. |
| 09:42:50 | <cizra> | So here you declare that the Ordering algebraic type is a Monoid. |
| 09:43:01 | <Cale> | But I actually used a more elaborate monoid: my functions were of type a -> a -> Ordering |
| 09:43:04 | <cizra> | ... with an identity and one operation, mappend. |
| 09:43:06 | <Cale> | yeah |
| 09:43:30 | <Cale> | However, there's also a monoid instance which looks like this: |
| 09:43:43 | <Cale> | instance (Monoid m) => Monoid (e -> m) where |
| 09:43:57 | <Cale> | mempty x = mempty |
| 09:44:13 | <Cale> | (f `mappend` g) x = (f x) `mappend` (g x) |
| 09:44:56 | <Cale> | That is, we just mappend pointwise. |
| 09:45:09 | <cizra> | Cale: 10 minutes of chatting with a pro is worth days of staring into books, sometimes. |
| 09:45:37 | <Cale> | and so this automatically makes e -> Ordering into a monoid, and then e -> e -> Ordering is as well |
| 09:45:59 | <cizra> | That last one got me confused again. Lemme htink.. |
| 09:46:01 | <Cale> | and the latter type is exactly the sort of function which we pass as a comparison to sortBy/maximumBy/etc. |
| 09:46:25 | <Cale> | The instance declaration says that whenever m is an instance of Monoid, then so is e -> m |
| 09:46:35 | <cizra> | A function returning m? |
| 09:46:41 | <Cale> | yeah |
| 09:47:19 | <Cale> | So how would we combine two such functions? Well we give the function which applies them both to its argument and combines the results. |
| 09:47:20 | <dons> | mmorrow: have you thought about adding a 'sizeOf' function to vacuum? i'd like to accurately measure the size of a structure |
| 09:47:32 | <cizra> | instance Monoid Ordering (typeclass, type). instance Monoid (e -> m) -- you're using a function as a type here! |
| 09:47:49 | <Cale> | (e -> m) is a type |
| 09:47:56 | <Cale> | :t chr |
| 09:47:59 | <lambdabot> | Int -> Char |
| 09:48:05 | <cizra> | Well, yeah, a type of a function |
| 09:48:10 | <Cale> | right. |
| 09:48:30 | <cizra> | So any function that conforms to the Monoid m => (e -> m) signature .. is what? |
| 09:48:35 | <cizra> | Is a monoid? |
| 09:48:52 | <Cale> | Any function type which conforms is a monoid, yes |
| 09:49:04 | <hackagebot> | Added by AlbertoRuiz, Mon Jun 8 09:48:28 UTC 2009.: Linear algebra and numerical computations http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmatrix-0.5.2.0 |
| 09:49:51 | <Cale> | > (id `mappend` reverse) "hello" |
| 09:49:53 | <lambdabot> | "helloolleh" |
| 09:49:58 | <cizra> | So to go back up a couple of screenfuls: f `mappend` g just lets me string together a bunch of comparators. |
| 09:50:02 | <Cale> | > "hello" `mappend` "hello" |
| 09:50:03 | <lambdabot> | "hellohello" |
| 09:50:10 | <Cale> | yeah |
| 09:50:46 | <Cale> | and the combined effect is that if the first comparator says it's less or greater, we take that as the result |
| 09:50:46 | <cizra> | :t mappend fails in my ghci. Which module should I load to get it? |
| 09:50:47 | <lambdabot> | parse error on input `in' |
| 09:50:58 | <Cale> | and if it gives EQ, then we take the result of the second comparator |
| 09:51:04 | <Cale> | Data.Monoid |
| 09:51:23 | <cizra> | *nod* |
| 09:51:45 | <Cale> | This is analogous to how we compare words in a dictionary by comparing the first letters and only if they match, we compare the rest |
| 09:51:45 | <cizra> | Where is the code that does the "if EQ then check the other one" logic? |
| 09:51:53 | <cizra> | Yes, I got that point a while ago (; |
| 09:52:01 | <Cale> | In the instance of Monoid for Ordering |
| 09:52:08 | <Cale> | (which is in Data.Monoid, I think) |
| 09:52:14 | <cizra> | OK |
| 09:52:23 | <Cale> | I wrote it above |
| 09:52:27 | <cizra> | Perhaps. |
| 09:52:37 | <Cale> | -- lexicographical ordering |
| 09:52:37 | <Cale> | instance Monoid Ordering where |
| 09:52:37 | <Cale> | mempty = EQ |
| 09:52:38 | <Cale> | LT `mappend` _ = LT |
| 09:52:38 | <Cale> | EQ `mappend` y = y |
| 09:52:38 | <Cale> | GT `mappend` _ = GT |
| 09:52:48 | <Cale> | copy/paste from the actual library :) |
| 09:53:02 | <cizra> | *whew* That was a big bunch of theory. |
| 09:53:06 | <cizra> | Thank you, Cale. |
| 09:53:11 | <Cale> | No problem :) |
| 09:53:33 | <cizra> | I originally started learning Haskell for its brain-twisting properties. It hasn't failed me ever since. |
| 09:53:33 | <Cale> | I only wish that Monoid had better syntax. |
| 09:53:50 | <Cale> | mempty should be called zero or something and mappend should be called ++ |
| 09:54:29 | <Cale> | instance Monoid [a] where |
| 09:54:29 | <Cale> | mempty = [] |
| 09:54:29 | <Cale> | mappend = (++) |
| 09:56:01 | <Cale> | http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Monoid.html -- there are a bunch of other instances listed here |
| 10:03:20 | <fasta> | I wrote some code which should eventually lead to me getting a 2d array from an image, but unfortunately hsmagick crashes at a random packed pixel (either position 54, 56 or 57 until now) http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5645#a5645 Is my approach in some sense wrong? |
| 10:09:21 | <TheColonial> | I'm a little confused why something called "point free" would involve adding '.' :) |
| 10:10:16 | <wjt> | TheColonial: it's referring to http://en.wikipedia.org/wiki/Pointless_topology , not to '.' |
| 10:10:17 | <fasta> | TheColonial: . is -> |
| 10:10:47 | <fasta> | TheColonial: \x.x+1 has a point |
| 10:10:50 | <TheColonial> | :) aye true. my bad. i just see a lot of point free examples with function composition and hence .. :) |
| 10:11:49 | <Cale> | Actually, it's not typographical in any way |
| 10:12:07 | <TheColonial> | Cale: how so? |
| 10:12:17 | <Cale> | You think of the elements of a type as points of an abstract space |
| 10:12:37 | <Cale> | A points-free definition of a function is one which doesn't explicitly mention those points |
| 10:12:56 | <Cale> | (for example, because it is defined as the composite of some other functions) |
| 10:13:24 | <TheColonial> | that's a good explanation :) |
| 10:13:45 | <Cale> | When we write (\x -> ...), the variable x ranges over all the points of the domain. |
| 10:14:54 | <araujo> | ACTION working in a new language and he already was told it looks a bit like epigram :P |
| 10:15:10 | <Cale> | The term comes from topology, where they really were talking about topological spaces whose elements were indeed points :) |
| 10:15:26 | <ClaudiusMaximus> | some output from my untyped lambda calculus lazy graph reducer: http://img35.imageshack.us/img35/8858/sixteen.gif (\a.(\j.(\d.(\f.d(d f))(\s z.s(s(s(s z)))))(j a))(\f x.f x x))(\m n s z.m s(n s z)) |
| 10:16:10 | <Cale> | ClaudiusMaximus: cool :) |
| 10:16:11 | <hackagebot> | Added by ReinierLamers, Mon Jun 8 10:15:55 UTC 2009.: Easy unit test driver framework http://hackage.haskell.org/cgi-bin/hackage-scripts/package/testrunner-0.9 |
| 10:18:31 | <araujo> | ( ( . ) ( .) ) --- Point free, What separate real men from children |
| 10:18:44 | <araujo> | ACTION wants a t-shirt with that now |
| 10:18:55 | <mux> | asymmetrical boobs? |
| 10:19:33 | <araujo> | the famous boob operator, only Haskell can offer that |
| 10:20:07 | <yitz> | dhun: there's a problem with your approach |
| 10:20:15 | <dhun> | which one? |
| 10:20:56 | <yitz> | dhun: Bad is a valid Anything. So [[[[]] can parse as Wikilink [Bad] |
| 10:21:37 | <dhun> | and as what would you like to have it? |
| 10:22:08 | <mux> | ACTION ponders a t-shirt "Type-safe boobs" |
| 10:22:19 | <mapreduce> | > let __ = (.) in @type (__.__) |
| 10:22:20 | <lambdabot> | <no location info>: parse error on input `@' |
| 10:22:38 | <yitz> | dhun: I think you're better off leaving out Bad. Just have your parser fail altogether when there is no closing ]], and deal with that exception when you run the parser. Make sense? |
| 10:23:46 | <dhun> | don't really understand yet, I will have to do with broken files and want to try to get some information out of them |
| 10:24:33 | <dhun> | furthermore I don't know how to make the parser fail, I think I would just trigger the fallback |
| 10:25:26 | <RayNbow> | :t let __ = (.) in (__.__) -- did you mean this, mapreduce? |
| 10:25:27 | <dhun> | "[[[[]]" parses as [Wikilink [Wikilink [],Bad]] |
| 10:25:27 | <lambdabot> | forall a b c a1. (b -> c) -> (a -> a1 -> b) -> a -> a1 -> c |
| 10:26:06 | <dhun> | that looks ok to me |
| 10:27:26 | <dhun> | to me this means there is Wikilink a, a contains a wikilink b, and a is broken |
| 10:33:52 | <dhun> | maybe it would be better to have [C '[',C '[', Wikilink []] |
| 10:33:58 | <dhun> | it certainly would |
| 10:41:40 | <EvilTerran> | dhun, i think that may make your grammar non-context-free |
| 10:41:57 | <EvilTerran> | (not that that's necessarily a problem) |
| 10:51:05 | <dhun> | don't really know about context free yet, have to llok up |
| 10:52:58 | <dhun> | perhaps you are right can't learn the topic now |
| 10:55:21 | <hackagebot> | Added by HenningThielemann, Mon Jun 8 10:54:24 UTC 2009.: Audio signal processing coded in Haskell http://hackage.haskell.org/cgi-bin/hackage-scripts/package/synthesizer-0.2 |
| 10:58:55 | <dhun> | my basic idea is that I got environments, each environment has got a start parser and end parser |
| 10:59:37 | <dhun> | and environment parses to MyEnvironment [Anything] |
| 11:00:26 | <dhun> | where Anything= Char c | Environronment1[Anything]|...|Environmentn[Anything] |
| 11:33:31 | <skorpan> | what's up with the facebook invite on haskell-cafe? |
| 11:34:06 | <boegel> | skorpan: it's funny, that's about it :P |
| 11:34:10 | <wjt> | presumably someone asked facebook to invite their entire GMail addressbook |
| 11:34:21 | <boegel> | ACTION would love a "No, I'm not on Facebook" T-shirt |
| 11:34:36 | <skorpan> | hehe |
| 11:39:40 | <osfameron> | social networking sites spamming your entire address book is a Bad Thing (TM) |
| 11:43:28 | <boegel> | ACTION leaves to ensure students don't cheat on their Compilers exam |
| 11:45:35 | <httpwwwMariegets> | http://www.marie-gets-deflowered.com/?id=54f5dc21 need 12 peolpe to enter this site so I can see more pictures |
| 11:47:12 | <httpwwwMariegets> | please copy that adres and enter that site only 1 time and thats all |
| 11:47:25 | <cizra> | httpwwwMariegets: Please be kickbanned ASAP |
| 11:47:28 | <cizra> | that's all |
| 11:48:02 | <httpwwwMariegets> | if that will help you to go to that site then OK |
| 11:48:09 | <osfameron> | ops? |
| 11:48:11 | <burp> | LOLO |
| 11:48:37 | <burp> | just don't click |
| 11:49:37 | <cizra> | Eh, Latvians, Latvians... |
| 11:49:45 | <httpwwwMariegets> | why don't click , you should say just click it |
| 11:50:16 | <osfameron> | @where ops |
| 11:50:16 | <lambdabot> | shapr Cale glguy dons sjanssen sorear dcoutts Saizan allbery_b dibblego conal Phillipa bos arjanb psnl lispy xerox vincenz davidhouse Heffalump kosmikus wli Pseudonym Igloo musasabi quicksilver |
| 11:50:17 | <lambdabot> | mauke |
| 11:50:42 | <osfameron> | ta |
| 11:50:57 | <RayNbow> | dcoutts saves the day \o/ |
| 11:51:00 | <araujo> | dcoutts, next time, with a message... "Fear the lambda" |
| 11:51:04 | <araujo> | dcoutts, :D |
| 11:51:07 | <dcoutts> | :-) |
| 11:51:08 | <araujo> | dcoutts!!! |
| 11:51:45 | <Itkovian> | Yeah! I love the sound of spammers kicked in the morning. |
| 11:51:55 | <dcoutts> | araujo!!?! |
| 11:52:21 | <RayNbow> | ACTION equips lambdabot with a few weapons |
| 11:52:26 | <RayNbow> | lambdabot is now an anti-spam turret :p |
| 11:52:52 | <araujo> | dcoutts, how is businesses? |
| 11:53:08 | <dcoutts> | araujo: good actually |
| 11:53:35 | <araujo> | dcoutts, so that means... Haskell domination plans are doing good then .... |
| 11:53:40 | <dcoutts> | ACTION is getting paid to make ghc even more awesome |
| 11:53:42 | <dcoutts> | araujo: yep |
| 11:53:59 | <araujo> | yes!!! |
| 11:54:17 | <araujo> | ACTION thinks world domination is near |
| 12:03:00 | <zsol> | hmm |
| 12:03:24 | <zsol> | are these supposed to be the same, or is GHC optimising here? |
| 12:03:30 | <zsol> | hamm = let x = 1 : merge (map (*2) x) (map (*3) x) in x |
| 12:03:31 | <zsol> | hamm' = 1 : merge (map (*2) hamm') (map (*3) hamm') |
| 12:04:25 | <zsol> | because the first one should be using sharing while the second is just plain old recursion |
| 12:04:34 | <zsol> | or am I missing something? |
| 12:06:08 | <Lemmih> | zsol: They both use sharing. |
| 12:07:08 | <zsol> | oh, right.. |
| 12:08:46 | <zsol> | oh well, back to the drawing board before I make myself any more embarassed |
| 12:21:11 | <zsol> | this is what I meant: hamm' f = f : merge (hamm' (2*f)) (hamm' (3*f)) |
| 12:21:11 | <zsol> | and it works as expected |
| 12:21:32 | <zsol> | which is sl000oo0ww :) |
| 12:23:07 | <Philonous1> | > let hamm' f = f : merge (hamm' (2*f)) (hamm' (3*f)) in hamm' 3 |
| 12:23:08 | <lambdabot> | Not in scope: `merge' |
| 12:23:36 | <Philonous1> | Well, as ham is a function, it's return values are not memoized |
| 12:23:50 | <Philonous1> | hamm' even |
| 12:29:14 | <Philonous> | But I doubt this makes much of a difference |
| 12:32:59 | <RayNbow> | @let mergeByR cmp fxy fx fy z = go where go [] ys = foldr fy z ys ; go xs [] = foldr fx z xs ; go (x:xs) (y:ys) = case cmp x y of ; LT -> fx x (go xs (y:ys)) ; EQ -> fxy x y (go xs ys) ; GT -> fy y (go (x:xs) ys) |
| 12:33:01 | <lambdabot> | Defined. |
| 12:33:15 | <RayNbow> | > let merge = mergeByR compare (const (:)) (:) (:) []; merge3 as bs cs = merge as (merge bs cs); hammings = 1 : merge3 (map (2*) hammings) (map (3*) hammings) (map (5*) hammings) in hammings |
| 12:33:21 | <lambdabot> | [1,2,3,4,5,6,8,9,10,12,15,16,18,20,24,25,27,30,32,36,40,45,48,50,54,60,64,7... |
| 12:43:46 | <mmorrow_> | pumpkin: TH-generated fully-unrolled fft's for power-of-2-length inputs up to 64 http://moonpatio.com/repos/ffts_upto_64.hs |
| 12:44:28 | <mmorrow_> | (i think ghc can only handle up to a 512 fully unrolled one or so, or else compile-time goes through the roof) |
| 12:45:37 | <mmorrow_> | so i guess i have to add configurable unrolling depth (and get rid of those annoying "case [a,b,c] of [c,d,e] ->"'s, even though ghc probably eliminates those anyways) |
| 12:45:59 | <ClaudiusMaximus> | hmm, (\x -> x x)(\x -> x x) loops in untyped lambda calculus, but how might i go about constructing more complicated terms that loop with longer periods? |
| 12:46:12 | <mmorrow_> | the y combinator is |
| 12:46:30 | <mmorrow_> | (\f -> (\x -> f (x x)) (\x -> f (x x))) |
| 12:46:40 | <mmorrow_> | err |
| 12:46:46 | <mmorrow_> | no that's it |
| 12:47:04 | <dolio> | (\x -> x x) (\x -> x x) is typically named Omega, I think. |
| 12:48:08 | <EvilTerran> | mmorrow_, that looks like y to me |
| 12:48:23 | <dolio> | \x -> x x being omega. |
| 12:49:04 | <EvilTerran> | ClaudiusMaximus, well, you could sprinkle it with "i"s |
| 12:49:07 | <mux> | I thought Omega was Turing's fixed point combinator |
| 12:49:15 | <EvilTerran> | mux, iirc, that's Theta |
| 12:49:27 | <mmorrow_> | EvilTerran: yeah, i confused myself for a second there |
| 12:49:29 | <mux> | ah, my problem is greek letters :D |
| 12:49:30 | <dolio> | Omega's a pretty over-used symbol. |
| 12:50:26 | <ClaudiusMaximus> | Omega reduces to Omega in 1 step, but I want to construct some term Quux that reduces to Quux in N steps, with N large but finite |
| 12:50:35 | <mmorrow_> | , "ω" |
| 12:50:37 | <lunabot> | "\969" |
| 12:50:45 | <mmorrow_> | , "α" |
| 12:50:46 | <lunabot> | "\945" |
| 12:50:53 | <mmorrow_> | ACTION memorizes \945 |
| 12:51:33 | <EvilTerran> | y = λf. (λx. f (x x)) (λx. f (x x)); ω = λx. x x; Ω = ω ω = y i |
| 12:51:55 | <mmorrow> | , (text . utf8enc . take 25) ['\945'..] |
| 12:51:57 | <lunabot> | αβγδεζηθικλμνξοπρςστυφχψω |
| 12:52:14 | <mmorrow> | (25 since there are two sigmas) |
| 12:52:40 | <mmorrow> | (end-of-word and not) |
| 12:53:02 | <ClaudiusMaximus> | all i see is boxes with a lonely pi, my font is obviously lacking |
| 12:53:04 | <dhun> | I'd like to know how to stick parsers together, currently I am doing it with a lot of code |
| 12:53:13 | <dhun> | http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/haskell |
| 12:53:20 | <EvilTerran> | and Θ = (λx y. y (x x y)) (λx y. y (x x y)) |
| 12:53:31 | <dhun> | my parsers are dikilink and wikilink |
| 12:53:54 | <dhun> | in anything I got the lines with k and k1 |
| 12:54:11 | <dhun> | both look very similar, is there a way to avoid typing them twice |
| 12:54:13 | <dhun> | ? |
| 12:54:25 | <EvilTerran> | ClaudiusMaximus, given an expression E, iE reduces to E in one step, i(iE) in two steps, etc |
| 12:55:17 | <EvilTerran> | (in fact, iiE would also reduce to E in two steps) |
| 12:56:08 | <EvilTerran> | ClaudiusMaximus, so (i i...i (\x.x x)) (i i...i (\x.x x)) would reduce to itself in a number of steps equal to the number of i's on each side plus 1, i think |
| 12:56:19 | <EvilTerran> | ClaudiusMaximus, although of course it depends on your reduction strategy |
| 12:56:30 | <mmorrow> | , foldr (.) id (replicate 1000 id) 42 |
| 12:56:32 | <lunabot> | 42 |
| 12:56:37 | <mmorrow> | , foldr (.) id (replicate 10000000 id) 42 |
| 12:56:39 | <lunabot> | 42 |
| 12:57:05 | <mmorrow> | , foldr (flip id) 42 (replicate 10000000 id) |
| 12:57:07 | <lunabot> | luna: Occurs check: cannot construct the infinite type: c = a -> c |
| 12:57:13 | <Gracenotes> | hm... join (.) is twice.. |
| 12:57:23 | <ClaudiusMaximus> | ACTION tries that |
| 12:57:25 | <mmorrow> | , foldr id 42 (replicate 10000000 id) |
| 12:57:26 | <EvilTerran> | when i say "E reduces to E' in N steps", i mean "there exists a reduction path from E to E' of length N" |
| 12:57:28 | <lunabot> | 42 |
| 12:57:44 | <mmorrow> | , foldr id id (replicate 10000000 id) 42 |
| 12:57:46 | <lunabot> | 42 |
| 13:00:55 | <fasta> | Random fact: Loading an image in Haskell. Tried 3 libraries, one has missing functionality, the next segfaults and the final one gives an exception. Loading an image in Python. import Python + 2 lines to write all the image data to stdout with a very well documented library. Conclusion: library situation in Haskell is basically a joke (I don't know of any functionality that's available in Haskell which is not available on some other platform in a better way (ot |
| 13:00:55 | <fasta> | her than everything needing to be pure)). |
| 13:02:18 | <dhun> | like Python too, but doing haskell just because it is quite hard for me |
| 13:02:32 | <fasta> | I don't like Python. |
| 13:02:38 | <EvilTerran> | fasta, i'd say "conclusion: image library situation in haskell is basically a joke", tbh. i've had no trouble with, eg, writing a web scraper using someone else's HTTP and HTML libraries |
| 13:02:58 | <fasta> | EvilTerran: yes, HTTP stuff worked the last time I tried it. |
| 13:03:12 | <quicksilver> | fasta: pick one particular example. generalise wildly. conclusion : arguments on the internet frequently suffer from fallacies and exagerration. |
| 13:03:25 | <fasta> | EvilTerran: but then again, that probably would also work in $LANG. |
| 13:03:36 | <EvilTerran> | ACTION once tried to write bindings to the Allegro graphics library for haskell, but got stuck because they'd used a load of #defines instead of an enum >:[ |
| 13:03:47 | <quicksilver> | but there certainly isn't a decent image library for haskell - or I've never found one. |
| 13:03:59 | <quicksilver> | I have successfully loaded images with Wx, for what it's worth. |
| 13:04:09 | <quicksilver> | (without actually using Wx for the rest of the application, or not necessarily) |
| 13:04:29 | <PeakerWork> | SDL image, maybe? |
| 13:04:30 | <EvilTerran> | fasta, well, i did try implementing it in perl first; wrote a few hundred lines of code, and couldn't work out why they didn't work, so then switched to haskell and wrote something that worked as soon as it typechecked |
| 13:04:39 | <EvilTerran> | (and was a quarter of the length) |
| 13:04:42 | <Axman6> | Tried to write fast concurrent programs, got them working far easier than i expected, and was pleasently surprised. conclusion: haskell should replace all languages used for programming of any kind |
| 13:04:50 | <fasta> | EvilTerran: Haskell is not a bad language for doing things from scratch. |
| 13:04:59 | <fasta> | EvilTerran: in fact, it's a quite good language. |
| 13:05:16 | <EvilTerran> | i agree that haskell's library situation isn't anywhere near as advanced as, eg, perl, python, C, etcetc |
| 13:05:21 | <EvilTerran> | but we're working on it |
| 13:05:56 | <fasta> | The problem is that porting a library requires work, instead of it just being there. |
| 13:06:16 | <Axman6> | and there was no work writing those libraries in other languages? |
| 13:06:18 | <fasta> | There is no fundamental reason why one cannot automate more of the porting. |
| 13:06:24 | <Axman6> | i find that hard to believe |
| 13:06:57 | <Axman6> | fasta: the thing is, you can do a direct binding to other libraries, but they don't end up being very haskell like |
| 13:07:08 | <EvilTerran> | it's harder to nicely bind C libraries to haskell than to imperative languages, though; that's probably a contributing factor |
| 13:07:11 | <CSWookie> | So, I'm wanting to have a loop, a mapping object, and a list which I append values to. Am I thinking about this wrongly for Haskell? |
| 13:07:37 | <Saizan> | mapping object? |
| 13:07:42 | <Axman6> | CSWookie: not necessarilly, but appending to a list is usually a bad idea |
| 13:07:58 | <PeakerWork> | CSWookie: you probably just want a map, or a list comprehension |
| 13:07:58 | <Saizan> | and thinking in "loops" is not particulary haskelly |
| 13:08:02 | <EvilTerran> | and we don't really have loops |
| 13:08:08 | <EvilTerran> | or objects :P |
| 13:08:16 | <Saizan> | or lists! |
| 13:08:25 | <EvilTerran> | ... we've got lists. shush. |
| 13:08:39 | <Axman6> | no, we've got [] a's |
| 13:09:02 | <EvilTerran> | we've probably got a wider variety of linear containers than most languages |
| 13:09:13 | <EvilTerran> | lists, arrays, sequences, bytestrings... |
| 13:10:06 | <fasta> | EvilTerran: C++ probably has more. |
| 13:10:18 | <dhun> | an especially user declared infix operators :-) |
| 13:10:24 | <FunctorSalad> | random thought... could [] be implemented as a hybrid array/linked thing like (I think) lazy bytestrings are? |
| 13:10:37 | <FunctorSalad> | (with the arrayness hidden) |
| 13:10:56 | <EvilTerran> | fasta, well, haskell and C++ both have a countable infinity of 'em, if you squint right ;) |
| 13:11:34 | <fasta> | EvilTerran: sure, I was just talking about a practical thing. |
| 13:12:01 | <EvilTerran> | i've not subjected myself to enough C++ to be sure, so i'm happy to take your word for it |
| 13:19:57 | <dhun> | how can I convert a Parser String to a Parser () |
| 13:20:01 | <hackagebot> | Added by NeilBrown, Mon Jun 8 13:19:18 UTC 2009.: Generic programming library http://hackage.haskell.org/cgi-bin/hackage-scripts/package/alloy-1.0.0 |
| 13:20:06 | <wjt> | dhun: >> return () |
| 13:21:24 | <dhun> | you mean >>= ? |
| 13:21:25 | <EvilTerran> | ?type (>> return ()) |
| 13:21:26 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => m a -> m () |
| 13:21:34 | <EvilTerran> | ?type (>>) |
| 13:21:35 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => m a -> m b -> m b |
| 13:21:52 | <EvilTerran> | dhun, (>>) just sequences, it throws away the result of its first parameter |
| 13:21:54 | <EvilTerran> | ?src (>>) |
| 13:21:55 | <lambdabot> | m >> k = m >>= \_ -> k |
| 13:22:29 | <EvilTerran> | m >> k = m >>= const k |
| 13:22:42 | <dhun> | I see |
| 13:23:02 | <Axman6> | > [1,2,3] >> "abc" |
| 13:23:03 | <lambdabot> | "abcabcabc" |
| 13:23:04 | <EvilTerran> | ACTION suspects (>>= return ()) would produce some incomprehensible error message about () not being a monad |
| 13:23:20 | <EvilTerran> | ?type (>>= return ()) |
| 13:23:22 | <lambdabot> | Couldn't match expected type `m b' against inferred type `()' |
| 13:23:22 | <lambdabot> | In the first argument of `return', namely `()' |
| 13:23:22 | <lambdabot> | In the second argument of `(>>=)', namely `return ()' |
| 13:24:17 | <paolino> | @seen dcoutts |
| 13:24:18 | <lambdabot> | dcoutts is in #haskell-soc, #haskell-in-depth, #gentoo-haskell, #darcs, #ghc, #haskell-overflow and #haskell. I last heard dcoutts speak 23s ago. |
| 13:24:44 | <RayNbow> | :t (>>= const$return ()) |
| 13:24:45 | <lambdabot> | The operator `>>=' [infixl 1] of a section |
| 13:24:45 | <lambdabot> | must have lower precedence than that of the operand, |
| 13:24:45 | <lambdabot> | namely `$' [infixr 0] |
| 13:24:54 | <RayNbow> | :t (>>= const (return ())) |
| 13:24:55 | <lambdabot> | forall a (m :: * -> *). (Monad m) => m a -> m () |
| 13:33:08 | <sinelaw> | can someone explain the advantages of using Lava (or York Lava) instead of just writing VHDL?> |
| 13:34:06 | <PeakerWork> | sinelaw: hey |
| 13:34:16 | <PeakerWork> | @where lava |
| 13:34:16 | <lambdabot> | I know nothing about lava. |
| 13:34:20 | <PeakerWork> | @go lava |
| 13:34:21 | <lambdabot> | http://en.wikipedia.org/wiki/Lava |
| 13:34:21 | <lambdabot> | Title: Lava - Wikipedia, the free encyclopedia |
| 13:34:30 | <sinelaw> | not that :) |
| 13:34:34 | <fasta> | quicksilver: did anything happen to my bugreport? |
| 13:34:56 | <sinelaw> | http://raintown.org/lava/ |
| 13:35:39 | <fasta> | sinelaw: currently there are no advantages, AFAIK. |
| 13:35:49 | <quicksilver> | fasta: I can't remember what it was about, now ;) |
| 13:36:03 | <sinelaw> | fasta, and eventually? |
| 13:36:10 | <sinelaw> | i mean, what's the point |
| 13:36:19 | <fasta> | sinelaw: It is meaningless to describe hardware in a description language which has no back-end that actually exists. |
| 13:36:58 | <sinelaw> | what? |
| 13:37:02 | <fasta> | sinelaw: eventually, it might be a good idea. |
| 13:37:33 | <RayNbow> | hmm, Haskell-Cafe doesn't set the reply-to header? |
| 13:37:38 | <fasta> | sinelaw: the idea of Lava should be that you describe your stuff in Lava and that some hardware company takes that description and gives you your hardware within some time. |
| 13:37:46 | <ClaudiusMaximus> | EvilTerran: sprinkling i's (if by i you mean (\y.y)) didn't work (at least with my reduction strategy, being lazy evaluation/graph reduction) - reached the same cycle of 3 graphs (x -> y -> z -> x) as Omega did (sorry for delay, i accidentally DOS'd myself) |
| 13:38:04 | <fasta> | sinelaw: I don't think there is any company who accepts Lava as input currently or accepts anything which is the output of Lava. |
| 13:38:17 | <fasta> | sinelaw: but it has been some time that I have taken a look at Lava. |
| 13:38:23 | <fasta> | sinelaw: things might have changed. |
| 13:38:29 | <sinelaw> | fasta, ok. i thought VHDL (or verilog) was exactly that |
| 13:38:44 | <fasta> | sinelaw: VHDL has industry support. |
| 13:39:12 | <EvilTerran> | ClaudiusMaximus, hm, that's strange |
| 13:39:25 | <fasta> | sinelaw: oh, it seems they do have such a backend. |
| 13:39:32 | <sinelaw> | they convert it to VHDL |
| 13:39:32 | <fasta> | sinelaw: so, maybe it is actually useful :) |
| 13:40:28 | <EvilTerran> | ClaudiusMaximus, surely (taking i = \x.x, w = \x.xx): iw(iw) -> w(iw) -> iw(iw) |
| 13:40:31 | <fasta> | sinelaw: but I don't think it is very advanced; there is no routing in it etc. |
| 13:40:45 | <EvilTerran> | and iiw(iiw) -> iw(iiw) -> w(iiw) -> iiw(iiw) |
| 13:40:48 | <sinelaw> | ok |
| 13:40:57 | <EvilTerran> | with leftmost reduction |
| 13:42:33 | <EvilTerran> | ClaudiusMaximus, or does your reduction strategy exploit sharing? |
| 13:43:05 | <ClaudiusMaximus> | EvilTerran: with lazy evaluation, iiw(iiw) -> iw(iiw) -> w(iiw) -> let x = iiw in x x -> let x = iw in x x -> let x = w in x x -> w w |
| 13:44:19 | <CSWookie> | Hmm. I'll let this cogitate on a back burner for a while (I imagine at least a week), and come back to it this weekend. |
| 13:44:22 | <EvilTerran> | i see; it's the sharing that's preventing it from taking longer |
| 13:45:09 | <EvilTerran> | i'm not sure how you'd subvert that aspect of lazy evaluation |
| 13:46:07 | <hackagebot> | Added by HenningThielemann, Mon Jun 8 13:41:47 UTC 2009.: Fast, packed, strict storable arrays with a list interface like ByteString http://hackage.haskell.org/cgi-bin/hackage-scripts/package/storablevector-0.2.3 |
| 13:46:13 | <ClaudiusMaximus> | nor i. perhaps i'm trying to achieve the impossible (again) |
| 13:46:36 | <HugoDaniel> | hi |
| 13:47:44 | <paolino> | is it ever possible to write a MonadState instance for IO ? |
| 13:48:31 | <dhun> | can I write that more concise (like assuming wikilink and dikilink to be elements of a list) k<-app wikilink p b [Empty] |
| 13:48:31 | <dhun> | ;k1<-app dikilink p b k |
| 13:50:27 | <doserj> | k1 <- app wikilink p b [Empty] >>= app dikilink p b, if you want to avoid naming the intermediate k |
| 13:50:36 | <dhun> | ok |
| 13:50:58 | <mmorrow> | paolino: sure, use an IORef or MVar |
| 13:51:01 | <paolino> | I wrote a MonadState r for ReaderT (TVar r) IO, but I cannot use it as callback to "on" functions in gtk2hs, as they must be pure IO |
| 13:51:22 | <dhun> | but if I got [wikilink, dikilink. blahlink], can I do it with the list at once |
| 13:51:27 | <mmorrow> | hmm, actually you'd have to keep a ref to the IORef/MVar.. |
| 13:51:34 | <paolino> | eh |
| 13:51:35 | <mmorrow> | which i'm not sure you could do without globals |
| 13:53:09 | <hackagebot> | Added by HenningThielemann, Mon Jun 8 13:52:28 UTC 2009.: Audio signal processing coded in Haskell http://hackage.haskell.org/cgi-bin/hackage-scripts/package/synthesizer-0.2.0.1 |
| 13:54:24 | <paolino> | :t unsafePerformIO $ newIORef 0 |
| 13:54:25 | <lambdabot> | Not in scope: `unsafePerformIO' |
| 13:54:26 | <lambdabot> | Not in scope: `newIORef' |
| 13:54:41 | <paolino> | mmorrow: that is a global ? |
| 13:54:43 | <doserj> | dhun: sth like foldM (\x f -> app f p b) [Empty] [wikilink, dikilink, blahlink] could work |
| 13:54:47 | <mmorrow> | paolino: yes |
| 13:54:54 | <dhun> | ok |
| 13:55:11 | <doserj> | err, foldM (\x f -> app f p b x) ..., of course |
| 13:55:15 | <mmorrow> | paolino: (if you use an IORef and you're concurrent, be sure to use atomicModifyIORef) |
| 13:55:37 | <paolino> | mmorrow: will it work inside the MonadState methods ? |
| 13:55:54 | <mmorrow> | paolino: you could make it to, but it'd be hacky |
| 13:56:15 | <mmorrow> | ooh, i think you can actually write a wrapper function to do what you want |
| 13:56:18 | <mmorrow> | ACTION thinks |
| 13:56:27 | <paolino> | more then gtk2hs ? :) |
| 13:56:44 | <Saizan> | paolino: you can use ReaderT (IORef a) IO |
| 13:56:51 | <Saizan> | paolino: instead of globals |
| 13:57:14 | <Saizan> | paolino: it's easy to convert that to an IO action |
| 13:57:32 | <Saizan> | (that you can pass to callbacks) |
| 13:59:32 | <paolino> | but I lose the state monad, then |
| 14:00:31 | <dhun> | did app2 l p b k= do {k1<-app (head l) p b k;app2 (tail l) p b k1} |
| 14:00:36 | <dhun> | seems to work |
| 14:00:48 | <dhun> | but maybe yours is more elegant |
| 14:01:04 | <paolino> | Saizan: the monad must implement MonadState and be called inside a callback |
| 14:01:44 | <paolino> | mhh, must think actually |
| 14:01:51 | <fasta> | quicksilver: the bug was about the Emacs mode. |
| 14:01:56 | <doserj> | dhun: you have en extra base case for app2 [], I hope? |
| 14:02:06 | <dhun> | yes of course |
| 14:04:13 | <Saizan> | paolino: you can implement MonadState for that type |
| 14:05:18 | <Saizan> | paolino: get = do ref <- ask; lift $ readIORef ref; put x = do ref <- ask; lift $ writeIORef ref x |
| 14:05:23 | <quicksilver> | fasta: oh that one. No, no response :( Maybe he's on holidays. |
| 14:05:26 | <Baughn> | > (\False -> 1; \True -> 2) False -- ..somehow, I don't think so |
| 14:05:29 | <lambdabot> | <no location info>: parse error on input `;' |
| 14:06:38 | <Baughn> | But shouldn't it be possible to do that, logically speaking? |
| 14:06:46 | <EvilRanter> | ACTION has seen proposed syntax "(case of False -> 1; True -> 2) False" for that |
| 14:07:21 | <Baughn> | EvilRanter: I remember that. Mine's more general, though; consider having multiple parameters |
| 14:07:30 | <Baughn> | Although I'm not sure it doesn't collide with existing syntax |
| 14:07:39 | <EvilRanter> | as it stands, i guess you have to write (let f False -> 1; f True -> 2 in f) or (\x -> case x of ...) |
| 14:07:56 | <Baughn> | You could do that. |
| 14:08:08 | <Baughn> | Of course, that's verbose. And part of the reason why haskell works so well is that lambda is \. |
| 14:08:44 | <EvilTerran> | true |
| 14:10:30 | <EvilTerran> | with appropriate monoid instances etc, and the proposed (|PAT -> EXP) --> (\x -> case x of PAT -> Just EXP; _ -> Nothing) de-sugaring i've seen |
| 14:10:47 | <EvilTerran> | you could make that ((|False -> 1) ++ (|True -> 2)) |
| 14:11:03 | <mmorrow> | paolino: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5651#a5651 |
| 14:11:50 | <conal> | EvilTerran: i guess one could also drop the Maybe and use unamb |
| 14:11:56 | <conal> | oops -- i mean lub |
| 14:12:16 | <EvilTerran> | conal, what, (\False -> 1) `lub` (\True -> 2) ? |
| 14:12:24 | <conal> | EvilTerran: exactly |
| 14:12:39 | <EvilTerran> | that's... evil genius material :D |
| 14:12:45 | <conal> | :) |
| 14:12:53 | <RayNbow> | lub..? least upper bound? |
| 14:13:00 | <conal> | RayNbow: yeah |
| 14:13:07 | <RayNbow> | ok :) |
| 14:13:07 | <conal> | @hackage lub |
| 14:13:07 | <lambdabot> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/lub |
| 14:13:48 | <EvilTerran> | ACTION notes that, while it intuitively looks like it might break lub's contract, it actually doesn't |
| 14:13:50 | <conal> | and http://conal.net/blog/tag/lub/ |
| 14:13:54 | <mmorrow> | paolino: ooh, actually that doesn't even need the IORef |
| 14:14:00 | <EvilTerran> | because, if one side is defined at all, the other side will be _|- |
| 14:14:03 | <EvilTerran> | er, _|_ |
| 14:14:14 | <conal> | yeah. nice :) |
| 14:14:21 | <EvilTerran> | it's very cheeky, though |
| 14:14:30 | <conal> | EvilTerran: lub's contract is looser than unamb's |
| 14:15:25 | <Saizan> | well, only if the patterns don't overlap |
| 14:15:41 | <mmorrow> | paolino: tunnel callback k = do r <- ask; liftIO (k (flip runReaderT r . callback)) |
| 14:15:47 | <Saizan> | and you mean \arg -> (\False -> 1) arg `lub` (\True -> 2) arg, right? |
| 14:15:48 | <EvilTerran> | Saizan, yeah, that's what i mean; or at least, the result has to be the same where the patterns overlap |
| 14:16:05 | <conal> | EvilTerran: it only has to be consistent, not necessarily the same |
| 14:16:21 | <EvilTerran> | that's also what i meant |
| 14:16:21 | <mmorrow> | paolino: tunnel :: (a -> ReaderT r IO b) -> ((a -> IO b) -> IO c) -> ReaderT r IO c |
| 14:16:27 | <EvilTerran> | ACTION is insufficiently familiar with lub to be entirely coherent about it :P |
| 14:16:36 | <paolino> | mmorrow: thanks , I was there too :) |
| 14:16:40 | <Baughn> | conal: I see what you're doing there. However, don't you think lub is just a /little/ too heavyweight for this? |
| 14:16:44 | <mmorrow> | paolino: :) |
| 14:16:48 | <paolino> | and Saizan |
| 14:16:54 | <CSWookie> | ACTION wonders if EvilTerran forgot an 'e', there... |
| 14:17:13 | <EvilTerran> | ... or to be sure if it's okay to lub two partial functions together instead of lub'ing their results |
| 14:17:16 | <conal> | Baughn: semantically heavyweight? |
| 14:17:27 | <Baughn> | conal: No, implementation-wise heavyweight |
| 14:18:07 | <conal> | Baughn: for the current implementation. |
| 14:18:28 | <Baughn> | conal: Point. Though I don't think you can do without threads while still handling infinite loops. |
| 14:18:29 | <dolio> | The Maybe version is probably more heavyweight than you'd really want. |
| 14:18:50 | <EvilTerran> | dolio, yeah, i suspect CPS-transforming it would be worthwhile |
| 14:18:51 | <quicksilver> | I'm not sure if this is what "Semantically heavyweight" means |
| 14:19:00 | <quicksilver> | but lub is non-monotonic, isn't it? |
| 14:19:04 | <conal> | Baughn: without digging into the RTS? |
| 14:19:15 | <Baughn> | conal: Even /with/ digging into the RTS |
| 14:19:25 | <conal> | quicksilver: it's monotonic in each argument. |
| 14:19:56 | <conal> | quicksilver: which means its monotonic as a curried function. |
| 14:19:57 | <EvilTerran> | maybe something like (|PAT -> EXP) --> (\next x -> case x of PAT -> EXP; _ -> next x) |
| 14:19:59 | <Baughn> | conal: You can't /detect/ infinite loops, you can just try to spread your effort and hope one branch succeeds. Such spreading is, in itself, a thread. |
| 14:20:04 | <quicksilver> | conal: not, it's not. |
| 14:20:13 | <quicksilver> | conal: hmm. |
| 14:20:16 | <quicksilver> | conal: maybe it is :) |
| 14:20:51 | <conal> | quicksilver: if you know more about a or b, then you know more about a `lub` b |
| 14:20:58 | <EvilTerran> | which'd get us "(|False -> 1) (|True -> 2) undefined" (or whatever) |
| 14:21:12 | <EvilTerran> | well, with more parentheses |
| 14:21:25 | <conal> | Baughn: yeah. in a broad sense of "thread". |
| 14:21:58 | <Baughn> | conal: Well, you would be stuck with the stack-freezing machinery and such that is the cause for threads being as costly as they are, so.. :) |
| 14:22:47 | <yowgi> | hello. |
| 14:22:49 | <yowgi> | > let f (x+1) = x in f 43 -- is this standard or just GHC? |
| 14:22:50 | <lambdabot> | 42 |
| 14:23:02 | <yowgi> | (the x+1 part) |
| 14:23:06 | <RayNbow> | n+k patterns? |
| 14:23:07 | <doserj> | standard |
| 14:23:09 | <dolio> | Standard, but unpopular. |
| 14:23:14 | <Saizan> | lub does something more than what you actually want here, though, you want committed choice, while lub is more like "merged" non-determinism |
| 14:23:15 | <conal> | Baughn: perhaps. when implemented at run-time. |
| 14:23:39 | <yowgi> | ok, thanks! |
| 14:23:45 | <conal> | Baughn: i'm generally reluctant to say how things must be done, since often there's lots of room for creativity. |
| 14:24:33 | <Baughn> | conal: Hm. There are some optimizations, I suppose.. |
| 14:24:54 | <conal> | Baughn: yeah. lub is semantically foundational, so i wouldn't be surprised to see a compiler do smart things with it. |
| 14:25:35 | <Saizan> | you can apply the optimizations some compilers for logic languages do |
| 14:25:35 | <Baughn> | conal: Even with the current ghc, we only need to fork threads when trying to evaluate one branch takes a while, but never actually blocks or crashes |
| 14:26:04 | <Baughn> | conal: It /might/ be useful to put a timeout on that, and only start evaluating the second in parallel if the first doesn't finish or crash within some period of time. Needs measurement. |
| 14:26:29 | <EvilTerran> | , [x | x@(even->True) <- [1..]] |
| 14:26:30 | <lunabot> | [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,5... |
| 14:26:43 | <EvilTerran> | yaay |
| 14:27:24 | <conal> | Baughn: reminds me of research on speculative evaluation, which may relate. |
| 14:27:33 | <Baughn> | conal: We could start by throwing the second thread into a spark, so if there's a free capability it'll run it anyhow |
| 14:27:50 | <alexsuraci> | Anyone know how I'd fix this strange type error: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5652#a5652 |
| 14:27:55 | <Baughn> | Though, then unamb/amb would need to execute differently from race |
| 14:27:55 | <ski> | hm |
| 14:27:56 | <EvilTerran> | ACTION notes that var@(f -> pat) could be a pretty useful idiom |
| 14:28:01 | <ski> | , [x | x | even x <- [1..]] |
| 14:28:02 | <lunabot> | luna: Parse error in pattern |
| 14:28:08 | <ski> | (: |
| 14:28:31 | <dolio> | > filter even [1..] |
| 14:28:33 | <lambdabot> | [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,... |
| 14:28:34 | <EvilTerran> | alexsuraci, i suspect you're somehow using two different versions of Socket |
| 14:28:36 | <conal> | Baughn: i'm happy for the implementation to change radically. it's really unamb & lub i care about. not amb or race. |
| 14:29:19 | <alexsuraci> | EvilTerran: The type headers in Network.Socket.ByteString.Lazy's source use the same Socket |
| 14:29:26 | <quicksilver> | conal: On the other hand lub is nondeterministic, and it might seem heavyweight to try to use a nondeterministic construct to add a new deterministic construct to a deterministic language. |
| 14:29:28 | <alexsuraci> | For send, etc. |
| 14:29:41 | <conal> | quicksilver: lub is nondeterministic?? |
| 14:29:57 | <Baughn> | conal: I'm getting quite a large number of ideas for optimizations I can only test out after ghc (and then reative) have been fixed. I really hope that's soon.. |
| 14:30:06 | <conal> | quicksilver: oh -- i think i know what you mean. |
| 14:30:09 | <quicksilver> | conal: what is the value of (1:xs) `lub` (2:xs) ? |
| 14:30:27 | <EvilTerran> | quicksilver, mu, you've broken the contract |
| 14:30:31 | <conal> | quicksilver: lub imposes a semantic restriction that "|" doesn't. |
| 14:30:57 | <quicksilver> | the language I'm working in doesn't have a way to attach semantic restrictions to functions ;) |
| 14:31:23 | <quicksilver> | all it has is a type system, and if the type system permits a term - which is a static property - then the term is well formed, well typed, and must have a denotation. |
| 14:31:27 | <conal> | quicksilver: not only that, but case allows its cases to disagree |
| 14:31:33 | <quicksilver> | apologies for getting oldfashioned/pedantic ;) |
| 14:31:44 | <quicksilver> | so "lub" is not a well-defined term former. |
| 14:31:55 | <quicksilver> | the only way to make it monotonic is to make it nondeterministic. |
| 14:32:24 | <EvilTerran> | ACTION suddenly gets what quicksilver means by "monotonic" |
| 14:32:27 | <conal> | quicksilver: or partial |
| 14:32:41 | <quicksilver> | conal: I don't think so , no. |
| 14:32:43 | <Saizan> | the partiality breaks monotonicity |
| 14:32:51 | <conal> | i didn't mean that kind of partial |
| 14:33:00 | <quicksilver> | conal: _|_ `lub` (1:xs) is (1:xs) |
| 14:33:15 | <quicksilver> | conal: meanwhile (2:xs) `lub` _|_ is (2:xs) |
| 14:33:40 | <quicksilver> | therefore (1:xs) `lub` (2:xs) *must* be at least as defined as (1:xs), (2:xs) |
| 14:33:43 | <quicksilver> | which is impossible, of course |
| 14:33:51 | <quicksilver> | (1:xs) and (2:xs) have no common upper bound. |
| 14:33:58 | <quicksilver> | so you have to go nondeterministic. |
| 14:34:03 | <EvilTerran> | fork the universe! |
| 14:34:19 | <hackagebot> | Added by NeilBrown, Mon Jun 8 14:33:16 UTC 2009.: Some add-on instances for the Alloy library http://hackage.haskell.org/cgi-bin/hackage-scripts/package/alloy-proxy-fd-1.0.0 |
| 14:34:23 | <ski> | ACTION supposes it could be assymmetric, instead |
| 14:34:27 | <conal> | quicksilver: or don't go at all. two different notions of partiality. |
| 14:34:37 | <quicksilver> | conal: I don't know what you mean? |
| 14:34:59 | <quicksilver> | ski: if it was left-favouring, so that the value chosen is (1:xs), that's a contradiction. |
| 14:35:08 | <quicksilver> | ski: monotonicity says it must be a refinement of (2:xs) |
| 14:35:13 | <ski> | ah, i see |
| 14:35:36 | <mxc> | anyone here familiar with the FIX protocol? |
| 14:36:20 | <hackagebot> | Added by GregoryCrosswhite, Mon Jun 8 14:35:37 UTC 2009.: Haskell values that cannot be evaluated immediately. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/procrastinating-variable-1.0.2 |
| 14:36:47 | <quicksilver> | lest anyone think I'm being too oldfashioned and pedantic, I'm not saying that "lub" isn't interesting, or fun, or a worthy thing to discuss and research. |
| 14:36:57 | <quicksilver> | I'm just trying to point out it's incompatible with the static semantics of haskell. |
| 14:37:03 | <quicksilver> | you've made the language something new. |
| 14:37:19 | <dhun> | I got a parser for nested environments no and I am very happy about it |
| 14:37:34 | <Baughn> | quicksilver: The way I read par, it does 'setPriority None . forkIO . evaluate', semantically speaking. That's well and good, but is there a setPriority call I could use on ordinary threads? |
| 14:37:37 | <conal> | quicksilver: in that i've ventured outside of the type system to impose additionally partiality on the semantics. |
| 14:38:16 | <quicksilver> | Baughn: sparks are different from forkIO'd threads. |
| 14:38:18 | <Baughn> | quicksilver: (I want to spark a low-priority evaluation. I then want to kill it if it turns out to be unnecessary.) |
| 14:38:18 | <thomastc> | @seen nominolo |
| 14:38:18 | <lambdabot> | I saw nominolo leaving #haskell-soc, #yi, #ghc, #haskell-in-depth and #haskell 4d 17h 54m 22s ago, and . |
| 14:38:25 | <quicksilver> | Baughn: they're *even* *more* lightweight than threads. |
| 14:38:41 | <quicksilver> | Baughn: JaffaCake is probably the only person in IRC who really understand them at the level you're asking, though. |
| 14:39:05 | <conal> | quicksilver: in that (1:xs) `lub` (2:xs) is not a meaningful expression, although it's type-correct. |
| 14:39:07 | <Baughn> | quicksilver: I'll ask him, I suppose. I'd be happy with ordinary threads, though, I just want to reduce their priority. |
| 14:39:17 | <quicksilver> | conal: which is quite a big semantic price to pay. (It might be worth paying, perhaps) |
| 14:39:59 | <conal> | quicksilver: short of full dependent types, i think we'll always have contracts that the type system fails to capture. |
| 14:39:59 | <quicksilver> | conal: by making the entire semantics partial - rather than merely modelling partiality within the semantics - you have broken various rules of the rewrite system. |
| 14:40:11 | <conal> | quicksilver: another example is fromAscList |
| 14:40:19 | <quicksilver> | well, it's not really the same. |
| 14:40:26 | <quicksilver> | fromAscList obeys its type |
| 14:40:36 | <quicksilver> | it just produces a value which is an ADT with a broken invariant. |
| 14:40:39 | <Baughn> | JaffaCake: Might it be possible to abort a spark if I find out later that, no, I don't really need it (but can't have it GCed)? Or reduce the priority of an ordinary thread so it acts more like a spark? |
| 14:40:58 | <conal> | quicksilver: the *semantics* of fromAscList as a map is undefined when the invariant is broken. |
| 14:41:05 | <JaffaCake> | neither is supported right now |
| 14:41:17 | <conal> | and not in the sense of _|_. in the sense that it's not meaningful. |
| 14:41:23 | <Baughn> | Could they be, or would it require major redesign? |
| 14:41:38 | <quicksilver> | sure, but that's a different level of semantic interpretation. |
| 14:41:59 | <conal> | quicksilver: yeah. |
| 14:42:01 | <quicksilver> | fromAscList [(2,2),(1,1)] is a perfectly valid haskell value |
| 14:42:12 | <conal> | quicksilver: just not a valid map |
| 14:42:13 | <quicksilver> | it has a perfectly well understood denotation. |
| 14:42:23 | <conal> | quicksilver: as a representation, but not as a map |
| 14:42:23 | <quicksilver> | it violates an API contract, that's all. |
| 14:42:43 | <quicksilver> | whereas (1:xs) `lub` (2:xs) is what, a runtime error? |
| 14:43:03 | <quicksilver> | ...it can't be a runtime error, because that violates monotonicity ;) |
| 14:43:26 | <quicksilver> | it has to be a deep dark hole in our semantics which is somehow not _|_ |
| 14:43:30 | <quicksilver> | like a meta-_|_ |
| 14:44:20 | <conal> | quicksilver: like the fromAscList example, it's a failure of the type system to reject an expression that does not denote a value of the semantic type i care about. |
| 14:45:05 | <conal> | quicksilver: and i see the difference you're pointing out about these levels of meanings. |
| 14:45:48 | <frwmanners> | lub :: a -> a -> Maybe a |
| 14:45:49 | <lambdabot> | frwmanners: You have 1 new message. '/msg lambdabot @messages' to read it. |
| 14:46:23 | <Axman6> | @djinn a -> a -> Maybe a |
| 14:46:23 | <lambdabot> | f _ a = Just a |
| 14:46:24 | <quicksilver> | conal: breaking monotonicity is fairly deep, though. Break monotonicity and you lose the fixed point theorem. |
| 14:46:30 | <quicksilver> | recursion "doesn't work" any more. |
| 14:46:37 | <frwmanners> | lub _|_ 4 = Just 4 |
| 14:46:39 | <conal> | frwmanners: the difficulty with that type is that it's undecidable whether two values are consistent. |
| 14:46:56 | <frwmanners> | Could be inconvenient |
| 14:47:14 | <frwmanners> | True |
| 14:47:14 | <conal> | frwmanners: hm. i didn't think through that claim very carefully. |
| 14:47:47 | <frwmanners> | conal: no, you're right. If we hide the result in a Maybe we lose the entire point |
| 14:48:05 | <conal> | quicksilver: i agree with you that monotonicity is fundamental to denotational semantics. |
| 14:48:22 | <quicksilver> | I strongly suspect it breaks static optimisations, too |
| 14:48:26 | <quicksilver> | although I'm not sure. |
| 14:50:12 | <hashkool> | why do I get an occurs check in xpath [http://www.mibbit.com/pb/gqSqNB ] |
| 14:50:19 | <leimy> | SnoLepfail? |
| 14:50:24 | <leimy> | oops ! |
| 14:50:27 | <leimy> | wrong channel |
| 14:50:30 | <leimy> | hi Conal! :-) |
| 14:50:42 | <conal> | hi leimy ! |
| 14:51:00 | <leimy> | conal: how are things in the land of reactive programming? |
| 14:51:41 | <conal> | leimy: there seems to be some frp energy stirring. my head has been more in functional GPU programming. |
| 14:52:06 | <Saizan> | hashkool: hard to tell without the definition of Rep |
| 14:52:14 | <conal> | leimy: what new with you? |
| 14:52:23 | <EvilTerran> | hashkool, i think we may need to see the Reps module |
| 14:52:46 | <leimy> | conal: oh not too much.. been working to keep the dream alive :-) You know cuz it takes team work, to make the dream work. |
| 14:52:48 | <doserj> | hashkool: the type signature says that the second argument of xpath is of type 'a'. But you pattern match on it? |
| 14:53:04 | <leimy> | In other words I was at a customer site for 4 days (including working the weekend) in a small box, collecting data. |
| 14:53:27 | <conal> | leimy: was that any fun at all? |
| 14:53:37 | <leimy> | Actually it was surprisingly nice in there... but loud |
| 14:53:40 | <hashkool> | Saizan: see here http://www.mibbit.com/pb/lPt77G :-) |
| 14:53:51 | <leimy> | We make this mobile containers. they're little portable datacenters |
| 14:54:05 | <LeCamarade|Away> | I've failed to get any PostgreSQL bindings that work. |
| 14:54:10 | <leimy> | they're pretty darned "green", in that they're efficient. |
| 14:54:18 | <LeCamarade|Away> | Even Takusen, which installed fine, didn't have the modules. |
| 14:54:20 | <leimy> | And you can load em on a truck and move them :-) |
| 14:54:29 | <LeCamarade|Away> | I'd have none of my current problems. :o( |
| 14:54:34 | <leimy> | This was the first one I've seen, and it's a project I've been working on for months |
| 14:54:34 | <conal> | leimy: wow |
| 14:54:45 | <leimy> | The remote management system uses Erlang |
| 14:54:59 | <leimy> | and the simulations I've been building to work against it are in Haskell :-) |
| 14:55:12 | <leimy> | So all in all it was pretty freaking fun :-) |
| 14:55:15 | <leimy> | but tiring. |
| 14:55:28 | <conal> | leimy: cool! :) |
| 14:55:31 | <leimy> | Of course the customers don't see Erlang, they see SNMP agents :-) |
| 14:55:44 | <EvilTerran> | hashkool, it seems you're trying to use different types in different patterns on the second parameter of xpath |
| 14:55:48 | <leimy> | And I was thinking that I wish I could have done the whole system in Haskell instead. |
| 14:55:55 | <leimy> | but for lack of good SNMP libraries for Haskell |
| 14:56:08 | <EvilTerran> | hashkool, if you want to do that, you're going to need to make xpath a method of a typeclass parameterised by xpath's second parameter |
| 14:56:31 | <leimy> | I've been bitten by quite a few type-safety issues here and there. And I was wondering about Reactive, and binary streams of network data. |
| 14:56:57 | <leimy> | But I've yet to really dig into Reactive, so it was just a casual wondering :-) |
| 14:57:26 | <conal> | leimy: yeah. might be cool to explore a genuinely functional approach to what you're doing. whether frp or not. |
| 14:57:26 | <EvilTerran> | hashkool, think "class Xpath a where xpath :: Rep a -> a -> [String] -> [a] |
| 14:57:27 | <EvilTerran> | ; instance Xpath UnitT where xpath RUnit Unit ..."" |
| 14:58:07 | <leimy> | conal: yeah. I was just thinking that SNMP requests are just "events". Polling to fill up a cache is an event. Asynchronous events are just events. And evaluating stuff to produce a trap is just an event :-) |
| 14:58:17 | <leimy> | So why not a Reactive SNMP agent implementation framework? |
| 14:58:23 | <conal> | maybe so |
| 14:58:31 | <quicksilver> | leimy: One of my concerns about using reactive to process realtime data streams is I suspect it won't degrade gracefully if data comes in too fast. |
| 14:59:08 | <hashkool> | EvilTerran: In what cases do I not return [a]? Using classes is the method which is taken in EMGM, I need to use the LIGD-approach (if this sounds familiar to you) |
| 14:59:32 | <leimy> | quicksilver: That's a problem with any asynchronous-response system though right? |
| 14:59:35 | <conal> | quicksilver: and not just reactive, but perhaps *any* semantically precise framework. |
| 14:59:37 | <leimy> | in that you can get flooded :-) |
| 14:59:43 | <quicksilver> | conal, leimy: yes. |
| 15:00:03 | <quicksilver> | however, I thik people are more familiary with teh memory-management and degradation modes of (say) a system written in C. |
| 15:00:22 | <leimy> | yeah.... that's trick |
| 15:00:23 | <leimy> | y |
| 15:00:26 | <EvilTerran> | hashkool, i'm not familiar with those acronyms |
| 15:00:29 | <quicksilver> | would a haskell-reactive system start slowing down and getting timestamps wrong? would it catastrophically spiral into swap? |
| 15:00:46 | <quicksilver> | would it continue to produce output fine, just lagging further and further behind? |
| 15:00:48 | <EvilTerran> | hashkool, and i didn't say anything about the return type; the problem is the type of the second parameter |
| 15:00:54 | <quicksilver> | if the input paused, would it eventually catch up? |
| 15:01:02 | <quicksilver> | I don't suggest these problems are insoluble. |
| 15:01:04 | <leimy> | That was a big concern of mine. I don't necessarily understand how to look at Haskell code yet, and see how the size of data grows |
| 15:01:09 | <quicksilver> | I'm sure they're eminently soluble :) |
| 15:01:13 | <leimy> | Lazy languages with all the thunking and what-not :-) |
| 15:01:13 | <quicksilver> | I just think they need thinking about. |
| 15:01:14 | <conal> | leimy, quicksilver: i'd suggest defined the desired semantics first. and only then see if it matches frp semantics. |
| 15:01:34 | <hashkool> | EvilTerran: not really too important, but EMGM is an haskell package for generic programming |
| 15:02:37 | <hashkool> | Thanks for your feedback. I only don't see where I change the second parameter |
| 15:03:56 | <leimy> | conal: makes sense. The whole world isn't a nail because you've got a shiny, new hammer :-) |
| 15:04:29 | <PeakerWork> | I think the goal is to have functional systems that react to the world. So if FRP means just that -- its probably just going to morph into whatever does that properly :-) |
| 15:04:52 | <conal> | quicksilver: i'm summarizing our earlier semantic discussion in my notes, and i want to make sure i've captured it. i think the essence of your point is this: unamb and lub introduce a new element to haskell programming in that we no longer have a monotonic semantics that is defined on all well-typed expressions. |
| 15:04:57 | <EvilTerran> | hashkool, Unit is of type UnitT, (Prod a b) is of type (Prod something something), etc; you're using those as patterns in the second parameter |
| 15:05:08 | <EvilTerran> | hashkool, but a parameter to a function has to always be the same type |
| 15:05:14 | <akamaus> | greetings. I'm thinking about embedding .glade file into a haskell string in order to get a standalone executable. Can I use a cabal for such kind of preprocessing? |
| 15:05:57 | <conal> | PeakerWork: yeah. i think of "frp" very loosely as a functional/denotational approach to time-varying whatever. it'll evolve. |
| 15:06:18 | <conal> | i.e., work-in-progress |
| 15:06:19 | <dcoutts> | akamaus: there's no special support but you can write code to generate modules in Setup.hs |
| 15:06:46 | <Saizan> | EvilTerran: but Rep is a GADT |
| 15:06:58 | <Saizan> | EvilTerran: so 'a' is refined by the constructor |
| 15:07:17 | <EvilTerran> | Saizan, uh... does it really work that way? |
| 15:08:24 | <conal> | quicksilver: did i get the essence of your remarks on lub? |
| 15:08:34 | <Saizan> | EvilTerran: yes |
| 15:09:16 | <akamaus> | dcoutts, Can you please point me the api? Right now I'm looking at Distribution.Simple.PreProcess, but seems it's not what I need. |
| 15:09:40 | <Saizan> | hashkool: the problem is that xpath ra a cns :: [x] while the result type of that branch must be [Sum x t] |
| 15:10:00 | <Saizan> | hashkool: because the 'a' in the signature is refined to "Sum x t" by the pattern matching |
| 15:10:21 | <Saizan> | hashkool: so you've to use map L (xpath ra a cns) |
| 15:10:23 | <EvilTerran> | ACTION gives up |
| 15:11:25 | <EvilTerran> | ACTION had no idea GADTs could do that |
| 15:11:36 | <Saizan> | EvilTerran: well, if you can have case branches of different types you can also take additional arguments of different types |
| 15:11:57 | <EvilTerran> | Saizan, i wasn't aware you could have case branches of different types |
| 15:12:10 | <Saizan> | ah, ok |
| 15:12:25 | <dmwit> | EvilTerran: Yup, GADTs do some pretty scary things. =) |
| 15:12:26 | <dcoutts> | akamaus: you don't need to use anything special, just write the file out in the pre-build step |
| 15:12:31 | <SamB> | EvilTerran: only with GADTs or similar |
| 15:12:43 | <quicksilver> | conal: yes. |
| 15:12:58 | <SamB> | but actually, they only have different types insofar as the cased-over expression does |
| 15:14:19 | <conal> | quicksilver: thx. and thx for the chat. it helped to clarify a distinction i was glossing over in my mind. |
| 15:14:46 | <RayNbow> | conal, lub (\x -> let loop = loop in loop) id 3 -- is this valid, and if so, what should it evaluate to? |
| 15:16:01 | <conal> | RayNbow: (\x -> bottom) `lub` (\ x -> x) == \ x -> bottom `lub` x == \ x -> x == id |
| 15:16:19 | <RayNbow> | conal: it crashes ghci here :p |
| 15:16:32 | <conal> | RayNbow: oh! i'll try it also. |
| 15:16:43 | <RayNbow> | but it might be because I'm running GHC 6.10.1 |
| 15:16:57 | <RayNbow> | (I'm currently on an old laptop) |
| 15:18:05 | <Saizan> | a "fix id" loop is not interruptible, iirc |
| 15:18:22 | <conal> | RayNbow: hm. just sits there in my ghci. doesn't give 3 as i'd expect. |
| 15:18:36 | <LeCamarade|Away> | I think I take the award for using GHC on the oldest machine here. |
| 15:18:38 | <conal> | Saizan: oh. |
| 15:19:07 | <LeCamarade|Away> | ACTION runs to -blah. |
| 15:19:10 | <conal> | Saizan: oh, so ghc's multithreading isn't letting the non-bottom thread ever run. |
| 15:19:12 | <conal> | urg. |
| 15:19:52 | <conal> | RayNbow: i guess ghc's threading isn't up for that example. bummer. |
| 15:20:27 | <akamaus> | dcoutts, what preBuild is supposed to return? Can I just return emptyHookedBuildInfo? |
| 15:20:40 | <quicksilver> | conal: were you trying in ghci? try running ghci with -N2 |
| 15:20:42 | <dcoutts> | akamaus: yep |
| 15:20:50 | <quicksilver> | you probably need another 'real thread' for that to have any chance |
| 15:20:53 | <conal> | quicksilver: will do. |
| 15:22:32 | <conal> | quicksilver: hm. same result. just hangs. and i'm using 'lub (\x -> last [0..]) id 3' |
| 15:23:18 | <fasta> | How lightweight are threads in GHC btw? In Linux it was about 860 cycles, IIRC. |
| 15:23:39 | <akamaus> | dcoutts, It works, and is simplier than I expected. Thanks! |
| 15:23:48 | <PeakerWork> | fasta: how much does a syscall cost on x86/64? Probably more than that? |
| 15:23:50 | <dcoutts> | akamaus: np |
| 15:24:03 | <conal> | hm. unamb (\x -> last [0..]) id 3 also hangs. |
| 15:24:26 | <fasta> | PeakerWork: what do you mean? Different system calls take differents amount of time. |
| 15:24:34 | <PeakerWork> | fasta: the syscall overhead itself |
| 15:24:39 | <PeakerWork> | fasta: kernel entry/exit |
| 15:24:51 | <conal> | well, that unamb use wasn't legit. but unamb (last [0..]) 3 hangs also. |
| 15:24:58 | <fasta> | PeakerWork: on the order of tens, I would guess. |
| 15:25:14 | <dhun> | I am asking my self how to structure my program I got several Parsers, which are only allowed to match if the current environment is element of a set of allowed environments for that particular parser, at the moment I call all parsers from am common function, but I want only allowed once to match |
| 15:25:19 | <conal> | Baughn: ping. |
| 15:25:21 | <RayNbow> | hmm, on my newer machine I also have GHC 6.10.1... time to do an upgrade... |
| 15:25:46 | <PeakerWork> | fasta: the ring switch, stack switch, storing/restoring of user-level registers, etc, probably costs more |
| 15:26:12 | <Baughn> | conal: Pong |
| 15:26:34 | <Baughn> | conal: Oh, I see. Hmm. |
| 15:26:44 | <conal> | in the latest unamb, 'unamb 3 (last [0..])' and 'unamb (last [0..]) 3' both hang in ghci on my machine. |
| 15:26:56 | <fasta> | PeakerWork: why would the stack switch take more than a single mov? |
| 15:28:05 | <conal> | Baughn: similarly, race (evaluate 3) (evaluate (last [0..])) |
| 15:28:07 | <PeakerWork> | fasta: It happens automatically inside the ring switch, I think it switches both SS and ESP, it at least loads a new segment descriptor, checks the descriptor involved, etc |
| 15:28:26 | <Baughn> | conal: Or amb, which is more convenient |
| 15:28:31 | <fasta> | PeakerWork: right, but the segment stuff works in hardware. |
| 15:28:55 | <conal> | Baughn: yeah |
| 15:29:46 | <fasta> | PeakerWork: so, would you say the Haskell forkIO is never going to be more than 10 times faster than using pthreads? |
| 15:30:07 | <PeakerWork> | fasta: no idea. in theory, analysis can eliminate forkIO's completely |
| 15:30:17 | <PeakerWork> | (static language-level analysis) |
| 15:31:29 | <PeakerWork> | fasta: perhaps thread forking can be made really really cheap, at the expense of slowing down stuff in general |
| 15:32:48 | <Baughn> | conal: I've got it. This is interesting.. |
| 15:32:56 | <conal> | Baughn: yeah? |
| 15:33:12 | <Baughn> | conal: It hangs when calling cleanup in race, presumably because the last [0..] is doing no allocation |
| 15:33:12 | <akamaus> | dcoutts, I forgot the the most important. How to read GladeXML from string? I'm sure I saw it somethere |
| 15:33:22 | <Baughn> | conal: The fix is to forkIO the cleanup |
| 15:33:36 | <Baughn> | conal: Although, that's a bad fix. It'll still be eating CPU. Don't do that. |
| 15:33:44 | <conal> | Baughn: how could last [0..] not allocation? |
| 15:33:52 | <conal> | (not allocate) |
| 15:33:54 | <PeakerWork> | piggy-backing allocations sounds like a bad idea :-( |
| 15:34:07 | <dcoutts> | akamaus: oh, come to think if it, that may not have been bound, though it'd be easy to do so |
| 15:34:25 | <dcoutts> | akamaus: if you want something that works now then use cabal's feature to install data-files |
| 15:34:41 | <conal> | Baughn: oh! killThread hangs. |
| 15:34:47 | <Baughn> | conal: You should ask JaffaCake or someone, not me, but logically GHC is probably fusing the last and the [0..] |
| 15:35:10 | <conal> | Baughn: oh, of course it could fuse last [0..]. |
| 15:35:21 | <conal> | Baughn: i hadn't thought of fusion. |
| 15:35:28 | <Baughn> | conal: killThread is implemented in terms of throwTo, yes. Locally I've replaced the killThread with a different exception; that of course makes no difference. |
| 15:35:32 | <conal> | i wonder: does *ghci* fuse? |
| 15:35:37 | <Baughn> | It does. |
| 15:35:40 | <leimy> | will it blend? |
| 15:35:53 | <Baughn> | This is technically a ghc bug, I suppose.. |
| 15:36:21 | <burp> | mhm ghci smoke |
| 15:36:55 | <leimy> | Don't inhale this |
| 15:37:02 | <quicksilver> | conal, Baughn : ghci doesn't do any optimisations at all, does it? |
| 15:37:07 | <quicksilver> | fusion happens at the core level |
| 15:37:14 | <Baughn> | conal: Eh |
| 15:37:17 | <quicksilver> | ghci users bytecode |
| 15:37:18 | <Baughn> | conal: It /doesn't/ fuse |
| 15:37:28 | <Baughn> | There are plenty of garbage collections |
| 15:37:50 | <BMeph> | conal: what happens if you give unamb two different values? |
| 15:37:58 | <Baughn> | BMeph: Don't. |
| 15:38:13 | <conal> | BMeph: you have to go to confession |
| 15:38:18 | <Baughn> | BMeph: You get whichever result evaluated first, of course.. |
| 15:38:40 | <conal> | BMeph: that's what amb is for |
| 15:39:25 | <conal> | i've forgotten: how do i tell ghci to show GCs? |
| 15:40:25 | <Baughn> | +RTS -Sstderr |
| 15:40:54 | <conal> | there's no dynamic ghci flag? |
| 15:41:42 | <Baughn> | Never looked. You can start ghci with that flag, of course. |
| 15:42:10 | <Axman6> | :set +RTS -Sstderr? |
| 15:42:13 | <conal> | Baughn: thx. you're seeing GCs but killThread is hanging? |
| 15:42:21 | <Baughn> | Yes |
| 15:42:39 | <conal> | sigh |
| 15:42:57 | <Baughn> | I'm having trouble replicating it as a standalone program, but.. let's see. |
| 15:43:25 | <conal> | Baughn: that'd be great. if we can get a simple example, ghc HQ will help. |
| 15:44:02 | <Baughn> | Ah. No, I think it's my fault somehow. |
| 15:44:33 | <Baughn> | ACTION just stares |
| 15:44:40 | <Baughn> | ..I forgot to throw an unblock around the forkIO calls |
| 15:45:34 | <Baughn> | conal: "let f x = unblock $ forkIO $ putCatch x v" <-- Works fine. Use this. |
| 15:45:51 | <Baughn> | Wait.. |
| 15:46:21 | <Baughn> | conal: " let f x = forkIO $ unblock $ putCatch x v" <-- This. That's the correct line. |
| 15:47:42 | <Baughn> | conal: So that would mean.. hm. Well, no threads ever got killed before; I'd say this needs to be released soonest.. |
| 15:47:56 | <Baughn> | ACTION blinks. Hang on, removing the killThreads also removed that ghc bug |
| 15:49:13 | <Baughn> | conal: And fixing this bug *ALSO STOPPED THE SEGFAULT*. Yay! |
| 15:49:29 | <Baughn> | conal: Although that's still a ghc bug, I now have /useful/ information to provide.. plus, it no longer affects us |
| 15:49:29 | <conal> | Baughn: :) ! |
| 15:50:06 | <conal> | Baughn: do you recommend "forkIO $ unblock $ putCatch x v"? |
| 15:50:11 | <Baughn> | Yes |
| 15:50:16 | <Baughn> | Hm |
| 15:50:20 | <Baughn> | ..no |
| 15:50:24 | <Baughn> | That's still subtly buggy |
| 15:50:24 | <dmwit> | hehe |
| 15:50:26 | <Baughn> | Darn it. |
| 15:50:46 | <Saizan> | ACTION throws more concurrency at Baughn |
| 15:50:57 | <dhun> | I made a tiny class hierarchy http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/haskell could anybody tell me how to implements something like this in Haskell? |
| 15:51:05 | <Baughn> | conal: let f x = forkIO $ putCatch (unblock x) v |
| 15:51:08 | <Baughn> | THERE. |
| 15:52:03 | <conal> | Baughn: or move the unblock into putCatch? |
| 15:52:18 | <conal> | Baughn: maybe keep with the forkIO line |
| 15:52:22 | <conal> | since they're related. |
| 15:52:27 | <conal> | i don't know |
| 15:52:43 | <conal> | i'm adrift. i have no mental model for this stuff. |
| 15:52:43 | <Baughn> | conal: Really, at the moment putCatch belongs inside race |
| 15:52:48 | <Baughn> | They're deeply interlinked |
| 15:52:59 | <Baughn> | I'll look at decomposing them more cleanly, tomorrow. |
| 15:53:09 | <Baughn> | For the moment, this version is at least bugless.. |
| 15:53:30 | <conal> | thanks. good time to darcs-push and hackage-release? |
| 15:53:35 | <Baughn> | Although, it changed the behavior of a reactive bug I was working on from "throws BothBottom" to "Hang" |
| 15:53:39 | <Baughn> | Give me a few minutes |
| 15:53:55 | <conal> | Baughn: sure. just let me know. |
| 15:56:04 | <dhun> | is there a set type in Haskell? |
| 15:56:08 | <dmwit> | Data.Set |
| 15:57:12 | <dhun> | ok |
| 15:57:31 | <dmwit> | dhun: MyParser looks like a normal "data" declaration, and Environment seems to just wrap a "type" declaration. |
| 15:57:40 | <dmwit> | dhun: But your "Anything" class is a little strange. |
| 15:57:56 | <dhun> | ata Anything = Wikilink [Anything] | Dikilink [Anything]| C Char | |
| 15:57:56 | <dhun> | Evil|Empty|Something [Anything] |
| 15:58:21 | <dhun> | anything is a node in the parse tree |
| 15:58:45 | <dmwit> | Okay. That's not what it looked like from your paste. =) |
| 16:00:32 | <PeakerWork> | Baughn: do you have an automated unit test thing for this? |
| 16:01:23 | <dhun> | I can not have a set of types, can I? |
| 16:02:11 | <Baughn> | PeakerWork: It's very hard to write unit tests for race conditions, I'm afraid |
| 16:02:19 | <Baughn> | I don't know how to do it |
| 16:09:07 | <quicksilver> | Baughn: add programmable delays at every point you can |
| 16:09:21 | <quicksilver> | Baughn: fudge those delays to deliberately produce the racing interleaving. |
| 16:09:25 | <quicksilver> | or, if you like, all interleaves. |
| 16:11:09 | <Baughn> | quicksilver: I'm doing just that, and getting odd results |
| 16:12:24 | <Baughn> | quicksilver: Namely, every time I think I'm starting to understand this, it changes behavior and what used to not work suddenly works. |
| 16:13:40 | <quicksilver> | Baughn: I can well believe. |
| 16:13:49 | <quicksilver> | I intend to add such fudges to my reactive implementation |
| 16:13:53 | <quicksilver> | but I have not done so yet. |
| 16:14:14 | <Baughn> | ..it hung. I /know/ it hung! |
| 16:14:20 | <Baughn> | But now it doesn't. |
| 16:14:44 | <hackagebot> | Added by RemcoNiemeijer, Mon Jun 8 16:13:28 UTC 2009.: Benchmarking code through strict evaluation http://hackage.haskell.org/cgi-bin/hackage-scripts/package/StrictBench-0.1.1 |
| 16:17:06 | <quicksilver> | dcoutts: who administers hackagebot? |
| 16:17:21 | <sm> | good timing.. that's me |
| 16:17:35 | <sm> | was just checking it |
| 16:17:38 | <quicksilver> | sm: could I suggest you push the URL through xrl.us ? |
| 16:17:46 | <quicksilver> | or your favourite URL shortener? |
| 16:17:54 | <quicksilver> | they are a bit spammy because they're so long. |
| 16:19:07 | <sm> | that's more than I want to do, and I'm not fond of tiny urls, but I can drop the urls, or drop the timestamp which is less useful ? |
| 16:19:26 | <Baughn> | conal: http://brage.info/~svein/unamb.patch |
| 16:19:29 | <sm> | what do folks prefer ? |
| 16:20:04 | <quicksilver> | sm: I personally think hackagebot is a useful service but it should strive to be as terse as possible. |
| 16:20:06 | <Baughn> | conal: It should be good. I'm not sure what the cause of the hangs I was having were, since I suddenly can't reproduce them anymore, but it's at least a step towards correctness. |
| 16:20:08 | <doserj> | quicksilver: that would lose the packagename and version information |
| 16:20:22 | <quicksilver> | doserj: true. |
| 16:20:32 | <Axman6> | hmm, O'Reilly's "recommended to you" thing is pretty broken. it's recommending three books, ttwo of which are already i my cart |
| 16:20:34 | <hackagebot> | Added by RemcoNiemeijer, Sun Jun 7 19:53:21 UTC 2009.: Benchmarking code through strict evaluation |
| 16:20:38 | <sm> | how's that |
| 16:20:45 | <quicksilver> | another solution would be for hackage to support shorter URLs ;) |
| 16:20:56 | <quicksilver> | hackage.haskell.org/p/StrictBench-0.1.1 |
| 16:21:07 | <sm> | indeed, I just show what's in their feed (with some rewrites & selection available) |
| 16:22:23 | <sm> | the hackage-server repo awaits your patch for better urls, I think everyone would like it |
| 16:22:31 | <quicksilver> | a shorter date format would help a little I suppose |
| 16:22:54 | <sm> | I figure irc bots don't need to show timestamps, that's built in to your irc client |
| 16:23:02 | <conal> | Baughn: applying patch ... |
| 16:23:05 | <sm> | and this is more about real-time notifications |
| 16:24:37 | <quicksilver> | as long as it is actually a recent feed the date is indeed redundant |
| 16:24:45 | <quicksilver> | it's only if there was delays in the system it would matter |
| 16:24:55 | <hackagebot> | Added by RemcoNiemeijer: Benchmarking code through strict evaluation |
| 16:25:20 | <doserj> | I would put the url inbetween |
| 16:25:56 | <sm> | oh yeah.. now I've lost the package name |
| 16:25:59 | <doserj> | ACTION is bikeshedding |
| 16:26:06 | <Baughn> | conal: THat's it for today. I've an exam in, oh, fifteen hours, so.. |
| 16:26:58 | <conal> | Baughn: did you try the tests? seems to be going quite a bit slower. |
| 16:27:08 | <conal> | Baughn: first impression |
| 16:27:38 | <conal> | Baughn: and yeah -- rest up & get ready for the exam. thanks much for your help. |
| 16:28:48 | <RayNbow> | ACTION forgot cabal install doesn't work in Vista without elevated rights... |
| 16:28:53 | <Baughn> | conal: The only difference with this patch is that subordinate threads are actually getting killed. Since they're doing /very little work/, that might actually cost more than just evaluating them to the end. |
| 16:28:54 | <BMeph> | ACTION looks into plans for a Lucite(TM) bikeshed, thus avoiding all of the paintint issues... |
| 16:29:05 | <Baughn> | conal: Such optimizations are future work, anyhow. |
| 16:29:09 | <Baughn> | ACTION signs off |
| 16:29:15 | <BMeph> | ACTION meant "painting, not paintint |
| 16:29:17 | <conal> | Baughn: take care! |
| 16:29:41 | <conal> | Baughn: i'll push & release |
| 16:32:50 | <hackagebot> | Added by FrederickRoss: Pure Haskell implementation of PGM image format |
| 16:34:19 | <hackagebot> | bamboo 2009.6.8 |
| 16:34:47 | <sm> | frick, now it's upset |
| 16:35:08 | <Saizan> | who runs hackagebot ? |
| 16:35:12 | <sm> | I do |
| 16:36:12 | <hackagebot> | bamboo 2009.6.8 - A simple blog middleware on hack (JinjingWang) |
| 16:37:52 | <sm> | it's interesting how things impact people differently.. to me a single long irc message has no impact, my irc window has 15 tabs full of irc spam^h^h^h^hdiscussion |
| 16:38:10 | <TomMD> | sm: Who are you? Simon M.? |
| 16:38:11 | <hackagebot> | unamb 0.2.2 - Unambiguous choice (ConalElliott) |
| 16:38:11 | <Saizan> | oh, it's just that dons's one were taken down because it was considered mostly noise, so i'm surprised to see it here again |
| 16:38:20 | <sm> | yes, Simon Michael |
| 16:38:28 | <monochrom> | hahahaha |
| 16:38:41 | <TomMD> | Arrr, serves me right for assuming there couldn't be more simons in the Haskell universe. |
| 16:38:45 | <sm> | heh :) |
| 16:39:05 | <monochrom> | "Simon M" is clearly ambiguous. |
| 16:39:09 | <skorpan> | it's weird that so many haskellers are named simon |
| 16:39:09 | <conal> | hackagebot++ |
| 16:39:11 | <conal> | sm++ |
| 16:39:25 | <oal> | hello |
| 16:39:28 | <sm> | thanks conal :) |
| 16:39:34 | <Saizan> | conal: why? |
| 16:39:47 | <oal> | I have some troubles building head at a 64 bit linux machine |
| 16:40:14 | <sm> | Saizan: ok, I don't know that history. I've had no negative comments re hackagebot yet |
| 16:40:18 | <BMeph> | oal: suspect the problems are with HEAD, not with you. ;) |
| 16:40:21 | <quicksilver> | sm: 15 tabs? Hah! I have 86. |
| 16:40:33 | <quicksilver> | sm: but the issue is vertical space, not horizontal. |
| 16:40:37 | <sm> | I worked on dons' rss2irc specifically to make it be silent when entering the channel |
| 16:40:40 | <quicksilver> | the hackagebot messages were taking 3+ lines. |
| 16:40:48 | <oal> | BMeph, well, thought so |
| 16:40:51 | <conal> | Saizan: for hackagebot |
| 16:40:54 | <oal> | am trying at 32 bit |
| 16:40:55 | <sm> | quicksilver: I see.. better now ? |
| 16:41:06 | <quicksilver> | well, it takes much much less spce now :) |
| 16:41:07 | <oal> | actually I want a working compiler for data parallel haskell |
| 16:41:17 | <quicksilver> | I just can't decide whether I'm sad that the URL isn't there. |
| 16:41:50 | <sm> | yeah.. why don't I add it back ? After all a hackage release is a joyous event, we can allow it two lines on your screen ? :) |
| 16:41:57 | <Saizan> | well, it takes less space because it doesn't do bulk reports, right? |
| 16:43:17 | <Saizan> | sm: tinyurl the links :) |
| 16:43:27 | <oal> | oh well |
| 16:43:29 | <quicksilver> | Saizan: that was my suggestion initially. |
| 16:43:32 | <oal> | it fails for 32 bit too |
| 16:43:38 | <quicksilver> | Saizan: he said he didn't like url shorteners :) |
| 16:44:13 | <monochrom> | I don't like url shorteners either. I configure tinyurl to show me the full url first. |
| 16:44:54 | <Saizan> | uhm, why? |
| 16:44:55 | <monochrom> | I also don't like multiple lines on IRC. Everyone has 16:9 wide screens so why are you using vertical space? |
| 16:45:06 | <quicksilver> | a shortened url from a trusted bot is different from a shortened URL from a random stranger. |
| 16:45:06 | <Saizan> | it's not like the linked page can have anything surprising |
| 16:45:09 | <sm> | yes, I don't like shortened urls. They lose useful information |
| 16:45:24 | <quicksilver> | monochrom: because I use the other 2/3 of my screen for something else |
| 16:45:34 | <Saizan> | and the useful information is on the rest of the line, anyway |
| 16:45:58 | <sm> | I'm out of time, so I'll leave it for now (no urls) - if folks want these to be clickable, they should probably post on-list so we can see the consensus |
| 16:46:11 | <quicksilver> | sm: there is no useful information which is not already there. |
| 16:46:23 | <quicksilver> | sm: we already know it's on hackage (the name of the bot) the name of the package and the exact version |
| 16:46:31 | <quicksilver> | so including the full URL is redundant. |
| 16:46:44 | <quicksilver> | URLs *in general* contain useful information, sure. |
| 16:46:55 | <quicksilver> | but this particular one contains no useful information whcih is not already present. |
| 16:47:14 | <monochrom> | Everyone's IRC client wraps lines. If you write one long line, it means everyone chooses his IRC window geometry to fit his needs and you are respecting it. If you emit multiple short lines, it means you are arrogant and you are making a choice for everyone. Totally immoral. |
| 16:47:33 | <quicksilver> | oh right. |
| 16:47:38 | <Saizan> | monochrom: but one short line? |
| 16:47:39 | <quicksilver> | were we even talking about that, though? |
| 16:47:49 | <quicksilver> | we were just talking about one long line, versus one short line |
| 16:47:58 | <quicksilver> | I don't think 3 short lines was in the choices under discussion ;) |
| 16:48:01 | <monochrom> | We were talking about should hackagebot emit 3 lines or 2 or 1. |
| 16:48:07 | <quicksilver> | no, we weren't. |
| 16:48:17 | <sm> | quicksilver: agreed, including the url is only useful in allowing many readers to check out the new package with a click |
| 16:48:26 | <quicksilver> | we were talking about if the 1 line it emits could be shortened enough not to wrap too much on quicksilver's screen. |
| 16:48:31 | <monochrom> | Then what's this? <sm> yeah.. why don't I add it back ? After all a hackage release is a joyous event, we can allow it two lines on your screen ? :) |
| 16:48:33 | <EvilTerran> | i think we were, insofar as we were discussing whether the one line should be <80, <160, or <240 characters |
| 16:48:44 | <quicksilver> | because the 1 long line being emitted was 3 lines on quicksilver's screen. |
| 16:48:46 | <EvilTerran> | and hence how many lines it'd tend to wrap over |
| 16:48:47 | <Saizan> | monochrom: he was assuming it would wrap |
| 16:48:52 | <monochrom> | OK sorry. |
| 16:48:56 | <sm> | hackage bot messages are always a single line. Yup. |
| 16:48:56 | <quicksilver> | and clearly quicksilver's config is the only one worth basing decisions on. |
| 16:49:28 | <quicksilver> | after all, anyone who insists on talking about himself in the third person is clearly someone to be reckoned with. |
| 16:49:34 | <EvilTerran> | ACTION is using 1024x768, and has a nicknames pane down the right, so it's almost always gonna be two lines here |
| 16:50:12 | <oal> | btw |
| 16:50:15 | <hackagebot> | combinat 0.2.2 - Generation of various combinatorial objects. (BalazsKomuves) |
| 16:50:59 | <sm> | so to recap: hackagebot is now emitting a more terse description without the url ^^^, and if anyone wants the clicky url back, please post on haskell-cafe |
| 16:51:08 | <abbe> | monochrom: interesting quote :) |
| 16:51:08 | <oal> | oh, nevermind |
| 16:51:27 | <monochrom> | I have an interesting quote recently? |
| 16:51:27 | <Saizan> | ACTION still doesn't see the point of redirecting any rss feed to a generally busy channel |
| 16:51:52 | <abbe> | monochrom: that IRC line one :-) |
| 16:51:59 | <sm> | and if anyone wants the bot gone, please post on haskell-cafe |
| 16:55:23 | <monochrom> | I think we don't need url in hackagebot announcements. Perhaps you can call me 19th century because I don't advocate including a link in every sentence. |
| 16:55:52 | <Baughn> | I'd like links. I just don't want to see them. So use <a> tags. :3 |
| 16:56:22 | <CSWookie> | monochrom: Well they didn't have URLs in the 1800s, so it would be hard to call you 19th century. Perhaps 20th? |
| 16:56:27 | <Baughn> | ACTION drags IRC kicking and screaming into the 20th century |
| 16:56:28 | <sm> | ah that would be ideal, but irc doesn't support it |
| 16:56:33 | <sm> | (Baughn ) |
| 16:56:48 | <Baughn> | sm: Yeah, I know. IRC fails to support quite a lot of things. |
| 16:57:03 | <Saizan> | clearly we need a different medium, like for example an rss reader on another window on your desktop ;) |
| 16:57:15 | <Baughn> | No, let's modernize IRC. :P |
| 16:57:38 | <ik> | again‽ |
| 16:57:40 | <monochrom> | postmodern IRC means every package is in XML. |
| 16:57:40 | <Baughn> | It wouldn't be /that/ hard to have the client and server agree to use irc-2, otherwise fall back to irc-1. It's a wonder that nobody's done that. |
| 16:57:49 | <monochrom> | s/package/packet/ |
| 16:58:03 | <Saizan> | yeah, see XMPP/jabber |
| 16:58:08 | <bd_> | Baughn: it's because mirc's author's a jerk who doesn't participate in standards development :| |
| 16:58:20 | <ik> | forget mirc |
| 16:58:34 | <bd_> | ik: we can't forget mirc. Too many people use mirc. :| |
| 16:58:36 | <Baughn> | bd_: So? mirc users would just be stuck with irc-1 limitations |
| 16:58:36 | <mux> | it's not like mirc hindered IRC's standard development |
| 16:58:58 | <CSWookie> | Baughn: People use mirc? |
| 16:59:02 | <dcoutts> | sm, quicksilver: the way to make the hackagebot urls nicer is to make the hackage urls nicer, the new hackage-server uses just $host/packages/foo-1.0/ |
| 16:59:09 | <CSWookie> | s/Baugn/bd_/ |
| 16:59:11 | <bd_> | CSWookie: maybe not so much on freenode :) |
| 16:59:21 | <ik> | you'd be surprised |
| 16:59:24 | <ik> | there's enough of it |
| 16:59:28 | <monochrom> | Ignore mirc but make sure you get all other irc clients to reach a consensus. Then mirc will just comply. |
| 16:59:33 | <sm> | dcoutts: +1 |
| 16:59:58 | <dcoutts> | sm: I've pushed your hackage-server patches btw |
| 17:00:07 | <bd_> | monochrom: just enforcing utf8 would be a huge improvement... |
| 17:00:15 | <sm> | great! |
| 17:00:25 | <dcoutts> | sm: TomMD also has some changes |
| 17:00:54 | <dcoutts> | sm: if you have time to do any more then we should talk about what to do next |
| 17:00:54 | <BMeph> | Forget mIRC. If someone makes another client that is better than mIRC, folks will use it, just to try something different. :) |
| 17:01:04 | <sm> | ok |
| 17:01:07 | <mux> | I'd rather have the IRC protocol properly forward charset information than enforcing UTF-8 everywhere |
| 17:01:14 | <sm> | not yet, but if I do will ping you |
| 17:01:21 | <dcoutts> | sm: ok |
| 17:01:21 | <Nafai> | I haven't know anyone that uses mIRC for at least a decade :) |
| 17:01:21 | <bd_> | mux: no need to forward charset info if it's utf8. just convert at the client. |
| 17:01:35 | <Baughn> | mux: Simplest way would be to have the client convert to utf-8 and back. Nicely backwards-compatible. |
| 17:01:38 | <ik> | encoding is hard. Don't trust developers to get it right, use utf8. |
| 17:01:43 | <ik> | It's superior anyway |
| 17:01:51 | <mux> | simplest sure, but I'd rather have the protocol be charset indepedant |
| 17:02:00 | <Baughn> | Why? |
| 17:02:08 | <ik> | utf8 covers everything, doesn't it? |
| 17:02:10 | <bd_> | mux: IRC proved that to be a bad idea :| |
| 17:02:21 | <dhun> | how can I find out if x is element of the list y |
| 17:02:27 | <monochrom> | human proved to be a bad idea. |
| 17:02:28 | <mux> | bd_: IRC lacks such a mechanism |
| 17:02:28 | <Baughn> | ik: And then some. Want klingon hieroglyphs? Here you go. |
| 17:02:31 | <Twey> | dhun: x `elem` y |
| 17:02:34 | <mux> | Baughn: to not be forced to use utf-8 |
| 17:02:35 | <dhun> | thanks |
| 17:02:38 | <bd_> | mux: I hang out in channels where Japanese is spoken. You have no idea how bad things get with three or more charsets being in use at the same time... |
| 17:02:41 | <mux> | this is an IETF recommandation btw |
| 17:02:42 | <abbe> | yep, as telnet is also considered an IRC client :p |
| 17:02:46 | <ik> | Baughn: I thought that proposal was rejected |
| 17:02:53 | <Twey> | Baughn: They refuse to include Klingon in Unicode, I thought? |
| 17:03:01 | <mux> | bd_: that just wouldn't be a problem if charset was propagated... |
| 17:03:13 | <Baughn> | mux: People would get the conversion wrong |
| 17:03:16 | <bd_> | mux: and while negotiation may help, it's really a lot simpler just to use utf8. What possible reason could there be not to? |
| 17:03:21 | <mux> | not negociating |
| 17:03:26 | <mux> | forwarding |
| 17:03:30 | <Baughn> | mux: With your proposal, either the server has to convert, or every client has to understand every single charset |
| 17:03:30 | <EvilTerran> | Twey, ok, shavian quickscript? i ching hexagrams? |
| 17:03:33 | <mux> | the client then knows how to interpret the data |
| 17:03:41 | <Twey> | bd_: On IRC, little |
| 17:03:47 | <EvilTerran> | :P |
| 17:03:49 | <mux> | every client just uses iconv, end of the problem |
| 17:03:53 | <Baughn> | mux: If you stick to utf-8, then every client has to understand utf-8 - easy - and possibly what they want to convert to. Which they won't normally have to. |
| 17:03:58 | <mux> | reencoding on the server would be hugely inefficient |
| 17:03:59 | <bd_> | mux: FYI, some charsets have major de-facto but unofficial extensions. Eg, iso-2022-jp's hankaku extensions. |
| 17:04:15 | <bd_> | mux: so even if you agree to use iso-2022-jp, that's not enough. |
| 17:04:42 | <bd_> | mux: to make things even more fun, not all charsets even contain ascii. Shift-JIS has no halfwidth backslash or caret. |
| 17:04:49 | <mux> | that's a non issue |
| 17:04:51 | <Baughn> | mux: Why would I want to bloat my client with iconv when I can just pass-through unicode to the terminal? |
| 17:04:59 | <ik> | It's so much easier to use unicode! And I don't understand why you -want- to pass through every encoding |
| 17:05:04 | <ik> | You still haven't explained that |
| 17:05:12 | <mux> | Baughn: to avoid hardcoding a specific charset |
| 17:05:23 | <ik> | Why? |
| 17:05:26 | <bd_> | mux: It's a huge issue. You come in here with an english client and suddenly can't type backslash. Why? Who knows? IRC-2 is weird, let's go back to IRC-1. |
| 17:05:43 | <mux> | bd_: huh? |
| 17:06:08 | <bd_> | mux: like I said, shift-jis has no backslash. If the channel's using shift-jis, you can't represent backslash. period. |
| 17:06:21 | <mux> | ik: because UTF-8 ain't "the best possible charset in the world such taht noone will never want to use anything else", and no such charset exists |
| 17:06:36 | <ik> | mux: what symbols does it not cover? |
| 17:06:36 | <mux> | bd_: the channel isn't using any charset |
| 17:06:47 | <Baughn> | mux: Give one example of when you'd want to not use unicode. :) |
| 17:06:51 | <mux> | bd_: some client might, and too bad for it if it doesn't have backslash :) |
| 17:06:51 | <monochrom> | every sentence is tagged with its charset |
| 17:06:56 | <mux> | Baughn: UTF-8 != unicode |
| 17:07:00 | <bd_> | mux: So each client gets to pick their own? what happens if the other end doesn't have the coding tables for this charset? |
| 17:07:12 | <Twey> | UTF-8 doesn't cover all of Unicode |
| 17:07:28 | <Twey> | If you want to be safe you'd need to go with UTF-32... |
| 17:07:30 | <Baughn> | Twey: Wait, what? |
| 17:07:32 | <mux> | bd_: you realize that 99.999% of the clients will use either ASCII or UTF-8 anyways? |
| 17:07:48 | <mux> | Twey: hence why its a bad idea imho to lock yourself with just one charser |
| 17:08:05 | <Twey> | Baughn: Beg pardon. WP says it does. |
| 17:08:26 | <dhun> | is subtyping I got the data contructors of A and B and want to put them in a listß |
| 17:08:32 | <Baughn> | Twey: For the time being. Unicode could conceivably exceed its limits, but it'd take some doing. |
| 17:08:48 | <Baughn> | Twey: It doesn't cover the full 32-bit space, that's true. Oh, and it's ucs-32, not utf-32 |
| 17:08:55 | <Baughn> | Er. Rather, UCS-4 |
| 17:09:02 | <Twey> | Right. |
| 17:09:20 | <Twey> | Oh really? |
| 17:09:22 | <monochrom> | dhun: No, that is not subtyping. |
| 17:09:33 | <mux> | it's very possible that one day utf-8 will be less used in favor of some other encoding, for instance for performance reasons |
| 17:09:34 | <Twey> | What's with the naming? WP has both ([[UTF-32/UCS-4]]) |
| 17:09:35 | <bd_> | mux: Yes, and nobody will test that last 0.001%. |
| 17:09:52 | <bd_> | mux: And then if you don't have the charset it will *break* and nobody will know why. |
| 17:10:06 | <raji> | Are there any tools that help you detect deadlocks or starvation ? how not to make mistakes while doing multi threading |
| 17:10:08 | <EvilTerran> | ACTION encodes all his text in WTF-23 |
| 17:10:11 | <dhun> | well if I say A is Subtype of C and B is as well I can have a [C], in which I can put both |
| 17:10:13 | <Twey> | mux: That's already the case where non-ASCII characters are common — you save 1/3 for Asian characters |
| 17:10:22 | <Twey> | EvilTerran: Heh |
| 17:10:22 | <Baughn> | Twey: Mm, utf-8 only covers unicode 0x0 through 0x10ffff |
| 17:10:26 | <EvilTerran> | raji, that's a Hard Problem |
| 17:10:28 | <mux> | bd_: nope, at worse people with a system that don't support such an encoding will get an error message saying that the message cannot be decoded |
| 17:10:49 | <Baughn> | Twey: (It would obviously be trivial to extend, mind) |
| 17:10:53 | <Twey> | Aye. |
| 17:10:56 | <bd_> | mux: And how are they supposed to fix this? Think of the users :) |
| 17:10:59 | <dhun> | can I do anything similar? |
| 17:11:13 | <bd_> | mux: What actual, real languages have iconv-supported charsets but can't be represented by utf8? |
| 17:11:30 | <raji> | EvilTerran, how not to make mistakes while doing multi threading, any guidelines. There should be some form of emperical measurement ? I mean in algorithms you can increase the data size ,draw a graph and make approximate O(n^x) . |
| 17:11:35 | <monochrom> | If you write "data C = A | B" it is not subtyping. There is no subtype "A" created. Only the value "A" created. |
| 17:11:51 | <bd_> | mux: hint: iconv, like just about every charset-conversion library, uses unicode as an intermediate representation :) |
| 17:12:03 | <dhun> | yes right, but I would like to have subtyping as in OOP |
| 17:12:07 | <mux> | bd_: it's not about utf-8 not being able to represent any character, it's about the fact that there is no "one charset that rules them all" |
| 17:12:15 | <mux> | bd_: you want your protocol to last, don't you ? |
| 17:12:16 | <monochrom> | Haskell98 doesn't have subtyping. |
| 17:12:36 | <dhun> | any idea how to work around the problem |
| 17:12:39 | <Twey> | dhun: I think you probably want a typeclass |
| 17:12:43 | <bd_> | mux: Yes, and I trust unicode to do a lot better at that than making a list of ten thousand character sets every client needs to support. |
| 17:12:51 | <dhun> | I will lool |
| 17:12:57 | <mux> | bd_: once again, utf-8 != unicode |
| 17:13:06 | <bd_> | mux: and utf8 covers all of unicode |
| 17:13:08 | <Twey> | If both A and B are instances of C then you can have a [C a => a] |
| 17:13:18 | <Twey> | Or rather, a C a => [a] |
| 17:13:22 | <mux> | utf-8 is just one way to encode unicode, among many others |
| 17:13:33 | <mux> | where others might be more suitable for performance reasons, for instance |
| 17:13:46 | <monochrom> | Re-architect your design so you don't talk about subtypes subclasses etc. |
| 17:13:54 | <Twey> | ACTION nods. |
| 17:13:57 | <Baughn> | [forall a. C a => a] <-- I want this ;_; |
| 17:14:00 | <bd_> | mux: okay, and if that becomes a problem a server extension can be proposed where the server transcodes losslessly to another unicode representation |
| 17:14:00 | <mux> | utf-8 is a nice default charset, and should definitely be supported, but I don't think you should limit yourself to it |
| 17:14:02 | <Twey> | You're probably doing something wrong. |
| 17:14:08 | <Twey> | Baughn: Hehehe |
| 17:14:17 | <mux> | bd_: ugh, the server reencoding messages would be a terrible botleneck |
| 17:14:20 | <Saizan> | Baughn: no, you don't, you want [exists a. C a => a] |
| 17:14:31 | <Baughn> | Saizan: Probably. |
| 17:14:36 | <mux> | bd_: this is why HTTP forwards charsets :-P |
| 17:14:39 | <bd_> | mux: But what's worse is requiring the client to support an open-ended set of encodings. |
| 17:14:44 | <Baughn> | Saizan: ..how did that translate to forall, again? |
| 17:15:09 | <Saizan> | [(forall a. C a => a -> r) -> r] |
| 17:15:09 | <monochrom> | Make good use of "data C = A | B". Although "A" is a value not a type, it still represents the high-level goal that "there are two cases, case A and case B". |
| 17:15:11 | <mux> | bd_: in practice, it's not, and it works fairly well for HTTP |
| 17:15:19 | <dhun> | just pasted http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/haskell |
| 17:15:26 | <Saizan> | [forall r. (forall a. C a => a -> r) -> r] to be precise |
| 17:15:31 | <bd_> | mux: I regard that as legacy, however. |
| 17:15:36 | <Baughn> | Saizan: ..No, I don't think I want that |
| 17:15:41 | <bd_> | mux: What -actual advantage- does this have? |
| 17:15:41 | <monochrom> | You don't "need" OOP to represent "I have several cases". |
| 17:15:43 | <Baughn> | Saizan: Is that /really/ the same type? |
| 17:15:54 | <dhun> | this line does not work [WikitableP, WikilinkP] |
| 17:16:00 | <Saizan> | Baughn: don't you want something like data AnyC = forall a. C a => AnyC a, [AnyC] ? |
| 17:16:03 | <mux> | bd_: I said that already: the fact that you don't limit yourself to one specific charset |
| 17:16:20 | <bd_> | mux: I consider that to be a disadvantage. Why do we want this? |
| 17:16:44 | <bd_> | Yes, UTF-32 or what-have-you might be marginally better in some cases. But bandwidth is cheap. CPU is cheap for the client. |
| 17:16:45 | <Baughn> | Saizan: ..I have no idea. |
| 17:16:49 | <Saizan> | Baughn: exists a. C a => a ~~ AnyC ~~ forall r. (forall a. C a => a -> r) -> r |
| 17:16:53 | <Twey> | Practically speaking, mux, you're probably never going to need more than UTF-16. |
| 17:16:54 | <Baughn> | Saizan: Eh. I'll re-read the documentation later. |
| 17:17:00 | <Baughn> | Saizan: And now you're just talking greek. |
| 17:17:15 | <Saizan> | Baughn: by ~~ i meant isomorphic to |
| 17:17:18 | <Twey> | At least in any reasonable timeframe for which your protocol could remain non-obsolete. |
| 17:17:18 | <mux> | bd_: so that you don't have to reset to hacks such as the one you suggested: introduce extensions to support specific additional charsets (which will break some clients) and/or reencoding at the server level |
| 17:17:24 | <mux> | s/reset/resort/ |
| 17:17:48 | <Saizan> | Baughn: and [exists a. C a => a] is a list of values potentially of different types but all being instances of the C class |
| 17:17:50 | <mux> | Twey: most people asserting things like that end up being wrong, it's just a matter of time :-P |
| 17:17:54 | <Baughn> | Saizan: I should be reading up on federated databases, not discussing haskell. See you tomorrow, probably. :P |
| 17:17:57 | <Twey> | mux: Obviously this has happened before with ASCII to other things, but Unicode is different |
| 17:18:04 | <mux> | Twey: and it's really not about a representation issue |
| 17:18:05 | <Twey> | 'bye Baughn :) |
| 17:18:21 | <Twey> | Unicode is a) HUGE and b) extensible with plenty of space left to spare |
| 17:18:23 | <Saizan> | Baughn: it wasn't really a discussion :) |
| 17:18:26 | <bd_> | mux: They're unnecessary anyway. If the unicode space is enough, just use utf8. If unicode space is not enough, what are you smoking? :) |
| 17:18:31 | <dhun> | this does not work: |
| 17:18:33 | <dhun> | lr ::(MyParser a=>[a]) |
| 17:18:33 | <dhun> | lr=[WikitableP, WikilinkP] |
| 17:18:34 | <mux> | utf-8 makes some algorithms much slower since you can't have random access |
| 17:18:42 | <Twey> | mux: So go for UTF-16 |
| 17:18:48 | <Baughn> | Twey: Same problem |
| 17:18:54 | <mux> | it's not unlikely that one would be willing to use another encoding in specific situations, which is why those other encodings exist |
| 17:18:54 | <bd_> | mux: it's a *transport encoding*. Convert it to UCS-4 at the client. |
| 17:18:56 | <Twey> | Baughn: Oh, point |
| 17:19:03 | <Twey> | UTF-32/UCS-4 it is, then |
| 17:19:11 | <Baughn> | Twey: UCS-4. THere is no UTF-32. |
| 17:19:27 | <Twey> | Baughn: I asked you to explain this nomenclature confusion :-P |
| 17:19:36 | <Twey> | WP calls it UTF-32 |
| 17:19:37 | <Saizan> | dhun: that can't work |
| 17:19:44 | <Baughn> | Twey: UTF-x means "variable-length encoding, x-bit chunks" |
| 17:19:44 | <mux> | bd_: yes, and some day you might want to use another transport encoding :-) but we're going in circles here... |
| 17:19:57 | <Twey> | UTF-32 was originally a subset of the UCS-4 standard, but the Principles and Procedures document of JTC1/SC2/WG2 states that all future assignments of characters will be constrained to the BMP or the first 14 supplementary planes, and has removed former provisions for private-use code positions in groups 60 to 7F and in planes E0 to FF. |
| 17:20:02 | <bd_> | mux: 'might want to use' is no reason to give clients free license to annoy each other today ;) |
| 17:20:02 | <Twey> | Accordingly UCS-4 and UTF-32 are now identical except that the UTF-32 standard has additional Unicode semantics. |
| 17:20:03 | <Baughn> | Twey: UCS-n means "fixed-length encoding, n-byte code-points" |
| 17:20:04 | <Saizan> | dhun: lr doesn't contain polymorphic values |
| 17:20:24 | <mux> | bd_: this is not what would happen practically, and I think you agree to this. |
| 17:21:00 | <Baughn> | Twey: UTF-32 would have been /eight/ bytes for anything in planes 80 through FF, four otherwise |
| 17:21:24 | <dhun> | the question is, what is the right way to do it |
| 17:21:25 | <dhun> | ? |
| 17:21:29 | <Twey> | Hmn, okay. |
| 17:21:33 | <bd_> | mux: No, it will. I assure you of this. |
| 17:21:36 | <Saizan> | dhun: if lr :: MyParser a => [a], it means that the user of "lr" can decide what 'a' is, not lr |
| 17:21:37 | <Baughn> | Twey: But we've got.. how many planes in use? Two? |
| 17:21:48 | <Twey> | Yeah, I don't think they've filled up the second one, yet. |
| 17:21:50 | <dhun> | ok |
| 17:21:59 | <bd_> | mux: mIRC, even today, has incredibly broken unicode support. If mirc moved to irc-2, I can guarentee you it will start sending sjis or iso-8859-1 on the wire if allowed to. |
| 17:22:03 | <Baughn> | Right, which makes utf-32 a mite silly |
| 17:22:03 | <mmorrow> | @remember quicksilver after all, anyone who insists on talking about himself in the third person is clearly someone to be reckoned with. |
| 17:22:03 | <lambdabot> | Done. |
| 17:22:05 | <mmorrow> | lol |
| 17:22:08 | <Twey> | Heh, bd_ |
| 17:22:10 | <Saizan> | dhun: first of all, why do you want it to have that type? |
| 17:22:14 | <mux> | bd_: it will be as much as an annoyance as the day you'll want to support additional charsets in your irc-all-in-utf8 protocol |
| 17:22:22 | <Twey> | mIRC sometimes likes to *alternate* character encodings. |
| 17:22:22 | <mux> | who cares about mIRC, seriously? |
| 17:22:27 | <Saizan> | dhun: and what are the types of the values contained? |
| 17:22:28 | <bd_> | Twey: Within the same line. |
| 17:22:34 | <mux> | we're talking about designing a new protocol |
| 17:22:37 | <And[y]> | hi, how can i check, which types haskell implicty choose for a given function? |
| 17:22:40 | <Twey> | I've never seen that. |
| 17:22:41 | <dhun> | well look at http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/haskell |
| 17:22:51 | <Twey> | And[y]: Open it up in GHCi and do a :t |
| 17:23:00 | <dcoutts> | Baughn: huh? 8 bytes? surely even the crazy unicode people would not have thought we'd ever need more than 32bits for code points? |
| 17:23:10 | <Baughn> | dcoutts: That's why utf-8 is silly |
| 17:23:13 | <dhun> | both elements of the list are parsers |
| 17:23:19 | <Baughn> | dcoutts: Er. utf-32 |
| 17:23:21 | <bd_> | mux: Yes, and if it gets popular, here comes mirc. My intent is to force clients to not screw up, and put blame on them if they do. The server should disconnect instantly if you break protocol rules. If you don't, people get lazy. |
| 17:23:31 | <And[y]> | Twey: thats exactly what i wanted, thx :) |
| 17:23:36 | <Baughn> | dcoutts: And no, utf-32 would've used eight bytes for code points where the 31st (highest) bit is set |
| 17:23:38 | <mux> | bd_: if clients work so poorly that they can't decode messages properly, people won't be using them |
| 17:23:48 | <bd_> | mux: So if you allow a completely open-ended set of encodings, without giving any recommendations or limits on what you can do, you WILL see ALL possible values used. |
| 17:23:57 | <bd_> | mux: You wish :) |
| 17:24:00 | <dhun> | Hey yitz, it works without Bad now |
| 17:24:03 | <dcoutts> | Baughn: oh, crazy. |
| 17:24:04 | <mauke> | Baughn: [citation needed] |
| 17:24:04 | <Baughn> | dcoutts: Or would it.. hm, I think I got that wrong. Well, it would've used eight bytes for /some/ points, anyhow |
| 17:24:14 | <mux> | bd_: not completely - utf-8 should be the default (this is also an IETF recommendation), because it is a sane default |
| 17:24:22 | <Saizan> | dhun: i think you're still using a too OO design, that doesn't work out very well in haskell |
| 17:24:31 | <dhun> | I think so too |
| 17:24:33 | <bd_> | mux: Just because you say it should be the default, does not mean it will be the default. |
| 17:24:42 | <mux> | IETF actually forbids not supporting utf-8 |
| 17:24:47 | <dhun> | the questing is how can I redesign it |
| 17:24:54 | <Baughn> | Twey: He speaks the truth. Windows hands mirc unicode; if you give it a letter that can't be encoded using the current encoding.. guess what. |
| 17:25:00 | <bd_> | mux: Basically, if you want to allow other charsets, fine, but don't force every client to deal with it. |
| 17:25:07 | <Twey> | Gack. |
| 17:26:13 | <mux> | anyways, I'm outta here, cya |
| 17:26:48 | <And[y]> | now i have a function called nthElem: |
| 17:26:54 | <And[y]> | nthElem (l:lr) 1 = l |
| 17:26:54 | <And[y]> | nthElem (l:lr) n = nthElem lr (n-1) |
| 17:27:02 | <And[y]> | i thought it should be typed like: nthElem :: [Int] -> Int -> Int |
| 17:27:03 | <Saizan> | dhun: uhm, i'd make MyParser a record type rather than a class |
| 17:27:10 | <And[y]> | haskell choose: nteElement :: Num a => [b] -> a -> b |
| 17:27:18 | <And[y]> | whats wrong with my assumption? :D |
| 17:27:53 | <mauke> | And[y]: why would it be restricted to [Int]? |
| 17:28:01 | <mauke> | And[y]: it doesn't do anything with the list elements |
| 17:28:23 | <And[y]> | only coz i wanted it to work on int lists, only, tbh |
| 17:28:40 | <mauke> | well, it works for all lists :-) |
| 17:28:52 | <paggas_> | when writing "par a b", what if b uses a before it is done computing? |
| 17:28:52 | <Baughn> | And[y]: How does it differ from (!!)? ;) |
| 17:29:09 | <dhun> | are there any exmaples on that? |
| 17:29:23 | <And[y]> | hmmm, dunno Baughn ... never saw (!!) before :D |
| 17:29:40 | <Baughn> | And[y]: At this point in your career, just assume there'S a function to do it. :P |
| 17:29:48 | <hackagebot> | LambdaCalculator 0.0.1 - A basic lambda calculator with beta reduction and a REPL (ThomasDuBuisson) |
| 17:30:12 | <And[y]> | lets say i wanted it to only accept int lists ... what should i write then? :> |
| 17:30:37 | <mauke> | a type signature |
| 17:30:39 | <Baughn> | And[y]: nthElement :: [Int] -> Int -> Int |
| 17:30:44 | <Baughn> | And[y]: nthElement = (!!) |
| 17:31:01 | <And[y]> | okay, thank you, i will try :) |
| 17:31:16 | <Apocalisp> | How would you turn a String into a unix timestamp (Int)? |
| 17:31:17 | <Baughn> | Though I don't understand why you'd want to. |
| 17:31:24 | <Baughn> | Apocalisp: reads? |
| 17:31:33 | <Baughn> | Apocalisp: Wait, what sort of string? |
| 17:31:42 | <Apocalisp> | "12:45 AM" |
| 17:31:46 | <Apocalisp> | that kind of thing |
| 17:32:36 | <Baughn> | You'd have to parse the string, but Data.Time.Clock has some useful functions for this |
| 17:32:38 | <BMeph_> | ACTION wants a fudge REPL... |
| 17:32:52 | <Baughn> | Apocalisp: So does Data.TIme.Calendar.. but as you can see, it isn't a simple problem. |
| 17:33:09 | <Baughn> | Apocalisp: What date is "1 year ago" on february 29th? How about on march 1st if there was a leap day? |
| 17:33:28 | <Baughn> | Or if there was one last year? |
| 17:33:48 | <Baughn> | Never mind that a year is 365.25 days. :P |
| 17:33:58 | <osfameron> | and don't forget leap seconds! |
| 17:34:02 | <Baughn> | Never! |
| 17:34:21 | <Baughn> | You'll also have to do gregorian/julian conversions for sufficiently old dates |
| 17:34:32 | <BMeph_> | What are leapseconds? Did I forget them, or was I never told? ;) |
| 17:35:02 | <Baughn> | BMeph_: Corrections for the varying rotational speed of earth, mostly |
| 17:35:13 | <Baughn> | BMeph_: They get announced some time in advance. |
| 17:35:14 | <osfameron> | time-geeks get excited about them.. |
| 17:35:37 | <osfameron> | apparently they're Important |
| 17:36:03 | <osfameron> | datetime maths makes me cry |
| 17:36:58 | <BMeph_> | osfameron: Important like a cog is? ;) |
| 17:37:18 | <osfameron> | cog? |
| 17:37:31 | <Baughn> | BMeph_: As important as a horse-shoe. |
| 17:37:49 | <Apocalisp> | Why would you wear a horse for a shoe? |
| 17:38:01 | <Baughn> | Apocalisp: To go faster! |
| 17:38:05 | <gwern> | Baughn: hey, kingdoms have been lost because of horsehoes |
| 17:38:07 | <Apocalisp> | of course! |
| 17:38:15 | <osfameron> | one horse per foot? |
| 17:38:19 | <Baughn> | Yes! |
| 17:38:25 | <gwern> | osfameron: oh, you need several hundred |
| 17:38:25 | <ski> | Saizan : s/[exists a. C a => a]/[exists a. C a *> a]/ |
| 17:38:29 | <Apocalisp> | Horseskates |
| 17:38:36 | <gwern> | if you want to have decent transportation |
| 17:38:41 | <Baughn> | osfameron: http://ghostlightning.files.wordpress.com/2009/04/sengoku-basara-02-takeda-shingen-scales-a-castle-on-top-of-2-horses.jpg <-- Like this |
| 17:39:23 | <osfameron> | heh |
| 17:39:45 | <Saizan> | dhun: like this http://pastebin.com/m652a6154 |
| 17:40:27 | <Saizan> | dhun: then you can use [wikitablep,wikilinkp] :: [MyParser] |
| 17:40:34 | <Saizan> | ski: oh, right :) |
| 17:40:50 | <mmorrow> | paggas_: if `b' uses `a' and `a' hasn't produced any useable (sub-)results yet, b'll have to wait |
| 17:41:28 | <dhun> | thank you |
| 17:42:04 | <BMeph_> | osfameron: http://motivatedphotos.com/?id=454 |
| 17:42:08 | <Saizan> | dhun: except that maybe you want to change the type of the allowed field |
| 17:42:18 | <ski> | (Saizan : i've not seen any other suggestion for notation for `*>', so i'm using that for the time being .. i'd like people to notice the difference to `=>') |
| 17:42:21 | <mmorrow> | paggas_: so if (a = sum [0..999999999]) or something, and `b' uses `a', then the `par` was probably for the worst |
| 17:42:33 | <Saizan> | dhun: maybe make it "Anything -> Bool" |
| 17:43:12 | <ski> | Saizan> @src Anything |
| 17:43:15 | <Saizan> | dhun: since you cant compare unapplied constructors like you are trying to do with elem in the body of anything |
| 17:43:27 | <Saizan> | ski: http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/haskell |
| 17:43:29 | <ski> | Saizan : oh, dhun provided it. nvm |
| 17:44:42 | <Saizan> | or i guess one could change the Anything type |
| 17:44:46 | <dhun> | will need some time to understand that, but will work |
| 17:44:52 | <hackagebot> | test-framework 0.2.3 - Framework for running and organising tests, with HUnit and QuickCheck support (MaxBolingbroke) |
| 17:45:03 | <paggas_> | mmorrow, but i can have e.g. (a = iterate f x) and b will be able to use the produced list element by element as they are computed, with a and b running in parallel indefinitely? |
| 17:45:22 | <ski> | dhun : instead of `app2 l p b k se= ..(head l)..(tail l)..' use `app2 (x:l) p b k se = ..x..l..' |
| 17:45:44 | <ski> | looks much nicer with pattern-matching |
| 17:45:44 | <dhun> | yes |
| 17:46:06 | <ski> | also, in `app' use matching on the left-hand side of `=', instead of `case' |
| 17:46:19 | <lilac> | Baughn: unix timestamps don't use leap seconds. and they do leap-years wrong too. |
| 17:46:48 | <ski> | app z p b (Evil:_) = return [Evil] |
| 17:46:54 | <Baughn> | lilac: Well, there is that.. |
| 17:47:03 | <lilac> | it makes the problem quite a lot easier |
| 17:47:07 | <ski> | app z p b (Empty:_) = try (...) <|> return [Empty] |
| 17:47:16 | <Baughn> | lilac: No, it means you have to compensate for that |
| 17:47:25 | <ski> | app z p b (Something x:_) = return [Something x] |
| 17:47:32 | <ski> | dhun : like that |
| 17:47:36 | <lilac> | Baughn: why? |
| 17:47:36 | <dhun> | ok |
| 17:48:00 | <ski> | (dhun : i put `_' there since you weren't using `tail k' anywhere) |
| 17:48:11 | <dhun> | yes |
| 17:48:30 | <Baughn> | lilac: You can't just ignore the leap seconds. You might get whole seconds off from the truth. |
| 17:48:48 | <lilac> | Baughn: the whole point of that simplification is that you /can/ |
| 17:49:37 | <lilac> | Baughn: Jan 1 2009 as a unix timestamp is (39 * 365 + 9) * 86400 |
| 17:50:01 | <lilac> | (yes, 2000 was a leap year according to time_t) |
| 17:50:45 | <lilac> | although determining the number of actual seconds between two time_t values is hard... |
| 17:50:47 | <ski> | dhun : instead of `if r==False then ... else ...' use `if not r then ... else ...' |
| 17:51:21 | <Saizan> | dhun: oh, and try to avoid tabs, you'll find that dealing with layout becomes much simpler |
| 17:51:28 | <jthing> | a year is approx 265.2425 day's (365 + 1/4 - 1/100 + 1/400) su oit is often easier to do date computations in julian days |
| 17:51:30 | <CSWookie> | Don't forget double-leap seconds. |
| 17:51:35 | <CSWookie> | My personal favorite. |
| 17:51:46 | <Saizan> | dhun: set your editor to insert spaces when you use the tab key |
| 17:51:51 | <Axman6> | ski: i'd usuallt recommend that too, but thinking about it, i think r == False is clearer |
| 17:51:54 | <roconnor> | CSWookie: when do those happen? |
| 17:51:54 | <Axman6> | reads better |
| 17:51:55 | <ski> | dhun : instead of `if l==[Evil] then ... else ...' i'd probably do `case l of {[Evil] -> ... ; _ -> ...}' .. but ymmv |
| 17:52:03 | <yitz> | CSWookie: there have never been any of those |
| 17:52:19 | <CSWookie> | yitz: Of course there have. They're an astronomical thing. |
| 17:52:23 | <ski> | Axman6,(dhun) : hm, that might be in this particular case .. why ? |
| 17:52:31 | <CSWookie> | yitz: Well, maybe not of course. |
| 17:52:36 | <ski> | ACTION has btw no idea what the code is really doing |
| 17:53:18 | <ski> | hm, `r<-try(p)<|>return False' looks a bit strange, i suppose |
| 17:53:36 | <ski> | there should be a better way to do this, i think |
| 17:54:03 | <yitz> | CSWookie: @google table of leap seconds |
| 17:54:09 | <yitz> | @google table of leap seconds |
| 17:54:10 | <lambdabot> | Plugin `search' failed with: Lib.URL.isTextHTML: getHeader failed |
| 17:54:15 | <yitz> | urgh |
| 17:54:23 | <ski> | first, instead of that repeated `r == False' test, the test should be done once |
| 17:54:25 | <yitz> | http://tf.nist.gov/pubs/bulletin/leapsecond.htm |
| 17:54:31 | <ski> | dhun : ^ |
| 17:54:56 | <dhun> | I am reading the discussion |
| 17:55:19 | <ski> | then, maybe one can avoid the `<|> return False' part, if that is a workaround |
| 17:55:23 | <yitz> | dhun: sorry I had to run out earlier. glad to see that you're making progress. :) |
| 17:55:32 | <roconnor> | @hackage leapseconds-announced |
| 17:55:32 | <lambdabot> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/leapseconds-announced |
| 17:56:21 | <mmorrow> | paggas_: yes |
| 17:56:41 | <roconnor> | http://hackage.haskell.org/packages/archive/leapseconds-announced/2009/doc/html/src/Data-Time-Clock-AnnouncedLeapSeconds.html#leapSeconds |
| 17:56:41 | <ski> | it appears that if `p' succeeds in parsing, you want to parse a few things more, otherwise you want to do something else |
| 17:57:09 | <ski> | or, hrm |
| 17:57:23 | <dhun> | if p fails! |
| 17:57:24 | <ski> | `p' might succeed, but still return `False' |
| 17:57:26 | <ski> | right |
| 17:57:35 | <paggas_> | mmorrow, nice, thanks! |
| 17:57:37 | <dhun> | p can only return true |
| 17:57:39 | <mmorrow> | paggas_: a nice example of a `par` use is ==> mean xs = let n = length xs; s = sum xs in n `par` s `pseq` s / n |
| 17:57:42 | <dhun> | thats may convention |
| 17:57:55 | <mmorrow> | paggas_: (foldl' (+) 0 instead of sum and fromIntegrals omitted) |
| 17:57:57 | <ski> | dhun : then why does it have a `Bool' monadic return type ? |
| 17:57:59 | <yitz> | roconnor: ah, yes. much clearer. thank you. :) |
| 17:58:15 | <dhun> | because I want to see if p matches or not |
| 17:58:19 | <ski> | dhun : if it can't return `False', imo it should have type `Parser ()' |
| 17:58:20 | <dhun> | so I need two states |
| 17:58:28 | <dhun> | no |
| 17:58:28 | <ski> | you can see that anyway |
| 17:58:29 | <mmorrow> | paggas_: that'll run down the list in parallel computing length and sum |
| 17:58:40 | <dhun> | I want r to be false if p didn't match |
| 17:58:45 | <ski> | if you reach the second branch of the `<|>', then the first branch failed |
| 17:58:50 | <paggas_> | mmorrow, and also in constant space? |
| 17:58:56 | <mmorrow> | paggas_: exactly |
| 17:59:02 | <dhun> | yes |
| 17:59:07 | <ski> | dhun : yes, but for what *purpose* ? |
| 17:59:21 | <ski> | why bother with `r' at all, if you can avoid it ? |
| 17:59:30 | <mmorrow> | paggas_: (so if the list was infinite, although it wouldn't ever finish, i'm pretty sure it'd run in constant space) |
| 17:59:41 | <dhun> | I think I can not avoid it |
| 18:00:00 | <ski> | you're saying `p' will only ever return `True' |
| 18:00:01 | <mmorrow> | paggas_: at least, if it didn't run in constant space that'd prob be considered a bug |
| 18:00:08 | <ski> | (or fail, but then it doesn't return anything) |
| 18:00:09 | <paggas_> | mmorrow, though it seems a little overkill in this case, a nice example nonetheless :) |
| 18:00:12 | <mmorrow> | heh |
| 18:00:24 | <dhun> | yes but I need to know if it matched |
| 18:00:44 | <dhun> | its a parser |
| 18:00:50 | <ski> | yes, wait a moment |
| 18:04:00 | <BMeph_> | ACTION starts humming the tune, "UR DOIN IT RONG"... |
| 18:04:05 | <ski> | assuming `p' never monadically returns `False', it appears to me what you wrote in the `Empty' branch there is the same as |
| 18:04:09 | <ski> | do try p |
| 18:04:12 | <ski> | return [] |
| 18:04:13 | <paggas_> | mmorrow, in the means example, to run in constant space the two threads should be synchronized, no? so neither runs too far in the list with the other lagging behind. but how do you make sure this doesn't happen? |
| 18:04:15 | <ski> | <|> do c <- anyChar |
| 18:04:19 | <ski> | l <- anything p b se |
| 18:04:20 | <ski> | return ([C c] ++ l) |
| 18:04:26 | <ski> | dhun : what you say ? |
| 18:04:37 | <mmorrow> | paggas_: heh, just tested the infinite mean const space thing, and it does NOT run in constant space :( |
| 18:04:57 | <hackagebot> | iteratee 0.2 - Iteratee-based I/O (JohnLato) |
| 18:05:22 | <dhun> | but in case true I want to return the empty list |
| 18:05:35 | <ski> | dhun : in case `p' succeeds in parsing, the whole returns `[]'; otherwise, we read a char into `c', some "anything" stuff into `l' and return `C c : l' like you did in your code |
| 18:05:41 | <ski> | yes |
| 18:05:58 | <ski> | if `p' succeeds parsing, then the `return []' will be called |
| 18:06:17 | <ski> | the second branch of `.. <|> ..' will not be used, since the first one succeeded |
| 18:06:18 | <dhun> | ok I will try that |
| 18:06:30 | <paggas_> | mmorrow, probably one thread is faster than the other and evaluates the list, taking up space, without the other thread consuming as fast |
| 18:06:41 | <ski> | (also, this way there should be no need to put dummy values into `c' and `l' like you tried in your code) |
| 18:06:42 | <mmorrow> | paggas_: yeah, one way threads/sparks sync is, when a node gets evaluated it's marked as a blackhole, and any other thread that tries to evaluate that blackhole gets grabbed and put in a wait queue for that node |
| 18:07:10 | <mmorrow> | (and once it's done evaluating threads can access it in parallel, since it's never again mutated) |
| 18:07:13 | <ski> | (dhun : if you prefer, you can put `{',`;',`}' delimiters into it ..) |
| 18:07:47 | <dhun> | yes but it will take some time until I will be able to try it |
| 18:07:54 | <ski> | ok |
| 18:07:56 | <mmorrow> | paggas_: hmm, interesting. i wonder if there's some way to tweak that mean to force the threads to "stay close" |
| 18:07:57 | <dhun> | first I have to get things working again |
| 18:08:34 | <ski> | dhun : btw, note that my rewriting above dependend on `p' only ever returning `True', never `False' .. otherwise one can't rewrite that simply |
| 18:08:57 | <paggas_> | mmorrow, seems to me it needs some annotations on the list itself :) no idea though |
| 18:08:58 | <dhun> | but that is the case |
| 18:09:10 | <ski> | fine, then |
| 18:11:10 | <mmorrow> | paggas_: (i have 2 cores) interestingly up to -N7 all don't run in constant space, but -N8 or more does |
| 18:11:28 | <conal> | is it possible to import a data constructor without importing the corresponding data type? |
| 18:11:37 | <mmorrow> | (but this is probably for some random reason) |
| 18:12:00 | <conal> | i know how to import just the data type, or the data type and some constructors, but not a constructor without the data type. |
| 18:12:08 | <BMeph_> | ACTION is now away - Reason : Auto-Away after 30 minutes |
| 18:12:29 | <BMeph_> | ACTION is no longer away : Gone for 30 minutes 20 seconds |
| 18:13:03 | <ski> | ACTION raises eyebrow |
| 18:15:08 | <dhun> | ski it works |
| 18:15:38 | <ski> | you can replace `[C c] ++ l' with `C c : l' if you want. it's the same |
| 18:16:05 | <dhun> | yes |
| 18:16:19 | <dino-> | conal: I'm not sure but I don't think so. I wonder if this is where one gets to making a mkMyDataType function that makes one and exporting that but not the type itself. |
| 18:16:32 | <ski> | ACTION feels tempted to fix up the formatting of dhun's code |
| 18:16:52 | <conal> | dino-: i suppose so. |
| 18:17:11 | <ski> | dhun : anyway, now possibly you can change the type of `p' from `Parser Bool' to `Parser ()' ? |
| 18:17:33 | <conal> | dino-: although i also want to pattern-match against the constructor. |
| 18:17:34 | <dirk_> | dirk_ <- dhun |
| 18:18:14 | <ski> | * ski feels tempted to fix up the formatting of dhun's code |
| 18:18:15 | <ski> | <ski> dhun : anyway, now possibly you can change the type of `p' from `Parser Bool' to `Parser ()' ? |
| 18:18:41 | <dirk_> | yes |
| 18:19:03 | <ski> | (which ? :) |
| 18:19:14 | <dirk_> | ? |
| 18:19:43 | <ski> | you want me to try fixing the formatting or you can change that `Bool' to `()' ? |
| 18:20:11 | <dirk_> | no I will do it myself |
| 18:20:32 | <dino-> | conal: You can export only selected constructors for matching (and construction). I'm having difficulty seeing a situation where you don't want the type as a whole visible. Can you give me an example? |
| 18:21:30 | <dirk_> | ok done |
| 18:22:09 | <conal> | dino-: i have a more general form of the type that i want to import qualified and then use it to define a more specialized form of the type, with the convenient name. e.g., type Foo = R.Foo Integer |
| 18:23:35 | <dino-> | huh, general form of the type |
| 18:24:51 | <dirk_> | sky but if you got more things you are unhappy with in my code just tell me |
| 18:25:47 | <dino-> | That gets me off down a rut thinking about OO and inheritance. |
| 18:25:52 | <mmorrow> | paggas_: this is interesting: http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2598#a2598 |
| 18:26:10 | <mmorrow> | paggas_: so walking in parallel over chunks of configurable size.... |
| 18:26:30 | <mmorrow> | paggas_: chunk-size = 10000000 and non-const mem use |
| 18:26:34 | <paggas_> | mmorrow: but this works only for lists? |
| 18:26:43 | <mmorrow> | paggas_: chunk-size = <1000000 ==> const-mem use |
| 18:27:13 | <mmorrow> | paggas_: yes, although most structures probably have an analog of `parChunkAccum' |
| 18:27:32 | <mmorrow> | (that might be a worthwhile class actually) |
| 18:28:55 | <paggas_> | mmorrow: thing is, since one thread will probably be faster than the other, you end up with a constant distance between the progress of the two threads (of one chunk or so), and that distance remains more or less constant, so why not just synchronize them at a chuck of size 1? :D |
| 18:29:08 | <mmorrow> | paggas_: oops, the poor-par one in that comment should read "./mean +RTS -N2 -RTS s/5000000/5000/" |
| 18:29:26 | <ski> | dirk_ : i'm reformatting your code anyway, if you don't mind :) |
| 18:29:43 | <dirk_> | do what you like |
| 18:29:48 | <ski> | dirk_ : after that, i'll see if i can suggest anything substantive or not |
| 18:29:49 | <mmorrow> | paggas_: with chunks of size 1, you'd be sparking sparks for every element of the list |
| 18:30:33 | <mmorrow> | paggas_: i think a graph (of the (x,y) kind) would be interesting of (chunksize, parallelism) |
| 18:31:02 | <mmorrow> | paggas_: (and you'd get no parallelism with size-one chunks also) |
| 18:31:40 | <mmorrow> | err, make that (chunksize,parallelism,memusage) |
| 18:31:48 | <dirk_> | now I am at the point where I can not compare Wikilink for equality |
| 18:32:10 | <dirk_> | how can I get around it |
| 18:32:29 | <paggas_> | mmorrow: hmmm, but too big a chuck size probably doesn't have much benefits after a point, no? |
| 18:32:49 | <mmorrow> | paggas_: totally.. there's definitely an optimum chunk size |
| 18:33:02 | <mmorrow> | s/optimum/optimal/ |
| 18:33:05 | <ski> | dirk_ : why not ? |
| 18:33:45 | <paggas_> | mmorrow: these are the problems when doing parallel programming on the x86 with the threading paradigm! :P |
| 18:34:00 | <mmorrow> | ACTION puts (chunksize,parallelism,memusage) for chunked mean on his to-generate-data-for-and-plot-with-R list) |
| 18:34:05 | <mmorrow> | paggas_: heh |
| 18:34:31 | <dirk_> | wikilink is a data contructor of type anthing |
| 18:34:59 | <dirk_> | Anything |
| 18:35:05 | <ski> | did you lose the `deriving (Show,Eq)' on `data Anything = ...' ? |
| 18:35:33 | <dirk_> | well (Wikilink []) is |
| 18:36:08 | <dirk_> | actually I can use it |
| 18:38:45 | <dirk_> | yes it works! |
| 18:41:35 | <dschoepe> | Is there a better way to change particular keys in a Data.Map.Map than removing them and adding the new changed keys? |
| 18:43:25 | <dino-> | dschoepe: There are the adjust* and update* functions for Data.Map |
| 18:43:48 | <dino-> | Or maybe you mean better way than what those are doing. |
| 18:44:00 | <dschoepe> | dino-: Ah, thanks I overlooked those. |
| 18:44:03 | <Cale> | dschoepe: Doing an insert normally will replace a key if it is already in the map |
| 18:44:38 | <dschoepe> | I meant something like exchanging part of a key and keeping the respective values. |
| 18:44:55 | <dschoepe> | mapKeys seems to be what I want |
| 18:50:56 | <pumpkin> | mmorrow: sorry, I missed what you said... it scrolled off my screen |
| 18:53:39 | <gio123> | any german speaker? |
| 18:53:46 | <dirk_> | Jawohl |
| 18:53:50 | <dirk_> | I am german |
| 18:54:12 | <opqdonut> | shouldn't that be, I german am |
| 18:54:17 | <opqdonut> | ;) |
| 18:54:33 | <opqdonut> | hmm, I guess germans should be good at stack languages like forth |
| 18:56:20 | <gnuvince> | @src interact |
| 18:56:21 | <lambdabot> | interact f = do s <- getContents; putStr (f s) |
| 19:02:51 | <ski> | @hoogle (acc -> x -> m (acc,y)) -> acc -> [x] -> m (acc,[y]) |
| 19:02:52 | <lambdabot> | No results found |
| 19:03:13 | <ski> | @hoogle mapAccumLM |
| 19:03:14 | <lambdabot> | No results found |
| 19:03:16 | <ski> | @hoogle mapAccumML |
| 19:03:17 | <lambdabot> | No results found |
| 19:03:18 | <ski> | @hoogle mapAccumM |
| 19:03:19 | <lambdabot> | Data.Generics.Twins gmapAccumM :: (Data d, Monad m) => (a -> d -> (a, m d)) -> a -> d -> (a, m d) |
| 19:04:04 | <ski> | (yes, i know i can do `mapM' with `StateT acc m' ..) |
| 19:04:21 | <ski> | @hoogle (acc -> x -> m acc) -> acc -> [x] -> m acc |
| 19:04:22 | <lambdabot> | Control.Monad foldM :: Monad m => (a -> b -> m a) -> a -> [b] -> m a |
| 19:04:22 | <lambdabot> | Data.Foldable foldlM :: (Foldable t, Monad m) => (a -> b -> m a) -> a -> t b -> m a |
| 19:04:22 | <lambdabot> | Control.Monad foldM_ :: Monad m => (a -> b -> m a) -> a -> [b] -> m () |
| 19:05:36 | <ski> | (.. of course) |
| 19:08:52 | <ski> | dirk_ : in `app', is the call `anything p b se' every supposed to be able to monadically return `[Evil]' ? |
| 19:09:13 | <ski> | (s/every/ever/) |
| 19:09:27 | <dirk_> | wait looking at it |
| 19:10:28 | <dirk_> | you mean ever instead of every? |
| 19:10:33 | <ski> | yes |
| 19:11:14 | <dirk_> | so you are asking if anything can return [Evil] |
| 19:12:14 | <dirk_> | not it should not |
| 19:12:21 | <dirk_> | return [Evil] |
| 19:12:40 | <dirk_> | in case of Evil it should fail |
| 19:12:44 | <ski> | ok, fine |
| 19:12:55 | <ski> | so in |
| 19:12:56 | <ski> | l <- try (anything p b se) <|> return [Evil] |
| 19:13:17 | <ski> | if `l' ever is `[Evil]' that means the `anything p b se' call failed |
| 19:13:24 | <ski> | right ? |
| 19:14:12 | <dirk_> | wait |
| 19:14:28 | <FliPPeh> | Man, how can I split a string with some extra checking without trying to go into procedural programming? |
| 19:14:54 | <sm> | ACTION likes the split package |
| 19:14:59 | <FliPPeh> | IRC Line ":Testnick!user@host PRIVMSG #testchan :wat", I want those little parameters in there :( |
| 19:15:06 | <FliPPeh> | But the : at the start does not have to be there |
| 19:15:21 | <FliPPeh> | Neither must there be a !, if the server sends that line |
| 19:15:54 | <dirk_> | ski you are right (certainty 99%) |
| 19:21:19 | <hackagebot> | synthesizer-alsa 0.0.2 - Control synthesizer effects via ALSA/MIDI (HenningThielemann) |
| 19:21:36 | <gwern> | all glory to the hypnotoad! |
| 19:25:06 | <Baughn> | conal: http://haskell.org/haskellwiki/Unamb <-- Looking at this wiki page, as of version 0.2.2 it supports recursive termination and restarting on 10.3 too |
| 19:25:17 | <Baughn> | I think |
| 19:25:20 | <Baughn> | conal: I think |
| 19:27:20 | <hackagebot> | haskore-synthesizer 0.0.3 - Music rendering coded in Haskell (HenningThielemann) |
| 19:27:58 | <FliPPeh> | Can noone help me? ;< |
| 19:28:03 | <FliPPeh> | I know there are smart people here |
| 19:28:15 | <FliPPeh> | Well, not smart, but fluent in haskell |
| 19:29:46 | <Geheimdienst> | flippeh: sm said he likes the split package ... ? |
| 19:30:07 | <FliPPeh> | I don't want any packages that do most of the work for me |
| 19:30:12 | <FliPPeh> | I want to learn :( |
| 19:30:13 | <gwern> | -_- |
| 19:30:24 | <gwern> | FliPPeh: so write a split on your own |
| 19:30:31 | <gwern> | it's not that hard |
| 19:30:59 | <FliPPeh> | For you. I'm no Haskell-coder yet, I'm just starting to learn |
| 19:31:01 | <yitz> | FliPPeh: what's wrong with words? |
| 19:31:13 | <mgsloan> | yeah, split is an awesome bike shed |
| 19:31:17 | <mgsloan> | so many ways to approach it |
| 19:31:23 | <yitz> | > words ":Testnick!user@host PRIVMSG #testchan :wat" |
| 19:31:25 | <lambdabot> | [":Testnick!user@host","PRIVMSG","#testchan",":wat"] |
| 19:31:32 | <pumpkin> | lol |
| 19:32:02 | <gwern> | mgsloan: never use awesome and bikeshed in the same sentence again |
| 19:32:12 | <gwern> | I spent quite a bit of time banging on the bikeshedding of split |
| 19:32:25 | <FliPPeh> | I somehow struggle on combining all that splitting and filtering to one single result |
| 19:32:51 | <mgsloan> | gwern - sorry, haha! I spent a good hour or two doing my particular angle on it as well |
| 19:32:52 | <yitz> | gwern: i put my awesom bicycle in the ... bike storage hut. |
| 19:34:15 | <Geheimdienst> | flippeh, here is some code i wrote recently: http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2600#a2600 |
| 19:34:29 | <mgsloan> | here is my particular splitter: http://www.haskell.org/haskellwiki/Data.List.Split#Break_on_Nothing |
| 19:34:34 | <Geheimdienst> | (i'm a newbie myself) |
| 19:35:01 | <Geheimdienst> | i wrote a function using the span function, then passed that into unfoldr |
| 19:35:03 | <yitz> | FliPPeh: did you write anything yet? can you say exactly what result you want for the example input you provided? |
| 19:35:10 | <gwern> | FliPPeh: just work on one piece at a time. split looks something like this: 'split delim (s:rest) = if s == delim then split delim rest else s : split delim rest' |
| 19:35:30 | <FliPPeh> | I want a combined algebraic data type |
| 19:35:37 | <FliPPeh> | I tried different things, buut |
| 19:35:54 | <FliPPeh> | after looking at the code, I found it really... dumb. |
| 19:35:58 | <yitz> | FliPPeh: what does the ADT look like? do you have anything you can paste? |
| 19:36:43 | <FliPPeh> | http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2601#a2601 |
| 19:36:45 | <FliPPeh> | Like that |
| 19:36:48 | <FliPPeh> | You see, really bad |
| 19:37:00 | <FliPPeh> | But the only solution I'd know about :/ |
| 19:38:49 | <gwern> | Maybe Params seems kind of odd, if Params = [String]. what do you do with Just [] that differs from Nothing? |
| 19:39:17 | <FliPPeh> | I didn't even think about that.. |
| 19:39:35 | <FliPPeh> | So yeah, help me get on track to make more elegant solutions |
| 19:42:20 | <gwern> | all raise to the hypnotoad! |
| 19:45:13 | <jelly12gen> | hi i installed libmpd for haskell on Arch |
| 19:45:17 | <pastorn> | can anyone here say something cool about C#3.0? please! i started a game development course today that is running all through this summer and i want to be positive, but i feel that it might be hard |
| 19:45:30 | <jelly12gen> | but i can't import Network.MPD |
| 19:45:56 | <jelly12gen> | ow wait it does but only in ghci |
| 19:46:02 | <BMeph_> | @remember FliPPeh Well, not smart, but fluent in haskell |
| 19:46:03 | <lambdabot> | It is stored. |
| 19:46:10 | <pastorn> | i know there's lambdas in 3.0, but it seems like some weird sort of lambdas, not very nice at all |
| 19:46:48 | <BMeph_> | C# 3.0: Now, with 50% more Haskell than C# 2.5! ;p |
| 19:46:56 | <koala_man> | how are they weird? |
| 19:46:58 | <ski> | dirk_ : i was thinking of something more like <http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5665> |
| 19:47:28 | <pastorn> | all i can think of is that quote about object oriented languages "If i want a banana I want a banana. I don't want to have to take a whole jungle" |
| 19:47:35 | <pastorn> | </rant> |
| 19:48:10 | <dirk_> | reading it |
| 19:48:31 | <ski> | dirk_ : i found a type error that you probably have already fixed in some way in your code |
| 19:49:10 | <ski> | dirk_ : er, also, i forgot removing `run = undefined' :) |
| 19:52:12 | <dirk_> | the funny thing about haskell is that I am getting scare of the function I am calling and defining |
| 19:52:29 | <Geheimdienst> | guys, i'm looking for a little feedback on this: http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2603#a2603 |
| 19:52:36 | <gwern> | pastorn: well, I hear c# has monads. of a sort |
| 19:52:39 | <Geheimdienst> | kinda my first haskell program after hello world ... |
| 19:52:45 | <ski> | dirk_ : btw, i noted your `app2' was basically a call to `foldM' |
| 19:53:09 | <dirk_> | yes I see |
| 19:54:21 | <dirk_> | still I do have problems undstanding foldl and Monads seperately so foldM is not really simple |
| 19:55:06 | <ski> | @src foldM |
| 19:55:06 | <lambdabot> | foldM _ a [] = return a |
| 19:55:06 | <lambdabot> | foldM f a (x:xs) = f a x >>= \fax -> foldM f fax xs |
| 19:55:17 | <ski> | well, say |
| 19:55:35 | <ski> | foldM _ s [ ] = return s |
| 19:55:52 | <ski> | foldM _ s (a:as) = do s' <- f s a |
| 19:56:16 | <ski> | foldM f s' as |
| 19:56:28 | <ski> | that's basically what you had in `app2' |
| 19:56:32 | <dirk_> | ok |
| 19:56:36 | <ski> | (well, `foldM f ...' in the second case) |
| 19:56:45 | <dirk_> | I can understand the second definition you gave |
| 19:57:04 | <ski> | i.e. walk through a list, execute an action on each list element, passing in a state, and passing on the output as the next state |
| 20:01:15 | <dirk_> | slowly starting to get a feeling for that |
| 20:01:15 | <ski> | Geheimdienst : why the `do' in `nextSegment' ? |
| 20:01:31 | <yitz> | Geheimdienst: nice! |
| 20:01:58 | <yitz> | Geheimdienst: stylisticly, I might not make nextSegment a top-level. |
| 20:02:13 | <ski> | Geheimdienst : instead of `x == ""' you may (or may not) prefer `null x' |
| 20:02:27 | <yitz> | Geheimdienst: instead: splitPath p = ... where nextSegment = ... or something like that |
| 20:02:29 | <Geheimdienst> | thanks yitz :-) |
| 20:02:54 | <ski> | Geheimdienst : instead of `if null x then Nothing else Just (...)' you may say `do guard (not (null x)); return (...)', if you prefer |
| 20:02:59 | <Geheimdienst> | ski: good question ... |
| 20:03:22 | <ski> | (it doesn't really matter much, here) |
| 20:03:43 | <ski> | hm |
| 20:03:45 | <ski> | actually |
| 20:03:49 | <Geheimdienst> | ski: when i remove the do, i need to add an "in" before the if |
| 20:03:50 | <ski> | @hoogle Bool -> Maybe a -> Maybe a |
| 20:03:51 | <lambdabot> | Data.Generics.Aliases orElse :: Maybe a -> Maybe a -> Maybe a |
| 20:03:51 | <lambdabot> | Data.Maybe fromMaybe :: a -> Maybe a -> a |
| 20:03:51 | <lambdabot> | Control.Monad unless :: Monad m => Bool -> m () -> m () |
| 20:03:52 | <Geheimdienst> | is that normal? |
| 20:03:56 | <ski> | yes |
| 20:04:40 | <Geheimdienst> | ok, but why does let even work without the in ? |
| 20:04:54 | <ski> | > unless False (return ()) :: Maybe () |
| 20:04:55 | <lambdabot> | Just () |
| 20:05:08 | <ski> | Geheimdienst : it only does that as a command in a `do'-block |
| 20:05:22 | <ski> | > unless True (return ()) :: Maybe () |
| 20:05:24 | <lambdabot> | Just () |
| 20:05:28 | <Geheimdienst> | yitz: ah i see, hadn't realized i could just define the function in a where clause. cool |
| 20:05:48 | <ski> | @src unless |
| 20:05:49 | <lambdabot> | unless p s = if p then return () else s |
| 20:05:53 | <ski> | oh, right |
| 20:06:01 | <yitz> | > let splitPath = map (takeWhile (/= ':') . takeWhile (not . null) . iterate (drop 1 . dropWhile (/= ':')) in splitPath "/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games" -- <-- Geheimdienst |
| 20:06:02 | <lambdabot> | <no location info>: parse error on input `in' |
| 20:06:16 | <yitz> | > let splitPath = map (takeWhile (/= ':')) . takeWhile (not . null) . iterate (drop 1 . dropWhile (/= ':')) in splitPath "/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games" -- <-- Geheimdienst |
| 20:06:18 | <lambdabot> | ["/usr/local/bin","/usr/bin","/bin","/usr/bin/X11","/usr/games"] |
| 20:06:26 | <Geheimdienst> | ski: so it's more like an implementation side-effect that should not be relied on? |
| 20:07:04 | <ski> | Geheimdienst : sure you can rely on it. just as long as you understand when `in' is required, and when it is prohibited |
| 20:07:23 | <ski> | (maybe `prohibited' is somewhat misleading, but ..) |
| 20:08:19 | <Geheimdienst> | ski: just tried it with both do and in. won't work. so i see what you mean :) |
| 20:09:26 | <ski> | Geheimdienst : it will work if you indent the `in' (and the following action) |
| 20:09:49 | <ski> | but that's only because `let .. in ..' is a valid expression, and hence a valid command in a `do'-block |
| 20:10:06 | <ski> | (so it's not really a `let'-command in a `do'-block, in that case) |
| 20:10:35 | <Geheimdienst> | whoa, ok |
| 20:10:45 | <Geheimdienst> | the whole layout thing is still freaking me out |
| 20:10:59 | <cygnus> | Can anyone tell me where I might go to get help with hscurses? |
| 20:11:01 | <ac> | ack, so many web servers: salvia, mohws, httpd-shed, happstack, HAppS, and probably others |
| 20:11:35 | <ski> | ACTION seems to recall there were some hackage-lib with `Bool -> a -> Maybe a', but doesn't recall which |
| 20:12:03 | <leimy> | Is that even hard to do? |
| 20:12:13 | <leimy> | 'Bool -> a -> Maybe a ' that is |
| 20:12:16 | <yitz> | Geheimdienst: it's not so freaky - mostly it's the way you'd indent anyway, so why bother with the {;} noise, just let the compiler do it for you. |
| 20:12:21 | <ski> | leimy : it's easy |
| 20:12:26 | <byorgey> | @djinn Bool -> a -> Maybe a |
| 20:12:27 | <leimy> | I was going to say |
| 20:12:27 | <lambdabot> | f a b = |
| 20:12:27 | <lambdabot> | case a of |
| 20:12:27 | <lambdabot> | False -> Nothing |
| 20:12:27 | <lambdabot> | True -> Just b |
| 20:12:34 | <ski> | the question was if there was a standard name |
| 20:12:40 | <leimy> | AH |
| 20:12:42 | <conal> | Baughn: thx. i've added a comment to the unamb wiki page: "unamb seems to be working well in version 0.2.2, under GHC 6.10.3." |
| 20:12:47 | <leimy> | deBoolifyValue! |
| 20:12:47 | <ski> | (well "standard", i suppose) |
| 20:13:02 | <byorgey> | maybefy? |
| 20:13:05 | <ski> | (istr there was an operator name in the lib) |
| 20:13:07 | <leimy> | Falsinate! |
| 20:13:16 | <leimy> | falsifyNothing |
| 20:13:25 | <byorgey> | uncertainize |
| 20:13:26 | <leimy> | or "justTrue" |
| 20:13:37 | <yitz> | @type \x y -> guard x >> return y |
| 20:13:38 | <lambdabot> | forall (m :: * -> *) b. (MonadPlus m) => Bool -> b -> m b |
| 20:13:49 | <ski> | possibly it was `(<?>)' |