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:00:17 | <newsham> | map (+1) [1..10] -> map ((+1) [1..10]) ? |
| 00:00:22 | <newsham> | > (+1) [1..10] |
| 00:00:23 | <lambdabot> | add an instance declaration for (Num [t]) |
| 00:00:23 | <lambdabot> | In the expression: (+ 1) ([1 ... |
| 00:00:28 | <EvilTerran> | earnest, well, there's be brackets everywhere |
| 00:00:41 | <ddarius> | All that really needs to be said is that we'd rather write 'f a b c' to apply a function to three arguments as opposed to '((f a) b) c' |
| 00:01:05 | <EvilTerran> | a lot of functions in haskell take multiple parameters that way |
| 00:01:08 | <earnest> | hm |
| 00:01:13 | <earnest> | i didnt know this would happen |
| 00:01:39 | <purejadekid> | newsham: no c&p because I'm using IRC and Safari on OS X and I guess Parallels didn't implement a shared clipboard for non-Windows OSes like FreeBSD |
| 00:01:51 | <newsham> | ahh, gotcha. |
| 00:02:00 | <newsham> | you could always build irc for fbsd :) |
| 00:02:00 | <EvilTerran> | anyway, a couple more points of syntax: the body of a lambda, a let/in, and suchlike other things extends as far to the right as it can. that's a useful one to remember. |
| 00:02:03 | <purejadekid> | I mean I could implement one using a web server which I can do when I get ghc6.6 working |
| 00:02:34 | <purejadekid> | newsham: true |
| 00:02:40 | <ddarius> | Network clipboard! |
| 00:02:57 | <purejadekid> | ddarius: tell me more |
| 00:03:10 | <ddarius> | I'm not suggesting something. |
| 00:04:16 | <EvilTerran> | hpaste the thing you want to copypaste? |
| 00:05:12 | <purejadekid> | hpaste just might do it |
| 00:05:18 | <purejadekid> | gracias |
| 00:10:57 | <mr_tenor> | where can i find a formal definition of what a general combinator is? |
| 00:11:31 | <earnest> | EvilTerran: that's right; that one i have in mind |
| 00:11:52 | <earnest> | but i actually always match the in with the column of the let |
| 00:11:54 | <ddarius> | mr_tenor: The term "combinator" is usually abused to mean practically anything and totally unrestricted by its actual meaning. |
| 00:12:17 | <EvilTerran> | that works |
| 00:13:06 | <ddarius> | mr_tenor: There is a brief but complete definition at the beginning of http://en.wikipedia.org/wiki/Combinatory_logic |
| 00:13:07 | <monochrom> | Any function is a combinator. |
| 00:13:07 | <lambdabot> | Title: Combinatory logic - Wikipedia, the free encyclopedia |
| 00:16:18 | <mr_tenor> | ddarius: that's been my impression, but there's always the risk that one just doesn't "get it" and there are abstract underpinnings ;) |
| 00:17:06 | <mr_tenor> | so it's like a buzzword for PL geeks I guess ;) |
| 00:18:03 | <ddarius> | mr_tenor: People usually have connotations attached to the word "combinator" when used in a loose sense that do go back to the actual meaning of combinators. |
| 00:18:08 | <ddarius> | Yes. |
| 00:19:01 | <purejadekid> | I thought combinators implied a certain amount of points-free-ness, as a connotation |
| 00:19:16 | <purejadekid> | as opposed to a general function |
| 00:19:35 | <purejadekid> | you don't see people writing combinatorial style Java programs, right? |
| 00:19:51 | <mr_tenor> | the stuff i've seen referred to as combinators seem to have easier composability and more high orderness, roughly speaking |
| 00:20:38 | <purejadekid> | mr_tenor: agreed |
| 00:22:56 | <phobes> | I thought combinator just implied no free variables |
| 00:24:14 | <purejadekid> | is (+1) a combinator? it doesn't take functions args so I wouldn't elevate it to that status |
| 00:24:39 | <thoughtpolice> | phobes: i was thinking the same |
| 00:24:53 | <phobes> | If it's the successor function on ordinals with the curch encoding, then I would think it a combinator |
| 00:25:19 | <phobes> | ordinals = naturals :) |
| 00:25:21 | <ddarius> | Combinators must be built from other combinators. |
| 00:25:51 | <phobes> | which is any lambda expression with no free variables (if you start from SKI), right? |
| 00:26:13 | <ddarius> | You can't use lambda ("except" for the primitive combinators) |
| 00:26:40 | <phobes> | right, but with @pl and @unpl, you can go back and forth |
| 00:26:44 | <ddarius> | Xf = f(\x.S) is not a combinator |
| 00:26:52 | <phobes> | hmm |
| 00:27:13 | <phobes> | Are those x's meant to be the same? |
| 00:27:18 | <ddarius> | no |
| 00:27:33 | <ddarius> | Not that it would matter or make sense. |
| 00:27:47 | <phobes> | So that's just \f. f (const S)? |
| 00:28:12 | <ddarius> | phobes: Yes. That would be a combinator. |
| 00:28:26 | <ddarius> | Something being a combinator or not is an intensional property. |
| 00:28:42 | <phobes> | ddarius: ok I get your meaning |
| 00:28:50 | <monochrom> | You know how people say "xerox" for photocopying, "develop" for programming, "rip" for copying CDs and DVDs. Language is a funny thing. If there are two different words "xerox" and "photocopy", surely there must be a difference and you're missing something? But no, language is not supposed to be that logical. |
| 00:29:16 | <ddarius> | monochrom: wtf? |
| 00:29:33 | <monochrom> | I'm speaking in analogy. |
| 00:32:05 | <mr_tenor> | according to http://en.wikipedia.org/wiki/Combinatory_logic, isn't the set of combinators equivalent to the set of higher order pure functions? |
| 00:32:06 | <lambdabot> | Title: Combinatory logic - Wikipedia, the free encyclopedia |
| 00:33:17 | <ddarius> | mr_tenor: It depends on what primitive combinators you assume. |
| 00:34:15 | <sioraiocht> | @src [] pure |
| 00:34:15 | <lambdabot> | pure = return |
| 00:35:08 | <sioraiocht> | @src [] (<*>) |
| 00:35:09 | <lambdabot> | (<|>) = (++) |
| 00:35:36 | <sioraiocht> | that's...not what i asked for..thanks though lambdabot =p |
| 00:35:39 | <sioraiocht> | @src [] ap |
| 00:35:39 | <lambdabot> | Source not found. You type like i drive. |
| 00:36:12 | <monochrom> | hahaha, that one is bizzare |
| 00:36:13 | <mr_tenor> | ddarius: ah, that's what i'm missing. so i guess it's like logic. "here our axioms and let's see where they get us" |
| 00:36:32 | <ddarius> | mr_tenor: It -is- logic. Combinatory logic. |
| 00:37:19 | <sioraiocht> | @src ap |
| 00:37:19 | <lambdabot> | ap = liftM2 id |
| 00:37:25 | <mr_tenor> | sorry... i'm abbreviating. i mean "the practice of building a combinator library looks like the process of defining a logic system" |
| 00:37:50 | <mr_tenor> | which is pretty much what you're doing, right? |
| 00:38:52 | <ddarius> | mr_tenor: You can view it that way, yes. |
| 00:39:37 | <mr_tenor> | stepsFromEnlightenment--; |
| 00:40:36 | <sioraiocht> | > ap (map (+) [1..5]) [6..10] |
| 00:40:37 | <ddarius> | @karma stepsFromEnlightenment |
| 00:40:37 | <lambdabot> | stepsFromEnlightenment has a karma of 0 |
| 00:40:38 | <lambdabot> | [7,8,9,10,11,8,9,10,11,12,9,10,11,12,13,10,11,12,13,14,11,12,13,14,15] |
| 00:40:54 | <sorear> | > nubBy(((>1).).gcd)[2..] |
| 00:40:55 | <lambdabot> | [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,... |
| 00:41:07 | <sioraiocht> | lol |
| 00:46:05 | <sioraiocht> | > map head (iterate (\ (p:xs) -> [x | x <- xs, x `mod` p /= 0]) [2..n]) |
| 00:46:06 | <lambdabot> | Not in scope: `n' |
| 00:46:10 | <sioraiocht> | > map head (iterate (\ (p:xs) -> [x | x <- xs, x `mod` p /= 0]) [2..]) |
| 00:46:11 | <lambdabot> | [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,... |
| 01:11:46 | <sioraiocht> | is there a good website of monad transformers |
| 01:13:10 | <sioraiocht> | nevermind, found the wikibook |
| 01:13:29 | <byorgey> | @go monad transformers step-by-step |
| 01:13:32 | <lambdabot> | http://uebb.cs.tu-berlin.de/~magr/pub/Transformers.en.html |
| 01:13:32 | <lambdabot> | Title: Monad Transformers Step by Step |
| 01:13:35 | <thoughtpolice> | sioraiocht: for an intro I really liked this page, http://sigfpe.blogspot.com/2006/05/grok-haskell-monad-transformers.html |
| 01:13:36 | <pjd> | cgibbard has a bit on them: http://cale.yi.org/index.php/How_To_Use_Monad_Transformers |
| 01:13:37 | <lambdabot> | Title: How To Use Monad Transformers - CaleWiki |
| 01:13:38 | <lambdabot> | Title: A Neighborhood of Infinity: Grok Haskell Monad Transformers, http://tinyurl.com/y6w3jr |
| 01:13:45 | <thoughtpolice> | and the paper byorgey gave is pretty good too. :) |
| 01:14:39 | <Cale> | My bit is mostly targetted at people who already know the basics of monad transformers -- it's really a bunch of style issues. |
| 01:15:12 | <sioraiocht> | well thanks |
| 01:15:24 | <pjd> | http://www.cs.chalmers.se/~augustss/AFP/monads.html -- John Hughes & Magnus Carlsson |
| 01:15:26 | <lambdabot> | Title: Systematic Design of Monads |
| 01:16:59 | <monochrom> | Hrm, do they use English extensively in a Swedish university? |
| 01:18:10 | <thoughtpolice> | Cale: I liked yours a lot. shows a good way to use transformers for creating a small DSL, basically. :) |
| 01:18:58 | <augustss> | monochrom: yes |
| 01:19:58 | <sioraiocht> | monochrom: there are a fair number of european schools that use english as the medium of instruction |
| 01:20:40 | <monochrom> | Interesting. |
| 01:20:41 | <augustss> | there's a lot of foreign students in swedish universities |
| 01:20:54 | <monochrom> | Nice. |
| 01:21:07 | <sioraiocht> | I imagine that's because the education is so inexpensive |
| 01:21:22 | <augustss> | as in free, yes :) |
| 01:25:14 | <sioraiocht> | augustss: even for international students? |
| 01:25:24 | <augustss> | yes |
| 01:25:33 | <sioraiocht> | harrumph, screw the UK, i should have gone to sweden |
| 01:25:51 | <augustss> | of course, it's only free if you are accepted. swedish or not swedish |
| 01:26:17 | <sioraiocht> | augustss: right, I should have applied to swedish schools, lol |
| 01:26:17 | <augustss> | if you're not accepted you get nothing |
| 01:26:49 | <sioraiocht> | as an international student from a non EU country, oxford SCREWWWWWED me |
| 01:26:52 | <monochrom> | Hey, rejection is free too. :) |
| 01:27:04 | <sorear> | augustss: don't you still have to pay taxes? |
| 01:27:06 | <sioraiocht> | monochrom: unless there's an application fee |
| 01:27:23 | <monochrom> | Hrm! There lies the catch... |
| 01:27:37 | <augustss> | sioraiocht: swedish rules could have changed in the last few years, but it used to be free regardless of country |
| 01:27:55 | <monochrom> | Very profittable business: "our school charges no tuition fee! but application fee is us$10000" :) |
| 01:28:03 | <sioraiocht> | haha |
| 01:28:11 | <augustss> | sorear: the students generally don't make enough money to pay any taxes to speak of |
| 01:28:15 | <sioraiocht> | speaking of USD, I hate exchange rates these days |
| 01:28:43 | <monochrom> | OK, make it 10000 GB Pounds XD |
| 01:29:04 | <sorear> | augustss: hmm, I got the impression from shapr that immegrants had to make N dollars taxible income, or face deportation |
| 01:29:08 | <sioraiocht> | I've saved up a decent amount of money for my first term, and it gets halved in 14 days >< |
| 01:29:22 | <sorear> | ACTION actually knows very little about this, in case anyone couldn't tell |
| 01:29:28 | <sioraiocht> | sorear: I would guess student visas are exempt from that |
| 01:29:33 | <augustss> | sorear: students are in sweden on a student visa, different rules |
| 01:29:41 | <wli> | sorear: Students and housewives, anyone? |
| 01:30:09 | <sioraiocht> | sorear: but you're right, a lot of countries, especially welfare states, will deport any free-riding immmigrants |
| 01:30:26 | <sioraiocht> | I believe Switzerland is notorious for getting rid of any immigrant pressure on the economy |
| 01:30:50 | <monochrom> | Somehow Canada doesn't. :) |
| 01:31:13 | <sorear> | so what do they do with free-riding natives? :) |
| 01:31:26 | <monochrom> | But of course, Canada gives you much hassle just for applying for immigration. |
| 01:31:28 | <sioraiocht> | sorear: well, as a welfare state that's a little redundant =p |
| 01:31:53 | <wli> | Oh brilliant. The right wing has come to #haskell. |
| 01:32:10 | <scook0> | quick, everybody foldl! |
| 01:32:17 | <sioraiocht> | hahah I'm not conservative at all! |
| 01:32:24 | <monochrom> | Basically you have to be extremely useful to Canada to get accepted. Or else, family re-union. |
| 01:32:42 | <sioraiocht> | I didn't mean that offensively, more that welfare states take care of their own..regardless |
| 01:32:58 | <monochrom> | But once you're accepted, all your misfortunes are taken care of. |
| 01:33:09 | <sioraiocht> | monochrom: I think that's true of most countries. Except the US, where you have a lottery |
| 01:35:03 | <sorear> | How is it *mathematically* possible for every country to be having a problem with immigrants?? |
| 01:35:57 | <sioraiocht> | sorear: LOL well, turkey, for one, doesn't =p |
| 01:36:24 | <sioraiocht> | as the influx of turkish workers to germany is one major reason they protest their admission into the EU |
| 01:36:48 | <sorear> | you're from turkey? (curiousity) |
| 01:37:04 | <sioraiocht> | sorear: no, had to right a paper on the topic in a class during undergrad |
| 01:37:12 | <sioraiocht> | (I was an international relations major for a semester) |
| 01:38:58 | <augustss> | sorear: it's easy for every country to have immigrant problems. at least if you view any immigrants as a problem |
| 01:39:59 | <monochrom> | I can make up a fictional scenerio of a universe with just two countries and both have immigrant problems. |
| 01:41:09 | <sioraiocht> | @seen dcouts |
| 01:41:09 | <lambdabot> | I haven't seen dcouts. |
| 01:41:11 | <sioraiocht> | @seen dcoutts |
| 01:41:11 | <lambdabot> | dcoutts is in #gentoo-haskell, #haskell-overflow, #haskell and #ghc. I last heard dcoutts speak 6h 3m 18s ago. |
| 01:42:38 | <sioraiocht> | monochrom: it's get complicated by the fact that in the EU for example, the borders among member countries are completely open |
| 01:42:54 | <sioraiocht> | making them even LESS inclined to accept immigrants from elsewhere |
| 01:50:35 | <sioraiocht> | :t when |
| 01:50:37 | <lambdabot> | forall (m :: * -> *). (Monad m) => Bool -> m () -> m () |
| 01:51:06 | <sioraiocht> | why can't it be m a instead of m ()? |
| 01:52:19 | <monochrom> | return undefined? :) |
| 01:52:33 | <sioraiocht> | oh |
| 01:52:52 | <Saizan> | ?src when |
| 01:52:52 | <lambdabot> | when p s = if p then s else return () |
| 01:53:28 | <sioraiocht> | riiiight, nevermind |
| 01:54:56 | <monochrom> | sometimes "if p then liftM Just s else return Nothing" may be more useful. |
| 01:55:11 | <sioraiocht> | aha! I kinda like that, heheh |
| 01:56:06 | <byorgey> | whenMaybe? |
| 01:56:23 | <nominolo> | > printf "%4.1d" 1024 |
| 01:56:24 | <lambdabot> | Add a type signature |
| 01:56:33 | <nominolo> | > printf "%4.1d" (1024::Double) |
| 01:56:33 | <lambdabot> | Add a type signature |
| 01:56:37 | <sioraiocht> | :t printf |
| 01:56:39 | <lambdabot> | forall r. (PrintfType r) => String -> r |
| 01:57:00 | <byorgey> | > printf "%4.1d" 1024 :: String |
| 01:57:02 | <lambdabot> | "1024" |
| 01:57:15 | <sioraiocht> | > printf "%4.1d" 1024 :: IO () |
| 01:57:17 | <lambdabot> | <IO ()> |
| 01:57:21 | <sioraiocht> | > printf "%4.1d" 1024 :: IO String |
| 01:57:23 | <lambdabot> | <IO [Char]> |
| 01:57:26 | <sioraiocht> | lol |
| 01:57:28 | <sioraiocht> | well then |
| 01:57:37 | <nominolo> | > printf "%4.1d" 1024 :: String |
| 01:57:38 | <lambdabot> | "1024" |
| 01:57:43 | <byorgey> | hey, that's neat! |
| 01:57:43 | <nominolo> | > printf "%4.1d" 1.4 :: String |
| 01:57:44 | <lambdabot> | Exception: Printf.printf: bad argument |
| 01:57:50 | <nominolo> | > printf "%4.1f" 1.4 :: String |
| 01:57:53 | <lambdabot> | " 1.4" |
| 01:57:58 | <nominolo> | > printf "%4.1f" 1024 :: String |
| 01:58:00 | <lambdabot> | Exception: Printf.printf: bad argument |
| 01:58:04 | <nominolo> | > printf "%4.1f" 1024.0 :: String |
| 01:58:05 | <lambdabot> | "1024.0" |
| 01:58:10 | <byorgey> | I didn't realize printf could act like both printf and sprintf =) |
| 01:58:16 | <sioraiocht> | lol |
| 01:58:32 | <sorear> | And fprintf! |
| 01:58:37 | <sorear> | (use hPrintf) |
| 01:59:01 | <nominolo> | still doesn't do what i want it to do |
| 01:59:07 | <byorgey> | @info PrintfType |
| 01:59:07 | <lambdabot> | (PrintfType) |
| 01:59:13 | <nominolo> | > printf "%4.f" 1024.0 :: String |
| 01:59:14 | <lambdabot> | "1024" |
| 01:59:17 | <sjanssen> | I'm surprised printf isn't overloaded st. you can give it a Handle directly |
| 01:59:20 | <byorgey> | @src PrintfType |
| 01:59:20 | <lambdabot> | Source not found. I feel much better now. |
| 01:59:22 | <nominolo> | > printf "%4.f" 1.0240 :: String |
| 01:59:23 | <lambdabot> | " 1" |
| 01:59:27 | <byorgey> | @source PrintfType |
| 01:59:27 | <lambdabot> | PrintfType not available |
| 01:59:41 | <byorgey> | @source printf |
| 01:59:41 | <lambdabot> | printf not available |
| 01:59:43 | <byorgey> | grr |
| 01:59:59 | <sioraiocht> | it looks like IO () and String work |
| 02:00:13 | <sioraiocht> | @instances PrintfType |
| 02:00:14 | <lambdabot> | Couldn't find class `PrintfType'. Try @instances-importing |
| 02:00:25 | <sioraiocht> | @instances-importing PrintfType |
| 02:00:26 | <lambdabot> | Couldn't find class `PrintfType'. Try @instances-importing |
| 02:00:47 | <byorgey> | http://haskell.org/ghc/docs/latest/html/libraries/base/Text-Printf.html |
| 02:00:49 | <lambdabot> | http://tinyurl.com/34sj2z |
| 02:00:50 | <sorear> | @instances-importing PrintfType Text.Printf |
| 02:00:51 | <lambdabot> | Couldn't find class `Text.Printf'. Try @instances-importing |
| 02:00:57 | <sorear> | @instances-importing Text.Printf PrintfType |
| 02:00:58 | <lambdabot> | (a -> r), IO a, [c] |
| 02:01:06 | <sorear> | use the correct syntax and it works! |
| 02:01:11 | <sioraiocht> | lol |
| 02:01:14 | <nominolo> | > show 10.34 |
| 02:01:16 | <lambdabot> | "10.34" |
| 02:01:29 | <nominolo> | > take 4 $ show 109.34 |
| 02:01:30 | <lambdabot> | "109." |
| 02:01:31 | <sioraiocht> | Prelude Text.Printf> printf "%4.1f" 1.4 :: IO String |
| 02:01:31 | <sioraiocht> | 1.4"*** Exception: Prelude.undefined |
| 02:02:43 | <nominolo> | > 234123/(1024*1024) |
| 02:02:45 | <lambdabot> | 0.22327709197998047 |
| 02:02:51 | <byorgey> | sioraiocht: try explicitly annotating 1.4 as Double? |
| 02:02:52 | <nominolo> | :t 234123/(1024*1024) |
| 02:02:54 | <lambdabot> | forall t. (Fractional t) => t |
| 02:03:02 | <nominolo> | @instances Fractional |
| 02:03:03 | <lambdabot> | Double, Float |
| 02:03:21 | <sioraiocht> | nope, neither float nor double works |
| 02:03:31 | <byorgey> | hm, strange |
| 02:04:00 | <thoughtpolice> | sioraiocht: type it as simply 'String,' not IO String |
| 02:04:14 | <sioraiocht> | thoughtpolice: but I should be able to type it as IO String |
| 02:05:06 | <idnar> | > return $ printf "%4.1f" 1.4 :: IO String |
| 02:05:07 | <lambdabot> | <IO [Char]> |
| 02:05:15 | <sioraiocht> | yeah, in ghci that doesn't play nice |
| 02:05:30 | <byorgey> | sioraiocht: does it work if you compile it? |
| 02:05:34 | <sioraiocht> | hrm, let's see |
| 02:05:36 | <idnar> | what doesn't play nice? |
| 02:05:40 | <thoughtpolice> | i've had the same experiance |
| 02:05:59 | <idnar> | I get the same result in ghci |
| 02:06:00 | <thoughtpolice> | compiling it results in nothing out of the ordinary |
| 02:06:11 | <thoughtpolice> | don't know why it throws an exception in ghci |
| 02:08:35 | <sioraiocht> | ueaj |
| 02:08:37 | <sioraiocht> | yeah |
| 02:08:43 | <sioraiocht> | no problem in compilation |
| 02:18:39 | <ricky_clarkson> | gigamonkey_: No idea (about bos, a Haskell book and O'Reilly). |
| 02:30:00 | <dcoutts> | sioraiocht: I'm not here! |
| 02:30:14 | <sioraiocht> | hahah hi dcoutts |
| 02:30:17 | <sioraiocht> | you're not? |
| 02:30:23 | <dcoutts> | sioraiocht: did you have a really quick question? |
| 02:30:45 | <sioraiocht> | actually cladhaire had a question, but it wasn't really quick, i'll find you later |
| 02:30:58 | <dcoutts> | sioraiocht: OK |
| 02:31:00 | <dcoutts> | ACTION should be in bed |
| 02:31:03 | <sioraiocht> | lol yes |
| 02:31:10 | <sioraiocht> | isn't it 3:30 there? |
| 02:31:14 | <dcoutts> | @Arr! |
| 02:31:14 | <lambdabot> | Aye |
| 02:31:18 | <dcoutts> | @localtime dcoutts |
| 02:31:18 | <lambdabot> | Local time for dcoutts is Sun Sep 9 03:33:21 |
| 02:31:52 | <ricky_clarkson> | dcoutts: UK? Which city? |
| 02:32:17 | <dcoutts> | .ox.ac.uk |
| 02:32:51 | <ricky_clarkson> | .salford.ac.uk for me - Where Lambda Is a Foreign Word |
| 02:34:47 | <mudge> | hey dons |
| 02:35:24 | <mudge> | dons: you there? |
| 02:35:33 | <ddarius> | ricky_clarkson: Lambda -is- a foreign word there. |
| 02:35:46 | <mudge> | hey ddarius |
| 02:36:03 | <ricky_clarkson> | ddarius: And humour is there, I expect. |
| 02:36:45 | <mudge> | hey, i just wrote an article on high level programming: http://nickmudge.info/?post=50 |
| 02:36:46 | <lambdabot> | Title: High-Level Programming is About Expression |
| 02:36:51 | <mudge> | i'm curious what anyone might think of it |
| 02:37:44 | <ricky_clarkson> | mudge: automaticities? |
| 02:38:25 | <dons> | mudge: yo |
| 02:39:13 | <mudge> | hey dons: i just finished writing an article/blog post about programming: http://nickmudge.info/?post=50 |
| 02:39:14 | <lambdabot> | Title: High-Level Programming is About Expression |
| 02:39:21 | <mudge> | will you read it and tell me what you think? |
| 02:39:32 | <dons> | ok. |
| 02:39:48 | <mudge> | ricky_clarkson: yea, automaticities, things that are automatic |
| 02:39:55 | <dons> | mudge: you want feedback via mail or irc? |
| 02:40:06 | <mudge> | either :) |
| 02:40:24 | <mudge> | which ever feels best for you |
| 02:40:26 | <mudge> | i like email |
| 02:40:32 | <dons> | ok. i'll have some dinner and give it a read. i think i've your email. |
| 02:40:42 | <mudge> | mudgen@gmail.com |
| 02:40:43 | <mudge> | cool |
| 02:40:47 | <mudge> | thanks dons |
| 02:43:01 | <ricky_clarkson> | mudge: It looks verbose. I'd quote sicp about programs being only incidentally for machines to execute, and say that modularising code makes it easier to understand as a whole, and hence maintain. Also that studying existing systems is a good idea. |
| 02:44:55 | <mudge> | ricky_clarkson: thanks, yea, it does look verbose. I didn't know SICP said that :) |
| 02:45:23 | <ricky_clarkson> | First chapter. |
| 02:46:08 | <mudge> | rad |
| 02:47:03 | <mudge> | i did try to keep it kind of simple, because I also wrote in mind a little for people that don't know programming totally, like maybe managers, and so also explain a bit of stuff |
| 02:50:49 | <ricky_clarkson> | Is there a reason to expect managers to read it? |
| 02:50:50 | <ddarius> | ACTION wonders why "people" have issues with the fact that adding mutable state to a language is an expressiveness boost. |
| 02:51:15 | <ricky_clarkson> | ..like have you pointed your own managers at it? |
| 02:51:37 | <FMota> | I dont understand uniqueness typing systems. |
| 02:51:49 | <ddarius> | FMota: What's not to understand? |
| 02:52:04 | <FMota> | how can they be functional? |
| 02:52:15 | <ddarius> | How can they not be functional? |
| 02:52:16 | <mudge> | well my boss who is a manager reads my blog |
| 02:52:49 | <mudge> | ricky, good point, it probably should just be for programmers |
| 02:52:54 | <FMota> | wouldn't the fact that you can only have one of something at one time essentially ammount to having state? |
| 02:52:56 | <FMota> | *amount |
| 02:53:11 | <ddarius> | FMota: No. |
| 02:53:14 | <FMota> | ok |
| 02:53:28 | <FMota> | there's obviously something I'm not getting. Wanna help? :) |
| 02:53:39 | <ddarius> | I have to know what it is you're not getting. |
| 02:53:55 | <ddarius> | If you erase the uniqueness types from a Clean program, say, you get a "normal" program. |
| 02:54:12 | <FMota> | how do they work? how can you use them? |
| 02:54:33 | <ddarius> | FMota: All they do is ensure you use a variable exactly once. |
| 02:54:47 | <scook0> | ddarius: "issues" as in they don't like it, or as in they don't accept it as true? |
| 02:54:53 | <FMota> | so essentially they restrict you |
| 02:55:02 | <pjd> | ddarius: as in linear typing? (are they the same thing?) |
| 02:55:06 | <ddarius> | FMota: That was exactly what I was about to say. |
| 02:55:12 | <FMota> | oh ok |
| 02:55:55 | <ddarius> | pjd: Yes and maybe no. I think Clean made it's uniqueness typing system before linear logic was as well understood as it is now, but yes, linear logic would do the job. |
| 02:55:58 | <FMota> | so you can use them for IO, because you can only a character off a stream once. |
| 02:56:07 | <ddarius> | scook0: As in they don't accept it as true. |
| 02:56:23 | <idnar> | what exactly is CDuce? |
| 02:56:36 | <ddarius> | idnar: Not Haskell. |
| 02:57:03 | <idnar> | hmm, ok |
| 02:57:08 | <pjd> | idnar: the act of getting people to use low-level programming languages? |
| 02:57:15 | <idnar> | pjd: bwahaha |
| 02:57:28 | <idnar> | ACTION should read more closely before following links |
| 02:58:40 | <scook0> | the CTMCP book makes it pretty clear that state adds expressiveness (and weakens other properties), I think |
| 02:59:24 | <ddarius> | Most people just use CTM for that. |
| 02:59:45 | <wli> | What's CTM? |
| 02:59:50 | <scook0> | I usually do too |
| 02:59:57 | <ddarius> | Concepts, Techniques, and Models of Computer Programming |
| 03:01:33 | <scook0> | I was assuming that "CTMCP" would make it easier for someone unfamiliar to find out what it is |
| 03:02:00 | <scook0> | but I don't think it actually helped |
| 03:02:17 | <ddarius> | "Concepts, Techniques and Models of Computer Programming" would be what you want in that case, or less helpfully, "Peter Van Roy's book" |
| 03:03:08 | <scook0> | sure, but those are more than 2 extra characters, and I was lazy :) |
| 03:03:18 | <scook0> | and I assumed *you* would know what I was talking about either way |
| 03:03:54 | <wli> | There needs to be a bibliographical database IRC client plugin. |
| 03:04:32 | <Philippa> | * ddarius wonders why "people" have issues with the fact that adding mutable state to a language is an expressiveness boost. <- Because it's often done in a way that makes a language merely differently expressive rather than clearly more expressive? |
| 03:06:30 | <scook0> | @what ctm |
| 03:06:30 | <lambdabot> | I know nothing about ctm. |
| 03:06:35 | <scook0> | @what+ ctm http://www.info.ucl.ac.be/~pvr/book.html |
| 03:06:35 | <lambdabot> | I know nothing about ctm. |
| 03:06:50 | <scook0> | @where+ ctm http://www.info.ucl.ac.be/~pvr/book.html |
| 03:06:51 | <lambdabot> | Done. |
| 03:06:57 | <scook0> | @what ctm |
| 03:06:58 | <lambdabot> | http://www.info.ucl.ac.be/~pvr/book.html |
| 03:07:05 | <ricky_clarkson> | @wtf ctm |
| 03:07:06 | <lambdabot> | Maybe you meant: bf ft wn |
| 03:07:28 | <ricky_clarkson> | @bf ft wn |
| 03:07:29 | <lambdabot> | fd:20: hClose: resource vanished (Broken pipe) |
| 03:07:29 | <FMota> | what's paradoxic about Van Roy's paradox? |
| 03:07:33 | <ddarius> | Philippa: Starting from a given "pure" language and adding state in the way it exists in practically all languages is definitively an expressiveness boost. |
| 03:07:37 | <pjd> | Philippa: that kind of statement can only end up in a heated debate about what exactly expressiviness means |
| 03:07:41 | <FMota> | (besides the fact that it may or may not be paradoxic) |
| 03:08:01 | <ddarius> | pjd: There is a specific definition of "expressiveness" that I have in mind and I don't think it's particularly contentious. |
| 03:08:09 | <pjd> | ddarius: you could consider the loss of referentially transparency a loss of expressiveness |
| 03:08:16 | <scook0> | I suppose theres the all-too-common assumtion that expressiveness is necessarily a good thing |
| 03:08:31 | <scook0> | in the sense that restricted expressiveness makes reasoning easier |
| 03:08:45 | <ddarius> | pjd: I didn't say the one I had in mind was the only one or necessarily the best one, but a reasonable one. |
| 03:09:05 | <ricky_clarkson> | Restricted expressiveness makes reasoning harder to express. |
| 03:09:13 | <FMota> | XD |
| 03:09:17 | <pjd> | one of several reasonable ones, which is the problem with that kind of statement :) |
| 03:09:32 | <scook0> | e.g. simply-typed \calc is "less expressive" than untyped, but you can solve the halting problem in it |
| 03:09:34 | <Philippa> | exactly. It's equally clearly not just a strict increase in expressiveness |
| 03:09:58 | <segher_> | first, define "expressiveness" |
| 03:09:59 | <ddarius> | pjd: I usually specify which "expressiveness" I mean, and with that one it is a strict increase in expressiveness. |
| 03:10:01 | <scook0> | Philippa: i.e. if you already have features equivalent to state? |
| 03:10:25 | <ddarius> | http://citeseer.ist.psu.edu/felleisen90expressive.html |
| 03:10:26 | <lambdabot> | Title: On the Expressive Power of Programming Languages - Felleisen (ResearchIndex) |
| 03:10:27 | <Philippa> | scook0: or a way to build them |
| 03:10:52 | <scook0> | Philippa: which is implied by "equivalent" ;) |
| 03:11:38 | <Olathe> | @check 1 == 1 |
| 03:11:39 | <lambdabot> | OK, passed 500 tests. |
| 03:11:42 | <Olathe> | Yay, it works ! |
| 03:11:47 | <ddarius> | Olathe: Whew. |
| 03:12:10 | <Olathe> | We can't be totally sure, though. There might be some value of 1 that wasn't checked. |
| 03:12:17 | <monochrom> | hahahha |
| 03:12:22 | <ddarius> | True, but I'm comforted. |
| 03:12:39 | <scook0> | @check (0/0) == (0/0) |
| 03:12:41 | <lambdabot> | Falsifiable, after 0 tests: |
| 03:12:52 | <monochrom> | Gives a new spin to "1 = 2 for large enough values of 1" or something. |
| 03:13:14 | <pjd> | does @check not suppress duplicate tests? |
| 03:13:34 | <ddarius> | @remember Olathe We can't be totally sure, though. There might be some value of 1 that wasn't checked. |
| 03:13:35 | <lambdabot> | Done. |
| 03:14:01 | <ddarius> | That said, there are values of 1 where that test may fail. |
| 03:14:09 | <mr_tenor> | is there a listing ofallthe quotes people have fed lambdabot somewhere? |
| 03:14:16 | <pjd> | ddarius: depends on the Num instance? |
| 03:14:21 | <ddarius> | mr_tenor: In the lambdabot database. |
| 03:14:26 | <mr_tenor> | :P |
| 03:14:44 | <ddarius> | pjd: More the Eq instance, as fromInteger 1 damn well better equal fromInteger 1. |
| 03:14:58 | <ddarius> | mr_tenor: I'm serious. |
| 03:15:23 | <pjd> | ddarius: well, as in the Num instance would have to return the funny Eq instance |
| 03:15:24 | <ddarius> | @version |
| 03:15:24 | <scook0> | I think the implied question was "is there a way for me to view this database?" |
| 03:15:24 | <lambdabot> | lambdabot 4p548, GHC 6.6 (Linux i686 2.66GHz) |
| 03:15:24 | <lambdabot> | darcs get http://www.cse.unsw.edu.au/~dons/lambdabot |
| 03:15:38 | <allbery_b> | dunno if it's still true but at one point you could geta snapshot by pulling the darcs version of lambdabot |
| 03:15:43 | <ddarius> | http://www.cse.unsw.edu.au/~dons/lambdabot/State/quote |
| 03:15:54 | <mr_tenor> | ACTION reads |
| 03:16:02 | <ddarius> | It's, for some insane reason, a gzipped text file. |
| 03:17:03 | <scook0> | is the requirement that Eq et al. behave sanely actually officially documented? it doesn't seem to be in the report |
| 03:17:22 | <ddarius> | scook0: I'm not sure that it is, or is very strongly. |
| 03:17:42 | <mr_tenor> | lambdabot stores state in dons' public_html directory? learn something new every day |
| 03:17:55 | <mr_tenor> | ddarius, scook0: cheers |
| 03:18:12 | <wli> | Why would Eq make a difference to the language? |
| 03:18:36 | <ddarius> | There is also the old QuotesPage, another thing in the lost tracts of HaWiki. |
| 03:19:04 | <wli> | Well, there are compiler intrinsics there. |
| 03:19:09 | <scook0> | wli: Eq itself is in the report |
| 03:19:52 | <scook0> | and a sanity requirement could potentially allow an optimizing compiler to short-circuit (==) with a pointer comparison |
| 03:20:11 | <pjd> | scook0: the situation is similar to many other type classes too |
| 03:20:14 | <scook0> | which you can't do if the compiler is obliged to respect faulty Eq |
| 03:21:08 | <pjd> | Functor, Monad, anything intended to capture behavior not directly reflected in the type system |
| 03:21:09 | <scook0> | at least Ord has the decency to mention "The Ord class is used for totally ordered datatypes", which implies sanity |
| 03:21:21 | <ecksit> | hello, i am just beginning to try to learn haskell and am having trouble with passing arguments as lists |
| 03:21:51 | <scook0> | ecksit: what do you have so far? |
| 03:22:06 | <ecksit> | i have two functions, one that adds a list, which i got off the internet |
| 03:22:30 | <ecksit> | the other divides the product of that list by the length of the list |
| 03:22:56 | <beelsebob> | ecksit: okay, well your first task is probably to understand how the sum function you have works |
| 03:22:58 | <pjd> | ecksit: a list of numbers? |
| 03:22:59 | <wli> | Eq may compare normal forms and do a number of machinations under the hood. |
| 03:23:17 | <ecksit> | so if the function is addList which takes a list as argument and returns its sum |
| 03:23:22 | <ecksit> | yeah, its integers |
| 03:23:47 | <scook0> | > sum [1, 3, 5] |
| 03:23:58 | <lambdabot> | 9 |
| 03:23:59 | <ecksit> | i figure the other function is "mean x = addList x / length x" |
| 03:24:12 | <pjd> | ecksit: you can perhaps paste what you have at http://hpaste.org/new |
| 03:24:17 | <beelsebob> | ecksit: yep, sounds good |
| 03:24:22 | <beelsebob> | ecksit: what's the problem? |
| 03:24:29 | <Cale> | ecksit: one problem with that |
| 03:24:38 | <beelsebob> | oh yeh |
| 03:24:41 | <Cale> | ecksit: length returns an Int, which is unsuitable for using / |
| 03:24:41 | <beelsebob> | function app binds tightest |
| 03:24:43 | <scook0> | ah, I think I see the problem |
| 03:24:52 | <ecksit> | i get a type error in application |
| 03:24:58 | <wli> | genericLength |
| 03:25:07 | <Cale> | So you either want genericLength or fromIntegral (length x) |
| 03:25:23 | <beelsebob> | ecksit: the problem is that function application is always the tightest binding thing -- so it's trying to give the function add list 4 arguments |
| 03:25:29 | <Cale> | beelsebob: no |
| 03:25:30 | <monochrom> | @type genericLength |
| 03:25:32 | <lambdabot> | forall b i. (Num i) => [b] -> i |
| 03:25:33 | <allbery_b> | still get a tpe error though, won't you? |
| 03:25:37 | <scook0> | mean xs = fromIntegral (sum xs) / fromIntegral (length xs) |
| 03:25:40 | <beelsebob> | the first one is x, the second one is /, the third is lingth |
| 03:25:40 | <monochrom> | Oh, nice, it's Num. |
| 03:25:46 | <Cale> | beelsebob: no, / is infix |
| 03:25:47 | <allbery_b> | right |
| 03:26:02 | <Cale> | beelsebob: to pass / as a parameter, you'd have to put it in parens |
| 03:26:12 | <beelsebob> | Cale: I thought infix opps had lower precidence than f-app? |
| 03:26:17 | <Cale> | Yes, lower. |
| 03:26:25 | <ddarius> | beelsebob: By your logic, 1 + 2 would be (1 (+)) 2 |
| 03:26:36 | <Cale> | Which means that it's (addList x) / (length x) |
| 03:26:53 | <ecksit> | so what does fromIntegral function do? |
| 03:26:55 | <beelsebob> | ddarius: no, that just makes + left ascosiative |
| 03:26:57 | <Cale> | / isn't a syntactically valid term |
| 03:27:03 | <monochrom> | numeric conversion |
| 03:27:11 | <beelsebob> | Cale: ah, fair enough indeed |
| 03:27:13 | <allbery_b> | :t fromIntegral |
| 03:27:15 | <lambdabot> | forall a b. (Num b, Integral a) => a -> b |
| 03:27:18 | <Cale> | ecksit: Converts any integer-like numeric type to any numeric type at all. |
| 03:27:30 | <ddarius> | beelsebob: Associativity can only come up with more than one operator. |
| 03:27:37 | <Cale> | In this case, probably Int to Double |
| 03:27:51 | <beelsebob> | ddarius: my point though wrong, had nothing to do with associativity though |
| 03:27:54 | <monochrom> | You've got an Int / But you want Double / Who do you call? / "fromIntegral!" |
| 03:27:59 | <beelsebob> | merely operator precidence |
| 03:28:02 | <ddarius> | beelsebob: Neither did my point. |
| 03:28:12 | <ddarius> | beelsebob: You brought up associativity, not me. |
| 03:28:14 | <wli> | mean xs = sum xs / genericLength xs ; stdErr = let { n = genericLength xs ; mu = sum xs / n } in sqrt $ (sum $ map (^2) $ [x - mu | x <- xs]) / (n - 1) |
| 03:28:19 | <monochrom> | (With apology to Ghostbusters :) ) |
| 03:28:25 | <beelsebob> | ddarius: as there's only one operator in 1 + 2, operator precidence can't possibly have any effect at all |
| 03:28:29 | <pjd> | ecksit: that fromIntegral type signature essentially says "from some integer type to some other numeric type" |
| 03:28:48 | <ddarius> | beelsebob: There is only one operator in addList x / length x |
| 03:28:56 | <pjd> | @remember monochrom You've got an Int / But you want Double / Who do you call? / "fromIntegral!" |
| 03:28:57 | <lambdabot> | Done. |
| 03:29:02 | <monochrom> | haha |
| 03:29:12 | <beelsebob> | ddarius: yes, but there's also function application -- which has a higher precidence than any operator |
| 03:29:32 | <beelsebob> | there's 3 apps there, not 1 |
| 03:29:38 | <Cale> | mean xs = sum xs / genericLength xs ; stdErr xs = let { n = genericLength xs ; mu = sum xs / n } in sqrt $ (sum [(x - mu)^2 | x <- xs]) / (n - 1) |
| 03:30:09 | <ddarius> | beelsebob: Suffice to say you had (have?) a serious issue understanding how Haskell is parsed. |
| 03:30:27 | <beelsebob> | ddarius: no, I merely got the precidence the wrong way round |
| 03:30:38 | <scook0> | if the list contents aren't Fractional, you need to convert (sum xs) to do the division |
| 03:30:43 | <Cale> | mean xs = sum xs / genericLength xs; stdErr xs = sqrt $ sum [(x - mu)^2 | x <- xs] / (n - 1) where n = genericLength xs ; mu = sum xs / n |
| 03:30:52 | <beelsebob> | the point is -- in 1+2 there's only one application -- precidence cannot possibly come into it |
| 03:30:59 | <ecksit> | i get an error "Instance of Fractional Integer required for definition of mean" |
| 03:31:17 | <ecksit> | maybe i should change the return to floating point notation? |
| 03:31:18 | <ddarius> | beelsebob: No you didn't. If you had the precedence wrong you would be saying that that parsed as addList (x / length) x |
| 03:31:18 | <beelsebob> | the only thing that changes whether it's (1+)2 or 1(+2) is associativity |
| 03:31:23 | <Cale> | ecksit: That means that you're trying to apply (/) to things which are Integers |
| 03:31:34 | <ddarius> | beelsebob: That is not associativity. |
| 03:31:36 | <beelsebob> | ddarius: no, I said it would be parsed as addList x (/) length x |
| 03:31:47 | <beelsebob> | I admit I was wrong |
| 03:31:49 | <Cale> | ecksit: To do (truncating) integer division, you can use div |
| 03:31:50 | <scook0> | ecksit: mean xs = fromIntegral (sum xs) / fromIntegral (length xs) |
| 03:31:54 | <beelsebob> | you just haven't got how I was wrong |
| 03:32:03 | <ecksit> | right, thats what i did |
| 03:32:15 | <monochrom> | What's in xs? |
| 03:32:21 | <ddarius> | beelsebob: I didn't say that you said what I said above, I said that you didn't but what it is what you should have said if you understood precedence and just mixed them up. |
| 03:32:33 | <ecksit> | actually i have it as x, not xs, ill try that |
| 03:32:47 | <ecksit> | i dont think it matters |
| 03:32:55 | <scook0> | ecksit: you're right, that won't make a difference |
| 03:32:56 | <mr_tenor> | @quote OlegFacts |
| 03:32:56 | <lambdabot> | OlegFacts says: Oleg solves NP-hard problems in N log N time... in the type system |
| 03:33:00 | <beelsebob> | ddarius: all I did was take "function application binds tightest" one step too far -- I bound the / to addList as another argument |
| 03:33:00 | <ddarius> | beelsebob: You have a serious misunderstanding of either the terminology or what is actually going on. |
| 03:33:04 | <scook0> | (xs is just a Haskell style thing) |
| 03:33:18 | <beelsebob> | ddarius: no, you have a serious misunderstanding of what went wrong in my head |
| 03:33:19 | <ecksit> | hmm, same error |
| 03:33:28 | <ddarius> | beelsebob: Define associativity. |
| 03:33:36 | <scook0> | ecksit: what's your current definition? |
| 03:33:42 | <monochrom> | > fromIntegral (sum [1,2,3]) / fromIntegral (length [1,2,3]) |
| 03:33:42 | <ddarius> | Or rather, state in symbols what it means for an operator to be associative. |
| 03:33:46 | <lambdabot> | 2.0 |
| 03:33:51 | <monochrom> | seems to work |
| 03:33:51 | <ecksit> | mean :: [Integer] -> Integer |
| 03:33:55 | <beelsebob> | ddarius: associativity is the order in which operations of the same precidence are bound |
| 03:33:59 | <Cale> | ecksit: There's your problem :) |
| 03:34:13 | <Cale> | ecksit: That's not an appropriate type for the code we've been providing |
| 03:34:14 | <beelsebob> | an operator is left associative if x opp y opp z == (x opp y) opp z |
| 03:34:17 | <monochrom> | [Integer] -> Double |
| 03:34:23 | <beelsebob> | and right associative if the brackets appear on the other side |
| 03:34:52 | <ddarius> | beelsebob: Okay, then 1+2 can't be a case of associativity because there is only one operator. |
| 03:35:04 | <scook0> | or, if you want to be fancy, (Fractional a) => [Integer] -> a, though Double is likely sufficient for your purposes |
| 03:35:10 | <Cale> | :t let mean xs = fromIntegral (sum xs) / fromIntegral (length xs) in mean |
| 03:35:12 | <lambdabot> | forall a b. (Integral a, Fractional b) => [a] -> b |
| 03:35:19 | <beelsebob> | ddarius: no, but that's the closest possible description of what you seemed to be trying to do -- as parsing 1+2 as (1+)2 |
| 03:35:31 | <beelsebob> | (which is a bloody odd thing to do) |
| 03:35:45 | <ecksit> | ok, i think that worked, thanx alot |
| 03:35:49 | <allbery_b> | > let f = (1+) in f 2 |
| 03:35:51 | <lambdabot> | 3 |
| 03:35:59 | <scook0> | beelsebob: no, it was (1 $ (+)) 2 |
| 03:36:10 | <ddarius> | beelsebob: I was following exactly your example, parsing 1+2 as 1 applied to (+) and that applied to 2 which is exactly what (1 (+)) 2 parses as. |
| 03:36:16 | <ecksit> | i just started using haskell today and its weird but cool |
| 03:36:23 | <allbery_b> | ...what's so odd about it? :) |
| 03:36:28 | <beelsebob> | scook0: check your logs -- no dollars there |
| 03:36:37 | <monochrom> | It does many things right. That is why it's weird and cool. |
| 03:36:40 | <Cale> | allbery_b: hehe |
| 03:36:46 | <beelsebob> | ddarius: but that makes no sense at all -- 1 is not an identifier |
| 03:36:49 | <beelsebob> | and couldn't be |
| 03:36:57 | <beelsebob> | because identifiers can't start with numerals |
| 03:37:01 | <scook0> | beelsebob: the $ was to clarify the intent, it wasn't in the original |
| 03:37:14 | <ddarius> | beelsebob: You can quite definitely legitimately have write (1 (+)) 2 in code and have it parse and execute. |
| 03:37:35 | <beelsebob> | ddarius: yes -- but it most deffinately won't execute as "1 applied to (+)" |
| 03:37:41 | <scook0> | you just need a sufficiently crazy instance of Num |
| 03:37:42 | <ddarius> | beelsebob: Sure it could. |
| 03:37:47 | <beelsebob> | it'll execute as (+) applied first to 1, then to 2 |
| 03:37:57 | <ddarius> | beelsebob: No it won't. |
| 03:37:58 | <beelsebob> | 1 cannot be applied |
| 03:37:59 | <ecksit> | its most similar to python, nothing like java or c |
| 03:38:01 | <beelsebob> | it's not a function |
| 03:38:04 | <ddarius> | 1 can so be applied. |
| 03:38:06 | <allbery_b> | you might want to look at my example again and think about currying and partial application |
| 03:38:12 | <ddarius> | 1 can be a function. |
| 03:38:19 | <beelsebob> | ddarius: 1 can't even be an identifier |
| 03:38:26 | <beelsebob> | identifier start with letters |
| 03:38:34 | <ddarius> | \x -> x is not an identifier either, but I can apply it too. |
| 03:38:38 | <allbery_b> | let 1 = 3 in 1 + 1 |
| 03:38:42 | <allbery_b> | > let 1 = 3 in 1 + 1 |
| 03:38:43 | <lambdabot> | 2 |
| 03:38:47 | <allbery_b> | oh well |
| 03:38:56 | <Cale> | beelsebob: remember that 1 really means (fromInteger 1), and you can write an instance of Num for a function type |
| 03:39:02 | <scook0> | allbery_b: o_O |
| 03:39:02 | <beelsebob> | ddarius: yes -- and functions are one of... (a) named functions (identifiers) or (b) lambda expressions |
| 03:39:26 | <Cale> | beelsebob: Given the way that integer literals are overloaded, 1 can be of any type at all. |
| 03:39:31 | <ddarius> | beelsebob: No. It could also be an application, or a case analysis, or a let expression, or in fact any expression that evaluates to a function. |
| 03:39:31 | <allbery_b> | scook0: let binding can do interesting things |
| 03:39:32 | <beelsebob> | Cale: haha, now *that* would be impressively confusing |
| 03:39:34 | <Cale> | beelsebob: It just has to be an instance of Num. |
| 03:40:06 | <scook0> | beelsebob: (flip id) is a function, but it's neither (a) nor (b) |
| 03:40:09 | <beelsebob> | hmm, *goes away and writes instance Num (a -> a)* |
| 03:40:19 | <ddarius> | allbery_b: Unfortunately for you, that was just a failed but irrefutable pattern match of 1 against 3. |
| 03:40:24 | <allbery_b> | yep |
| 03:40:31 | <Cale> | beelsebob: unfortunately, you'll have to provide some crappy instances for Eq and Show |
| 03:40:46 | <beelsebob> | Cale: true, but if all my functions a->a are id, then that's pretty easy |
| 03:40:53 | <pjd> | @type (/) <$> fromIntegral . sum <*> fromIntegral . length |
| 03:40:55 | <lambdabot> | forall b a. (Integral a, Fractional b) => [a] -> b |
| 03:40:57 | <Cale> | heh, okay |
| 03:41:00 | <allbery_b> | Church numerals? |
| 03:41:11 | <ddarius> | Actually the typical Church encoding is a -> (a -> a) -> a |
| 03:41:19 | <ddarius> | With some foralls sprinkled about. |
| 03:41:24 | <Cale> | You can write a more meaningful instance for (Num b) => a -> b |
| 03:41:39 | <beelsebob> | Cale: of note... 1+2 would *still* not be parsed as 1 applied to +, because of defaulting |
| 03:41:45 | <beelsebob> | even if that instance did exist |
| 03:41:56 | <ddarius> | It wouldn't parse as that period because of the syntax of Haskell. |
| 03:42:02 | <Cale> | no, it wouldn't be parsed that way because of the way that infix functions are parsed |
| 03:42:08 | <Cale> | It(+) 1 2 |
| 03:42:16 | <Cale> | It's desugared to (+) 1 2 |
| 03:42:20 | <monochrom> | But now (1 (+)) is valid. |
| 03:42:30 | <beelsebob> | true |
| 03:42:35 | <beelsebob> | which would be entertaining |
| 03:42:57 | <beelsebob> | ACTION notes that down for Haskell obfuscation techniques |
| 03:43:10 | <ddarius> | ACTION often finds himself wanting a Num b => Num (a -> b) instance. |
| 03:43:25 | <beelsebob> | o.O |
| 03:43:29 | <beelsebob> | ACTION finds that scary |
| 03:43:38 | <beelsebob> | actually no |
| 03:43:47 | <beelsebob> | that just gives you a nice way to define an ordering on functions |
| 03:44:11 | <beelsebob> | although... why not just do Ord (a -> b) |
| 03:44:43 | <ddarius> | It's not that at all. It won't make making an Ord instance any more possible. It's just pointwise addition, subtraction, etc. |
| 03:45:15 | <ddarius> | It would be necessary to give dummy instances for Eq and Show and Ord. |
| 03:45:43 | <beelsebob> | I'm missing what you're gaining |
| 03:45:48 | <monochrom> | functional analysis and differential equation do that all the time. E.g., "d/dx + 5" means "\y -> dy/dx + 5*y". Quantum mechanics books to that all the time. |
| 03:45:54 | <beelsebob> | can you show me something you can do with that that you can't otherwise? |
| 03:46:30 | <beelsebob> | hmm, fair enough |
| 03:46:44 | <monochrom> | So 5 is not only used as a function, in fact it is a higher order function. |
| 03:46:47 | <beelsebob> | that's quite neat actually |
| 03:47:08 | <beelsebob> | although fairly nasty if you're trying to read the code |
| 03:47:25 | <Cale> | monochrom: Not \y -> dy/dx + 5 ? |
| 03:47:32 | <monochrom> | No. I'm sure. |
| 03:47:39 | <Cale> | er, oh, right |
| 03:47:40 | <ddarius> | Readability is why you'd do it. |
| 03:48:07 | <ddarius> | Though you'd probably only want to do it in a domain where that is very natural or standard. |
| 03:48:23 | <SamB_XP_> | ACTION thinks what Cale said would be valid but odd |
| 03:48:23 | <Cale> | I'm more used to the derivative operator being called D when used like that though. :) |
| 03:49:13 | <Cale> | yeah, I kind of misread what he wrote |
| 03:49:37 | <ddarius> | SamB_XP_: Cale's is more natural. Usually in QM the application is read as a multiplication. |
| 03:49:40 | <wli> | It's done often with generating functions as well. |
| 03:49:43 | <Cale> | dy/dx + 5 would mean \k -> (dy/dx)|_k + 5 |
| 03:49:56 | <wli> | z (d/dz) for instance is even written d/d(log(z)) |
| 03:50:07 | <Cale> | (Leibniz notation is awkward, and I tend not to use it) |
| 03:50:42 | <SamB_XP_> | I wonder if I could get away with using lambdas in any of my courses... |
| 03:50:43 | <Cale> | f' + 5 would mean \x -> f'(x) + 5 |
| 03:50:43 | <monochrom> | One reason it is done is because higher-order functions like (\y -> Dy + 5*y) belong to a nice class (called "operators") with nice properties. If you focus on operators themselves (rather than always applying them), i.e., if you go pointfree, you get important insights. |
| 03:51:02 | <Cale> | Right, D is a linear operator |
| 03:51:07 | <ddarius> | Agreed. |
| 03:51:17 | <SamB_XP_> | I have used D as a linear operator. briefly. |
| 03:51:22 | <Cale> | and in that context, a number n is treated as n times the identity map |
| 03:51:43 | <Cale> | Just like how you use 1 for the identity matrix. |
| 03:51:54 | <Cale> | (though some people don't like that overloading and use I) |
| 03:52:02 | <monochrom> | IIUC you get into Hilbert space something. It tells you a lot about quantum mechanics. The same results are not easily available pointful. |
| 03:52:08 | <SamB_XP_> | that was probably for one section of one chapter in Differential Equations, though |
| 03:53:02 | <ddarius> | SamB_XP_: You can almost treat D as a number and use normal number tricks, the difference is the algebra formed is non-commutative. |
| 03:53:14 | <SamB_XP_> | istr that |
| 03:53:14 | <Cale> | SamB: yeah, it's important notation for solving certain classes of differential equations where you can view the equation as some polynomial in D applied to your function being equal to some constant. |
| 03:53:45 | <ddarius> | It's really cute. |
| 03:53:47 | <SamB_XP_> | it'll probably make more sense once I've had linear algebra ;-) |
| 03:53:50 | <Cale> | p(D) f = g |
| 03:55:17 | <monochrom> | Quantum people are the people who can testify that pointfree is not just aesthetics, it's actually bread and butter. |
| 03:56:15 | <Cale> | Certain algebraic topologists are also quite fond of it. |
| 03:56:25 | <ddarius> | They would be. |
| 03:56:29 | <sorear> | Quantum people also have a habit of asserting without proof that any set of reals can be indexed by naturals. |
| 03:56:32 | <Cale> | Differential geometers just go nuts. |
| 03:56:46 | <sorear> | Physicist math makes me *sick*. |
| 03:56:47 | <ddarius> | Cale: It's reasonable there. |
| 03:56:54 | <monochrom> | hehehe |
| 03:57:04 | <ddarius> | sorear: Look at better physicists. |
| 03:57:05 | <Cale> | The overloading that happens in differential geometry confuses the hell out of me half the time. |
| 03:57:20 | <ddarius> | Cale: Agreed. |
| 03:57:29 | <Cale> | Yeah, most physicists have awful notation, but there are some who actually know what they're doing :) |
| 03:57:50 | <Cale> | It's really the lack of rigour which annoys me in physics. |
| 03:58:12 | <ddarius> | Cale: With differential geometry, my main issue is the inconsistency in the use of the notation. |
| 03:58:16 | <edwardk> | cale: just coz they like to cut off taylor series after a term or two as good enough... =) |
| 03:58:36 | <TSC> | Can someone explain this strange GHC warning? "Warning: Imported from `Data.Dynamic' but not used: `toDyn'" -- but I do use toDyn in the module! |
| 03:58:41 | <ddarius> | edwardk: QM is linear! It's amazing! |
| 03:58:47 | <Cale> | ddarius: heh, yeah, differential geometry has been referred to as the study of invariants under change of notation |
| 03:58:51 | <edwardk> | ddarius: =) |
| 03:59:23 | <monochrom> | I knew every geometry is supposed to be the invariance of something rather. |
| 04:00:02 | <FMota> | well, for normal intents and purposes, the real numbers /can/ be indexed by the natural numbers. |
| 04:00:19 | <FMota> | you simply restrict yourself to rationals |
| 04:00:26 | <FMota> | and that tends to be good enough |
| 04:00:36 | <monochrom> | IEEE 754 FTW |
| 04:00:44 | <ddarius> | Let's just sweep pi, e, and the Euler-Mascheroni constant under the rug. |
| 04:00:55 | <Cale> | Not to mention sqrt(2) |
| 04:01:02 | <FMota> | ddarius: you can use approximations |
| 04:01:06 | <monochrom> | just use rational trig. |
| 04:01:11 | <FMota> | physicists use approximations all the time ;) |
| 04:01:51 | <FMota> | heh. CS people should know that too. |
| 04:02:16 | <edwardk> | yeah, we call the usual approximation a 'float' =) |
| 04:02:21 | <sorear> | Cale: haha, I love it |
| 04:02:32 | <ddarius> | Field extensions should be no problem. |
| 04:02:54 | <Cale> | Yeah, you can work with the algebraic numbers, though it's computationally a little involved. |
| 04:03:20 | <scook0> | well, IEEE754 tends to approximate insanity more than it does the reals |
| 04:03:21 | <FMota> | ;) |
| 04:03:27 | <earnest> | here's what i get when i run xmonad from my .xinitrc: |
| 04:03:27 | <earnest> | Xlib: extension "XINERAMA" missing on display ":0.0". |
| 04:03:34 | <SamB_XP_> | Cale: I didn't know sqrt was a syscall! |
| 04:03:53 | <scook0> | ACTION groans |
| 04:03:54 | <Cale> | SamB_XP_: hm? |
| 04:04:03 | <FMota> | heh |
| 04:04:05 | <ddarius> | man |
| 04:04:06 | <sorear> | Lots of other stuff, too. Like in the derivation of the Fermi-Dirac equation, a book I'm looking at goes "Okay, now this square root is too hard, so square both sides (later on, we'll revise our physics to make the spurious solutions seem real)" |
| 04:04:07 | <SamB_XP_> | Cale: you said something about sqrt(2) |
| 04:04:17 | <ddarius> | Took me a second too. |
| 04:04:18 | <FMota> | I dislike floats :/ |
| 04:04:18 | <Cale> | SamB_XP_: yeah? I mentioned that it's not rational. |
| 04:04:26 | <ddarius> | which(1) |
| 04:04:31 | <SamB_XP_> | Cale: stupid pun, yes, I know... |
| 04:04:34 | <Cale> | oh |
| 04:04:41 | <Cale> | I see |
| 04:04:47 | <ddarius> | FMota: Use doubles. |
| 04:05:08 | <FMota> | ddarius: I dislike those too, as you probably can guess. |
| 04:05:09 | <edwardk> | ieee754 is the bane of my existence, i can't comply with its notion of equality and have a notion of observational equality between floats since it says that 0 = -0, but that they have different behaviors. |
| 04:05:30 | <beelsebob> | o.O |
| 04:05:31 | <ddarius> | FMota: Use affine arithmetic. |
| 04:05:33 | <scook0> | > map (1/) [0, -0] |
| 04:05:38 | <lambdabot> | [Infinity,-Infinity] |
| 04:05:42 | <beelsebob> | haha |
| 04:05:44 | <beelsebob> | fun |
| 04:05:55 | <edwardk> | > 0 == -0 |
| 04:05:57 | <lambdabot> | True |
| 04:06:00 | <Boney> | > Infinity == (-Invinity) |
| 04:06:01 | <lambdabot> | Not in scope: data constructor `Invinity' |
| 04:06:07 | <Cale> | > (1/0) == (1/(-0)) |
| 04:06:08 | <lambdabot> | False |
| 04:06:08 | <beelsebob> | but then Infinity and -Infinity don't exist |
| 04:06:09 | <Boney> | > Infinity == (-Invfinity) |
| 04:06:10 | <lambdabot> | Not in scope: data constructor `Invfinity' |
| 04:06:16 | <scook0> | > (\x -> x == x) (0/0) -- this one's fun too |
| 04:06:17 | <SamB_XP_> | ACTION continues to add books to his bookshelf on facebook... |
| 04:06:18 | <lambdabot> | False |
| 04:06:18 | <Boney> | nm, |
| 04:06:22 | <edwardk> | beelsebob: tell that to ieee754 =) |
| 04:06:27 | <beelsebob> | so it seems reasonable that in their equal non-existance they should be equal |
| 04:06:32 | <beelsebob> | edwardk: :P |
| 04:06:47 | <segher_> | you think floats are bad? "computer integers" aren't integers, either |
| 04:07:00 | <beelsebob> | edwardk: only way to rectify it is to say "well, numbers meet up round the back somewhere" |
| 04:07:06 | <edwardk> | oh, and i can't even have an observational disequality because two NaN's with the same physical representation have to be inequal =) |
| 04:07:08 | <beelsebob> | so Infinity == -Infinity |
| 04:07:16 | <sjanssen> | earnest: I think you can ignore that warning |
| 04:07:21 | <wli> | They're at least Z/2^nZ for some n. |
| 04:07:23 | <scook0> | segher_: "unlimited"-precision integers are decent, though |
| 04:07:26 | <ddarius> | segher_: Integers are a reasonable approximation, and Ints form a relatively nice mathematical structure. |
| 04:07:46 | <segher_> | scook0: no they're not -- the division operator isn't there |
| 04:07:58 | <FMota> | segher_: yes, however, it's trivial to extend ints, to be able to handle arbitrarily large numbers. |
| 04:08:00 | <beelsebob> | ACTION hands everyone a nice shiny church numeral and considers bed |
| 04:08:00 | <segher_> | not with the correct semantics, that is |
| 04:08:06 | <FMota> | except for one simple fact |
| 04:08:30 | <FMota> | computers aren't computers. ;) |
| 04:08:45 | <monochrom> | There is some wisdom in that. |
| 04:08:48 | <ddarius> | They're not Turing machines, that's for sure. |
| 04:08:52 | <FMota> | ;) |
| 04:08:53 | <scook0> | segher_: what about arbitrary-precision rationals? |
| 04:08:56 | <monochrom> | Another one is: humans aren't intelligent. |
| 04:08:56 | <segher_> | yeah, no actual computer is equivalent to a turing machine, heh |
| 04:09:05 | <FMota> | they're just approximations |
| 04:09:07 | <beelsebob> | rubbish! |
| 04:09:15 | <beelsebob> | my computer has an infinite tape coming out of it |
| 04:09:19 | <segher_> | scook0: sure, but those aren't "computer integers" |
| 04:09:22 | <FMota> | but in reality, they're just huge finite state machines |
| 04:09:50 | <FMota> | ...aren't we all? |
| 04:09:58 | <ddarius> | Isn't the whole universe? |
| 04:10:00 | <beelsebob> | FMota: which is scary -- because the implication is that all these "Context free grammars" we're programming them with are just giant regexps |
| 04:10:02 | <scook0> | segher_: sure ... my point is that it's easier to paper over the deficiencies of machine integers than machine floats |
| 04:10:04 | <monochrom> | I keep plugging in USB fingers to extend its memory. |
| 04:10:15 | <segher_> | huge finite state machines? humans have just two states, "on" and "off" ;-) |
| 04:10:19 | <FMota> | lopl |
| 04:10:21 | <FMota> | *lol |
| 04:10:34 | <allbery_b> | ACTION 's state is uually irrational |
| 04:10:34 | <FMota> | and since NDFA = DFA |
| 04:10:37 | <segher_> | scook0: true enough |
| 04:10:42 | <FMota> | ...we're all deterministic |
| 04:10:57 | <beelsebob> | FMota: I'd come to terms with that ages ago |
| 04:11:03 | <segher_> | fmota: yeah, we all switch to "off" state soon enough |
| 04:11:21 | <FMota> | :) yep. And I'm perfectly fine with it. |
| 04:11:39 | <scook0> | doesn't that mean you've solved the halting problem for human beings? ;) |
| 04:11:40 | <ddarius> | On a long enough timeline, the local state of everyone transitions to zero. |
| 04:11:49 | <beelsebob> | o -> (o) <-- the human :) |
| 04:11:52 | <scook0> | what if somebody diverges? |
| 04:12:05 | <FMota> | not gonna happen |
| 04:12:12 | <beelsebob> | scook0: yes -- human beings halt -- there, solved |
| 04:12:13 | <FMota> | (IMO) |
| 04:12:17 | <FMota> | heh |
| 04:12:17 | <segher_> | fmota: people look really strange at you if you want to test if the DFA in a new human works correctly |
| 04:12:23 | <FMota> | I can solve the halting problem |
| 04:12:24 | <monochrom> | divergence is called insanity. those people get sent to asylums. |
| 04:12:37 | <beelsebob> | FMota: in general? |
| 04:12:40 | <FMota> | yes |
| 04:12:45 | <FMota> | well |
| 04:12:45 | <beelsebob> | you can solve it for dogs too? |
| 04:12:52 | <ddarius> | Didn't I solve that last week. |
| 04:12:57 | <FMota> | for anything that actually exists |
| 04:13:00 | <monochrom> | hhahaha |
| 04:13:14 | <beelsebob> | FMota: even a jack russel? |
| 04:13:17 | <FMota> | halt f = true |
| 04:13:18 | <FMota> | ;) |
| 04:13:27 | <SamB_XP_> | ddarius: whether the universe is a finite state machine or not may depend on it's expansion/contraction... |
| 04:13:28 | <beelsebob> | I'm pretty sure some jack russels will carry on chasing their tails forever |
| 04:14:01 | <segher_> | samb_xp: if it is an fsm, it cannot contract nor expand ;-) |
| 04:14:07 | <ddarius> | SamB_XP_: Maybe, I'm actually betting that it doesn't. |
| 04:14:33 | <FMota> | segher_: but it can appear to do so |
| 04:14:33 | <segher_> | otoh, the universe _is_ created _by_ an FSM. and that's a fact :-) |
| 04:14:42 | <FMota> | lol |
| 04:14:48 | <scook0> | praise his noodly appendage! |
| 04:14:54 | <FMota> | omg, that makes so much sense. |
| 04:14:59 | <beelsebob> | ohh, another pastafarian |
| 04:15:05 | <SamB_XP_> | I'm thinking that if it expands fast enough, the relevant-to-me universe might be an FSM |
| 04:15:12 | <FMota> | er, *omfsm |
| 04:15:33 | <SamB_XP_> | probably an NFA... |
| 04:15:54 | <segher_> | beelsebob: hey, if i have to pick a religion, i pick the one with beer volcanos every day of the week |
| 04:15:55 | <FMota> | NFA = DFA, so FSM suffices really |
| 04:16:05 | <beelsebob> | segher_: and pirates! |
| 04:16:14 | <SamB_XP_> | FMota: it makes a difference at the reality level |
| 04:16:27 | <SamB_XP_> | I do not feel like a quantum superposition... |
| 04:16:29 | <segher_> | beelsebob: yeah, but that only on fridays |
| 04:16:35 | <FMota> | :) good point |
| 04:16:58 | <beelsebob> | I don't know -- there might be an un-me somewhere |
| 04:17:06 | <SamB_XP_> | ... 'twould be a very confused sort of feeling, if I did ;-) |
| 04:17:13 | <beelsebob> | but only if you actually observed me |
| 04:17:18 | <beelsebob> | best not turn my camera on |
| 04:17:21 | <sorear> | you mean the universe isn't a giant 64-dimensional membrane sitting in the tensor bundle of a 4-sphere? |
| 04:17:41 | <segher_> | sorear: yeah, it has only six dimensions |
| 04:17:43 | <scook0> | sorear: actually, it's turtles all the way down |
| 04:17:48 | <beelsebob> | sorear: well, it is, but the surface is covered in a giant diagram of a state machine :P |
| 04:18:07 | <FMota> | I thought it was a cube?! SHUT UP! |
| 04:18:14 | <FMota> | :o |
| 04:18:40 | <SamB_XP_> | if we could get the philosphers to buy that NFA = DFA argument, it would save them a lot of trouble ;-) |
| 04:18:47 | <beelsebob> | haha |
| 04:19:06 | <FMota> | :) |
| 04:19:30 | <beelsebob> | so in one night, we have successfully solved P=NP, the halting problem, and the deepest mysteries of the universe? |
| 04:19:32 | <beelsebob> | WIN! |
| 04:19:43 | <segher_> | if we could get the philosophers to buy _any_ argument, it would save _us_ a lot of trouble |
| 04:19:48 | <ddarius> | Computer science: Destroying jobs since 1946 |
| 04:19:58 | <beelsebob> | 46? |
| 04:20:02 | <scook0> | beelsebob: tomorrow, we'll solve emacs vs. vi! |
| 04:20:08 | <tessier_> | ddarius: Destroying jobs? |
| 04:20:09 | <FMota> | beelsebob: I haven't laughed so hard in a couple of weeks. :) |
| 04:20:12 | <beelsebob> | scook0: SubEthaEdit :P |
| 04:20:23 | <FMota> | or... no, wait, actually, I laughed a lot last week |
| 04:20:46 | <segher_> | emacs vs. vi will be solved pretty soon -- emacs will die an entropy death |
| 04:20:57 | <FMota> | something about a Haskell being used by Native American tribes as a mind-altering substance. |
| 04:21:00 | <ddarius> | Or implode into a blackhole! |
| 04:21:02 | <beelsebob> | either that or vi will be replaced with vii |
| 04:21:03 | <SamB_XP_> | segher_: I don't see why that prevents me from using it |
| 04:21:34 | <segher_> | samb_xp_: sure, but you'll be gone with it |
| 04:21:37 | <beelsebob> | ACTION is determined to always pronounce vi "six" |
| 04:22:00 | <SamB_XP_> | ACTION hopes his parents won't be too mad that he has forgotten to do the dishes ... er, yes, that does mean I'm going to bed now... |
| 04:22:12 | <beelsebob> | nn SamB |
| 04:22:28 | <SamB_XP_> | nn = nighty night? |
| 04:22:32 | <beelsebob> | yep |
| 04:22:44 | <beelsebob> | ACTION actually did the dishes tonight |
| 04:22:48 | <FMota> | gn! |
| 04:22:52 | <beelsebob> | just as well, the place was rapidly becoming a shit tip |
| 04:23:02 | <FMota> | ACTION had a pizza slice out. :/ |
| 04:23:13 | <SamB_XP_> | nn to you too! |
| 04:23:50 | <beelsebob> | ACTION notes that he really should not get addicted to sitting in here again when he has writing up to do :( |
| 04:24:29 | <FMota> | work is overrated |
| 04:24:36 | <beelsebob> | well |
| 04:24:41 | <beelsebob> | when you have 3 months money remaining |
| 04:24:53 | <FMota> | :/ |
| 04:25:02 | <beelsebob> | it's probably fairly necessary |
| 04:27:29 | <earnest> | ACTION bows to the authors of xmonad |
| 04:27:57 | <earnest> | i haven't seen a useful software after the gnu emacs in a long time |
| 04:28:29 | <sorear> | interesting |
| 04:28:31 | <earnest> | ACTION very satisfied |
| 04:28:33 | <monochrom> | nice |
| 04:28:48 | <sorear> | the level of xmonad talk on #haskell is almost back to the level it was when I created #xmonad |
| 04:29:07 | <earnest> | i didnt know there was #xmonad |
| 04:29:21 | <FMota> | If I had linux, I'd try it out |
| 04:29:23 | <sorear> | but we are pleased you're pleased :) |
| 04:29:31 | <beelsebob> | ACTION has never seen the point of tiling window managers |
| 04:29:32 | <hpaste> | s pasted "(no title)" at http://hpaste.org/2637 |
| 04:29:34 | <FMota> | as it stands, I have very little reason to install it... |
| 04:29:41 | <beelsebob> | overlapping stuff I find so much more useful |
| 04:29:48 | <FMota> | but I'd like to try it. so, yeah |
| 04:29:53 | <beelsebob> | let things be the shapes they need to be |
| 04:29:56 | <earnest> | Fmota: what system do you use? |
| 04:30:00 | <FMota> | Mac |
| 04:30:02 | <sorear> | sfultong: means what it says |
| 04:30:13 | <earnest> | i used to do with my mouse with xmonad now does by itself |
| 04:30:20 | <sorear> | sfultong: you have a misnamed module |
| 04:30:24 | <beelsebob> | if the document is A4, why should the window be wider than the A4 page |
| 04:30:38 | <monochrom> | ACTION wants an editor that takes the shape of the Mendolbrot set or something. |
| 04:30:39 | <earnest> | i used to do with my mouse *what* xmonad now does by itself |
| 04:31:05 | <monochrom> | It would completely justify procrastination - even better than "compiling". :) |
| 04:31:06 | <earnest> | beelsebob: you got a point, but most of the time i really want to tile the winodws |
| 04:31:16 | <beelsebob> | earnest: I used to do with my mouse what the F9 key does by its self |
| 04:31:18 | <sfultong> | sorear: yes, but... a similarly named module works fine... a module called Client.Display in file Client/Display.hs works fine... |
| 04:31:30 | <beelsebob> | now windows just go everywhere |
| 04:31:38 | <beelsebob> | and it doesn't matter |
| 04:31:54 | <earnest> | i still prefer xmonad than those fancies window managers |
| 04:32:04 | <earnest> | there's also that; there's some kind of beauty in simplicity |
| 04:32:24 | <mr_tenor> | like programming languages, you don't want the freedom to stuff things up |
| 04:32:25 | <earnest> | now i just wish alt would function as my meta key under xterm |
| 04:32:28 | <conal> | sorear: thanks for the poiner for library submissions and the alternative suggestion for Cont as a monoid. |
| 04:32:48 | <sorear> | sfultong: Exactly - in file Client/Display.hs |
| 04:32:59 | <earnest> | prefer xmonad [over] those fancies window managers |
| 04:33:08 | <sorear> | sfultong: You need Client/ClientState.hs, not ClientState.hs |
| 04:33:19 | <sorear> | earnest: quite easy |
| 04:33:20 | <sfultong> | sorear: yup, that's what I have |
| 04:33:22 | <beelsebob> | earnest: http://www.apple.com/macosx/features/expose/ <-- solves the same problem, but allows windows to be freeform |
| 04:33:23 | <lambdabot> | Title: Apple - Mac OS X - Exposé |
| 04:33:28 | <hpaste> | conal pasted "Monoid choices for Cont" at http://hpaste.org/2638 |
| 04:34:15 | <sorear> | sfultong: grep -r 'import *ClientState' . |
| 04:34:19 | <earnest> | sorear: do you know how to get my alt in shape? |
| 04:34:31 | <sorear> | earnest: yeah, change modKey to mod4Mask |
| 04:34:43 | <earnest> | in my xorg.conf? |
| 04:34:43 | <sorear> | earnest: I have no clue why the default is what it is... |
| 04:34:51 | <sorear> | earnest: in your Config.hs |
| 04:34:58 | <earnest> | oh, is that in xmonad? |
| 04:35:05 | <earnest> | but it was this way even before xmonad |
| 04:35:11 | <sorear> | earnest: oh. |
| 04:35:16 | <sorear> | earnest: what terminal? |
| 04:35:19 | <earnest> | xterm |
| 04:36:26 | <sorear> | urxvt works for me |
| 04:36:31 | <sfultong> | sorear: huh, interesting... I didn't realize that how I imported a module would affect how ghc thought it should be named |
| 04:36:39 | <sfultong> | sorear: thanks, too :) |
| 04:36:45 | <earnest> | i guess i should leave xterm in the past then |
| 04:36:56 | <earnest> | i hear that urxvt has good support of unicode? |
| 04:37:04 | <sorear> | sfultong: you're probably under the impression module names are hierarchal |
| 04:37:11 | <sorear> | sfultong: they aren't |
| 04:37:22 | <sorear> | sfultong: Data.Map, Data, and Control.Monad are equally unrelated |
| 04:37:51 | <sorear> | sfultong: when you import ClientState, ghc looks for ClientState.hs in the path (. and ..), finding it in . |
| 04:38:03 | <sfultong> | sorear: I thought directory structure was important for module names |
| 04:38:04 | <sorear> | sfultong: and expects it to be module ClientState |
| 04:38:39 | <sorear> | sfultong: Only true insofar as module names contain slashes. |
| 04:39:00 | <sorear> | sfultong: when you import Client.ClientState, GHC looks for Client/ClientState.hs in the path (. and ..), finding it in .. - but expects module Client.ClientState |
| 04:39:21 | <sorear> | sfultong: the *only* significance of . is that it expands to the platform filename separator |
| 04:39:44 | <sorear> | sfultong: there is no scoping, no concept of a current directory, no fanciness of any kind |
| 04:39:51 | <sorear> | sfultong: just s/./\//g |
| 04:40:06 | <sorear> | sfultong: clears this up? |
| 04:40:40 | <sfultong> | yes, thanks |
| 04:49:42 | <falconair> | > replicate 6 (recip 6) |
| 04:49:44 | <lambdabot> | [0.16666666666666666,0.16666666666666666,0.16666666666666666,0.1666666666666... |
| 04:49:45 | <falconair> | > let dist buckets = replicate buckets (recip buckets) in dist 6 |
| 04:49:46 | <lambdabot> | add an instance declaration for (Fractional Int) |
| 04:49:57 | <falconair> | what's going on here? why does one work and not the other? |
| 04:50:31 | <sjanssen> | @type replicate |
| 04:50:33 | <lambdabot> | forall a. Int -> a -> [a] |
| 04:50:37 | <ddarius> | falconair: Because in the first, the 6's don't have to be the same type. |
| 04:50:45 | <ddarius> | But buckets has to be the same type as buckets. |
| 04:51:26 | <falconair> | oh....but I want a function like 'dist' ... how else can i do it? |
| 04:51:42 | <ddarius> | What type should dist be? |
| 04:52:12 | <falconair> | the first result is the correct one, it should be a list of some sort of decimals (float, double, whatever) |
| 04:52:17 | <monochrom> | @quote fromIntegral |
| 04:52:17 | <lambdabot> | monochrom says: You've got an Int / But you want Double / Who do you call? / "fromIntegral!" |
| 04:52:59 | <scook0> | > let dist buckets = replicate buckets (recip $ fromIntegral buckets) in dist 6 |
| 04:53:01 | <lambdabot> | [0.16666666666666666,0.16666666666666666,0.16666666666666666,0.1666666666666... |
| 04:53:51 | <falconair> | cool, thanks! I was trying to put in explicit type annotations...this one works (and frankly solve many other problems similar bugs :) ) |
| 04:56:42 | <sorear> | conal: I put Partial throught the correct deletion procedure |
| 04:57:52 | <conal> | sorear: thanks. what's the procedure? |
| 04:58:05 | <sorear> | conal: {{Please delete me}} |
| 04:58:17 | <conal> | sorear: and how does that work? |
| 04:58:23 | <conal> | i mean, what happens? |
| 04:58:46 | <sorear> | conal: sets up a category so that the administrators will find it, eventually |
| 04:58:59 | <conal> | oh, great. thanks. :) |
| 05:07:50 | <dons> | night all. |
| 05:08:14 | <conal> | night dons |
| 05:08:18 | <sorear> | 'night |
| 06:19:12 | <prb> | Anyone built the fastcgi libraries with the multi-threaded bindings enabled? |
| 06:28:27 | <prb> | nm -- darcs tip appears to include it and builds OK. |
| 08:04:43 | <matt__r> | :hoogle |
| 08:05:27 | <matt__r> | @hoogle [String] -> String |
| 08:05:28 | <lambdabot> | Prelude.unlines :: [String] -> String |
| 08:05:28 | <lambdabot> | Prelude.unwords :: [String] -> String |
| 08:05:28 | <lambdabot> | Test.QuickCheck.configEvery :: Config -> Int -> [String] -> String |
| 08:06:39 | <matt__r> | @type id |
| 08:06:41 | <lambdabot> | forall a. a -> a |
| 08:06:53 | <oerjan> | also concat |
| 08:36:55 | <hpaste> | hgolden pasted "Error compiling hsgnutls-0.2.3" at http://hpaste.org/2639 |
| 08:48:42 | <crazy_coder> | hello everyone |
| 08:49:07 | <crazy_coder> | I am trying to write this tictactoe game in Haskell using GTKhs |
| 08:49:55 | <crazy_coder> | i am having problems with the idea of updating the state of the board (i.e the 3X3 matrix of buttons I made in Glade) |
| 08:50:53 | <crazy_coder> | should I change the glade file contents as the game progresses ? |
| 08:51:03 | <Saizan> | crazy_coder: have you seen the tictactoe demo that comes with gtk2hs? |
| 08:51:10 | <crazy_coder> | no |
| 08:51:39 | <crazy_coder> | Its not in the docs |
| 08:52:38 | <Saizan> | it's inside demo/noughty |
| 08:53:01 | <crazy_coder> | ok I saw it |
| 08:53:37 | <crazy_coder> | Thanks |
| 08:53:43 | <crazy_coder> | I'll check it |
| 08:53:43 | <Saizan> | np |
| 09:28:22 | <wli> | One could always try Connect Four or Othello if the Tic-Tac-Toe example is too overdone. |
| 09:29:33 | <wli> | The whole board game schtick is overdone, though. |
| 09:30:24 | <olliej> | ACTION just took more than a minute to work out wli was talking abou :D |
| 09:33:47 | <wli> | Was it so complicated? |
| 09:37:39 | <olliej> | wli: no, but hadn't been foollowing #haskell |
| 09:37:59 | <olliej> | and apparently am to tired to read back chat that is visible on the screen on the first go :D |
| 09:39:04 | <wli> | How about instead of board games, fashion design! |
| 09:40:37 | <olliej> | heh |
| 09:41:00 | <olliej> | erk |
| 09:41:04 | <olliej> | ACTION sleeps |
| 09:41:05 | <wli> | Design new outfits and dress up animated models in them. |
| 09:43:10 | <wli> | Okay, that's quite a bit more complicated than Tic Tac Toe, Connect Four, or Othello. But it is vastly more interesting from a programming point of view as well. |
| 09:48:37 | <Boney> | sometimes people just go to far.. |
| 09:50:48 | <wli> | Am I going too far? |
| 09:56:21 | <wli> | There's geometry, ontology, and relatively serious HCI having to do with how you get adequate and usable user input into the thing at all. |
| 09:56:41 | <wli> | So I'd say it is vastly more interesting than board games. |
| 11:00:58 | <EvilTerran> | **poke** |
| 11:01:40 | <Japsu> | In Finnish, "poke" is also a slang word for "porn". |
| 11:02:07 | <EvilTerran> | in English, it's also a slang word for "have sex with". |
| 11:02:13 | <Japsu> | heh |
| 11:02:19 | <EvilTerran> | i wonder if those're somehow related. |
| 11:10:57 | <EvilTerran> | okay, i count 9 files in this here cabal bundle that're probably necessary for getting it to work. 7 of them have no chance of running on windows without cygwin. |
| 11:11:08 | <EvilTerran> | ACTION concludes that cabal is *nix-only. |
| 11:14:35 | <EvilTerran> | ACTION also concludes that this makes actually doing anything useful with haskell on windows Very Difficult. |
| 11:16:29 | <roconnor> | ACTION has a theory as to why haskell isn't used to develop large programs |
| 11:16:37 | <wli> | Do tell. |
| 11:16:50 | <mlesniak> | ACTION is also listening |
| 11:16:53 | <roconnor> | haskell almost forces you to think carefully and create a well designed program |
| 11:17:08 | <roconnor> | but no one knows how to develop large well designed programs |
| 11:17:14 | <roconnor> | so it is hard to write them in haskell. |
| 11:17:16 | <matthew-_> | define large? |
| 11:17:32 | <wli> | Well, that's largely worked out for compilers. |
| 11:17:32 | <matthew-_> | I've done programs with one other person that hit 10kloc with no docs |
| 11:18:16 | <roconnor> | wli: web browsers, compilers, spreadsheets |
| 11:18:22 | <roconnor> | gimp |
| 11:18:35 | <roconnor> | I consider those as examples of large programs |
| 11:18:40 | <wli> | Spreadsheets probably don't really count since they're interpreters of sorts. |
| 11:18:56 | <roconnor> | okay, nix spreadsheets |
| 11:19:18 | <wli> | Compilers are out because they're so very well understood as far as structure goes it's not going to hurt them. |
| 11:19:25 | <EvilTerran> | ACTION would like a spreadsheet where he could write haskell in the cells |
| 11:19:30 | <wli> | Interpreters in like fashion. |
| 11:19:35 | <matthew-_> | I don't think a functional programmer would have designed html in the first place |
| 11:19:43 | <roconnor> | wli: probably why compliers written in haskell exist. |
| 11:19:46 | <matthew-_> | so the complexities of rendering it wouldn't have occured |
| 11:20:02 | <roconnor> | matthew-_: really? I <3 HTML |
| 11:20:12 | <roconnor> | and SGML even more |
| 11:20:28 | <matthew-_> | HTML would be fine if it was strictly defined |
| 11:20:35 | <matthew-_> | and if CSS was even vaguely sane |
| 11:20:41 | <EvilTerran> | i'd happily get to writing this, but i'd want to use Tk, and in order to do that, i either need the existing Haskell/Tcl bindings (that're old and non-idiomatic), c2hs (which requires cabal, so is no-go on windows), or to do the bindings manually =/ |
| 11:20:47 | <roconnor> | what do you mean strictly defined? |
| 11:20:57 | <matthew-_> | roconnor: no "lax" modes in browsers |
| 11:21:05 | <EvilTerran> | ACTION would rather write in s-exp than in HTML |
| 11:21:05 | <wli> | roconnor: How about my suggestion of an application to design clothing and so on? |
| 11:21:11 | <matthew-_> | no "trying to make the best job of badly defined pages" |
| 11:21:20 | <EvilTerran> | tag soup! quirks mode! |
| 11:21:36 | <matthew-_> | yeah, that stuff. Ban it. |
| 11:21:41 | <roconnor> | wli: clothing design seems comperable to photoshop/gimp in scope. |
| 11:21:44 | <EvilTerran> | but seriously. my main gripe with XML is how stupid verbose it is |
| 11:21:57 | <wli> | roconnor: No, it's more of a CAD/CAM -type application. |
| 11:22:01 | <EvilTerran> | well, after how mind-numbingly verbose the standards are. |
| 11:22:22 | <wli> | roconnor: Quite distinct from image processing per se. |
| 11:22:28 | <roconnor> | wli: okay, maybe illustrator is more analogus. But yes, these are good examples of large applications. |
| 11:23:27 | <roconnor> | EvilTerran: a while back I had the idea of a Haskell RFC project to give Haskell reference programs to all effective RFCs. |
| 11:24:22 | <wli> | roconnor: Where would you start on the clothing design bit? It appears to be somewhat at odds with typical CAD/CAM in various respects, so it's not entirely obvious from the CAD/CAM precedents. |
| 11:24:50 | <roconnor> | wli: what do you mean, where whould I start? |
| 11:24:59 | <wli> | roconnor: UI is probably a somewhat deep question as well. |
| 11:25:11 | <wli> | roconnor: As far as the "large program design" bit goes. |
| 11:25:31 | <roconnor> | wli: GUI is a deep unsolved problem, which is presumably why there is not decent haskell implementation. |
| 11:26:08 | <roconnor> | and by ``deep unsolved problem'' I mean, I don't know the answer. :) |
| 11:26:24 | <roconnor> | I don't even know what the answer might be. |
| 11:27:19 | <EvilTerran> | CAD/CAM very much qualifies as Big Software... the impression i get is that it's some of the largest end-user software |
| 11:27:34 | <EvilTerran> | especially for UI. i've seen some UI monstrosities in CAD/CAM. |
| 11:28:34 | <EvilTerran> | ACTION finds CAD UIs only work if there's a well-written command-line. otherwise I spend most of the time looking through samey-looking buttons on the gazillion toolbars. |
| 11:29:01 | <EvilTerran> | (see: autocad. you *can* do everything from the toolbars, but you *really* want to learn to use its commandline) |
| 11:30:00 | <matthew-_> | roconnor: A friend an I are trying to do a gui tk in opengl. Some of the issues that come up really have no good answer |
| 11:30:20 | <matthew-_> | you end up saying "well, which of these things does in make more sense to ignore in this situation?" |
| 11:30:34 | <matthew-_> | which is entirely unsatisfying |
| 11:30:40 | <roconnor> | yep, deep unsolved problem. |
| 11:31:01 | <matthew-_> | layout isn't really the issue - that's solveable |
| 11:31:05 | <matthew-_> | it's event handling |
| 11:31:16 | <roconnor> | all we can do is wait for a genius to solve our problems. |
| 11:31:20 | <fasta> | EvilTerran: I think most autocad users cannot use the command line like a programmer would |
| 11:31:41 | <EvilTerran> | i found myself using the commandline almost exclusively |
| 11:31:53 | <matthew-_> | oooo! Is there anyone here with knowledge of the haskell X bindings? |
| 11:32:05 | <EvilTerran> | if i couldn't remember the command, i'd look that up and use it, so i could use it in future, rather than using the oolbar button |
| 11:32:27 | <roconnor> | matthew-_: obviously comonads are the solution :P |
| 11:32:32 | <EvilTerran> | we need an isomorphism between events and category theory! |
| 11:32:46 | <fasta> | EvilTerran: I almost never used AutoCad, but when someone had a problem, I just looked up the command in the manual and did it. They just thought of the command line as "complicated". |
| 11:33:13 | <EvilTerran> | i know that feeling. some people have an irrational fear of non-gooey interfaces. |
| 11:33:36 | <EvilTerran> | me, i like being able to have twice as much of the page visible 'cos i'd hidden all the toolbars. |
| 11:33:44 | <fasta> | I developed the opposite, since so many GUIs are so bad and crash often. |
| 11:33:55 | <matthew-_> | EvilTerran: I have an irrational fear of guis |
| 11:34:11 | <EvilTerran> | autocad's gui is very much <enormous grid of similar-looking buttons> |
| 11:35:07 | <fasta> | EvilTerran: Visual Studio is like that too. |
| 11:35:43 | <EvilTerran> | ew, visual studio |
| 11:35:54 | <fasta> | s/Visual Studio/every large Windows program |
| 11:36:06 | <EvilTerran> | ACTION distrusts programming languages that are well-nigh impossible to use without an IDE |
| 11:36:38 | <EvilTerran> | ACTION also distrusts programs that create a mass of "project files" with no readily-available explanation of what each does |
| 11:36:39 | <fasta> | I start to distrust complicated languages like Haskell ;) |
| 11:36:40 | <roconnor> | really? |
| 11:37:04 | <roconnor> | i think the future of programming languages is going to be more strongly linked to an IDE. |
| 11:37:10 | <fasta> | They seem too difficult to implement correctly. |
| 11:37:13 | <roconnor> | fucking strings as programs |
| 11:37:19 | <EvilTerran> | ''i only wanted to do "hello world"! why are there six files in this folder?!'' |
| 11:37:36 | <roconnor> | granted, files are dumb. |
| 11:37:37 | <EvilTerran> | roconnor, it reeks of DWIM to me, i guess |
| 11:37:41 | <matthew-_> | EvilTerran: it's called abstraction! |
| 11:38:10 | <fasta> | The future of programming languages will always be in the future. |
| 11:38:18 | <EvilTerran> | flowcharts-as-programming is a fairly classic example of a bad idea that looks good on paper |
| 11:38:35 | <matthew-_> | fsms have their uses |
| 11:38:47 | <matthew-_> | protocols are quite usefully specified as fsms |
| 11:38:52 | <EvilTerran> | yes, but writing Enterprise Software is not one of them |
| 11:39:01 | <matthew-_> | well quite. |
| 11:39:05 | <roconnor> | as I understand, Epigram (and Agda) are strongly tied to an IDE. |
| 11:39:15 | <roconnor> | specify a function |
| 11:39:27 | <matthew-_> | hah! yeah, Epigram is heavily tied to xemacs |
| 11:39:33 | <roconnor> | fill it in |
| 11:39:52 | <fasta> | Epigram never worked out of the box for me, so imho, it doesn't exist. |
| 11:39:58 | <matthew-_> | but it's not like you'd try to write enterprise software in epigram anyway |
| 11:40:02 | <EvilTerran> | ACTION would quite like, say, a haskell IDE, but i really like that you don't *need* one |
| 11:40:08 | <matthew-_> | fasta: you should try harder ;) |
| 11:40:25 | <roconnor> | matthew-_: In the future we will write enterprise software in epigram's decendents |
| 11:40:35 | <fasta> | matthew-_: I tried two times, there is no reason to put in more effort. Probably the project is dead is a few years, too. |
| 11:41:04 | <matthew-_> | roconnor: I very much hope so |
| 11:41:05 | <EvilTerran> | "k, i've typed this term, and its context, but i need some kind of transformation function to make them mesh together. hey, IDE, what's a function ::(...Foo -> ... -> Bar)? |
| 11:41:12 | <roconnor> | I also think that will will need IDE support to get version control working properly. |
| 11:41:21 | <matthew-_> | fasta: meh. It's still cool to play with even if the devel.blog is a bit quite |
| 11:41:26 | <roconnor> | in particular distriubted version control. |
| 11:41:34 | <matthew-_> | fasta: and the last I heard, they did have funding to crack on with epigram 2 |
| 11:41:59 | <fasta> | matthew-_: ok, I will put it differently: universities do not build products. |
| 11:42:15 | <matthew-_> | fasta: you're right. BSD and X did not come from universities |
| 11:42:30 | <matthew-_> | EvilTerran: The nice thing about epigram is that it's more proactive than that - it just prompts you to fill in the blanks |
| 11:42:48 | <EvilTerran> | a souped-up IDE could do that for most languages |
| 11:42:52 | <wli> | Epigram has a structure editor? |
| 11:42:59 | <EvilTerran> | especially ones with funky type systems like Haskell |
| 11:43:04 | <fasta> | matthew-_: those were actually practically needed for lots of people. |
| 11:43:10 | <roconnor> | Epigram requires a structure editor IIRC. |
| 11:43:18 | <wli> | Structure editors are what these are called. |
| 11:43:19 | <EvilTerran> | ACTION would also like on-the-fly typechecking etc |
| 11:43:26 | <fasta> | matthew-_: and the best way to do operating systems still needed to be invented. |
| 11:43:32 | <fasta> | matthew-_: and the same for X. |
| 11:43:42 | <EvilTerran> | which could be Great With A Big G in haskell, given how powerful the type system is |
| 11:44:02 | <fasta> | matthew-_: nobody in universities need another programming language; they have Python and it works. |
| 11:44:10 | <wli> | Thus far the only "radical" proposals I've seen to improve X are castrating it with respect to network transparency. |
| 11:44:11 | <roconnor> | one problem with OS's and X, is that the best way to do them keeps changing with the hardware. |
| 11:46:21 | <EvilTerran> | does it strike no-one else as odd that (the Windows binary, at least) of ghc comes with OpenGL but not GLUT? |
| 11:46:30 | <roconnor> | I have another theory. What if the entire universe was made up of tiny virbrating strings? |
| 11:47:00 | <mr_tenor> | EvilTerran: I had to go to some totally nonoficial webpage to get Windows GLUT stuff. |
| 11:47:13 | <EvilTerran> | mr_tenor, that's the impression i get, too. |
| 11:47:25 | <mr_tenor> | i don't understand how these projects are organised |
| 11:47:28 | <EvilTerran> | ACTION is still quite annoyed about the Cabal => *nix things |
| 11:47:34 | <fasta> | EvilTerran: report a feature request/bug if the Linux version does it differently. |
| 11:47:47 | <fasta> | EvilTerran: don't worry, Cabal doesn't work in the HEAD. |
| 11:48:03 | <fasta> | EvilTerran: or at least it's not compatible with e.g. Edison. |
| 11:48:04 | <mr_tenor> | i'm a Debian person, so i'm used to things not being easily obtainable and working right away ;) |
| 11:48:10 | <EvilTerran> | i don't know if the Linux one is different - i haven't looked at it, as i'm, er, on windows |
| 11:48:13 | <mr_tenor> | "not used"... gah |
| 11:48:50 | <fasta> | EvilTerran: is there any reason you are on Windows? |
| 11:49:21 | <EvilTerran> | because it came with my laptop, a lot of software that i like is windows only, and i happen to quite like XP pro? |
| 11:49:21 | <fasta> | EvilTerran: AutoCad? ;) |
| 11:49:47 | <fasta> | Amazing, that one can actually like XP Pro. |
| 11:49:55 | <fasta> | Then again, I did once too. |
| 11:49:59 | <int-e> | is there any reason to dislike mingw? |
| 11:50:06 | <fasta> | int-e: yes |
| 11:50:35 | <EvilTerran> | i have nothing against the mingw port of gcc. MSYS makes me want to kill people, however. |
| 11:50:36 | <fasta> | int-e: it's 10 times slower than the native tools, so I heard, and from practice I know it was slower last time I used it. |
| 11:51:09 | <EvilTerran> | ah, yes, actually, i do have something against mingw gcc. it's big, it's slow, and it produces larger executables than the native tools |
| 11:51:15 | <fasta> | int-e: and it's probably not as complete as a real environment. |
| 11:51:21 | <EvilTerran> | even with optimisations disabled |
| 11:51:34 | <EvilTerran> | by quite a large factor |
| 11:51:43 | <int-e> | minimal = unusable. makes sense. |
| 11:52:22 | <fasta> | int-e: ? |
| 11:52:33 | <fasta> | int-e: who said it was unusable? |
| 11:52:38 | <int-e> | that was a comment about MSYS. |
| 11:53:04 | <EvilTerran> | however, if a *nix project has been actually ported to windows (cygwin DOES NOT COUNT), it will almost certainly only build on mingw gcc |
| 11:53:14 | <int-e> | nobody explicitely said that it was unusable. |
| 11:55:00 | <EvilTerran> | i think it may've been implied by the bile i've been spouting |
| 11:57:23 | <hpaste> | mauke pasted "I didn't know this was possible" at http://hpaste.org/2640 |
| 11:58:01 | <EvilTerran> | higher-order types? |
| 11:58:18 | <EvilTerran> | instance Num [Char]? |
| 11:58:45 | <hpaste> | mauke annotated "I didn't know this was possible" with "implementation" at http://hpaste.org/2640#a1 |
| 12:00:56 | <scook0> | mauke: nice |
| 12:02:14 | <scook0> | have you read SYB? |
| 12:02:22 | <mauke> | not really |
| 12:03:46 | <scook0> | among other things, it mentions a reference implementation of cast using unsafeCoerce and typeclasses |
| 12:03:50 | <scook0> | (iirc) |
| 12:04:27 | <scook0> | basically, you use the two Typeable instances to obtain "type representation" values |
| 12:04:52 | <scook0> | if the typereps match, you can coerce values of b to values of a, since the types are the same |
| 12:04:58 | <scook0> | if not, you just return Nothing |
| 12:06:07 | <mauke> | yeah, that's what Data.Typeable.cast does |
| 12:21:07 | <EvilTerran> | ACTION prods the Tcl/Tk headers |
| 12:21:10 | <EvilTerran> | ACTION despairs |
| 13:04:02 | <kayess_> | I'm fiddling around with something and getting myself confused. It starts with partial application like this: let papply ( f, a ) b = f a b |
| 13:04:35 | <kayess_> | Next up I define a binary add function: let add ( a, b ) = a + b |
| 13:04:47 | <kayess_> | But what I can't do is this: let inc = papply ( add, 1 ) |
| 13:04:57 | <kayess_> | I get an error message I completely fail to understand |
| 13:05:46 | <hkBst> | kayess_: because papply assume that add is defined add a b = a + b |
| 13:05:50 | <kayess_> | However this seems to work: let inc = papply ( (+), 1 ) |
| 13:06:14 | <kayess_> | hkBst: Right. Got it! thanks |
| 13:06:19 | <EvilTerran> | ?type let add ( a, b ) = a + b in add |
| 13:06:22 | <EvilTerran> | ?type (+) |
| 13:06:24 | <lambdabot> | forall t. (Num t) => (t, t) -> t |
| 13:06:25 | <lambdabot> | forall a. (Num a) => a -> a -> a |
| 13:07:23 | <kayess_> | If I wanted to use my version of add that takes a tuple then I need to change papply in some way, but I'm not sure how |
| 13:07:35 | <mrd> | curry |
| 13:08:24 | <mauke> | let papply (f, a) b = f (a, b) |
| 13:08:24 | <mrd> | your version of add = uncurry (+) |
| 13:08:31 | <kayess_> | I think it's all starting to dawn on me now |
| 13:08:44 | <kayess_> | I want this: let papply ( f, a ) b = f ( a, b ) |
| 13:08:57 | <mauke> | but what's wrong with papply f a b = f a b? |
| 13:09:18 | <kayess_> | Isn't that just an identity function? |
| 13:09:31 | <mauke> | yes |
| 13:09:40 | <mauke> | in fact, I don't see why you need papply at all |
| 13:09:41 | <mrd> | haskell already does this stuff for you |
| 13:10:25 | <EvilTerran> | > let add a b = a + b in add 1 |
| 13:10:28 | <lambdabot> | <Integer -> Integer> |
| 13:10:30 | <EvilTerran> | > (+) 1 |
| 13:10:31 | <lambdabot> | <Integer -> Integer> |
| 13:10:33 | <kayess_> | I'm actually trying to work something out in C++, but the types are bit more verbose there so wanted to see if I could describe it in Haskell first. This is why I'm working with tupled arguments |
| 13:10:39 | <mauke> | haha |
| 13:10:47 | <mauke> | oh yeah |
| 13:11:01 | <mauke> | C++ template types are awesome |
| 13:11:05 | <mauke> | where awesome = no please no |
| 13:11:18 | <mrd> | then you should expand it into papply (f, a) = \ b -> f (a, b) |
| 13:12:03 | <kayess_> | I've written a papply and curry, but it seems to me that if I curry papply then I should get something interesting out, but I couldn't work out the C++ type so want to get GHCi to tell me what it thinks |
| 13:12:10 | <EvilTerran> | duck typing! |
| 13:13:02 | <mrd> | @djinn quack -> quack |
| 13:13:03 | <lambdabot> | f a = a |
| 13:14:28 | <mauke> | template<typename A, typename B, typename C> function<A (C)> curry(function<A (B, C)> f, B x) { return f(x, _1); } // no idea if this actually works |
| 13:16:45 | <kayess_> | It's similar to that. Do you really want to see the prototype? :) |
| 13:17:47 | <Botje> | @djinn lead -> gold |
| 13:17:47 | <lambdabot> | -- f cannot be realized. |
| 13:17:51 | <Botje> | damn. |
| 13:18:27 | <gpi5> | Is there a function to iterate on lists, similar but more complex than scanr of the type :: (a->b->c)->(a->b->b)->[a]->b->([c], b) |
| 13:18:32 | <kayess_> | mauke: template< typename R, typename V1, typename V2 > boost::function< boost::function< R ( V1 ) > ( V2 ) > curry( boost::function< R ( V1, V2 ) > f ); |
| 13:18:44 | <gpi5> | Or how would you do that? |
| 13:18:48 | <gpi5> | Thanks |
| 13:19:06 | <kayess_> | mauke: You even nearly get the -> in the function type :) |
| 13:20:09 | <Botje> | gpi5: and what would that do? |
| 13:21:21 | <der_eq> | gpi5: that looks like a variant of mapAccumL |
| 13:21:30 | <der_eq> | or R |
| 13:24:29 | <kayess_> | Anybody recognise this type signature? ((t, t1) -> t2, t) -> t1 -> t2 |
| 13:26:03 | <gpi5> | der_eq: yes indeed, I think I can use that. Thanks. |
| 13:27:01 | <tuxplorer> | I have a string coming in as an argument. based on some regex and stuff I want to do a type inference on it.. say some strings should belong to a type A and some to type B, type C, etc. which are custom defined data types, and I want to do a type inference on it.. is there some pointers to help me with it? |
| 13:27:54 | <tuxplorer> | say I want to classify them as words, phrases, metaphors(if they have some comparison conjunctives), etc.. etc.. |
| 13:30:15 | <sciolizer> | @djinn ((t, t1) -> t2, t) -> t1 -> t2 |
| 13:30:15 | <lambdabot> | f (a, b) c = a (b, c) |
| 13:30:56 | <Botje> | tuxplorer: create a datatype to hold the string |
| 13:31:22 | <Botje> | something like data Linguistic = Word String | Phrase String | Metaphor String |
| 13:31:30 | <Trixsey> | min (head list1) (head list2) -- This works in the terminal but not in my .hs file, any idea why? |
| 13:31:36 | <tuxplorer> | Botje: without calling the appropriate constructor, I want the compiler to decide the type.. |
| 13:31:48 | <Trixsey> | nvm |
| 13:31:51 | <Trixsey> | solved it =) |
| 13:31:52 | <Botje> | don't think ot can do that for you |
| 13:32:09 | <gpi5> | @djinn (a,b)->a |
| 13:32:09 | <lambdabot> | f (a, _) = a |
| 13:32:24 | <Botje> | perhaps with some kind of read hack, but still |
| 13:32:59 | <gpi5> | Is there a defined function for f (a, _) = a ? |
| 13:33:17 | <Botje> | fst |
| 13:33:19 | <Botje> | :t fst |
| 13:33:21 | <lambdabot> | forall a b. (a, b) -> a |
| 13:33:30 | <gpi5> | thx |
| 13:33:35 | <Botje> | you can ask hoogle too |
| 13:33:39 | <tuxplorer> | Botje: oh! there is nothing like a function that can be written to tell the compiler? like how we use ord to do the order recognition? well yeah I understand that Ord just returns a order data type to the functions.. but still |
| 13:33:40 | <Botje> | @hoogle (a,b) -> a |
| 13:33:41 | <lambdabot> | Prelude.fst :: (a, b) -> a |
| 13:33:41 | <lambdabot> | Prelude.uncurry :: (a -> b -> c) -> (a, b) -> c |
| 13:33:41 | <lambdabot> | Prelude.snd :: (a, b) -> b |
| 13:34:21 | <Botje> | tuxplorer: best thing I can think of is a read function that does the classification for you |
| 13:34:31 | <Botje> | but then IANA Haskell Wizard |
| 13:34:59 | <tuxplorer> | Botje: oh! ok.. will try.. Thanks |
| 13:36:25 | <mauke> | @. djinn type ((t, t1) -> t2, t) -> t1 -> t2 |
| 13:36:27 | <lambdabot> | Cannot parse command |
| 13:36:33 | <mauke> | er |
| 13:36:38 | <mauke> | @. pl djinn ((t, t1) -> t2, t) -> t1 -> t2 |
| 13:36:39 | <lambdabot> | f = uncurry ((. (,)) . (.)) |
| 13:38:11 | <kayess_> | let papply ( f, a ) b = f ( a, b ) - mauke this is what your C++ prototype describes, partial application rather than curry |
| 13:38:36 | <mauke> | oh yeah |
| 13:38:42 | <mauke> | it's only the same thing in haskell |
| 13:39:06 | <mauke> | @vixen pervasive currying is pervasive |
| 13:39:06 | <lambdabot> | I can't of anything nice to say about myself |
| 13:39:11 | <kayess_> | Yeah. That's been one of the reasons I've been getting confused. Everything normally comes pre-curried in Haskell |
| 13:40:07 | <kayess_> | I knew there was an identity hiding in there, I just couldn't work out what it was. I thought it was on the C++ curry, but it turns out to be on papply |
| 13:40:27 | <kayess_> | let cppcurry f ( a, b ) = papply ( f, a ) b |
| 13:41:11 | <kayess_> | :t cppcurry papply - gives the same as :t papply |
| 13:41:13 | <lambdabot> | Not in scope: `cppcurry' |
| 13:41:14 | <lambdabot> | |
| 13:41:14 | <lambdabot> | <interactive>:1:9: Not in scope: `papply' |
| 13:41:46 | <kayess_> | And so does :t cppcurry $ cppcurry papply |
| 13:42:15 | <mauke> | > sqrt `id` 2 |
| 13:42:18 | <lambdabot> | 1.4142135623730951 |
| 13:44:04 | <Trixsey> | >min 2 3 |
| 13:44:08 | <Trixsey> | > min 2 3 |
| 13:44:10 | <lambdabot> | 2 |
| 13:44:12 | <Trixsey> | :D |
| 13:44:16 | <Trixsey> | ITS ALIVE! :D |
| 13:44:26 | <Trixsey> | > min 3 2 |
| 13:44:27 | <lambdabot> | 2 |
| 13:44:29 | <Trixsey> | YAY :D |
| 13:44:38 | <mauke> | > let min 2 3 = 3 in min 2 3 |
| 13:44:40 | <lambdabot> | 3 |
| 13:44:56 | <Trixsey> | :( |
| 13:44:57 | <astrolabe> | Is there any way of hiding methods of a superclass? Does that make sense? |
| 13:45:08 | <Trixsey> | min 2 3 |
| 13:45:11 | <Trixsey> | > min 2 3 |
| 13:45:12 | <lambdabot> | 2 |
| 13:45:16 | <Trixsey> | :o |
| 13:45:39 | <mauke> | astrolabe: I don't think so |
| 13:45:44 | <Trixsey> | mauke, why is overriding possible? |
| 13:45:47 | <Trixsey> | :P |
| 13:45:57 | <mauke> | > let min = "hello, world" in min |
| 13:45:59 | <lambdabot> | "hello, world" |
| 13:46:07 | <Trixsey> | oh you used it as a variable? |
| 13:46:10 | <mauke> | yes |
| 13:46:15 | <mauke> | I temporarily redefined min |
| 13:46:44 | <mauke> | > let min 2 3 = 3 in min 1 1 |
| 13:46:46 | <lambdabot> | Non-exhaustive patterns in function min |
| 13:47:06 | <mauke> | this is actually an (incomplete) local function that happens to be called 'min' |
| 13:48:26 | <Botje> | > let min = max in min 2 3 |
| 13:48:27 | <lambdabot> | 3 |
| 13:51:25 | <mauke> | > let 2 + 2 = "cornflakes" in 2 + 2 |
| 13:51:27 | <lambdabot> | "cornflakes" |
| 14:00:10 | <Igloo> | Does anyone know if I can convince GHC 6.6.1 to accept something equivalent to this? http://hpaste.org/2641 |
| 14:00:36 | <Igloo> | (a GADTs problem) |
| 14:01:51 | <matthew-_> | Igloo: I don't think so. |
| 14:02:16 | <matthew-_> | not without putting Eq a on foo |
| 14:02:25 | <Igloo> | Ho humm. I wonder if waiting for 6.8 is an option. |
| 14:02:41 | <matthew-_> | is the rc out yet? |
| 14:02:46 | <Igloo> | No |
| 14:02:56 | <fasta> | Igloo: have you seen #ghc already? |
| 14:03:30 | <Igloo> | fasta: I'm not dealing with that ATM |
| 14:06:04 | <cinimod> | Igloo: I can't see that working. Won't you need a "proof" that a is in Eq? ie foo :: Eq a => etc |
| 14:06:27 | <Igloo> | cinimod: There's one in EqInstance a. It works in the HEAD |
| 14:10:13 | <cinimod> | Igloo: I've fallen over the same sort of issue. I assumed you had to have a proof. |
| 14:10:23 | <Igloo> | There is a proof |
| 14:10:55 | <cinimod> | I can see that now which is why I said "I assume" |
| 14:11:05 | <Igloo> | Ah, OK |
| 14:11:13 | <cinimod> | Bother I have to go now just as this was turning into an interesting discussion |
| 14:11:26 | <Igloo> | Hmm, not even http://hpaste.org/2641#a1 works in 6.6.1 |
| 14:11:49 | <cinimod> | I'd really like to see the formal proof rules for GADTs and typeclasses then you could work out whether something should or should not compile |
| 14:11:52 | <Igloo> | I don't think there's much left to discuss. It just doesn't work in 6.6.1 AFAICS :-) |
| 14:12:01 | <cinimod> | byes |
| 14:12:05 | <Igloo> | See ya |
| 14:12:28 | <Igloo> | I think the rules are in a paper by SPJ (probably coauthored with others), BTW |
| 14:12:35 | <int-e> | Igloo: http://hackage.haskell.org/trac/ghc/ticket/289 |
| 14:12:36 | <lambdabot> | Title: #289 (class context restrictions in GADT types not assumed) - GHC - Trac |
| 14:12:49 | <int-e> | fixed after 6.6.1 came out |
| 14:13:58 | <int-e> | and I don't know whether it's possible to express this in previous versions. |
| 14:15:52 | <Igloo> | *nod*, none of the possible workarounds I've thought of work |
| 14:16:06 | <fasta> | What are the uses of that feature? |
| 14:16:30 | <fasta> | I see what it should do, I just see no practical use. |
| 14:16:31 | <int-e> | you can pack different type class dictionaries into the same type |
| 14:16:47 | <int-e> | imagine an OrdInstance :: Ord a => OrdInstance a alternative. |
| 14:17:02 | <int-e> | and a function that matches on both alternatives. |
| 14:17:38 | <int-e> | in 6.6.1 you'd have to write foo :: (Ord a, Eq a) => Instances a -> Bool which is more limiting than you want. |
| 14:17:39 | <fasta> | Yes, I fully understood "you can... same type", before you said so. |
| 14:19:19 | <fasta> | But if you never write down the type signatures in the first place, then what's the application? |
| 14:19:52 | <fasta> | Oh, I see. |
| 14:20:08 | <fasta> | It solves something the compiler should do by itself already, imho. |
| 14:20:25 | <fasta> | Currently the compiler doesn't repeat the class context. |
| 14:20:44 | <fasta> | As a user you need to repeat it in an instance declaration. |
| 14:20:57 | <fasta> | This would make that a bit easier. |
| 14:21:27 | <doserj> | the problem is not only in typing the class context |
| 14:22:31 | <doserj> | the problem is that there are sensible types that you cannot express in 6.6.1 |
| 14:23:33 | <fasta> | doserj: like? |
| 14:23:48 | <doserj> | look at int-e's example |
| 14:24:15 | <int-e> | fasta: I really wouldn't want the compiler to make impredicativity implicit. I'd like to have class synonyms to save some typing instead. |
| 14:26:13 | <fasta> | Ok, I see what int-e meant now. I haven't run into that problem, I guess. |
| 14:26:27 | <int-e> | (we could argue about class contexts on data declarations though ... data Ord a => Foo a = Foo a) |
| 14:26:53 | <Igloo> | I thought everyone agreed that they are just broken in H98 |
| 14:26:57 | <int-e> | right now the Ord a => serves no real purpose at all but is syntactically allowed. |
| 14:27:08 | <Igloo> | GHC does the sensible thing for type declared with GADT syntax, I believe |
| 14:27:43 | <fasta> | Why is it a sensible thing that the instances for (Monad m) => class Bar m a need to repeat the Monad constraint? |
| 14:28:38 | <fasta> | An IDE could simply look up the context if the user would be interested in the class context. |
| 14:29:59 | <int-e> | well, if you read instance xxx => Foo yyy where ... as "if xxx are satisfied then we can construct an instance of Foo for yyy" (and I do) then that makes perfect sense. |
| 14:30:30 | <fasta> | Was getNumElements discussed on the libraries list? |
| 14:31:14 | <fasta> | Google doesn't return anything for it. |
| 14:32:22 | <fasta> | If it's not, then why was it included? Shouldn't all libary changes go through the libraries mailing list? |
| 14:33:02 | <fasta> | library* |
| 14:34:14 | <int-e> | http://www.haskell.org/pipermail/libraries/2007-August/007907.html |
| 14:34:16 | <lambdabot> | Title: Proposal: Make arrays safer, http://tinyurl.com/ysr2qq |
| 14:35:11 | <fasta> | int-e: a discussion with one whole user! |
| 14:35:43 | <int-e> | good enough, it was publicly announced, and it had a 14 days deadline. |
| 14:35:47 | <fasta> | Not that I think these minor things should be discussed, though. Discussion only adds overhead for these trivial things. |
| 14:36:02 | <fasta> | int-e: fair enough. |
| 14:36:23 | <kristnjov> | yo |
| 14:36:28 | <kristnjov> | how do i convert an integer to a string? |
| 14:36:38 | <Igloo> | show |
| 14:36:40 | <fasta> | > show (1::Integer) |
| 14:36:42 | <lambdabot> | "1" |
| 14:36:43 | <mauke> | > show 42 |
| 14:36:44 | <lambdabot> | "42" |
| 14:36:53 | <gpi5> | Is 'map $ f . g $ l' same as 'map (f.g) l'? |
| 14:37:12 | <fasta> | If everyone produced their own Haskell implementation, we would now have 100 broken implementations. Hmm, that's not a good idea. ;) |
| 14:37:18 | <mauke> | gpi5: no |
| 14:37:30 | <mauke> | it's map (f (g l)), I think |
| 14:37:40 | <Igloo> | It is |
| 14:37:55 | <wli> | :t \f g l -> (map $ f . g $ l) |
| 14:37:57 | <lambdabot> | forall a b b1 a1. (b1 -> a -> b) -> (a1 -> b1) -> a1 -> [a] -> [b] |
| 14:38:09 | <gpi5> | Ok.. |
| 14:38:16 | <wli> | :t \f g l -> (map (f . g) l) |
| 14:38:17 | <lambdabot> | forall b c a. (b -> c) -> (a -> b) -> [a] -> [c] |
| 14:38:30 | <kristnjov> | putStrLn (show (nPrime number)::Integer) <- what am i doing wrong? |
| 14:38:47 | <mauke> | :t \f g l -> (map $ f . g $ l) `asTypeOf` (map (f.g) l) |
| 14:38:49 | <lambdabot> | Occurs check: cannot construct the infinite type: a = [a] |
| 14:38:49 | <lambdabot> | Expected type: [a] |
| 14:38:58 | <mauke> | kristnjov: what's the ::Integer for? |
| 14:39:02 | <kristnjov> | mauke, dunno mate |
| 14:39:07 | <Trixsey> | rofl |
| 14:39:08 | <mauke> | then why did you put it in? |
| 14:39:17 | <kristnjov> | dunno |
| 14:39:25 | <kristnjov> | doesn't work without it either |
| 14:39:29 | <mauke> | what's the error? |
| 14:39:41 | <kristnjov> | Couldn't match `Integer' against `String' |
| 14:39:50 | <kristnjov> | oops f*ck |
| 14:39:51 | <kristnjov> | my bad |
| 14:40:01 | <kristnjov> | i have to convert number to an Integer |
| 14:40:08 | <mauke> | > read "42" |
| 14:40:10 | <lambdabot> | 42 |
| 14:40:29 | <kristnjov> | oh lawd it works! |
| 14:40:40 | <kristnjov> | thanks mate |
| 14:40:59 | <mauke> | yay |
| 14:41:33 | <kristnjov> | i recall that one can use . to put functions together, kind of like putStrLn (show (nPrime (read (number)))) into (putStrLn . show . nPrime . read) number but it doesn't seem to work |
| 14:42:01 | <Igloo> | Why not? |
| 14:42:08 | <kristnjov> | dunno, i was hoping you guys knew |
| 14:42:08 | <Igloo> | putStrLn . show == print, by the way |
| 14:42:13 | <kristnjov> | oh thanks |
| 14:42:31 | <mauke> | kristnjov: we can't see the error message your compiler gives you |
| 14:42:45 | <kristnjov> | yeah i know, sorry, i'll try to ask questions better |
| 14:42:49 | <mauke> | :t \number -> (putStrLn . show . nPrime . read) number |
| 14:42:52 | <lambdabot> | Not in scope: `nPrime' |
| 14:42:59 | <mauke> | :t \nPrime number -> (putStrLn . show . nPrime . read) number |
| 14:43:01 | <lambdabot> | forall b c. (Show c, Read b) => (b -> c) -> String -> IO () |
| 14:43:02 | <Saizan> | show . read --> ambiguous type variable |
| 14:43:12 | <kristnjov> | hey whaddya know it works now |
| 14:43:18 | <mauke> | Saizan: depends on the type of nPrime |
| 14:43:37 | <kristnjov> | nPrime is Integer -> Integer |
| 14:43:46 | <kristnjov> | it finds the nth prime number |
| 14:44:09 | <kristnjov> | trying to find the 10001'th prime number in less than 20 seconds using haskell |
| 14:44:20 | <kristnjov> | and obviously my algorithm isn't good enough |
| 14:44:49 | <mauke> | > groupBy (((>1).).gcd) [2..] !! 10000 |
| 14:44:51 | <lambdabot> | [10002] |
| 14:44:58 | <kristnjov> | uhhhhh what. |
| 14:45:02 | <gkr> | >2 |
| 14:45:03 | <mauke> | > nubBy (((>1).).gcd) [2..] !! 10000 |
| 14:45:07 | <lambdabot> | Terminated |
| 14:45:08 | <kristnjov> | okay..... |
| 14:45:11 | <mauke> | yeah, that's too slow |
| 14:45:33 | <kristnjov> | i don't get it at all |
| 14:45:43 | <kristnjov> | perhaps i didn't explain my problem thoroughly |
| 14:45:57 | <mauke> | that was the "confuse newbies" version of computing primes |
| 14:46:08 | <kristnjov> | the first prime number is 2, the second is 3, etc. and i want to find the 10001'th prime number |
| 14:46:13 | <mauke> | > nubBy (((>1).).gcd) [2..] |
| 14:46:14 | <lambdabot> | [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,... |
| 14:46:16 | <kristnjov> | what's gcd? |
| 14:46:24 | <kristnjov> | what the heck |
| 14:46:24 | <mauke> | greatest common divisor |
| 14:46:29 | <kristnjov> | oh |
| 14:46:43 | <kristnjov> | i was more into a method taking three input parameters and using three guards |
| 14:47:38 | <kristnjov> | my hugs won't find nubBy |
| 14:47:38 | <EvilTerran> | (((>1).).gcd) x y = ((>1).) (gcd x) y = (>1) (gcd x y) = gcd x y > 1 |
| 14:47:38 | <mrd> | import List |
| 14:47:38 | <kristnjov> | thanks |
| 14:48:10 | <mrd> | ACTION wonders what import Liszt would get you |
| 14:48:19 | <mauke> | Piano numbers |
| 14:49:07 | <wli> | It'd drag Chopin and Mary Ann Evans Cross in with it. |
| 14:49:33 | <EvilTerran> | mrd, mauke: *groan* |
| 14:49:45 | <mauke> | success! :-) |
| 14:51:58 | <EvilTerran> | > succ "ess" |
| 14:51:59 | <lambdabot> | add an instance declaration for (Enum [Char]) |
| 14:51:59 | <lambdabot> | In the expression: succ "... |
| 14:52:13 | <mrd> | > succ 355 |
| 14:52:14 | <lambdabot> | 356 |
| 14:52:54 | <mauke> | EvilTerran: sorry, you need Perl for that :-) |
| 14:53:29 | <mrd> | hm, couldn't a reasonable definition for String be made based on the Enum instance for Char |
| 14:53:39 | <kristnjov> | no! |
| 14:53:42 | <kristnjov> | nevar! |
| 14:53:46 | <mrd> | actually, instance (Enum a) => Enum [a] |
| 14:54:24 | <wli> | It'd be easy enough to make generic Enum t => Enum [t] instances, but they'd often clash with more specific instances you'd want, like (Enum t, Bounded t) => Enum [t] |
| 14:54:48 | <fasta> | overlapping instances |
| 14:54:51 | <fasta> | ACTION ducks |
| 14:55:05 | <mrd> | no ducking typing |
| 14:55:11 | <wli> | The lack of scoping for classes and instances really hurts. |
| 14:55:57 | <mrd> | it's more than you can define instances for data types of other modules |
| 14:56:05 | <mrd> | (or other packages) |
| 14:56:29 | <mrd> | but packages aren't part of Haskell |
| 14:56:30 | <EvilTerran> | overlapping instances doesn't look at the class context anyway, AFAIK |
| 14:57:00 | <mrd> | is there a package proposal for Haskell'? |
| 14:57:30 | <mrd> | fasta: i was able to compile a simply typed lambda calculus interpreter with my today-compiled ghc |
| 14:57:43 | <Igloo> | mrd: Why do you need one? |
| 14:57:52 | <Igloo> | (package proposal) |
| 14:58:07 | <mrd> | seems like a good thing to standardize for a number of reasons |
| 14:58:16 | <wli> | Even if there isn't a higher-order first-class module system en route, there should really be some sort of stopgap measure to get some kind of control over the scopes of classes, instances, and the like. |
| 14:58:36 | <mrd> | and also then you could define semantics of instances inside and outside of packages |
| 14:58:57 | <Igloo> | The package system is invisible as far as all the language semantics are concerned |
| 14:59:03 | <mrd> | right now |
| 14:59:46 | <Igloo> | There are problems if you start coping instances. John Meacham sent a mail about it to the haskell-prime list a while ago, IIRC |
| 14:59:52 | <Igloo> | s/coping/scoping/ |
| 15:00:02 | <mrd> | ACTION goes to look that up |
| 15:02:05 | <blablabla> | Please help me: http://tinyurl.com/2yu2te |
| 15:02:12 | <lambdabot> | Title: Pennergame |
| 15:02:26 | <wli> | Igloo: I have a vague idea that it might not play well with e.g. existential types. |
| 15:03:11 | <EvilTerran> | hm. i know what that fellow needs! a +b! |
| 15:04:32 | <Igloo> | wli: I think his example was what happened if you built a set with one Ord instance and then used it with a different Ord instance |
| 15:06:05 | <mrd> | really the solution is functors. i don't think people would go for that. |
| 15:09:58 | <Botje> | re that blablabla guy: just click the "diesen link als spam melden" |
| 15:10:10 | <Botje> | with a bit of luck his account 'll be closed. |
| 15:10:27 | <EvilTerran> | reported him? awesome. |
| 15:10:37 | <Botje> | yeah |
| 15:10:39 | <Botje> | join me >:) |
| 15:11:03 | <Botje> | click it, select IRC, copypaste the tinyurl thing, and hit the left button (not the one that says abbrechen) |
| 15:11:10 | <EvilTerran> | ACTION has nothing but scorn for people who do those stupid "trick people into visiting our site" things |
| 15:11:11 | <Botje> | idiot spammers deserve punishment |
| 15:12:23 | <EvilTerran> | s/idiot// |
| 15:12:39 | <Botje> | :) |
| 15:13:11 | <mauke> | oh crap |
| 15:13:16 | <mauke> | try.hs:72:8: My brain just exploded. |
| 15:13:28 | <Botje> | you turned the tables on haskell? :) |
| 15:13:30 | <cognominal_> | is a ghc compiled haskell program standalone? |
| 15:13:35 | <Botje> | cognominal_: yes |
| 15:13:40 | <EvilTerran> | @ghc |
| 15:13:41 | <lambdabot> | ghc says: Occurs check: cannot construct the infinite kind |
| 15:13:44 | <mauke> | Botje: yes! I beat ghc! |
| 15:14:14 | <mrd> | cognominal_: well, i haven't seen a ghc compiled program with 2 legs yet |
| 15:14:42 | <nominolo> | cognominal, but ghc supports dlls now |
| 15:15:00 | <mrd> | but you can use 'ldd' and 'file' on any executable to see how it is linked to the system |
| 15:15:35 | <cognominal_> | yes, I meant except for loading the "standard" share libraries... |
| 15:16:02 | <mrd> | the only additional one on my system is libgmp |
| 15:16:19 | <mrd> | the GNU Multiprecision arithmetic library |
| 15:16:53 | <nominolo> | oh, that's LGPL, isn't it? |
| 15:17:05 | <mrd> | yea |
| 15:17:29 | <cognominal_> | I like to have the adavantage of an interpreted environment for development but to avoid the associated hassle in production (dealing with all sort of dependancies) |
| 15:17:46 | <cognominal_> | s/adavantage/advantage/ |
| 15:18:14 | <cognominal_> | I am reading the TH turorials and think I will soon have a lot of fun |
| 15:18:18 | <mrd> | consider that darcs is commonly distributed as a single exe file |
| 15:18:43 | <nominolo> | TH is evil |
| 15:19:08 | <fasta> | TH is not documented and has arbitrary limitations. |
| 15:19:26 | <nominolo> | and doesn't support many extensions |
| 15:19:27 | <Saizan> | ?docs Language.Haskell.TH |
| 15:19:27 | <lambdabot> | http://haskell.org/ghc/docs/latest/html/libraries/template-haskell/Language-Haskell-TH.html |
| 15:22:56 | <cognominal_> | nominolo, can you elaborate? I don't mind being evil, the sinner has often more fun... |
| 15:24:32 | <EvilTerran> | TH doesn't support type splices yet, and could really do with pattern splices as well |
| 15:24:47 | <EvilTerran> | i'm sure it also has other limitations i'm not yet aware of |
| 15:26:12 | <nominolo> | cognominal, it's incredibly hard to get some piece of code to work with TH. Usually, you try to quote the code you want to generate, then pprint the syntax tree, and try to generate that tree yourself. |
| 15:26:30 | <nominolo> | quoting works, sometimes, but often-times not |
| 15:26:32 | <gpi5> | Is it possible to see the C code generated by GHC (just being curious..)? |
| 15:26:40 | <nominolo> | gpi5, yes |
| 15:27:04 | <nominolo> | gpi5, see the various -dump options |
| 15:27:08 | <gpi5> | Any command line option to do that? |
| 15:27:12 | <gpi5> | Ok, thanks |
| 15:27:40 | <nominolo> | cognominal, last time i checked it also didn't support GADTs or similar |
| 15:27:47 | <Saizan> | nominolo: have you seen Language.Haskell.TH.Helper inside the derive package? it's very helpful :) |
| 15:27:57 | <nominolo> | cognominal, so i guess, it depends on what you want to do |
| 15:28:04 | <nominolo> | Saizan, no |
| 15:28:18 | <mauke> | gpi5: http://www.haskell.org/ghc/docs/latest/html/users_guide/flag-reference.html |
| 15:28:20 | <lambdabot> | Title: 4.17. Flag reference, http://tinyurl.com/ydk2e6 |
| 15:28:21 | <nominolo> | Saizan, i never really felt I needed TH since then |
| 15:28:24 | <EvilTerran> | ghc -fvia-C -keep-hc-files works, i think |
| 15:28:25 | <cognominal_> | nominolo, I know that audreyt uses HT and many advanced extensions |
| 15:28:30 | <mauke> | it's -C |
| 15:29:01 | <nominolo> | Saizan, and that is despite me having been a long-time Lisper |
| 15:29:06 | <cognominal_> | but she a higher order programmer, so she may get away with things that would deter the mere mortals |
| 15:29:21 | <nominolo> | (ok, well, "long-time" = 3 years) |
| 15:29:55 | <nominolo> | cognominal_, well, i guess, it's worth a try |
| 15:30:23 | <Saizan> | heh, i think there're 2 major uses of TH, parsing data at compile time (like regexes) and deriving instances |
| 15:30:35 | <cognominal_> | dealing with ASTs always give a deeper undersstanding of a language |
| 15:30:57 | <nominolo> | cognominal, well, at least of it's syntax |
| 15:31:11 | <nominolo> | but haskell's syntax is pretty complex |
| 15:31:53 | <cognominal_> | I am coming form the Perl world and interested by Perl6. I am not afraid of syntax :) |
| 15:31:54 | <EvilTerran> | i wouldn't fancy parsing an existing AST of the sort TH uses |
| 15:32:01 | <EvilTerran> | but generating them isn't too bad |
| 15:32:38 | <nominolo> | cognominal, you *like* perl6? |
| 15:33:51 | <cognominal_> | yes, perl5 is too ugly. And I want more than a clean Perl5. So Ruby is nice but not a frill |
| 15:34:40 | <nominolo> | i think all that context-sensitivity and implicit stuff can quickly break your bones. |
| 15:34:48 | <jbjohns> | Perl6 is not much better. They took out a lot of the horrible hacks, but the design is much more complex and doesn't really bring anything new to the table. Well new for perl, but not new for programming languages |
| 15:35:06 | <gpi5> | is there an equivallent of show/read for functions? Would be cool to be able to add functions at runtime. |
| 15:35:07 | <nominolo> | otoh, i'm not so much up to date with perl6 development |
| 15:35:35 | <EvilTerran> | @where hsplugins <- gpi5 |
| 15:35:35 | <lambdabot> | http://www.cse.unsw.edu.au/~dons/hs-plugins/ |
| 15:35:39 | <nominolo> | gpi5, that's tricky, because it can break semantics |
| 15:35:52 | <nominolo> | the complex solution is the link abeve |
| 15:37:41 | <gpi5> | nominolo: thanks, I'll have a look |
| 15:38:10 | <cognominal_> | nominolo, yes, it takes some time to like it. |
| 15:38:37 | <cognominal_> | some will never will. |
| 15:41:00 | <cognominal_> | Saizan: thx about the derive tip |
| 15:44:57 | <jbjohns> | it takes time to like what? |
| 16:00:38 | <cognominal_> | jbjohns, the use of context in perl5. Will be even more prevalent in perl6 |
| 16:01:55 | <LoganCapaldo> | Hmm |
| 16:03:04 | <hpaste> | Dave M pasted "Generic trie" at http://hpaste.org/2642 |
| 16:04:33 | <jbjohns> | yes I know. I was pretty surprised by that. I saw they were fixing things from perl 6, I thought surely that context stuff would go, but instead it got even more complicated |
| 16:04:39 | <matthew-_> | err, both rahaskella and lambdabot are awake? |
| 16:05:02 | <LoganCapaldo> | it's the bot revolution |
| 16:05:10 | <LoganCapaldo> | they're forming skynet |
| 16:05:13 | <LoganCapaldo> | @bot |
| 16:05:13 | <lambdabot> | :) |
| 16:05:19 | <LoganCapaldo> | or not |
| 16:05:29 | <matthew-_> | sorry. |
| 16:05:34 | <matthew-_> | yeah, rahaskeller isn't here |
| 16:05:46 | <matthew-_> | it's only in ##otw |
| 16:06:29 | <cognominal_> | otw? |
| 16:07:01 | <matthew-_> | no idea |
| 16:07:27 | <LoganCapaldo> | of the week |
| 16:07:32 | <LoganCapaldo> | # of the week? |
| 16:07:38 | <LoganCapaldo> | Is it 42? |
| 16:08:15 | <arcatan> | 36? |
| 16:08:46 | <roconnor> | ACTION thinks it is week 36 |
| 16:08:58 | <roconnor> | ACTION also thinks weeks begin on Sunday. |
| 16:09:19 | <roconnor> | I wonder what the ISO thinks is the first day of the week. |
| 16:10:03 | <mauke> | argh :( |
| 16:10:03 | <mauke> | I need a single-stepping debugger |
| 16:10:30 | <matthew-_> | roconnor: I agree wrt weeks beginning on Sunday |
| 16:10:46 | <LoganCapaldo> | mauke, let me know if you find one |
| 16:11:09 | <int-e> | there's the compromise of giving sunday the number 0 ;) |
| 16:11:56 | <int-e> | then you can decide, based on that, whether 0 or 1 is the first natural number. |
| 16:12:38 | <LoganCapaldo> | int-e, your cleverness is only exceeded by your evilness ;) |
| 16:13:40 | <roconnor> | is sunday also the number 7? |
| 16:13:53 | <roconnor> | like midnight getting both 24:00 and 00:00 |
| 16:14:06 | <LoganCapaldo> | there is no 24:00 |
| 16:14:09 | <matthew-_> | roconnor: that's grim. Mind you, there are leap seconds |
| 16:14:29 | <xerox> | isSunday = (0==) . (`mod` 7) |
| 16:14:30 | <LoganCapaldo> | (imo anyway) |
| 16:14:50 | <roconnor> | matthew-_: do they occur at midnight? |
| 16:14:58 | <matthew-_> | roconnor: I'm not sure |
| 16:15:04 | <LoganCapaldo> | (reality may differ, we are not responsible for lost items, including sanity) |
| 16:15:09 | <roconnor> | LoganCapaldo: 24:00 exists, but is non canonical. |
| 16:15:20 | <nominolo> | according to bible, sunday is the 7th day, afaik |
| 16:15:54 | <Heffalump> | leap seconds are 23:60, aren't they? |
| 16:15:55 | <roconnor> | ISO is a bunch of godless nazi heathen devil worshipers. |
| 16:16:11 | <cognominal_> | trying to install green card on my intel mac, I get Lex.lhs:14:7: |
| 16:16:11 | <cognominal_> | Could not find module `Data.FiniteMap': |
| 16:16:26 | <cognominal_> | what could I have done wrong |
| 16:16:30 | <mrd> | does anyone still use greencard |
| 16:16:33 | <nominolo> | cognominal, which version of ghc? |
| 16:16:40 | <matthew-_> | roconnor: um, that might be a /bit/ strong... |
| 16:16:42 | <mrd> | because taht sounds way old. Data.FiniteMap --> Data.Map |
| 16:17:00 | <mauke> | greencard seems to suffer from bitrot |
| 16:17:28 | <cognominal_> | may be should I get it from cvs, darcs or whatever |
| 16:17:32 | <int-e> | LoganCapaldo: you forgot my laziness. that exceeds both of the qualities you mentioned. |
| 16:18:58 | <nominolo> | cognominal, why don't you use c2hs or that other ffi processor? |
| 16:20:00 | <cognominal_> | I don't know. I am trying to figure out everything that exists in the ghc environment |
| 16:22:47 | <LoganCapaldo> | I wonder way it was called FiniteMap |
| 16:23:11 | <ddarius> | Because it's a finite map ... |
| 16:23:27 | <LoganCapaldo> | Seems sort of implicit |
| 16:24:19 | <ddarius> | Integer -> Bool is an infinite map |
| 16:24:35 | <LoganCapaldo> | that was going to be my next question ;) |
| 16:25:50 | <LoganCapaldo> | @type \m k -> fromJust $ Data.Map.lookup k m |
| 16:25:52 | <lambdabot> | forall k a. (Ord k) => Data.Map.Map k a -> k -> a |
| 16:26:14 | <LoganCapaldo> | look, it's an infinite map from finite maps to infinite maps :) |
| 16:27:20 | <LoganCapaldo> | this is starting to remind me of the trie thing |
| 16:28:58 | <ddarius> | If k is finite, then k -> a would be a finite map, further unless k is finite, that conversion is partial. |
| 16:29:25 | <LoganCapaldo> | hence the smiley face |
| 16:29:47 | <LoganCapaldo> | I gotta stop doing that |
| 16:30:01 | <LoganCapaldo> | I think it might a sub concious desire to troll |
| 16:31:33 | <mdmkolbe> | @pl throwError . strMsg |
| 16:31:33 | <lambdabot> | throwError . strMsg |
| 16:33:03 | <LoganCapaldo> | @pl \x -> throwError (strMsg x) |
| 16:33:03 | <lambdabot> | throwError . strMsg |
| 16:34:06 | <LoganCapaldo> | they shoulda abbreviated it to terror |
| 16:34:23 | <mdmkolbe> | @type terror |
| 16:34:28 | <mdmkolbe> | @index terror |
| 16:34:32 | <lambdabot> | Not in scope: `terror' |
| 16:34:32 | <lambdabot> | bzzt |
| 16:34:35 | <balodja> | terror :)) |
| 16:43:26 | <xtacy[]> | Hi, in Hoare's Logic, for proving program correctness, I have a question in the assignment rule .. |
| 16:44:20 | <sorear> | xtacy[]: Don't ask to ask (general IRC convention) :D |
| 16:44:30 | <xtacy[]> | we have {P[E/x]} x := E {P} , |
| 16:44:42 | <xtacy[]> | sorear, Yeah, I was typing :) It was a kind of an announcement :D |
| 16:45:24 | <xtacy[]> | okay, when we have the rule {P[E/x]} x := E {P} ... |
| 16:45:28 | <ddarius> | Of all the programming language channels to ask on, ask on the one about a programming language with no assignment... |
| 16:45:37 | <mauke> | haha |
| 16:45:40 | <beelsebob> | hehe |
| 16:45:47 | <sorear> | writeIORef |
| 16:45:49 | <beelsebob> | yeh, but assignment is a lot like beta-reduction |
| 16:45:53 | <xtacy[]> | ddarius, :) we have subsitution in Haskell |
| 16:45:56 | <beelsebob> | so not too horrific |
| 16:46:05 | <sorear> | #haskell is actually #smart-people |
| 16:46:07 | <Tac-Tics> | With all the good things people say about Hindley Milner, the algorithm behind it is certainly not well represented on the web |
| 16:46:14 | <ddarius> | assignment is not like beta-reduction, that is why it is horrific. |
| 16:46:35 | <olsner> | Tac-Tics: isn't it basically just unification? |
| 16:46:36 | <beelsebob> | ddarius: at least the part he's asking about is very similar... just at the moment |
| 16:46:36 | <ddarius> | Tac-Tics: You can buy a freakin' T-shirt with it! |
| 16:46:45 | <xtacy[]> | Okay fine, now back to the question. for me, the Rule {P[E/x]} x := E {P} sounds more like: {P} x := E {P[x/E]} |
| 16:46:52 | <Tac-Tics> | hehe, really? |
| 16:47:11 | <Igloo> | ddarius: With the spec, not the algorithm, to be fair (if you're thinking of the same one I am) |
| 16:47:17 | <Tac-Tics> | I spent all day looking around for it, and everything I read just flew right over my head |
| 16:47:19 | <ddarius> | Tac-Tics: http://www.cafepress.com/skicalc |
| 16:47:19 | <sorear> | xtacy[]: P is contravariant in x, so it has to be backward to work out correctly |
| 16:47:33 | <ddarius> | Igloo: True. |
| 16:47:53 | <ddarius> | Still, in a logic language, the spec is rather close to the algorithm. |
| 16:48:23 | <Tac-Tics> | from what I've seen on the web, it requires working knowledge of prolog to implement |
| 16:48:26 | <Tac-Tics> | or something |
| 16:48:35 | <xtacy[]> | ddarius: wait, I havent heard the term "Contravariant" before ... lemme check it out |
| 16:48:41 | <Tac-Tics> | no source really does any good explaining the notation they use |
| 16:48:53 | <ddarius> | Tac-Tics: Certainly not, but it's pretty straightforward to do in a logic language. |
| 16:49:12 | <mauke> | basically, you just collect and unify constraints |
| 16:49:39 | <sorear> | Tac-Tics: Don't look for the answer in html, it's pdf only :) |
| 16:49:48 | <Tac-Tics> | hehe, sorear, I figured that |
| 16:50:02 | <Tac-Tics> | I downloaded about 10 pdfs yesterday and in none of them could I get past section 2 |
| 16:50:30 | <xtacy[]> | sorear: Could you give me an example where what I thought was right, does not hold good? |
| 16:50:36 | <Tac-Tics> | I'm sure it's nothing too complicated to understand, but their use of unfamiliar notation is a serious problem for me |
| 16:51:22 | <Tac-Tics> | Like the horizontal bar notation |
| 16:51:41 | <Tac-Tics> | I'm guessing it is for premises on top and the conclusion on the bottom |
| 16:51:52 | <xtacy[]> | A bar B is A => B |
| 16:51:54 | <Tac-Tics> | but it's never formally specified (if that is in fact what the notation does) |
| 16:52:04 | <xtacy[]> | Tac-Tics: horizontal bar, that is :) |
| 16:52:04 | <sorear> | Tac-Tics: uhm, yeah, that's natural deduction, everyone is assumed to know that |
| 16:52:26 | <olsner> | I've never learned to read the horizontal bar notation... I just wish they'd write it in prolog instead ;-) |
| 16:52:38 | <ddarius> | xtacy[]: {x = 2}x := 3{3 = 3} (that's what your notation reads as) |
| 16:52:40 | <Tac-Tics> | it seems quite unnatural to me ^^ |
| 16:53:00 | <Tac-Tics> | I am quite familiar with |- notation for that sort of thing |
| 16:53:31 | <Rebooted> | anyone here familiar with WASH? I can use a button to transition between pages but can't figure out how to do it via a link |
| 16:53:36 | <xtacy[]> | ddarius: in some sense, that *is* correct, right? :) |
| 16:53:50 | <xtacy[]> | ddarius: but it isnt useful ... |
| 16:54:05 | <Rebooted> | done via a button like this: submit0 page2 (attr "value" "Clickformyhobbies") |
| 16:54:11 | <pejo> | Tac-Tics, are you trying to implement type inference from standard HM? If so, have you seen the chapter in the book by SPJ on his homepage? |
| 16:54:37 | <Tac-Tics> | most likely |
| 16:54:46 | <Tac-Tics> | I have two pdfs by SPJ on the subject |
| 16:54:48 | <Tac-Tics> | ^^ |
| 16:55:05 | <sorear> | pejo: the person who wrote that chapter says on his webpage something to the effect of "I regret writing that, it's the most disgusting code I've seen" |
| 16:55:08 | <Tac-Tics> | really, I just want to be able to write a very simple type checked language in Haskell |
| 16:55:18 | <Tac-Tics> | just to learn the basics of it |
| 16:55:37 | <Tac-Tics> | the pdf I saw explained universally quantified type variables |
| 16:55:47 | <sorear> | Tac-Tics: Read Robinson in the original on unification; once you understand that, implenting HM should be easy... |
| 16:55:47 | <pejo> | sorear, ".. and we leave it as an exercise to the reader to improve it"? :-) |
| 16:55:52 | <Tac-Tics> | which (I think) is beyond what I want to do |
| 16:55:54 | <sorear> | pejo: no. :) |
| 16:56:02 | <sorear> | Tac-Tics: Boxy types? |
| 16:56:02 | <Tac-Tics> | thanks sorear |
| 16:56:08 | <sorear> | Tac-Tics: you don't want that! |
| 16:56:14 | <Tac-Tics> | yeah |
| 16:56:52 | <sorear> | ooh, ndm (compiler hacker) |
| 16:56:58 | <ddarius> | xtacy[]: Oh sorry, it should have been {x = 2}x := 3{3 = 2} |
| 16:57:13 | <ndm> | sorear: who is compiler hacking right now :) |
| 16:57:37 | <sorear> | ndm: Tac-Tics wants to implement a type inference engine (for a very simple language); any recommendations for reading material? |
| 16:57:37 | <ndm> | ACTION suspects sorear has equal compiler hacking knowledge |
| 16:57:45 | <ddarius> | No wait, that was still wrong, {x = 2}x:=3{x = 2} is exactly what it would come out to in that case. |
| 16:57:57 | <ndm> | Tac-Tics: types and programming languages |
| 16:58:19 | <Tac-Tics> | that's the other thing. The original articles are not available online, and I suspect, aren't available for free |
| 16:58:24 | <ndm> | plus the new tai chi library, which will hopefully be released shortly - its a type inference engine as a Haskell library which can do types for most things |
| 16:58:28 | <ddarius> | xtacy[]: And {y = 2}x:=3{y = x} is also a result of your rule |
| 16:58:46 | <ndm> | although i'm pretty sure it hasn't been released and isn't publically available :( |
| 16:59:13 | <xtacy[]> | ddarius: :) Lemme work it out ... I think my initial formulation should be changed a little |
| 16:59:28 | <ndm> | Tac-Tics: plus of course, typing haskell in haskell |
| 16:59:29 | <roconnor> | @go 2 quarts in l |
| 16:59:30 | <lambdabot> | 2 US quarts = 1.8927059 l |
| 16:59:47 | <ndm> | @go typing haskell in haskell jones |
| 16:59:49 | <ddarius> | xtacy[]: The rule you were given was correct. I'd spend more time trying to understand why. |
| 16:59:50 | <lambdabot> | http://citeseer.ist.psu.edu/424440.html |
| 16:59:50 | <lambdabot> | Title: Typing Haskell in Haskell - Jones (ResearchIndex) |
| 17:00:12 | <ndm> | Tac-Tics, if you can't find the original code, i've got a copy here - it was missing last time i went searching |
| 17:00:17 | <xtacy[]> | ddarius: what I had in mind was, you have a statement {Q}. and an assignment x := E... so, {Q} should be now still valid, with all occurances of 'x' in Q replaced by E |
| 17:01:04 | <Tac-Tics> | hmm that article looks not too bad |
| 17:01:10 | <Tac-Tics> | I'll take a look at it |
| 17:01:32 | <mdmkolbe> | @hoogle [Bool] -> [t] -> [t] |
| 17:01:33 | <lambdabot> | No matches, try a more general search |
| 17:01:46 | <ddarius> | Okay then you used the notation backwards (which I suspected and was probably a typo), still you then get {x = 2}x:=3{3 = 2} |
| 17:01:54 | <mdmkolbe> | @djinn [Bool] -> [t] -> [t] |
| 17:01:54 | <lambdabot> | f _ a = a |
| 17:02:03 | <ddarius> | xtacy[]: The way to think of the given rule is, |
| 17:02:25 | <olsner> | filter fst . zip ? |
| 17:02:37 | <Tac-Tics> | @let filter2 (True:bs) (x:xs) = x : filter2 bs xs; filter2 (False:bs) (x:xs) = filter2 bs xs; filter2 [] [] = [] |
| 17:02:41 | <lambdabot> | Defined. |
| 17:02:42 | <ari> | :t (filter fst .) . zip |
| 17:02:44 | <lambdabot> | forall b. [Bool] -> [b] -> [(Bool, b)] |
| 17:02:53 | <Tac-Tics> | > filter2 [True, True, False, True, False] [1..5] |
| 17:02:54 | <lambdabot> | [1,2,4] |
| 17:02:56 | <ddarius> | if P holds with all versions of x replaced with E, then when we set x to E, P should hold (without the substitution since x now equals E) |
| 17:03:11 | <mdmkolbe> | @type filter fst . zip |
| 17:03:13 | <lambdabot> | Couldn't match expected type `[(Bool, b)]' |
| 17:03:14 | <lambdabot> | against inferred type `[b1] -> [(a, b1)]' |
| 17:03:31 | <ddarius> | Thus in symbols {P[E/x]}x:=E{P} |
| 17:03:36 | <mdmkolbe> | @type (filter fst) . zip |
| 17:03:37 | <lambdabot> | Couldn't match expected type `[(Bool, b)]' |
| 17:03:37 | <lambdabot> | against inferred type `[b1] -> [(a, b1)]' |
| 17:03:41 | <mauke> | > ((map snd . filter fst .) . zip) [True, True, False, True, False] [1..5] |
| 17:03:42 | <lambdabot> | The operator `.' [infixr 9] of a section |
| 17:03:42 | <lambdabot> | must have lower precede... |
| 17:03:49 | <ndm> | concat $ zipWith (\a b -> [b|a]) |
| 17:03:51 | <mdmkolbe> | @type filter |
| 17:03:53 | <lambdabot> | forall a. (a -> Bool) -> [a] -> [a] |
| 17:04:07 | <mauke> | > (((map snd . filter fst) .) . zip) [True, True, False, True, False] [1..5] |
| 17:04:09 | <lambdabot> | [1,2,4] |
| 17:04:12 | <olsner> | @type concat $ zipWith (\a b -> [b|a]) |
| 17:04:14 | <lambdabot> | Couldn't match expected type `[[a]]' |
| 17:04:14 | <lambdabot> | against inferred type `[Bool] -> [b] -> [[b]]' |
| 17:04:40 | <olsner> | @type (concat .) . zipWith (\a b -> [b|a]) |
| 17:04:42 | <lambdabot> | forall b. [Bool] -> [b] -> [b] |
| 17:05:26 | <ari> | olsner++ |
| 17:05:41 | <olsner> | ndm++ |
| 17:06:00 | <mdmkolbe> | ndm++ |
| 17:06:04 | <olsner> | passing the karma ;-) |
| 17:06:21 | <mdmkolbe> | @help karma |
| 17:06:23 | <lambdabot> | karma <polynick>. Return a person's karma value |
| 17:06:27 | <mdmkolbe> | @karma ndm |
| 17:06:28 | <lambdabot> | ndm has a karma of 16 |
| 17:06:47 | <ndm> | thanks :) - i love the [a|b] trick! |
| 17:08:25 | <Tac-Tics> | [False | True] |
| 17:08:29 | <Tac-Tics> | > [False | True] |
| 17:08:31 | <lambdabot> | [False] |
| 17:08:42 | <Tac-Tics> | > [True | True] |
| 17:08:43 | <sioraiocht> | > [True | False] |
| 17:08:43 | <lambdabot> | [True] |
| 17:08:44 | <lambdabot> | [] |
| 17:08:47 | <ndm> | the classic example is |
| 17:08:56 | <mdmkolbe> | ndm: would that trick fuse properly? or would a Schwartian transform fuse better? |
| 17:09:14 | <ndm> | mdmkolbe: no idea, it does using the optimiser i'm writing :) |
| 17:09:14 | <Tac-Tics> | Er, wait, | isn't what I think it is.... |
| 17:09:19 | <Tac-Tics> | @src (|) |
| 17:09:20 | <lambdabot> | Source not found. This mission is too important for me to allow you to jeopardize it. |
| 17:09:25 | <Tac-Tics> | @type (|) |
| 17:09:27 | <beelsebob> | Tac-Tics: it's list comprehension |
| 17:09:27 | <lambdabot> | parse error on input `|' |
| 17:09:29 | <Tac-Tics> | yeah |
| 17:09:32 | <Tac-Tics> | hehe |
| 17:10:39 | <Tac-Tics> | I reverted to thinking | was a binary bitwise operator or something |
| 17:10:48 | <conal> | does anyone know if standalone deriving is in recent ghc? |
| 17:10:55 | <conal> | and if so, what the syntax is? |
| 17:11:32 | <ndm> | conal: i thought it was in the head, but can't remember hte syntax, although the head manual should have it in (i think i saw a patch to the manual land) |
| 17:11:37 | <xtacy[]> | ddarius: ah, |
| 17:11:50 | <xtacy[]> | ddarius: That example cleared things ... |
| 17:12:08 | <sjanssen> | conal: deriving instance Class Type -- IIRC |
| 17:12:23 | <conal> | ndm: thanks. hm, i wonder where i saw the head docs... |
| 17:13:31 | <sorear> | @docs |
| 17:13:31 | <lambdabot> | http://haskell.org/ghc/docs/latest/html/libraries/index.html |
| 17:13:39 | <sorear> | s/latest/current/ |
| 17:13:52 | <conal> | sorear: HEAD? |
| 17:14:01 | <sorear> | conal: s/latest/current/ |
| 17:14:28 | <conal> | oh, and more specifically, i'm looking for language extensions |
| 17:14:36 | <tuxplorer> | many programs should write some lines to a queue and one program should take line by line from that queue and process each line..is there any IPC library available for Haskell? |
| 17:15:08 | <conal> | i'll try the user's guide link from there/../.. |
| 17:15:11 | <allbery_b> | sockets |
| 17:15:16 | <allbery_b> | (ie. Network) |
| 17:15:21 | <conal> | oh -- urg. 6.6.1 |
| 17:16:14 | <tuxplorer> | allbery_b: Sockets is there, but is there a better way such as shared memory?(I understand that Haskell won't allow people to access memory locations directly, but may be if it provides some abstract way of doing it?) |
| 17:16:55 | <allbery_b> | I've seen shared memory techniques involving ForeignPtrs discussed, but no standard library |
| 17:17:11 | <tuxplorer> | allbery_b: oh! ok.. Thanks :) |
| 17:17:11 | <sorear> | http://haskell.org/ghc/dist/current/docs/users_guide/ |
| 17:17:12 | <lambdabot> | Title: The Glorious Glasgow Haskell Compilation System User's Guide, Version 6.7.200708 ... |
| 17:17:26 | <allbery_b> | Unix fifos could be done fairly easily without any special library (with due care due to some of the magic needed to get them to behave right) |
| 17:17:38 | <allbery_b> | not sure if POSIX IPC is worth the effort |
| 17:18:05 | <conal> | sorear: thanks |
| 17:18:33 | <allbery_b> | hm, System.Win32 doesn't seem to have Windows IPC either |
| 17:18:37 | <allbery_b> | kinda sad |
| 17:18:45 | <ndm> | how would i do this in applicative |
| 17:18:49 | <ndm> | f m x |
| 17:18:54 | <ndm> | where m is a monadic computation |
| 17:18:59 | <ddarius> | System.Win32 is far from a comprehensive binding. |
| 17:19:01 | <tuxplorer> | allbery_b: actually I wanted linux IPC :) |
| 17:19:01 | <ndm> | i.e. y <- m ; f y x |
| 17:19:24 | <ndm> | ddarius: if you want any particular bit binding, esa will usually oblige |
| 17:19:26 | <mauke> | return f `ap` m `ap` return x |
| 17:19:40 | <ndm> | mauke: i meant using the <$> and <*> syntax of applicative |
| 17:19:56 | <allbery_b> | ddarius: think you missed the point. neither unix/posix nor win32 IPC is there |
| 17:20:08 | <allbery_b> | much less a hypothetical higher level binding |
| 17:20:31 | <mauke> | oh, no return? |
| 17:20:35 | <ddarius> | allbery_b: All I was saying, is that -many- Win32 things aren't in System.Win32 |
| 17:20:43 | <xtacy[]> | ddarius: now, say x = 2, and then i make the assignment x := 3 , and so, x = 3 after the statement is executed. How do we write this in Hoare Logic? |
| 17:21:44 | <hpaste> | conal pasted "standalone deriving example -- does it work for anyone?" at http://hpaste.org/2645 |
| 17:22:20 | <xtacy[]> | ddarius: The statement: {x=2} x := 3 {x=3}, doesnt fit into the proposed logical rule for assignment statements ... |
| 17:22:21 | <allbery_b> | ACTION doesn't think he's got enough clue to devise such a higher level IPC binding |
| 17:22:45 | <sioraiocht> | conal: not for me |
| 17:23:07 | <conal> | i have 6.7 20070824. |
| 17:23:20 | <xtacy[]> | ddarius: here E = 3. but if we do P[E/x], we get {3 = 2}, which is false |
| 17:23:24 | <conal> | sioraiocht: what's your ghc version? |
| 17:23:34 | <sioraiocht> | conal: 6.6.1 |
| 17:23:42 | <xtacy[]> | ddarius: but the implication is true anyway :-) |
| 17:23:45 | <sjanssen> | conal: deriving rather than derive, and you have to provide a context |
| 17:23:52 | <xtacy[]> | ddarius: hmm, now I am confused |
| 17:24:01 | <sjanssen> | conal: and you need LANGUAGE StandaloneDeriving |
| 17:25:22 | <hpaste> | conal annotated "standalone deriving example -- does it work for anyone?" with "this one works. thanks, sjanssen" at http://hpaste.org/2645#a1 |
| 17:25:34 | <conal> | sioraiocht: oh, okay. i wouldn't expect it to work there. |
| 17:25:41 | <hpaste> | mdmkolbe pasted "A cute duality (for your enjoyment)" at http://hpaste.org/2646 |
| 17:26:02 | <sioraiocht> | conal: sorry, i only use stable release, i'm not pro enough to use bleeding edge haskell ;) |
| 17:26:06 | <conal> | sjanssen. super. :) i guess the docs are out of date. |
| 17:26:48 | <conal> | sioraiocht: usually a good choice! i seem always to be pushing the edge with my language use. |
| 17:27:01 | <puusorsa> | http://www.finnchan.fi/b/files/1189388640/1/[bigish]_the_art_of_cropping.jpg |
| 17:27:02 | <lambdabot> | http://www.finnchan.fi/b/files/1189388640/1/[bigish]_the_art_of_cropping.jpg |
| 17:27:09 | <ddarius> | xtacy[]: My examples weren't good on this point, but {P}E{Q}, P is a precondition, something that must hold before E is executed, not what does hold before E is executed. |
| 17:27:44 | <conal> | puusora: urk. i wish i hadn't see that |
| 17:27:48 | <Igloo> | OK, another GADT problem. In http://hpaste.org/2647 bar works but foo doesn't. Is there a way to write what I want without enumerating all the constructors? |
| 17:28:13 | <Eelis> | @djinn (Fd -> CInt) |
| 17:28:14 | <lambdabot> | -- f cannot be realized. |
| 17:28:26 | <ddarius> | xtacy[]: Also, in practice, you usually work backwards from post-conditions to pre-conditions. |
| 17:28:27 | <Igloo> | (and without having a Monad m context) |
| 17:29:20 | <xtacy[]> | ddarius: okay, lets fit it on this: if(x==2) x=3; |
| 17:30:11 | <mdmkolbe> | Igloo: isn't foo = (const (return True) :: SomeMonad m -> m Bool)? |
| 17:30:13 | <xtacy[]> | ddarius: oh, there is an assumption that in {P} E {Q}, execution of E does not affect P |
| 17:30:42 | <ddarius> | xtacy[]: P and Q should be timeless things. |
| 17:30:52 | <allbery_b> | Eelis: lemme guess, gtk2hs? |
| 17:30:57 | <Igloo> | mdmkolbe: That's what I want, yes |
| 17:31:04 | <xtacy[]> | ddarius: ah, so, I cant prove the correctness of an assignment then! |
| 17:31:28 | <Igloo> | mdmkolbe: But I don't want to have to put the Monad m constraint on foo. I don't mind putting it on the GADT, but GHC won't let me |
| 17:31:31 | <allbery_b> | ACTION hit that one trying to use the Gtk+ IO notification facilities |
| 17:31:46 | <xtacy[]> | ddarius: brb ... |
| 17:31:58 | <Eelis> | allbery_b: nope |
| 17:32:56 | <sorear> | Igloo: your op bit is still on, fwiw |
| 17:32:56 | <mdmkolbe> | Igloo: why does bar even work? I don't see a (Monad m) anywhere |
| 17:33:26 | <Igloo> | mdmkolbe: Because when GHC sees the constructor it knows that m == Maybe/IO, and thus is in Monad |
| 17:34:05 | <mdmkolbe> | Igloo: and which monad it uses depends on the value of the constructor? |
| 17:34:10 | <Igloo> | Yup |
| 17:34:39 | <mdmkolbe> | Igloo: now I begin to see why GHC doesn't like foo |
| 17:34:49 | <conal> | @pl \a b -> a * base + b |
| 17:34:49 | <lambdabot> | (+) . (base *) |
| 17:34:57 | <conal> | @pl \a b -> a + base * b |
| 17:34:57 | <lambdabot> | (. (base *)) . (+) |
| 17:35:32 | <Igloo> | mdmkolbe: Right, I understand that, but I'm not sure I see what problems would be caused by putting a "Monad m" constraint on the GADT declaration would cause |
| 17:35:52 | <mdmkolbe> | Igloo: umm, what about "foo undefined" |
| 17:35:53 | <conal> | allbery_b: what are "Gtk+ IO notification facilities"? |
| 17:36:53 | <Igloo> | mdmkolbe: that's an ambiguous type error isn't it? |
| 17:37:31 | <allbery_b> | inputAdd and inputRemove in System.Glib.MainLoop which take type FD (type FD = CInt) |
| 17:37:51 | <allbery_b> | maybe it's better in 0.9.12, I'm still using 0.9.11 |
| 17:38:18 | <allbery_b> | I had to dig in the source to find out what an FD was (and online docs seem to think this is still the case) |
| 17:38:24 | <mdmkolbe> | Igloo: ok. I thought I had come up with a good reason this couldn't be done, but you are right. |
| 17:38:51 | <EvilTerran> | ?type foldM |
| 17:39:00 | <lambdabot> | forall a b (m :: * -> *). (Monad m) => (a -> b -> m a) -> a -> [b] -> m a |
| 17:39:14 | <Igloo> | mdmkolbe: You could pass in (undefined :: SomeMonad (Either String)) for which there is no constructor, but I don't think anything bad would happen |
| 17:39:37 | <mdmkolbe> | Igloo: as long as the dictionary gets instantiated in that case, then it would work out |
| 17:39:47 | <Igloo> | Yeah, exactly |
| 17:41:14 | <EvilTerran> | ?src takeWhile |
| 17:41:15 | <lambdabot> | takeWhile _ [] = [] |
| 17:41:15 | <lambdabot> | takeWhile p (x:xs) | p x = x : takeWhile p xs |
| 17:41:15 | <lambdabot> | | otherwise = [] |
| 17:41:23 | <mdmkolbe> | Igloo: maybe someone has written a paper about writting constraints as GADTs. They would have had to have solved this problem. (Or maybe that is what you are doing.) |
| 17:42:20 | <Igloo> | ACTION isn't writing a paper, I'm just trying to use GADTs |
| 17:42:48 | <ddarius> | xtacy[]: Let's say you want to have add y to x and you write the program while(y > 0) { x := x + 1; y := y - 1; } The precondition of the whole thing is {x = a, y = b, b >= 0} the post-condition {x = a + b}, the loop invariant is {x+y = a+b}. Looking at the body of the loop and starting with the loop invariant as the post-condition we have {?}y:=y-1{x+y=a+b} giving {x+(y-1)=a+b} that becomes the post-condition to x:=x+1 and gives {(x+1)+(y-1)=a+b}x:=x+1;y |
| 17:42:48 | <ddarius> | :=y-1;{x+y=a+b} so the loop invariant is maintained. |
| 17:43:12 | <EvilTerran> | \o/ |
| 17:46:44 | <Eelis> | System.Posix.Types has newtype Fd = Fd CInt . i currently define fdOfFd (Fd fd) = fd to easily get the actual fd out of an Fd. of course, i wouldn't have to bother if Fd had been defined as newtype Fd = Fd { fd :: CInt }. what chances would a feature-request to add the field accessor have? |
| 17:47:32 | <mdmkolbe> | Igloo: I'm out of ideas. It sounds like GHC would have to infer that all of the constructors are monads so that SomeMonad m => Monad m which I don't think GHC even attempts to do right now. (You probably could write a function that informs GHC of that; it would have to list every constructor, but you would only have to write it once.) |
| 17:48:23 | <Igloo> | mdmkolbe: I'm happy to write it, so it would only have to check it |
| 17:49:04 | <sorear> | Igloo: foo won't do, for much the same reason that we don't allow irrefutable pattern matches on GADTs to refine |
| 17:49:26 | <sorear> | Igloo: we need to know *which* value of some is involved to pick the correct 'return' |
| 17:49:27 | <mdmkolbe> | Igloo: do you need an example, or is the idea clear enough on its own? |
| 17:49:34 | <sorear> | Igloo: but what if some is undefined? |
| 17:49:58 | <Igloo> | sorear: I want it to behave as if I had put a Monad m constraint on the type |
| 17:49:59 | <sorear> | Igloo: so foo would have to be strict, even though the name does not occur free in the RHS |
| 17:50:16 | <Igloo> | sorear: Do you see any problems that that would cause? |
| 17:50:28 | <mdmkolbe> | sorear: the type of the input (the m in SomeMonad m) tells us which monad to use |
| 17:50:37 | <sorear> | Igloo: so you want partial type signatures? ... => SomeMonad m -> m Bool ? |
| 17:50:42 | <Igloo> | mdmkolbe: I'm not sure what you mean |
| 17:50:50 | <xtacy[]> | ddarius: I kinda get it |
| 17:50:56 | <sorear> | Igloo: it wouldn't cause problems, no |
| 17:51:05 | <xtacy[]> | ddarius: But I need to think about it more ... this working backwards :-) |
| 17:51:21 | <Igloo> | sorear: No, I want to put a Monad m constraint on the GADT definition and have GHC then DTRT without me having to change foo |
| 17:51:37 | <Igloo> | (the reason being that there are lots of foo's, but only 1 GADT) |
| 17:51:53 | <xtacy[]> | ddarius: okay, so, one final thing ... how do I argue correctness for |
| 17:51:56 | <sorear> | Igloo: GHC would be DTWTing in this case; *digs up thread* |
| 17:52:12 | <xtacy[]> | x := 2; if(x=2) x := 3; |
| 17:52:44 | <monochrom> | what are the desired pre-condition and post-condition? |
| 17:52:45 | <hpaste> | mdmkolbe annotated "GADTs" with "one way to hack around it" at http://hpaste.org/2647#a1 |
| 17:53:18 | <EvilTerran> | @check \p xs -> (($[]) . foldl (\f x -> f . if p x then (x:) else const []) id $ xs) == takeWhile p xs |
| 17:53:19 | <lambdabot> | Add a type signature |
| 17:53:22 | <EvilTerran> | ... |
| 17:53:24 | <Igloo> | mdmkolbe: Oh, sorry, in reality I actually want to use do notation |
| 17:53:28 | <EvilTerran> | @check \p xs -> (($[]) . foldl (\f x -> f . if p x then (x:) else const []) id $ xs) == takeWhile p (xs::[Int]) |
| 17:53:29 | <lambdabot> | OK, passed 500 tests. |
| 17:53:35 | <EvilTerran> | :D |
| 17:56:38 | <Igloo> | sorear: No luck? :-( |
| 17:56:41 | <sclv> | does "foo :: Monad m => SomeMonad m -> m Bool" do anything like what you want? |
| 17:57:06 | <Igloo> | sclv: Yes, except I'd prefer not to have to write the context on every function |
| 17:58:09 | <sorear> | Igloo: yeah, no luck |
| 17:58:17 | <Igloo> | OK, thanks for looking |
| 17:58:50 | <sorear> | Igloo: but you see that foo is necessarily strict - what is foo undefined :: Ptr Bool ? |
| 17:59:29 | <mdmkolbe> | sorear: will Ptr Bool match SomeMonad m? |
| 17:59:37 | <Igloo> | sorear: A type error, as Monad Ptr doesn't hold |
| 17:59:44 | <ddarius> | xtacy[]: You need to say what is "correct", what is the code supposed to do. |
| 18:00:07 | <xtacy[]> | {x=3} ... at the end of execution. |
| 18:00:15 | <mdmkolbe> | sorear: err, sorry I miss read the implicit parens |
| 18:01:02 | <sioraiocht> | is it possible to declare type contraints in a polymorphic datatype declaration? |
| 18:01:05 | <sorear> | Igloo: You said foo :: SomeMonad m -> m Bool. Take m = Ptr; foo :: SomeMonad Ptr -> Ptr Bool. Now undefined :: a; take a = SomeMonad Ptr. now foo undefined :: Ptr Bool. Or are you suggesting SomeMonad Ptr be ill-kinded? |
| 18:01:16 | <sioraiocht> | like, data Tree a, but only for Ord a? |
| 18:01:25 | <monochrom> | rewrite "if(x=2)x:=3" as "if (x=2) then x:=3 else skip". Do you know the rule for {?} if (x=2) then x:=3 else skip {x=3} ? |
| 18:01:35 | <mauke> | sioraiocht: not really |
| 18:01:37 | <Igloo> | sorear: But I want to write data Monad m => SomeMonad m where ... |
| 18:01:41 | <sioraiocht> | mauke: oh, bummer, lol |
| 18:02:03 | <Igloo> | sorear: So GHC requires Monad Ptr in order to accept the type SomeMonad Ptr |
| 18:02:09 | <monochrom> | Anyway {true} x:=2 {x=2} if (x=2) then x:=3 else skip {x=3} you can probably see how to prove that. |
| 18:02:25 | <mdmkolbe> | Igloo: would "data (Monad m) => Wrap m = Wrap (SomeMonad m)" work? |
| 18:02:53 | <sorear> | Igloo: Found it |
| 18:02:57 | <sorear> | Igloo: Read "irrefutable patterns for existential types / GADTs |
| 18:02:58 | <crazy_coder> | hello everyome |
| 18:03:05 | <mdmkolbe> | sioraiocht: are you after something like "data (Ord a) => Tree a = ..."? |
| 18:03:07 | <crazy_coder> | :) |
| 18:03:08 | <xtacy[]> | monochrom: again, I am not able to fit the rule in this context |
| 18:03:18 | <sorear> | Igloo: some people broke the thread, so I can't give a URL *grump grump* |
| 18:03:39 | <ddarius> | xtacy[]: What is the (general) rule for if-then-else? |
| 18:03:40 | <xtacy[]> | monochrom: lemme try ... one minute :) |
| 18:03:44 | <Igloo> | sorear: Do you know who wrote the important message? Or do you mean the whole thread? |
| 18:04:26 | <xtacy[]> | ddarius: {P} if (E) then S1; else S2; {Q} --> {P and E} S1 {Q}, {P and !E} S2 {Q} |
| 18:04:39 | <xtacy[]> | so, here, we do ... |
| 18:05:21 | <mdmkolbe> | sioraiocht: I think this does what you want, "data (Ord a) => Tree a = Leaf a | Branch (Tree a) (Tree a)" |
| 18:05:28 | <xtacy[]> | so, here, {P} should be the post condition of the assignment x=2 |
| 18:05:31 | <sioraiocht> | mdmkolbe: yes |
| 18:05:40 | <xtacy[]> | ddarius, monochrom: right? |
| 18:05:44 | <monochrom> | yes |
| 18:06:05 | <ddarius> | (To expand on the practice, usually you start with preconditions for a block of code stating what you are assuming to be true, and postconditions stating what you want aftewards and you move backwards from the postcondition to see if you get something that is implied by the initial preconditions.) |
| 18:06:32 | <xtacy[]> | monochrom: which means, first I have to write the rule for the assignment ... |
| 18:06:47 | <xtacy[]> | ddarius: okay, there is no initial condition here. So, its just {True} |
| 18:07:14 | <EvilTerran> | hm... would you say (takeWhileM :: Monad m => (a -> Bool) -> [m a] -> m [a]) or (takeWhileM :: Monad m => (a -> m Bool) -> [a] -> m [a] |
| 18:07:14 | <EvilTerran> | ) is more generally useful? |
| 18:07:14 | <ddarius> | xtacy[]: In this case, yes. I was just stating that randomly. |
| 18:07:29 | <EvilTerran> | or is there some generalisation that exceeds both in utility? |
| 18:07:37 | <xtacy[]> | ddarius: alright. so, in this case, we have {true} x := 2 {Q}. |
| 18:08:25 | <xtacy[]> | ddarius: oh okay, its not like the post-codntion follows, is it? :) |
| 18:08:56 | <xtacy[]> | ddarius: i.e., is it that the post-condition follows naturally out of the conditions {true} and execution of "x := 2"? |
| 18:09:29 | <xtacy[]> | ddarius: But your previous statement clears things up ... here, I *want* (post-condition) that x = 2. which means, {Q} is {x = 2} |
| 18:09:57 | <xtacy[]> | ddarius: so it doesnt work that way, i.e. {true} and x := 2 => {x = 2}, am I right? :) |
| 18:10:02 | <ddarius> | xtacy[]: Start at the ultimate post-condition which you said (for the whole block) was {x=3} |
| 18:10:21 | <xtacy[]> | ddarius: Alright. |
| 18:10:43 | <earnest> | @src foldl |
| 18:10:43 | <lambdabot> | foldl f z xs = lgo z xs |
| 18:10:44 | <lambdabot> | where lgo z [] = z |
| 18:10:44 | <lambdabot> | lgo z (x:xs) = lgo (f z x) xs |
| 18:10:50 | <monochrom> | There are generally three ways of doing things. {?} program {??}. You can guess or be given both ? and ??, then prove. You can guess or be given ??, then calculate ?. You can guess or be given ?, then calculate ??. The last one is the hardest, since the formulas involved are the most ugly. |
| 18:11:16 | <earnest> | so foldl is recursive; if i write length in terms of foldl, then length will still be recursive; no? |
| 18:11:30 | <EvilTerran> | foldl f e [] = e; foldl f e (x:xs) = foldl f (f e x) xs |
| 18:11:34 | <ddarius> | The middle case is the normal case when you want to show some block is correct. |
| 18:11:35 | <conal> | hm. i tweaked all of my libraries to use the LANGUAGE pragma. now realize that they'll only work for people who have a very recent ghc head. |
| 18:11:43 | <xtacy[]> | ddarius: so, if the loop is: {P} if (x == 2) x = 3; else skip; {x=3} |
| 18:12:13 | <EvilTerran> | earnest, the list is a recursive data type. it is inevitable that you'll have to recurse somewhere if you want to be able to process lists in the general case |
| 18:12:19 | <xtacy[]> | ddarius: I get ... {P and x = 2} x := 3 {x = 3}, {P and x != 2} skip {x = 3} |
| 18:12:21 | <monochrom> | The first is pre-70s. By 1972 Dijkstra already has all the formulas for the middle case, and they're nice simple formulas. |
| 18:12:58 | <EvilTerran> | earnest, but the general consensus, however, is that implicit recursion through combinators that everyone knows is nicer |
| 18:12:58 | <ddarius> | The last case corresponds to show what a block of code means. |
| 18:13:11 | <earnest> | EvilTerran: i agree; hudak passes an exercise saying ``rewrite the definition of length nonrecursively''; i would think he is trying to get us to use foldl, but i dont know; can you write length nonrecursively? |
| 18:13:28 | <ddarius> | earnest: Not without using recursion somewhere. |
| 18:13:32 | <monochrom> | Yeah, the last case is reverse-engineering. |
| 18:13:36 | <earnest> | ddarius: okay |
| 18:13:47 | <ddarius> | xtacy[]: Continue. |
| 18:14:02 | <EvilTerran> | earnest, as someone can look at your source and see "aha, that's a fold! and that's a filter!" instead of having to work out that it's equivalent to such a thing by study |
| 18:14:24 | <xtacy[]> | ddarius: now, I dont have P with me. But all I know at this point is, {P and x = 2} should be the post-condition for the first assignment |
| 18:14:24 | <EvilTerran> | earnest, is this excercise intended to be done in haskell? |
| 18:14:30 | <earnest> | yes |
| 18:14:35 | <earnest> | all in haskell |
| 18:14:37 | <xtacy[]> | So, I have {?} x := 2 {P and x = 2} |
| 18:14:42 | <earnest> | that's The Haskell School of Expression |
| 18:14:52 | <earnest> | the book; do you know the book? |
| 18:14:56 | <EvilTerran> | i know of it |
| 18:15:03 | <EvilTerran> | a fold works, i guess. |
| 18:15:12 | <earnest> | i'm gonna try |
| 18:15:15 | <EvilTerran> | ?type until -- this is good for expressing "iterative" algorithms |
| 18:15:16 | <xtacy[]> | So, I have {?} = {P and 2 = 2} |
| 18:15:17 | <lambdabot> | forall a. (a -> Bool) -> (a -> a) -> a -> a |
| 18:15:20 | <xtacy[]> | which is essentially {P} |
| 18:15:29 | <xtacy[]> | ddarius: so, what is P? :) |
| 18:15:49 | <xtacy[]> | ah, P is the pre-condition. So, it means, |
| 18:16:20 | <earnest> | EvilTerran: i'm still very limited in my freedom of expression in Haskell; i can't really write what I may imagine; I'm still in the copy-from-the-book phase; or that's just as far as my intelligence goes |
| 18:16:25 | <xtacy[]> | ddarius: {P} must hold good for the statements to be executed. so, we can as well take P = True |
| 18:16:36 | <earnest> | so I can't really try using some ``until'' right now :) |
| 18:16:47 | <EvilTerran> | @src until |
| 18:16:47 | <lambdabot> | until p f x | p x = x |
| 18:16:48 | <lambdabot> | | otherwise = until p f (f x) |
| 18:16:48 | <earnest> | the syntax is still pretty difficult to me |
| 18:16:49 | <monochrom> | NO! {true}x:=2{P}. {P and x=2}x:=3{x=3}. {P and x!=2}skip{x=3}. This are the only things you prove (and find P). DO NOT THROW IN {true}x:=2{P and whatever} |
| 18:17:29 | <EvilTerran> | earnest, "until" is just another function, much like foldl or map or whatever. |
| 18:17:31 | <monochrom> | In fact if you read, I have suggested a candidate P early on. |
| 18:17:43 | <earnest> | actually, not just the syntax, but the whole idea of functional programming is still hard for me to grasp |
| 18:17:58 | <EvilTerran> | earnest, but, if foldl (for instance) has been introduced to you recently in the book, that's probably a hint that you should use it |
| 18:17:59 | <earnest> | EvilTerran: it's interesting that until is not recursive |
| 18:18:12 | <EvilTerran> | it is... look to the right of "otherwise" |
| 18:18:18 | <earnest> | EvilTerran: true; i bet that's what he has in mind |
| 18:18:41 | <earnest> | oh yeah; i got confused with that otherwise; |
| 18:18:48 | <earnest> | i thought that the otherwise would be the base case |
| 18:18:57 | <EvilTerran> | ACTION is reminded of solving problems in high school maths using "the wrong technique", ie one other than the one we'd just been taught |
| 18:18:58 | <earnest> | but it's the other way around |
| 18:19:23 | <monochrom> | what is the wrong technique you tried? |
| 18:19:23 | <earnest> | hehe, but that's the idea behind thinking :) |
| 18:19:39 | <earnest> | you were ignoring the lessons and thinking by yourself |
| 18:19:44 | <earnest> | that's not so bad |
| 18:19:52 | <EvilTerran> | anyway, use what you've been given. don't let me lead you astray. ;] |
| 18:19:58 | <earnest> | :) |
| 18:20:24 | <EvilTerran> | monochrom, i can't even remember now. i think it was some trick for escaping the tedium of calculating matrix determinants. |
| 18:20:29 | <xtacy[]> | monochrom: Hmm, so, do we have to *find* P? |
| 18:20:36 | <monochrom> | P is x=2 |
| 18:20:54 | <monochrom> | There are three ways to come to realize P is x=2. |
| 18:20:54 | <xtacy[]> | monochrom: I got that.. but all I want to know is |
| 18:21:04 | <hpaste> | togi pasted "(no title)" at http://hpaste.org/2648 |
| 18:21:05 | <cure_> | can this be done more neatly somehow? maybe some kind of fold? |
| 18:21:36 | <xtacy[]> | monochrom: do we have to realize that P is x = 2 from the rules of Hoare Logic? or, guess that x = 2 and find that the sequence of statements make sense, so, our guess is right? |
| 18:21:55 | <monochrom> | Both works. There is a third way. |
| 18:21:58 | <xtacy[]> | monochrom: I read your previous statements about {?} program {??} |
| 18:22:04 | <monochrom> | (Gosh, do I have to repeat myself three times?) |
| 18:22:52 | <xtacy[]> | reverse engineering? :) |
| 18:22:58 | <cizra> | EvilTerran: That's a horrible crime. I tried it once too. |
| 18:23:11 | <xtacy[]> | monochrom: I am sorry I missed your previous messages since they didnt have a "nick" prefixed! :( |
| 18:23:25 | <EvilTerran> | cizra, what, not using the techniques you're meant to be when at school? |
| 18:23:39 | <cizra> | yes. |
| 18:23:42 | <allbery_b> | .oO { ...what I tell you three times is true. } |
| 18:23:58 | <dons> | ?users |
| 18:23:58 | <lambdabot> | Maximum users seen in #haskell: 402, currently: 390 (97.0%), active: 22 (5.6%) |
| 18:24:07 | <EvilTerran> | meh. |
| 18:24:38 | <masm> | ACTION activates. |
| 18:24:44 | <masm> | ?users |
| 18:24:44 | <lambdabot> | Maximum users seen in #haskell: 402, currently: 390 (97.0%), active: 23 (5.9%) |
| 18:24:46 | <matthew-_> | ok, I'm clearly being dumb. What's the best way of going from String -> [Word8] |
| 18:25:03 | <dons> | :t Data.ByteString.Base.c2w |
| 18:25:09 | <lambdabot> | Char -> Word8 |
| 18:25:13 | <dons> | :t map Data.ByteString.Base.c2w -- :) |
| 18:25:15 | <lambdabot> | [Char] -> [Word8] |
| 18:25:30 | <Trixsey> | Is there any way to trim unwanted characters from a string? |
| 18:25:41 | <dons> | filter |
| 18:25:51 | <dons> | > filter (not.isSpace) "haskell is fun" |
| 18:25:53 | <lambdabot> | "haskellisfun" |
| 18:26:02 | <EvilTerran> | something involving dropWhile? |
| 18:26:05 | <matthew-_> | dons: without using internal bytestring utils! |
| 18:26:07 | <Trixsey> | if I want to fiter a set of unwanted chars? |
| 18:26:17 | <dons> | matthew-_: its just ord . fromIntegral or something. look up the definition |
| 18:26:36 | <Heffalump> | > filter (not . (`elem` "abcdefg")) "haskell is fun" |
| 18:26:37 | <lambdabot> | "hskll is un" |
| 18:26:58 | <dons> | yeah, `elem` "string" is a good idiom |
| 18:27:43 | <paolino> | @src elem |
| 18:27:43 | <lambdabot> | elem x = any (== x) |
| 18:27:47 | <matthew-_> | dons: yep, I know I was being dumb |
| 18:28:26 | <xtacy[]> | monochrom: ddarius: at last, I feel like I am getting something |
| 18:28:39 | <monochrom> | good |
| 18:28:42 | <xtacy[]> | monochrom, ddarius: may be a nights sleep over it should clear things up :) |
| 18:28:59 | <xtacy[]> | monochrom, ddarius: The thing I didnt get int he beggining was: "The flow" |
| 18:29:01 | <paolino> | :t elem |
| 18:29:03 | <lambdabot> | forall a. (Eq a) => a -> [a] -> Bool |
| 18:29:08 | <ddarius> | xtacy[]: The hard part of using Hoare logic is finding loop invariants. |
| 18:29:32 | <togi> | if i wanted to make a list of every character used in a string, is there some really neat haskell-way of doing this? |
| 18:29:50 | <ddarius> | id |
| 18:29:50 | <xtacy[]> | ddarius: ah, so is there another Logic for proving program correctness? |
| 18:30:05 | <monochrom> | loop is the only thing that needs guessing. All else can be calculated blindly. Also, it is not just Hoare logic. |
| 18:30:19 | <xtacy[]> | monochrom: what I didnt get initially was: "Where do {P} and {Q} come from? But you clearly mentioned 3 ways ... that helped :)" |
| 18:30:40 | <monochrom> | http://www.cs.toronto.edu/~hehner/aPToP/ is another |
| 18:30:42 | <lambdabot> | Title: a Practical Theory of Programming |
| 18:30:45 | <paolino> | togi , sort and group |
| 18:30:53 | <sclv> | nub? |
| 18:31:01 | <xtacy[]> | monochrom: so, given P calculate Q. Given Q, work back and calculate P. or, given P and Q, prove that its logically consistent, |
| 18:31:06 | <dons> | sorear: btw, did you know adam tomb was at the uni of california, santa cruz (in your area?) doing language research stuff? |
| 18:31:14 | <ddarius> | Usually P and Q are given or at least Q, you are just trying to make the meet in the middle (perhaps finding the weakest assumptions you need to make, P, in the process) |
| 18:31:21 | <sclv> | or histogram? |
| 18:31:39 | <paolino> | @src nub |
| 18:31:40 | <lambdabot> | nub = nubBy (==) |
| 18:31:52 | <paolino> | @src nubBy |
| 18:31:52 | <lambdabot> | nubBy eq [] = [] |
| 18:31:52 | <lambdabot> | nubBy eq (x:xs) = x : nubBy eq (filter (\ y -> not (eq x y)) xs) |
| 18:32:00 | <xtacy[]> | ddarius: so, if there is a clash in the "meeting in the middle", then the algorithm is wrong :) |
| 18:32:30 | <earnest> | i didnt make it to write length in terms of foldl; what does foldl do? i see it as writing out all elements of my list in a line, and putting it in `op` in between each of them; with the init value at the end; how can i count a list, then, by using the members of the list itself in a x `op` foldl ... fashion? my op can't be (+), so i'm puzzled |
| 18:32:43 | <monochrom> | If a loop is involved, since it requires guessing, it could also be you guessed something that doesn't work out. |
| 18:33:23 | <xtacy[]> | monochrom: yes, thats right. so, we change the guess |
| 18:33:33 | <monochrom> | If there is no loop, then a clash is a real clash. |
| 18:33:59 | <earnest> | here's a case that works: mlen xs = foldl (+) 0 xs; now call mlen [1,1] that works :) that's length in terms of foldl :P |
| 18:34:01 | <sclv> | earnest: foldl also takes an initial argument |
| 18:34:05 | <sclv> | :t foldl |
| 18:34:08 | <lambdabot> | forall a b. (a -> b -> a) -> a -> [b] -> a |
| 18:34:30 | <dons> | yow. |
| 18:34:39 | <earnest> | sclv: right, as i described above |
| 18:34:47 | <allbery_b> | > foldl (\n _ -> n + 1) 0 "abcdefg" |
| 18:34:48 | <lambdabot> | 7 |
| 18:35:00 | <sclv> | earnest: try to think what function you want instead of (+) and what properties it would have |
| 18:35:04 | <sclv> | then write it yourself |
| 18:35:19 | <earnest> | my problem is which operator to use; because after all i dont want to operate the elements of the list; i just want to count them; i guess i need an operator that just returns the number 2? |
| 18:35:26 | <earnest> | hm, that's an idea; thanks sclv |
| 18:35:59 | <earnest> | or that it just returns the number 1; not sure |
| 18:36:00 | <xtacy[]> | monochrom: ddarius: Thanks to both for helping me out today :) |
| 18:36:00 | <allbery_b> | ACTION shouldn't play around in public, perhaps :/ |
| 18:36:06 | <monochrom> | you're welcome |
| 18:36:19 | <xtacy[]> | monochrom, ddarius: I should prolly sleep now! good-day! (its good night here :) |
| 18:36:31 | <paolino> | earnest: see allbery_b function |
| 18:36:58 | <xtacy[]> | ACTION goes to sleep, happily :) |
| 18:37:43 | <togi> | sclv : thanks |
| 18:37:45 | <allbery_b> | actually I was kinda hoping he'd not notice so he could work it out on his own |
| 18:37:51 | <cizra> | @yaht |
| 18:37:51 | <lambdabot> | Maybe you meant: fact part yarr |
| 18:37:57 | <allbery_b> | hence the "not play around in public" |
| 18:38:00 | <paolino> | @pl \n _ -> n + 1 |
| 18:38:01 | <lambdabot> | const . (1 +) |
| 18:38:09 | <allbery_b> | @where yaht |
| 18:38:09 | <lambdabot> | http://darcs.haskell.org/yaht/yaht.pdf |
| 18:38:22 | <cizra> | allbery_b: Thanks |
| 18:38:54 | <nominolo> | @where yaws |
| 18:38:55 | <lambdabot> | I know nothing about yaws. |
| 18:39:08 | <mdmkolbe> | @what yaht |
| 18:39:08 | <lambdabot> | http://darcs.haskell.org/yaht/yaht.pdf |
| 18:39:13 | <ddarius> | nominolo: Why would we have a link to yaws? |
| 18:39:39 | <nominolo> | because it's nice software ;) .. just testing |
| 18:39:52 | <ddarius> | @where hws |
| 18:39:53 | <lambdabot> | I know nothing about hws. |
| 18:39:54 | <ddarius> | bah |
| 18:40:06 | <ddarius> | We don't even have a link to a webserver written in Haskell! |
| 18:40:14 | <ddarius> | @where hws-wp |
| 18:40:15 | <lambdabot> | I know nothing about hws-wp. |
| 18:40:17 | <ddarius> | @where hwswp |
| 18:40:17 | <lambdabot> | I know nothing about hwswp. |
| 18:40:33 | <nominolo> | @where happs |
| 18:40:33 | <lambdabot> | http://happs.org |
| 18:41:42 | <laz0r> | @where frag |
| 18:41:43 | <lambdabot> | http://www.haskell.org/haskellwiki/Frag |
| 18:42:01 | <olsner> | @where am I? |
| 18:42:01 | <lambdabot> | I know nothing about am. |
| 18:42:17 | <nominolo> | @whereis god |
| 18:42:17 | <lambdabot> | Maybe you meant: where where+ |
| 18:48:11 | <nominolo> | @localtime laz0r |
| 18:48:12 | <lambdabot> | Local time for laz0r is Sun Sep 9 20:40:51 |
| 18:48:38 | <laz0r> | still early enough to goof around in #haskell... |
| 18:48:40 | <laz0r> | :) |
| 18:48:47 | <laz0r> | @where nepal |
| 18:48:48 | <lambdabot> | I know nothing about nepal. |
| 18:48:50 | <laz0r> | mmh |
| 18:49:26 | <laz0r> | http://www.cse.unsw.edu.au/~chak/nepal/ |
| 18:49:27 | <lambdabot> | Title: The Nepal Project |
| 18:49:45 | <laz0r> | anyone has some experience with that? |
| 18:49:48 | <EvilTerran> | hm. i think i might've got carried away in my pointsfreeing, there: liftM.(.f).(.) |
| 18:49:56 | <ddarius> | laz0r: I imagine ChilliX does. |
| 18:50:06 | <nominolo> | laz0r, i've seen a lecture on this by SimonPJ |
| 18:50:19 | <EvilTerran> | hey, at least i didn't write it (fmap `fmap` (`fmap` f) `fmap` fmap) |
| 18:50:32 | <laz0r> | is it already useable? |
| 18:50:48 | <nominolo> | laz0r, it should be in ghc 6.8 |
| 18:50:49 | <oerjan> | > (0$0 `fmap`) |
| 18:50:51 | <lambdabot> | The operator `fmap' [infixl 9] of a section |
| 18:50:51 | <lambdabot> | must have lower prec... |
| 18:50:53 | <nominolo> | at least that was the plan |
| 18:50:56 | <mdmkolbe> | @djinn Bool -> m a -> m (Maybe a) |
| 18:50:57 | <lambdabot> | -- f cannot be realized. |
| 18:50:59 | <EvilTerran> | fmap (fmap fmap (flip fmap f)) fmap? |
| 18:51:10 | <mdmkolbe> | @type liftM maybe |
| 18:51:12 | <lambdabot> | forall a1 a (m :: * -> *). (Monad m) => m a1 -> m ((a -> a1) -> Maybe a -> a1) |
| 18:51:20 | <mdmkolbe> | @type maybe |
| 18:51:22 | <lambdabot> | forall b a. b -> (a -> b) -> Maybe a -> b |
| 18:51:34 | <mdmkolbe> | @type liftM2 maybe |
| 18:51:35 | <lambdabot> | forall a1 a (m :: * -> *). (Monad m) => m a1 -> m (a -> a1) -> m (Maybe a -> a1) |
| 18:51:52 | <EvilTerran> | ?type liftM.(. ?f).(.) |
| 18:51:52 | <olsner> | :t fmap ap . ap |
| 18:51:55 | <lambdabot> | forall (m :: * -> *) a b c a1. (Monad m, ?f::a -> a1 -> b) => (b -> c) -> m a -> m (a1 -> c) |
| 18:51:55 | <lambdabot> | forall a b (m :: * -> *) a1. (Monad m) => m (a1 -> a -> b) -> m a1 -> m a -> m b |
| 18:52:42 | <EvilTerran> | ACTION always thinks "echoes" when he sees foo `fmap` bar `ap` baz `ap` eek `ap` ook etc |
| 18:53:06 | <EvilTerran> | "FMAP -AP -AP -ap -ap..." |
| 18:53:13 | <monochrom> | hahahaha |
| 18:53:25 | <olsner> | ACTION misses the joke |
| 18:53:52 | <mdmkolbe> | @pl let foo False _ = return Nothing; foo True x = x >>= (return . Just) in foo |
| 18:53:52 | <lambdabot> | const (const (return Nothing)) |
| 18:54:28 | <EvilTerran> | huh |
| 18:54:37 | <EvilTerran> | aka return (return (return Nothing)) :D |
| 18:54:39 | <mdmkolbe> | @unpl const (const (return Nothing)) |
| 18:54:39 | <lambdabot> | (\ _ _ -> return Nothing) |
| 18:54:51 | <mdmkolbe> | bug in pl? |
| 18:55:23 | <olsner> | :t let foo False _ = return Nothing; foo True x = x >>= (return . Just) in foo |
| 18:55:25 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => Bool -> m a -> m (Maybe a) |
| 18:55:35 | <EvilTerran> | @let foo False _ = return Nothing; foo True x = x >>= (return . Just) |
| 18:55:38 | <lambdabot> | Defined. |
| 18:56:00 | <mdmkolbe> | @pl foo x y = if not x then return Nothing else y >>= (return . Just) |
| 18:56:01 | <lambdabot> | foo = (. (Just `fmap`)) . flip if' (return Nothing) . not |
| 18:56:08 | <EvilTerran> | > foo True [1,2,3] |
| 18:56:10 | <lambdabot> | [Just 1,Just 2,Just 3] |
| 18:56:19 | <EvilTerran> | apparently, mdmkolbe |
| 18:56:23 | <mdmkolbe> | I guess pl doesn't like 'let' |
| 18:56:39 | <Tac-Tics> | > foo False [1,2,3] |
| 18:56:41 | <lambdabot> | [Nothing] |
| 18:56:57 | <sclv> | why is replicate not always genericReplicate? |
| 18:57:12 | <EvilTerran> | for the same reason !! is not always genericIndex. |
| 18:57:13 | <mdmkolbe> | @type genericReplicate |
| 18:57:15 | <lambdabot> | forall i a. (Integral i) => i -> a -> [a] |
| 18:57:21 | <EvilTerran> | blame the authors of the report. |
| 18:57:21 | <mdmkolbe> | @type replicate |
| 18:57:23 | <lambdabot> | forall a. Int -> a -> [a] |
| 18:57:24 | <oerjan> | i rather think @pl dislikes multiple branches |
| 18:57:26 | <ddarius> | sclv: How often do you need something other than Int? |
| 18:57:57 | <mdmkolbe> | ddarius: whenever you want (Num a) or Integer |
| 18:58:09 | <earthy_> | and you often may want Integer |
| 18:58:15 | <ddarius> | > genericReplicate (product [1..1000000000]) 3 |
| 18:58:19 | <lambdabot> | Terminated |
| 18:58:36 | <oerjan> | i guess if it were generic then the defaulting would be Integer rather than Int, which might be less efficient? |
| 18:58:50 | <olsner> | > product [1..1000] :: Int |
| 18:58:51 | <lambdabot> | 0 |
| 18:59:05 | <EvilTerran> | oerjan, i thought it translated branches into applications of if' |
| 18:59:45 | <oerjan> | EvilTerran: case branches with pattern matching cannot be done in that way |
| 18:59:56 | <oerjan> | and let desugars to those |
| 18:59:59 | <Tac-Tics> | > product [0..10] |
| 19:00:01 | <lambdabot> | 0 |
| 19:00:06 | <mdmkolbe> | oerjan: yes, but that is the sort of optimization that is the province of compiler writers not the language spec. |
| 19:00:08 | <olsner> | ;-) |
| 19:00:15 | <Tac-Tics> | > (\n -> product [1..n]) 0 |
| 19:00:17 | <lambdabot> | 1 |
| 19:00:18 | <EvilTerran> | let PAT = EXP in ... = case EXP of ~PAT -> ..., right? |
| 19:00:21 | <Tac-Tics> | > product [] |
| 19:00:22 | <lambdabot> | 1 |
| 19:01:01 | <mdmkolbe> | @unpl (. (Just `fmap`)) . flip if' (return Nothing) . not |
| 19:01:01 | <lambdabot> | (\ h n -> if' (not h) (return Nothing) (fmap (Just) n)) |
| 19:01:27 | <EvilTerran> | hm. that one unpl'd particularly nicely. |
| 19:01:42 | <mdmkolbe> | EvilTerran: for some values of nice |
| 19:01:43 | <sclv> | i'm working with vals that are integrals -- at the point i'm replicating they're going to be well within int range (i hope!) but to get there i'm using integrals -- i just much prefer not having to fromIntegral all over the place |
| 19:01:52 | <sclv> | its one of the most irritating code smells i've found in haskell |
| 19:02:07 | <ddarius> | ACTION loves fromIntegral |
| 19:02:25 | <EvilTerran> | sclv, import prelude hiding (replicate); replicate = genericReplicate :D |
| 19:03:17 | <EvilTerran> | you could do that with all the generic*s, put that in a MyPrelude module in your module search path, and -fno-implicit-prelude, even |
| 19:03:33 | <EvilTerran> | if you think this is going to bother you more than once |
| 19:03:49 | <sclv> | yr probably right -- i was just wondering why it was designed that way to begin with? |
| 19:04:09 | <Olathe> | Are there any tools that will take a statement of a problem and determine which good methods (like greedy method, dynamic programming, etc.) can be used ? |
| 19:04:15 | <EvilTerran> | almost certainly performance, sclv |
| 19:04:48 | <EvilTerran> | Olathe, look for GNU HaltingProblem; it's still in beta, but it might do what you want ;] |
| 19:04:55 | <cizra> | EvilTerran: Haha |
| 19:05:08 | <earnest> | :) |
| 19:05:20 | <EvilTerran> | yes, well. that silliness aside... |
| 19:05:22 | <EvilTerran> | ACTION wanders off |
| 19:05:49 | <earnest> | that's a very good joke |
| 19:05:58 | <dons> | EvilTerran: haha :) |
| 19:06:28 | <earnest> | i feel bad :| |
| 19:06:49 | <olsner> | asking #haskell usually works, but that depends on whether they find the problem interesting ;-) |
| 19:12:36 | <norgul> | hi folks |
| 19:13:05 | <norgul> | a guy challenged me to write a function that takes row and col and returns the element of pascal's triangle |
| 19:13:41 | <dons> | ah yes, sounds like a cute little problem |
| 19:13:57 | <xerox> | hehe, it's *quite* easy if you know what those elements *are*. |
| 19:14:01 | <monochrom> | probably just computing C(row, col)? |
| 19:14:11 | <ddarius> | It's pretty trivial. |
| 19:14:28 | <norgul> | but i want as short as possible, to beat his Scheme version :P |
| 19:14:30 | <mdmkolbe> | guy == professor? problem == homework? |
| 19:14:50 | <ddarius> | norgul: As xerox said, it's immediate if you know what they are. |
| 19:14:56 | <dons> | what's the scheme look like? :) |
| 19:15:05 | <monochrom> | http://www.vex.net/~trebla/haskell/calculator/Calculator.hs has code |
| 19:15:05 | <xerox> | Yeah what does it look like? (-: |
| 19:15:19 | <norgul> | he dont want me to see it, so i can translate his code into haskell |
| 19:15:30 | <Olathe> | How short is it ? |
| 19:15:44 | <ddarius> | monochrom: Why not just use factorial. |
| 19:15:46 | <mdmkolbe> | norgul: umm why doesn't he want you to translate it to haskell? |
| 19:16:07 | <norgul> | he thinks that is cheating |
| 19:16:28 | <dons> | so you must solve it yourself then? :) |
| 19:16:32 | <mdmkolbe> | norgul: why? If Haskell is better than Scheme, then a direct translation isn't cheating |
| 19:16:36 | <Olathe> | Then he's not interested in seeing which language is more compact. |
| 19:16:48 | <monochrom> | Because (6*5*4*3*2*1) / [(4*3*2*1) * (2*1)] is a clear waste of time. At least you want (6*5)/(2*1). |
| 19:17:08 | <ddarius> | monochrom: You can define falling factorial. |
| 19:17:30 | <monochrom> | OK, I'll look up falling factorial, but you didn't say it. |
| 19:17:44 | <ddarius> | True. |
| 19:18:13 | <xerox> | Ex.(P(x)=>Ax.P(x)) |
| 19:18:21 | <xerox> | ACTION waits for another "True" 8-; |
| 19:18:36 | <ddarius> | It's possible that it may still work out to be faster to use your version, but it would be more direct (to me at least) to just use the normal calculation. |
| 19:20:16 | <monochrom> | For one-off answers (e.g. "I just want C(10,5)"), falling factorial works. In some other applications, if you want many answers, may as well memoize, and that is Pascal triangle. |
| 19:20:24 | <mdmkolbe> | norgul: what you say sounds like you're asking us to do your homework. that is why you haven't gotten an answer yet. |
| 19:20:32 | <ddarius> | monochrom: Yes. |
| 19:20:37 | <norgul> | uhm |
| 19:20:55 | <monochrom> | I'll add it to my code when I'm motivated. :) |
| 19:21:06 | <norgul> | well, i try to think myself a bit |
| 19:21:14 | <norgul> | but i concider myself as stupid |
| 19:21:16 | <ddarius> | "Please don't use the Ackermann function!" |
| 19:21:22 | <monochrom> | Hehehe |
| 19:21:28 | <norgul> | dont give an answer .. |
| 19:21:38 | <Philippa> | norgul: is implementing your own factorial cheating as well? |
| 19:21:47 | <norgul> | nah |
| 19:21:54 | <mdmkolbe> | @remember ddarius "Please don't use the Ackermann function!" |
| 19:21:54 | <lambdabot> | Done. |
| 19:22:00 | <Philippa> | so do that? |
| 19:22:10 | <ddarius> | mdmkolbe: I was quoting monochrom's code. |
| 19:22:30 | <ddarius> | Philippa: I don't think he realizes the connection at this point. |
| 19:22:52 | <LoganCapaldo> | Does the ackermann function have any practical applications besides stress testing recursion? :) |
| 19:23:03 | <monochrom> | I took a compiler class. I implemented recursion (it was optional). To test it, I added Ackermann. I wrote "Don't run me" in its comment. My TA liked it. :) |
| 19:23:15 | <mdmkolbe> | norgul: for the answer you must consider the basic math behind pascalls triangle. There are faster way than using addition to calculate it that have nothing to do with the language of choice. |
| 19:23:54 | <norgul> | heh, the way i was thinking was to use addition |
| 19:24:09 | <norgul> | but i think that would be "much coding" |
| 19:24:30 | <mdmkolbe> | norgul: what level are you in math? |
| 19:24:39 | <norgul> | I'm 16 |
| 19:24:42 | <norgul> | years old |
| 19:24:50 | <norgul> | havent learnt much in school yet |
| 19:25:05 | <norgul> | next year i will learn some more advanced stuff, i guess |
| 19:25:05 | <monochrom> | 16 is the ripe age for writing your own compiler, you know. |
| 19:25:21 | <monochrom> | ACTION eyes FMota and sorear |
| 19:25:24 | <mdmkolbe> | monochrom: if that was interpreter I'd agree, but compiler? |
| 19:25:38 | <monochrom> | OK, interpreter. |
| 19:26:53 | <Philippa> | mdmkolbe: it's reasonable for a first-order language into something fairly simple |
| 19:27:17 | <norgul> | im actually interested in programming language design and compilers :S |
| 19:27:24 | <oerjan> | @remember monochrom 16 is the ripe age for writing your own compiler, you know. |
| 19:27:25 | <lambdabot> | Done. |
| 19:27:42 | <mdmkolbe> | norgul: search the web for info on Paskall's triangle. You will find an equation that is more direct than the addition fairly quickly (remember to cite your source if this is for a homework). |
| 19:27:58 | <Saizan> | "Pascal" |
| 19:28:00 | <norgul> | this isnt homework |
| 19:28:10 | <norgul> | do you think we do programming at school? |
| 19:28:20 | <norgul> | this is on hobby basis |
| 19:28:21 | <monochrom> | What do you do at school? |
| 19:28:39 | <norgul> | english, norwegian, science, math |
| 19:29:03 | <ddarius> | I'm not sure when I first read that little Pascal compiler tutorial. It was a long long time ago though. |
| 19:29:51 | <norgul> | heh, i have Compilers, Principles, Tools and Technique here ... |
| 19:30:02 | <norgul> | havent read much in it, though |
| 19:30:49 | <Philippa> | the dragon book's really not a good intro these days |
| 19:30:50 | <monochrom> | Hey, Pascal in 48 hours! |
| 19:31:05 | <Philippa> | try Appel's "Modern Compiler Implementation in ML" (you can get Java or C too, but you want ML) |
| 19:31:17 | <norgul> | sure |
| 19:31:21 | <ddarius> | I'd like to flip through that at least some time to see if I'd want it. |
| 19:31:25 | <monochrom> | Yeah, the Java and the C versions are less readable somehow. |
| 19:31:32 | <mdmkolbe> | Philippa: my school used that book, it wasn't very good |
| 19:31:45 | <norgul> | im mostly interested in programming language design |
| 19:31:49 | <mdmkolbe> | Philippa: well the Java version of that book |
| 19:31:49 | <norgul> | any good books? |
| 19:31:50 | <monochrom> | It is very good, IMNSHO. |
| 19:32:05 | <monochrom> | But I mean the ML version. |
| 19:32:16 | <Philippa> | mdmkolbe: ML's the language Appel actually likes to work in, I suspect the other two versions suffered somewhat in translation |
| 19:32:38 | <Philippa> | norgul: LtU's reading list's worth a peek through |
| 19:32:38 | <monochrom> | You have to take a lot of concessions to do it in Java, you know? |
| 19:32:52 | <ddarius> | I believe the content is actually somewhat different between them too. |
| 19:33:00 | <mdmkolbe> | At least the Java version spent to much time on the parsing and front end parts and glossed over the back end |
| 19:33:06 | <ddarius> | ACTION remembers reading Steele's thesis the first time. |
| 19:33:18 | <mdmkolbe> | s/to/too/ |
| 19:33:46 | <wli> | What was Steele's thesis? |
| 19:34:05 | <dons> | so, anyone else plan on getting a phd in haskell studies, so they can get a job at a big investment bank? :) |
| 19:34:06 | <ddarius> | RABBIT: A compiler for Scheme (or some such) |
| 19:34:08 | <monochrom> | Yeah, I think I heard many people agreeing that the Java version is poor. But don't draw the same conclusion about the real version yet. |
| 19:34:20 | <Heffalump> | "haskell studies"? |
| 19:34:29 | <dons> | :) |
| 19:34:32 | <mdmkolbe> | dons: I would if I knew how |
| 19:34:42 | <norgul> | if i would design my own programming language, i would definately use some haskell features |
| 19:34:44 | <dons> | `This is a great opportunity for PhD students or above with proven experience of Haskell programming.' |
| 19:34:45 | <mdmkolbe> | dons: (except maybe the bank part) |
| 19:35:28 | <sioraiocht> | @src or |
| 19:35:29 | <lambdabot> | or = foldr (||) False |
| 19:35:44 | <Heffalump> | how does that translate to "a phd in haskell studies"? |
| 19:35:54 | <mrd> | Appel is alright, though I wasn't too pleased with the presentation of register allocation. I did manage to get mine working though. |
| 19:36:13 | <dons> | Heffalump: oh, it was a new discipline I just came up with to describe a phd spent in #haskell :) |
| 19:36:24 | <sioraiocht> | dons: If I would definitely do quant. finance after I finish grad school =p |
| 19:36:45 | <Heffalump> | :-) |
| 19:36:47 | <Philippa> | mrd: yeah, that's something you can read up more on over time though - you've still got a working compiler and an idea of what search terms to use |
| 19:36:51 | <cognominal_> | @src replaceAt |
| 19:36:51 | <lambdabot> | Source not found. Sorry about this, I know it's a bit silly. |
| 19:36:59 | <sioraiocht> | dons: maybe we should make #haskell a degree granting institution, - |
| 19:37:01 | <sioraiocht> | =p even |
| 19:37:04 | <dons> | i like it! |
| 19:37:06 | <mdmkolbe> | @remember dons so, anyone else plan on getting a phd in haskell studies, so they can get a job at a big investment bank? :) |
| 19:37:06 | <lambdabot> | Done. |
| 19:37:19 | <ddarius> | @google Appel iterative coalescing |
| 19:37:22 | <lambdabot> | http://www.cs.cmu.edu/afs/cs/academic/class/15745-s07/www/papers/presentations/register_allocation.pdf |
| 19:37:22 | <mdmkolbe> | (so I can cite in in my thesis later ;-) ) |
| 19:37:26 | <dons> | yes, we can offer diplomas, bachelors and graduate degrees in haskell studies |
| 19:37:28 | <monochrom> | @remember sioraiocht maybe we should make #haskell a degree granting institution |
| 19:37:28 | <lambdabot> | Done. |
| 19:37:28 | <sioraiocht> | hahahah |
| 19:37:33 | <dons> | just send me your credit card details! |
| 19:37:55 | <oerjan> | cognominal_: splitAt may help |
| 19:38:05 | <mrd> | I just did the basic graph coloring algo with some coalescing |
| 19:38:27 | <LoganCapaldo> | I want a #haskell degree |
| 19:38:44 | <nominolo> | dons, what's the advantage of a phd anyways? |
| 19:38:59 | <ddarius> | nominolo: You get to be called "Doctor!" |
| 19:38:59 | <LoganCapaldo> | Think I could get an associates degree in simplified layout rule analysis? |
| 19:39:07 | <dons> | nominolo: you can get a job at a big investment bank? |
| 19:39:07 | <nominolo> | ddarius, other than that |
| 19:39:24 | <dons> | its well known that phds have more fun |
| 19:39:28 | <nominolo> | dons, but if i don't want to? |
| 19:39:39 | <sioraiocht> | nominolo: you do it so you can say you made it through |
| 19:39:40 | <ddarius> | dons: Certainly more fun than those working on their PhD |
| 19:39:57 | <sioraiocht> | nominolo: and in theory you know lots of stuff =p |
| 19:40:05 | <ddarius> | In theory... |
| 19:40:10 | <dons> | heh |
| 19:40:16 | <sioraiocht> | ACTION mutters "blah blah blah, everything about nothing." |
| 19:40:20 | <nominolo> | well, many haskell papers are really practical |
| 19:40:40 | <nominolo> | at least as much as practical relates to haskell programming |
| 19:40:53 | <sioraiocht> | nominolo: getting a phd also guarantees you will always be dissatisfied with the salary you receive in proportion to your education |
| 19:40:53 | <ddarius> | That's because theory and practice are almost identical in Haskell. |
| 19:40:56 | <xerox> | dons and dcoutts were awarded the best practical paper award too ;) |
| 19:41:05 | <dons> | you get to tick the first box on forms marked: [Dr] [Mr] [Mrs] [Miss] [Ms] |
| 19:41:25 | <nominolo> | does simonpj have a phd? |
| 19:41:28 | <dons> | though not the ones with [Rev] or [Hon] first |
| 19:41:33 | <sioraiocht> | speaking of practical, anyone know ho to reduce a dislocated finger? |
| 19:41:36 | <ddarius> | nominolo: No, I don't think so. |
| 19:41:43 | <nominolo> | ddarius, see? :) |
| 19:41:45 | <Philippa> | he doesn't, but he started out when the field was rather younger |
| 19:41:47 | <Philippa> | that changes things |
| 19:41:52 | <dons> | sioraiocht: simmer gently for a couple of hours under a low flame? |
| 19:42:05 | <dons> | garnish with rosemary and pepper |
| 19:42:05 | <mdmkolbe> | nominolo: SPJ is so high up there, he's prefix-less |
| 19:42:17 | <chessguy> | hmm, dislocated finger, that sounds like a foldl' to me |
| 19:42:27 | <monochrom> | The process of getting a PhD includes allowing you to learn monads and call it "work". Contrast with: you have a real job doing something else, your monad learning has to be a weekend project at best. |
| 19:42:31 | <sioraiocht> | oh man, I'm never asking for random help here AGAIN =p |
| 19:42:33 | <glguy> | You'd think that the phd's would give him a dr. so that they could be in the same club as him ;) |
| 19:42:43 | <Tac-Tics> | monochrom: that is such a painful truth |
| 19:42:51 | <nominolo> | glguy, heh |
| 19:42:52 | <sioraiocht> | monochrom: but either way, you don't get paid for learning about i =p |
| 19:42:54 | <sioraiocht> | *it |
| 19:42:54 | <ddarius> | nominolo: Don't try to argue that point with me, I don't immediately have a high opinion of PhDs simply because they have PhDs. |
| 19:42:56 | <dons> | glguy: all ready for the big game? :) |
| 19:43:04 | <glguy> | dons, I suppose :) |
| 19:43:14 | <dons> | glguy: i picked up some sambas, and some shin pads for suzie. so we're set. |
| 19:43:14 | <monochrom> | Actually, there are ways you get paid for doing PhD. |
| 19:43:17 | <chessguy> | what big game? |
| 19:43:18 | <mdmkolbe> | game? |
| 19:43:20 | <dons> | we've been running drills up and down the hallway |
| 19:43:33 | <nominolo> | for me 3 more unpaid or 5 more half-payed years don't sound too rewarding |
| 19:43:35 | <dons> | galois v someone in soccer :) |
| 19:43:40 | <glguy> | Wow, you guys will probably be the stars of the game with that kind of regimine |
| 19:43:57 | <glguy> | I never know how to spell that last word |
| 19:44:00 | <sioraiocht> | ddarius: however, you shouldn't have a low opinion of someone for having one either? =p |
| 19:44:08 | <xerox> | ?spell regimine |
| 19:44:09 | <chessguy> | @spell regimine |
| 19:44:09 | <dons> | ?spell regime |
| 19:44:16 | <xerox> | haha. |
| 19:44:19 | <dons> | ah, no aspell |
| 19:44:20 | <nominolo> | regimen |
| 19:44:22 | <chessguy> | @quote stereo |
| 19:44:22 | <lambdabot> | No quotes match. Have you considered trying to match wits with a rutabaga? |
| 19:44:27 | <chessguy> | what?? |
| 19:44:34 | <dons> | hmm |
| 19:44:37 | <dons> | ?qyote |
| 19:44:37 | <lambdabot> | mudge says: I like big butts and can not lie |
| 19:44:41 | <glguy> | ah |
| 19:44:41 | <dons> | that's new. |
| 19:44:42 | <glguy> | regimen |
| 19:44:45 | <dons> | ?quote dons |
| 19:44:45 | <lambdabot> | dons says: "academic" is such an amusing insult. |
| 19:44:48 | <dons> | that's old |
| 19:44:51 | <dons> | ?quote stereo |
| 19:44:51 | <lambdabot> | No quotes match. Your mind just hasn't been the same since the electro-shock, has it? |
| 19:44:54 | <dons> | ?Quote Cale |
| 19:44:55 | <lambdabot> | Cale says: What we need are monad tutorial transformers. // So that we can compose the features of monad tutorials |
| 19:44:55 | <norgul> | folks |
| 19:44:59 | <nominolo> | http://www.m-w.com/dictionary/regimen |
| 19:45:03 | <lambdabot> | Title: Definition of regimen - Merriam-Webster Online Dictionary |
| 19:45:11 | <norgul> | my friends pasted his version of pascal's triangle |
| 19:45:12 | <norgul> | http://paste.lisp.org/display/47488 |
| 19:45:25 | <norgul> | rad means row and kol is col |
| 19:45:56 | <norgul> | and a haskell version :S |
| 19:46:00 | <sorear> | dons: no |
| 19:46:06 | <sorear> | dons: and San Diego :/ |
| 19:46:06 | <ddarius> | sioraiocht: I didn't say that. |
| 19:46:25 | <sioraiocht> | ddarius: oh, I wasn't trying to imply that you did, heh |
| 19:46:38 | <hpaste> | mdmkolbe pasted "Try using guards like this" at http://hpaste.org/2649 |
| 19:46:40 | <ddarius> | Essentially, I could care less what your education is, I'll judge based on what you write/say. |
| 19:46:54 | <mdmkolbe> | norgul: http://hpaste.org/2649 |
| 19:46:55 | <chessguy> | hmm. shame you can't do pascal rad rad = ...; pascal rad kol = ... |
| 19:47:02 | <monochrom> | pascal 0 0 = 1 change this to pascal 0 kol = 1 |
| 19:47:06 | <dons> | sorear: ah! oops |
| 19:47:39 | <byorgey> | norgul: hmm, doesn't that have exponential complexity? |
| 19:47:52 | <glguy> | I can't imagine why my puppy doesn't like beef flavored toothpaste |
| 19:47:52 | <monochrom> | I think it's intended. |
| 19:48:00 | <glguy> | I mean... I enjoy using it every day |
| 19:48:14 | <chessguy> | uh...pascal _ 0 = 1 you mean? |
| 19:48:23 | <byorgey> | yeah, it's not necessarily important, just pointing it out =) |
| 19:48:31 | <sclv> | hmm... wouldn't some memoization speed things up? |
| 19:48:33 | <chessguy> | instead of the first 2 lines |
| 19:48:39 | <dons> | btw, you know what's so great about working at galois? i get to sit next to the guy who wrote mtl, the guy who wrote monadLib, the guy who wrote halfs and some guy who wrote hpaste.org :) |
| 19:48:50 | <chessguy> | @bot |
| 19:48:51 | <lambdabot> | :) |
| 19:48:51 | <mdmkolbe> | sclv: using a different equation (see Wikipedia) would speed things up |
| 19:48:57 | <dons> | glguy: don't you think with that team we should be able to churn out some code? |
| 19:48:58 | <glguy> | ACTION was wondering how he was going to fit into that :) |
| 19:49:09 | <glguy> | dons, I'm counting on it |
| 19:49:11 | <ndm> | dons: i get to have a similar number of projects from sitting at York |
| 19:49:22 | <dons> | ndm, yeah, york is similarly dense |
| 19:49:36 | <ndm> | despite having only 5 functional programmers... |
| 19:49:39 | <sorear> | dons: what about the guy who made bytestrings practical? :D |
| 19:49:48 | <dons> | duncan? |
| 19:49:48 | <mdmkolbe> | sclv: that code is O(2^n). With memoization it's O(n^2). With a smarter equation it's O(n) where n is the magnitude of the inputs |
| 19:49:49 | <dons> | :) |
| 19:49:51 | <ndm> | sorear: he sits on that guy's chair :) |
| 19:50:12 | <glguy> | dons, the biggest thing that I know Isaac wrote was the apt-secure program |
| 19:50:27 | <dons> | and cabal. :) |
| 19:50:29 | <glguy> | I know he's been involved in other stuff, but that's the one I use daily |
| 19:50:30 | <glguy> | yeah, that! |
| 19:50:32 | <glguy> | :) |
| 19:50:33 | <sclv> | right -- but it would at least beat his friends. |
| 19:51:04 | <dons> | glguy: we need a galois open source page, listing all the projects maintained by galois people |
| 19:51:15 | <Trixsey> | Is there a function to split a list, or anything similar? |
| 19:51:20 | <glguy> | dons, Mention that interest to Andy Gill |
| 19:51:21 | <Trixsey> | Like split at all spaces |
| 19:51:23 | <ndm> | dons: sounds like a hackage query |
| 19:51:30 | <dons> | glguy: i might just do it anyway. |
| 19:51:35 | <dons> | ndm: yeah, good idea. |
| 19:51:37 | <monochrom> | > words "skjdkfj sjkdjk kdjk djkf" |
| 19:51:37 | <allbery_b> | > words "fee fi fo fum" |
| 19:51:42 | <ddarius> | dons: You are uncertain that the Haskell community recognizes the contributions of Galois? |
| 19:51:42 | <ndm> | dons: i.e. having a static page just waiting to go out of date seems like a bad idea, when all the meta information is already stored |
| 19:51:44 | <dons> | ndm, btw, did you send in your tshirt size? |
| 19:51:49 | <lambdabot> | ["fee","fi","fo","fum"] |
| 19:51:49 | <lambdabot> | ["skjdkfj","sjkdjk","kdjk","djkf"] |
| 19:51:50 | <allbery_b> | botverload! |
| 19:51:53 | <glguy> | dons, I just said Andy because he's one for pushing code out the door |
| 19:51:58 | <ndm> | dons: i can't make it to the hackathon - hotels and flights didn't work out :( |
| 19:52:04 | <allbery_b> | @src words |
| 19:52:04 | <lambdabot> | words s = case dropWhile isSpace s of |
| 19:52:04 | <lambdabot> | "" -> [] |
| 19:52:04 | <lambdabot> | s' -> w : words s'' where (w, s'') = break isSpace s' |
| 19:52:16 | <ndm> | dons: i'd still love a t-shirt, if thats possible :) |
| 19:52:18 | <norgul> | byorgey, not my code, my friend pasted his haskell version too |
| 19:52:19 | <dons> | ndm: oh! do let us know then, i think you're still on the list :( |
| 19:52:22 | <monochrom> | "words" is specific for spaces. But you should steal its source code and adopt it for other purposes. |
| 19:52:27 | <dons> | ndm: yeah, probably we can get some extras |
| 19:52:38 | <dons> | ndm, at least cross your name off the attendees list on the wiki please |
| 19:52:39 | <chessguy> | @type break |
| 19:52:41 | <lambdabot> | forall a. (a -> Bool) -> [a] -> ([a], [a]) |
| 19:52:47 | <ndm> | dons: i only got flights and tickets late last week, we left it too late :( |
| 19:52:52 | <dons> | :( |
| 19:53:10 | <chessguy> | @hoogle (a -> Bool) -> [a] -> [[a]] |
| 19:53:11 | <lambdabot> | No matches, try a more general search |
| 19:53:16 | <ndm> | we're 7km away from frieburg for IFL |
| 19:53:28 | <dons> | isn't IFL and the hackathon at the same location? |
| 19:53:41 | <Heffalump> | 7km?? I thought it was (a slightly long) walking distance. |
| 19:53:53 | <ddarius> | That's walking distance... |
| 19:53:59 | <sorear> | ndm: 12:52 < allbery_b> @src words |
| 19:54:07 | <dons> | it's a 30 minute walk or something. |
| 19:54:10 | <ndm> | dons: yes, but we're 7km away from IFL, miles out |
| 19:54:14 | <Heffalump> | only if you have a lot of spare time. And it's not a 30 minute walk. |
| 19:54:17 | <ndm> | dons: no, thats an hour at least |
| 19:54:20 | <Heffalump> | ah, right. |
| 19:54:34 | <ndm> | sorear: i saw, was just thinking whether to jump in or not :)( |
| 19:54:53 | <ddarius> | > 7 * 0.6 |
| 19:54:53 | <ndm> | allbery_b: the definition of words isn't very good, if you want to use it, you should use a revised copy of words to start from |
| 19:54:54 | <lambdabot> | 4.2 |
| 19:55:12 | <ndm> | allbery_b: http://www-users.cs.york.ac.uk/~ndm/temp/draft-supero.pdf - there is a new copy of words in that paper |
| 19:55:20 | <allbery_b> | I wasn't planning anything, was just wondering in light of Trixsey's query |
| 19:55:22 | <sorear> | @activity-full 300 |
| 19:55:22 | <lambdabot> | 10*total 8*#haskell 2*#scannedinavian |
| 19:55:26 | <chessguy> | i wondered if you were going to comment on that, ndm |
| 19:55:37 | <LoganCapaldo> | @let word = head . words |
| 19:55:39 | <lambdabot> | Defined. |
| 19:55:52 | <LoganCapaldo> | > word "to your mother" |
| 19:55:54 | <lambdabot> | "to" |
| 19:55:58 | <ndm> | i was looking at enhancing my supercompiler with CSE, then i might be able to change it automatically |
| 19:56:11 | <ndm> | then leaving words as it is hinders GHC massively and makes no difference to me :) |
| 19:56:43 | <allbery_b> | (I was actually rather surprised by the definition) |
| 19:56:55 | <LoganCapaldo> | @type words |
| 19:56:55 | <ndm> | its pretty close, only a few tweaks and its efficient |
| 19:56:57 | <lambdabot> | String -> [String] |
| 19:57:07 | <norpan> | word! |
| 19:57:09 | <ndm> | it does two redundant isSpace tests per word |
| 19:57:38 | <ndm> | if someone wants to prove that my implementation is correct, we can fix up the one in the Prelude |
| 19:57:53 | <ndm> | or at least wants to test it using strictness etc stuff |
| 19:58:00 | <LoganCapaldo> | @let word = fst . break isSpace |
| 19:58:01 | <lambdabot> | <local>:6:0: Multiple declarations of `L.word' Declared at: <local>:5... |
| 19:58:01 | <sclv> | @type splitWith |
| 19:58:03 | <lambdabot> | Not in scope: `splitWith' |
| 19:58:06 | <LoganCapaldo> | @let word' = fst . break isSpace |
| 19:58:08 | <lambdabot> | Defined. |
| 19:58:17 | <LoganCapaldo> | word' "to your mother" |
| 19:58:21 | <LoganCapaldo> | > word' "to your mother" |
| 19:58:22 | <lambdabot> | "to" |
| 19:58:34 | <ndm> | > word' " neil is here" |
| 19:58:35 | <lambdabot> | "" |
| 19:58:36 | <ndm> | > word " neil is here" |
| 19:58:38 | <lambdabot> | "neil" |
| 19:58:49 | <allbery_b> | @check \x -> word x == word' x |
| 19:58:50 | <lambdabot> | Exception: Prelude.head: empty list |
| 19:58:51 | <LoganCapaldo> | Nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo |
| 19:59:33 | <oerjan> | oh, @check reads @let definitions? |
| 19:59:34 | <sclv> | @type splitWithPS |
| 19:59:36 | <lambdabot> | Not in scope: `splitWithPS' |
| 20:00:01 | <oerjan> | sclv: there is no generalized words available |
| 20:00:07 | <allbery_b> | @check \x -> not (null x) ==> word x == word' x |
| 20:00:08 | <lambdabot> | OK, passed 500 tests. |
| 20:00:32 | <allbery_b> | ACTION had to test it, still unfamiliar with @check syntax |
| 20:00:54 | <sclv> | oerjan: yeah those are for bytestring and packedstring types -- just wanted to put them on the channel but don't know lambdabot v. well yet |
| 20:02:02 | <balodja> | data Tree a = Branch (Tree a) (Tree a) | Leaf a |
| 20:02:19 | <balodja> | Why is it always called Tree? |
| 20:02:30 | <balodja> | That's rather List, I think. |
| 20:02:31 | <fakeolliej2> | balodja: because it's a binary tree... |
| 20:02:40 | <sclv> | because one and troo were taken? |
| 20:03:08 | <mdmkolbe> | balodja: data List a = Null | Cons a (List a) -- list != tree |
| 20:03:09 | <balodja> | data Tree a = Branch a (Tree a) (Tree a) | Leaf -- that's binary tree |
| 20:03:19 | <fakeolliej2> | no |
| 20:03:27 | <fakeolliej2> | balodja: where would you store data? |
| 20:03:35 | <fakeolliej2> | balodja: oh |
| 20:03:37 | <twanvl> | Both are binary trees |
| 20:03:43 | <fakeolliej2> | balodja: you have leaf nodes with no content |
| 20:03:49 | <byorgey> | balodja: Branch (Tree a) (Tree a) | Leaf a is still a binary tree, it's just that there's only data at the leaves |
| 20:03:56 | <mdmkolbe> | balodja: some binary trees have data on leaves, some on branches, some on both with different types of data |
| 20:04:33 | <LoganCapaldo> | Do any have no data on branches or leaves? :) |
| 20:04:35 | <byorgey> | balodja: the important point is that there are two instances of "Tree a" in a "Branch", so it has a binary branching structure |
| 20:04:37 | <balodja> | ok, no more questions. |
| 20:04:38 | <oerjan> | data Tree a b = Branch a (Tree a b) (Tree a b) | Leaf b |
| 20:04:42 | <mdmkolbe> | LoganCapaldo: yes |
| 20:04:44 | <byorgey> | LoganCapaldo: sure =) |
| 20:05:00 | <byorgey> | data Tree = Branch Tree Tree | Leaf |
| 20:05:22 | <LoganCapaldo> | mdmkolbe, byorgey any interesting use cases for that? |
| 20:05:25 | <paolino> | applied biology |
| 20:05:37 | <balodja> | oerjan: that seems to be useful for expressions :) a is an operator and b is an operand |
| 20:05:50 | <ddarius> | There are approaches that separate the shape of the data from its contents. |
| 20:05:51 | <byorgey> | LoganCapaldo: well, if you're only interested in the *structure* of a tree |
| 20:06:32 | <mdmkolbe> | LoganCapaldo: encoding a binary tree that *has* data by spliting it into a tree without data and a list of the data. (DEFLATE does something that is *almost* like that but not quite) |
| 20:06:49 | <mdmkolbe> | (DEFLATE == the compression algorithm in gzip) |
| 20:06:59 | <LoganCapaldo> | mdmkolbe, I can see that |
| 20:07:05 | <balodja> | data Tree = Branch Tree Tree | Leaf -- hm-m-m. useful for representation of "kind" in haskell, yeah? :) |
| 20:07:26 | <mdmkolbe> | balodja: except that we have both * and ? now |
| 20:07:45 | <byorgey> | mdmkolbe: hmm, what's ? |
| 20:07:48 | <ddarius> | and ?? |
| 20:07:54 | <oerjan> | :k (->) |
| 20:07:55 | <mdmkolbe> | balodja: IIRC, * is boxed, ? is unboxed |
| 20:08:03 | <lambdabot> | ?? -> ? -> * |
| 20:08:07 | <allbery_b> | thought # was unboxed |
| 20:08:18 | <ddarius> | My kind type in my lollimon vapourware interpreter is isomorphic to that tree type. |
| 20:08:35 | <ddarius> | :k (#,#0 |
| 20:08:37 | <lambdabot> | parse error on input `,' |
| 20:08:39 | <ddarius> | :k (#,#) |
| 20:08:40 | <lambdabot> | parse error on input `,' |
| 20:08:41 | <dons> | bbl |
| 20:08:45 | <mdmkolbe> | :k Int# |
| 20:08:46 | <lambdabot> | Not in scope: type constructor or class `Int#' |
| 20:08:55 | <allbery_b> | :k GHC.Prim.Int# |
| 20:08:57 | <lambdabot> | # |
| 20:09:06 | <ddarius> | A whole menagerie of kinds. |
| 20:09:14 | <mdmkolbe> | hmm, then I have no idea what ? is |
| 20:09:25 | <ddarius> | It can be either # or * |
| 20:09:26 | <oerjan> | i think ? is supertype of * and # |
| 20:09:48 | <oerjan> | and ?? is supertype of that and unboxed tuples |
| 20:09:51 | <balodja> | What does ?? stand for? |
| 20:10:08 | <oerjan> | or is that the other way around |
| 20:10:10 | <LoganCapaldo> | Dragons, probably |
| 20:10:12 | <allbery_b> | :k (# #,# #) |
| 20:10:14 | <lambdabot> | parse error on input `#' |
| 20:10:24 | <oerjan> | ? is the largest supertype |
| 20:10:26 | <mdmkolbe> | oerjan: at this point don't we need to add var names? (e.g. ?a -> ?a -> ?b -> ?b -> #) |
| 20:10:29 | <oerjan> | :k (->) |
| 20:10:31 | <lambdabot> | ?? -> ? -> * |
| 20:10:42 | <allbery_b> | :k (# *,* #) |
| 20:10:44 | <lambdabot> | parse error on input `*' |
| 20:10:48 | <ddarius> | mdmkolbe: no |
| 20:11:02 | <ddarius> | :k (# Int#, Int# #) |
| 20:11:04 | <lambdabot> | Not in scope: type constructor or class `Int#' |
| 20:11:04 | <lambdabot> | |
| 20:11:04 | <lambdabot> | <interactive>:1:9: Not in scope: type constructor or class `Int#' |
| 20:11:05 | <oerjan> | the right argument of -> may be an unboxed tuple but not the left one |
| 20:11:11 | <LoganCapaldo> | :k (#,#) |
| 20:11:13 | <lambdabot> | parse error on input `,' |
| 20:11:21 | <ddarius> | :k (# GHC.Prim.Int#, GHC.Prim.Int# #) |
| 20:11:23 | <lambdabot> | (#) |
| 20:11:30 | <LoganCapaldo> | hoooooooray |
| 20:12:01 | <allbery_b> | ah, so there's the other magic kind |
| 20:12:05 | <oerjan> | (because unboxed tuples may only be returned, not passed into a function) |
| 20:12:15 | <mdmkolbe> | oerjan: so ? is a super of ?? |
| 20:12:18 | <mdmkolbe> | ? |
| 20:12:22 | <oerjan> | yes |
| 20:12:23 | <allbery_b> | heh |
| 20:12:32 | <LoganCapaldo> | The riddler has invaded #haskell |
| 20:12:51 | <oerjan> | there's a diagram in the ghc docs last i looked |
| 20:13:00 | <oerjan> | but it leaves out the mysterious ! |
| 20:13:02 | <allbery_b> | The riddler has always been here |
| 20:13:20 | <allbery_b> | ( </kosh> ) |
| 20:13:22 | <mdmkolbe> | Sooo...how long untill we just give up and support the entire hierarchy like Clean does? |
| 20:13:45 | <mdmkolbe> | oerjan: there's a '!' ?! |
| 20:14:08 | <elliottt> | what's the easiest way to turn a literate file into a non-literate one? (i'd like to preserve the text as comments) |
| 20:14:09 | <oerjan> | yes, apparently, though no one has been able to tell me what it is |
| 20:14:28 | <opqdonut> | mdmkolbe: what kind of hierarchy does clean have then? |
| 20:14:34 | <byorgey> | elliottt: I think there's an option you can give to lhs2tex to strip out all the literate stuff |
| 20:14:35 | <allbery_b> | if not for your parenthetical I'd suggest unlit |
| 20:14:44 | <elliottt> | byorgey: thanks :) |
| 20:14:46 | <allbery_b> | (in the ghc lib directory) |
| 20:14:52 | <byorgey> | elliottt: oh, wait, I didn't see your parenthetical... |
| 20:15:22 | <elliottt> | hrm, maybe i can write some crafty ruby script :) |
| 20:15:27 | <mdmkolbe> | opqdonut: just as kinds are the 'types of types', you can have 'types of kinds' and 'type of types of kind', etc. |
| 20:15:30 | <elliottt> | or actually, haskell might be easier at this point |
| 20:15:36 | <byorgey> | elliottt: shouldn't bee too hard to write a Haskell program to do it... delete every > at the start of a line, and add a -- at the start of all others |
| 20:15:56 | <opqdonut> | mdmkolbe: ah |
| 20:16:18 | <opqdonut> | what are all these good for? |
| 20:16:30 | <elliottt> | byorgey: yeah, that seems best. thanks :) |
| 20:16:35 | <byorgey> | unlines . map unlit . lines, where lit ('>':rest) = rest; lit xs = "-- " ++ xs |
| 20:16:48 | <byorgey> | uh, s/lit/unlit/ |
| 20:16:52 | <mdmkolbe> | opqdonut: I don't know. I've never actually used Clean. |
| 20:17:02 | <oerjan> | byorgey: i think you want '>':' ': |
| 20:17:09 | <byorgey> | oerjan: yeah, you're right |
| 20:17:46 | <oerjan> | hm, what about tabs? |
| 20:17:58 | <allbery_b> | tabs are evil |
| 20:17:58 | <byorgey> | oerjan: bah humbug |
| 20:18:15 | <oerjan> | i mean, are they allowed after >? |
| 20:18:35 | <byorgey> | oerjan: I have no idea |
| 20:18:43 | <oerjan> | ACTION checks |
| 20:19:06 | <allbery_b> | ACTION would also pass empty lines unchanged, just as a matter fo eprsonal preference |
| 20:19:14 | <allbery_b> | ...pretend I can type |
| 20:19:36 | <byorgey> | allbery_b: yeah, I would too, I was just suggesting a basic starting place |
| 20:20:06 | <oerjan> | oh, i was wrong about space after >, it is not significant |
| 20:20:11 | <allbery_b> | of course it's easy enough to add that pattern if you ignore lines containing whitespace |
| 20:20:22 | <byorgey> | oerjan: only with lambdabot, eh? =) |
| 20:20:28 | <allbery_b> | lit [] = [] |
| 20:21:00 | <oerjan> | "replacing the leading ">" with a space" |
| 20:21:14 | <mdmkolbe> | is there a varient of literate programming that is literate *and* test driven (i.e. the program is the documentation is the test suite) |
| 20:21:59 | <oerjan> | (presumably to keep alignment if there is an evil mix of tabs and spaces) |
| 20:23:45 | <ddarius> | mdmkolbe: Use quickcheck |
| 20:27:14 | <Cale> | mdmkolbe: Nope. It just can't be done. ;) |
| 20:27:41 | <mdmkolbe> | I only ask b/c I had to write my own a little while ago. |
| 20:28:19 | <Cale> | mdmkolbe: I suspect that quickcheck would work well with such an idiom. |
| 20:28:46 | <allbery_b> | yeh, I was just thinking quickcheck with lines prefixed by, say, ? |
| 20:28:55 | <mdmkolbe> | It was a tutorial text with a lot of "if you do this, you'll get this" examples. Writing a perl script to extract those examples and test that the results were correct found a few bugs. (This was in scheme.) |
| 20:29:00 | <allbery_b> | (and easy enough to wrap unlit for normal compiles) |
| 20:30:10 | <sorear> | why do we need tests when we can just prove our programs correct? |
| 20:30:47 | <Cale> | sorear: Sometimes the proof is wrong for some unforeseen technicality? |
| 20:31:09 | <Cale> | (For example, correct programs can still be impractical) |
| 20:31:22 | <mdmkolbe> | sorear: then we need to debug the equation that we are proving to be true |
| 20:31:30 | <sorear> | Do test suites test practicality? |
| 20:31:58 | <Cale> | Yeah, because you actually run them. If the tests take forever to run or too much memory, then you realise there's a problem. |
| 20:32:12 | <mdmkolbe> | e.g. is "foo x = not x" correct? or is that a bug that should be "foo x = x"? |
| 20:41:04 | <sioraiocht> | if you are creating a type class, do you HAVE to specify what the necessary minimal definitions are, or does haskell just "know" |
| 20:41:36 | <mdmkolbe> | sioraiocht: I think Haskell will jsut know |
| 20:41:59 | <sioraiocht> | I thought so, or at lesat just errors if you attempt to call certain functions without an acceptable definition |
| 20:42:47 | <allbery_b> | I *think* it doen't check unless it sees a call to an unimplemented method |
| 20:42:51 | <mdmkolbe> | sioraiocht: for example "class Eq a where a == b = not (a /= b); a /= b = not (a == b)". At least one of those has to be defined but it doesn't matter which one (not sure if that error is checked). |
| 20:43:14 | <sioraiocht> | okay, that's what I thought, just making sure I wasn't missing something |
| 20:43:39 | <oerjan> | it might be able to do more with strictness analysis |
| 20:46:21 | <sioraiocht> | hrm, let's find out.. |
| 20:47:29 | <chessguy> | mdmkolbe, what do you mean, "checked"? |
| 20:47:52 | <mdmkolbe> | chessguy: it might just go into an infinite loop at run time |
| 20:48:01 | <allbery_b> | that you didn't define either of those methods, which if taken literally are mutually recursive |
| 20:48:08 | <allbery_b> | with no end condition |
| 20:48:13 | <chessguy> | ah, i see |
| 20:48:30 | <chessguy> | i guess i assumed that was checked, but it's not written like it |
| 20:48:36 | <elliottt> | if i have a library that parses a text protocol, but doesn't do any network interaction, does it make sense to put it in Network? |
| 20:48:37 | <sioraiocht> | chessguy: it's not |
| 20:48:40 | <sioraiocht> | I just tested |
| 20:48:40 | <chessguy> | @src Eq |
| 20:48:41 | <lambdabot> | class Eq a where |
| 20:48:41 | <lambdabot> | (==), (/=) :: a -> a -> Bool |
| 20:48:45 | <sioraiocht> | you end up with a stack overflow |
| 20:48:52 | <allbery_b> | cute |
| 20:48:56 | <allbery_b> | @bug -- ? |
| 20:48:57 | <lambdabot> | http://hackage.haskell.org/trac/ghc/newticket?type=bug |
| 20:48:58 | <chessguy> | well, but how do you instantiate Eq without defining either? |
| 20:49:45 | <sioraiocht> | chessguy: well in that case you only need one of two to make a definition, but I just tried ti with Foldable, defining a function that doesn't meet the minimal def |
| 20:49:47 | <sioraiocht> | stack overflow |
| 20:50:02 | <balodja> | > [1,1..] !! 200 |
| 20:50:06 | <lambdabot> | 1 |
| 20:50:22 | <balodja> | does is calculate 199 ones? |
| 20:50:24 | <chessguy> | oh, you tested a different class |
| 20:50:31 | <chessguy> | @src Foldable |
| 20:50:32 | <lambdabot> | Source not found. Where did you learn to type? |
| 20:50:35 | <allbery_b> | balodja: shouldn't |
| 20:50:39 | <sioraiocht> | @src Data.Foldable |
| 20:50:39 | <lambdabot> | Source not found. Where did you learn to type? |
| 20:50:43 | <allbery_b> | it reifies the list but it's all thunks |
| 20:51:06 | <sioraiocht> | allbery_b: so it still allocates the memory, then |
| 20:51:07 | <sioraiocht> | heh |
| 20:51:19 | <allbery_b> | some of the memory |
| 20:51:51 | <balodja> | > [1,1..] !! 200000 |
| 20:51:53 | <lambdabot> | 1 |
| 20:51:58 | <sioraiocht> | chessguy: I tested Eq too |
| 20:52:08 | <sioraiocht> | by doing "instance Eq (Tree a) where" |
| 20:52:12 | <sioraiocht> | without any definitions |
| 20:52:18 | <chessguy> | heh. nice |
| 20:52:23 | <sioraiocht> | and it let me compare them, but I got a stack overflow |
| 20:52:50 | <chessguy> | surely that should never be allowed, to declare an instance without a definition |
| 20:53:05 | <sioraiocht> | chessguy: what if you have a class that needs no minimal defs? |
| 20:53:08 | <sioraiocht> | oops, dinner time |
| 20:53:44 | <chessguy> | hm |
| 20:54:25 | <chessguy> | i'm not sure what that would look like |
| 20:54:30 | <ddarius> | chessguy: I often do that. |
| 20:54:42 | <chessguy> | ddarius, for what class? |
| 20:55:26 | <|Jedai|> | allbery_b: It allocate the memory okay, but in fact it throw it away as soon as it processed the thunk, so it's in constant memory |
| 20:55:30 | <mdmkolbe> | chessguy: actually it is possible to declare in instance without a def |
| 20:55:45 | <ddarius> | chessguy: 1) Any class that I can't implement 2) any class with no methods 3) any class that already has suitable defaults |
| 20:56:26 | <chessguy> | err, if you can't implement it, why are you creating an instance of it? |
| 20:56:30 | <mdmkolbe> | chessguy: it's used when you want to flag certain types as belonging to a class without needing not know anything about that class (e.g. classes that an alternative algorithm should be used for) |
| 20:57:13 | <ddarius> | chessguy: Because it may be required to use other classes or functions. |
| 20:57:39 | <ddarius> | E.g. I may want Num b => Num (a -> b) but I can't implement Eq or Ord, and barely Show. |
| 20:57:56 | <chessguy> | but if it's required, surely a definition would be required too |
| 20:58:02 | <ddarius> | Nope. |
| 20:58:04 | <chessguy> | otherwise the requirement shouldn't be there |
| 20:58:18 | <ddarius> | Perhaps, but Haskell has legacy too. |
| 21:00:07 | <newsham> | http://www.thenewsh.com/%7Enewsham/formal/parse/parser.lhs |
| 21:00:29 | <newsham> | anyone wanna read a small parser tutorial and give feedback? |
| 21:00:50 | <ddarius> | Can I read it without giving you feedback or give you feedback without reading it? |
| 21:01:01 | <newsham> | you are free to do as we tell you, ddarius |
| 21:01:42 | <mdmkolbe> | newsham: what parsing technique do you use? Parsec? CYK? LALR? GLR? Early? Pack-rat? |
| 21:01:51 | <newsham> | its basically about parsec |
| 21:01:56 | <chessguy> | newsham, i'm already reading it :) |
| 21:02:20 | <newsham> | target audience is beginners, btw. |
| 21:02:35 | <ddarius> | Another upside is that it's easier to implement backtracking. |
| 21:02:49 | <newsham> | advantage to being a monad? |
| 21:03:08 | <chessguy> | "Each instance of Parser a will contain a parsing function." ...slightly more accurate, and maybe slightly less confusing would be: "Each value of type Parser a will be a parsing function" |
| 21:03:12 | <mrd> | speaking of which, ParsecT [] |
| 21:03:26 | <newsham> | chess: danke |
| 21:03:37 | <mrd> | non-det parsing? |
| 21:03:37 | <mdmkolbe> | I thought parsec had moved to arrows b/c of space leaks |
| 21:04:16 | <chessguy> | @pl r (P p) i = p i |
| 21:04:16 | <lambdabot> | (line 1, column 11): |
| 21:04:16 | <lambdabot> | unexpected "=" |
| 21:04:16 | <lambdabot> | expecting variable, "(", operator or end of input |
| 21:04:48 | <allbery_b> | can't unpl pattern matches |
| 21:04:53 | <allbery_b> | er, @pl |
| 21:04:57 | <chessguy> | oh, right |
| 21:05:17 | <EvilTerran> | @pl r (Maybe p) i = p i |
| 21:05:17 | <lambdabot> | (line 1, column 15): |
| 21:05:17 | <lambdabot> | unexpected "=" |
| 21:05:17 | <lambdabot> | expecting variable, "(", operator or end of input |
| 21:05:35 | <monochrom> | yeah, "instance" has another meaning around here |
| 21:06:09 | <newsham> | instance means instance :) wehter its an instance of a type or an instance of a type class :) |
| 21:06:16 | <oerjan> | @pl r (Just p) i = p i |
| 21:06:17 | <lambdabot> | (line 1, column 14): |
| 21:06:17 | <lambdabot> | unexpected "=" |
| 21:06:17 | <lambdabot> | expecting variable, "(", operator or end of input |
| 21:06:20 | <newsham> | but I like chess' wording better |
| 21:07:16 | <mdmkolbe> | newsham: when teaching, each jargon word should have only one meaning and should only be used to mean that |
| 21:07:53 | <newsham> | mdm: *nod* I would tend to agree. |
| 21:07:56 | <chessguy> | newsham, i think there's an issue with the way you switch to "data Parser a = ..." |
| 21:08:11 | <chessguy> | well, for one thing, there's a typo in "> parse Int "123 abc" == Just (" abc", 123)" |
| 21:08:40 | <chessguy> | but you can't assume a beginner will understand parameterized data types |
| 21:08:44 | <newsham> | *nod* I forgot to go back and recheck the examples |
| 21:09:20 | <chessguy> | you sort of explained it with Maybe, but should probably hit that a little harder |
| 21:09:27 | <newsham> | chess: think adding a single example will clarify? ie Parser Char means .... |
| 21:09:40 | <mrd> | byorgey: where can I find one of these "Haskars" on sale? =) |
| 21:09:41 | <mdmkolbe> | newsham: if you know perl, I'd recomend writting a perl script to extract the examples and check that they product the correct output (I've done in for some of my documents and it helps quite a bit.) |
| 21:10:03 | <newsham> | thats a job for awk or sed ;-) |
| 21:10:07 | <oerjan> | @quote haskar |
| 21:10:07 | <lambdabot> | No quotes match. I feel much better now. |
| 21:10:19 | <chessguy> | yeah, maybe say something like "'a' here again means any type. For example, Parser Char means..." |
| 21:10:22 | <EvilTerran> | or grep, if it's a LHS |
| 21:10:36 | <mudge> | can more than one bots be in the room? |
| 21:10:49 | <mdmkolbe> | newsham: fair enough. I just made it a point to never learn awk or sed b/c why learn 2/3 langs when I only need one ;-) |
| 21:11:28 | <chessguy> | newsham, oh, and you probably want to point out that type String = [Char] somewhere |
| 21:13:40 | <chessguy> | @type onlyCh ch (ch:chs) = Just (chs, ch); onlyCh ch _ = Nothing |
| 21:13:42 | <lambdabot> | parse error on input `=' |
| 21:13:54 | <chessguy> | @let onlyCh ch (ch:chs) = Just (chs, ch); onlyCh ch _ = Nothing |
| 21:13:54 | <lambdabot> | <local>:7:7: Conflicting definitions for `ch' In the definition of `o... |
| 21:14:25 | <chessguy> | guess i can't do that |
| 21:15:02 | <chessguy> | @let onlyCh ch (ch':chs) | ch == ch' = Just (chs, ch); onlyCh ch _ = Nothing |
| 21:15:05 | <lambdabot> | Defined. |
| 21:15:08 | <chessguy> | @type onlyCh |
| 21:15:10 | <lambdabot> | Not in scope: `onlyCh' |
| 21:15:16 | <chessguy> | @type L.onlyCh |
| 21:15:17 | <lambdabot> | Couldn't find qualified module. |
| 21:15:35 | <chessguy> | onlyCh 'a' "aaa" |
| 21:15:40 | <chessguy> | > onlyCh 'a' "aaa" |
| 21:15:42 | <lambdabot> | Just ("aa",'a') |
| 21:19:05 | <oerjan> | > onlyCh |
| 21:19:08 | <lambdabot> | <Integer -> [Integer] -> Maybe ([Integer],Integer)> |
| 21:19:23 | <oerjan> | bah |
| 21:19:38 | <chessguy> | wtf |
| 21:19:41 | <sjanssen> | magical ghci-defaulting |
| 21:19:42 | <oerjan> | probably Eq a => a replaces Integer |
| 21:21:09 | <opqdonut> | :D |
| 21:21:33 | <EvilTerran> | ?type onlyCh |
| 21:21:35 | <lambdabot> | Not in scope: `onlyCh' |
| 21:21:42 | <EvilTerran> | > typeOf onlyCh |
| 21:21:44 | <lambdabot> | Integer -> [Integer] -> Maybe ([Integer],Integer) |
| 21:21:44 | <newsham> | onlyCh :: Parser Char |
| 21:21:59 | <newsham> | integer? |
| 21:22:05 | <EvilTerran> | oh, wait, Typeable doesn't do polymorphism |
| 21:22:35 | <EvilTerran> | > onlyCh :: Eq a => a -> [a] -> Maybe ([a],a) |
| 21:22:36 | <lambdabot> | <Integer -> [Integer] -> Maybe ([Integer],Integer)> |
| 21:22:57 | <mdmkolbe> | @hoogle Int -> Char |
| 21:22:58 | <lambdabot> | Char.chr :: Int -> Char |
| 21:22:58 | <lambdabot> | Char.intToDigit :: Int -> Char |
| 21:22:58 | <lambdabot> | Data.PackedString.indexPS :: PackedString -> Int -> Char |
| 21:24:07 | <mdmkolbe> | ACTION just wrote gunzip in Haskell |
| 21:24:39 | <chessguy> | mdmkolbe, what was it, about 8 lines of code? :) |
| 21:26:18 | <oerjan> | @remember chessguy [mdmkolbe just wrote gunzip in Haskell] mdmkolbe, what was it, about 8 lines of code? :) |
| 21:26:19 | <lambdabot> | Done. |
| 21:26:28 | <mdmkolbe> | chessguy: That was the hope, but (1) gzip is very ad-hoc and (2) deflate uses both LZW and huffman tree's so each of those algorithms take 8 lines plus 20 more for the monad that I wrote for this |
| 21:27:55 | <sjanssen> | mdmkolbe: 36 lines of code is nothing to be ashamed of ;) |
| 21:28:01 | <mdmkolbe> | maybe once I get more experience with writting these types of parsers/programs I'll find a good compact set of abstractions |
| 21:28:11 | <ddarius> | It sounds 34 lines too long to me... |
| 21:28:36 | <allbery_b> | @quote realized |
| 21:28:36 | <lambdabot> | glguy says: in true Haskell form, after I realized what I was actually doing... all my functions melted down to about 2 lines each |
| 21:28:47 | <mdmkolbe> | wc reports 395 lines total (but I still ahve to clean things up and 206 of those lines are due to GZip's ad-hoc-ness) |
| 21:28:51 | <chessguy> | mdmkolbe, it's certainly not anything to be ashamed of, i didn't mean to imply that |
| 21:31:34 | <ddarius> | newsham: parseAB' looks a little scary because of the way you laid it out. |
| 21:31:49 | <newsham> | chess: I addressed your comments, and put up diffs. |
| 21:31:52 | <newsham> | http://www.thenewsh.com/%7Enewsham/formal/parse/ |
| 21:31:54 | <lambdabot> | Title: Directory /~newsham/formal/parse/ |
| 21:32:10 | <newsham> | ddarius: lemme fix |
| 21:32:45 | <hpaste> | newsham pasted "parseAB' layout" at http://hpaste.org/2650 |
| 21:32:49 | <newsham> | is that preferred? |
| 21:33:15 | <monochrom> | I'm so behind Oleg. |
| 21:33:16 | <newsham> | (possibly lining up andThen's) |
| 21:34:15 | <ddarius> | newsham: I would drop the parens (like you do), and line up the parsers, the andThens and the \rs (the last should come automatically), but yes, like that. |
| 21:34:37 | <newsham> | I wanted to show it both with and without parens |
| 21:34:41 | <ddarius> | monochrom: Why do you say that now? |
| 21:34:46 | <ddarius> | newsham: That's fine. |
| 21:35:45 | <hpaste> | chessguy pasted "newsham, onlyCh can still be improved" at http://hpaste.org/2651 |
| 21:36:03 | <ddarius> | It should make it even clearer that do notation corresponds to the original code. |
| 21:36:22 | <dons> | http://programming.reddit.com/info/2nig9/details |
| 21:36:24 | <lambdabot> | Title: Destructive Quicksort in Haskell (reddit.com) |
| 21:36:37 | <newsham> | chessguy: thanks |
| 21:36:39 | <ddarius> | (Of course, then people might wonder why one should bother as do-notation saves almost nothing...) |
| 21:37:02 | <monochrom> | A few years ago I was contemplating "how to do incremental, undoable parsing in general, e.g. for code completion or hinting in an IDE". I never had time nor knowledge to deduce an answer. Just last night I realized delimited continuations can help (it's just like generic zipper). And surely, Oleg has done exactly that too. |
| 21:37:34 | <mrd> | newsham: very cool tutorial |
| 21:37:43 | <chessguy> | indeed. |
| 21:37:47 | <chessguy> | newsham++ |
| 21:37:55 | <monochrom> | Fortunately it seems his incremental parsing is just written up July this year. I'm catching up now, just two months behind :) |
| 21:38:26 | <dons> | hmm, `First get-together of the Portland Haskell Neophytes last night.' |
| 21:38:36 | <dons> | glguy: any idea what that is? http://gorthx.livejournal.com/150030.html |
| 21:38:37 | <lambdabot> | Title: gorthx: Don't Haskell my Hoff! |
| 21:38:37 | <newsham> | next i'm hoping to make some proofs about the parser. that should be challenging :\ |
| 21:38:41 | <chessguy> | dons, is that a reference to lennart's blog? |
| 21:38:48 | <ddarius> | dons: This is similar to my semi-direct translation on the wiki http://www.haskell.org/haskellwiki/Introduction/Direct_Translation |
| 21:38:50 | <lambdabot> | Title: Introduction/Direct Translation - HaskellWiki, http://tinyurl.com/ytokyh |
| 21:39:01 | <monochrom> | If I learned delimited continuations three years ago, the history of computing would be rewritten. :) |
| 21:39:08 | <dons> | chessguy: yeah |
| 21:39:14 | <dons> | ddarius: ah yes. |
| 21:39:18 | <dons> | much as I'd do it too |
| 21:39:19 | <glguy> | dons, apparently there is a Portland Haskell user group already? |
| 21:39:23 | <chessguy> | i did think that was rather a strange little series... |
| 21:39:31 | <mdmkolbe> | monochrom: how is that? |
| 21:39:32 | <dons> | glguy: well, a newbie club? |
| 21:39:55 | <glguy> | dons, apparently, but I imagine that it is only a newbie club because they don't have any oldbies |
| 21:39:57 | <monochrom> | I might be able to get ahead of Oleg for once :) |
| 21:40:25 | <dons> | glguy: i think we should ponder a proper user group. |
| 21:40:27 | <dons> | one with pizza |
| 21:40:32 | <newsham> | mrd: thank you. hope the people I wrote it for can grok it. |
| 21:40:41 | <wli> | I'll show up once I find this earring. |
| 21:40:43 | <chessguy> | i like dons' definition of a proper user group :) |
| 21:40:49 | <dons> | :) |
| 21:41:04 | <glguy> | I've never been to or part of a "user group" |
| 21:41:09 | <glguy> | what might one do in one? |
| 21:41:22 | <chessguy> | i went to one session of a user group once |
| 21:41:30 | <dons> | hmm, i think talks, discussion, help, advice, beer, pizza, networking? |
| 21:41:30 | <monochrom> | Now you'll also have simple user subgroup, normal user subgroup, solvable user subgroup, exact sequence of user subgroups, ... |
| 21:41:47 | <glguy> | User semi-group, perhaps? |
| 21:41:53 | <dons> | we can all attend the Church of the Higher Order Curry or something |
| 21:41:55 | <monochrom> | user monoids! |
| 21:42:04 | <mdmkolbe> | user rings? user fields? |
| 21:42:15 | <chessguy> | everyone did some hacking (in perl, in this case) on a particular problem, and then compared notes. and then...it devolved into a rant by one member on all that's evil in international politics |
| 21:42:18 | <monochrom> | instance Monoid (Portland_User_Group) where ... |
| 21:42:23 | <chessguy> | which was a little odd. |
| 21:42:24 | <glguy> | is a user semi-group a user group without a pizza operation? |
| 21:42:29 | <dons> | oh, this might be another ref to the portland newbie group, http://www.chesnok.com/daily/2007/09/06/haskell/ |
| 21:42:33 | <lambdabot> | Title: tending the garden » haskell! |
| 21:43:01 | <glguy> | dons, all of these postings are quite vague |
| 21:43:12 | <ddarius> | The normal subgroup are those users that are annihilated when going from one group to another. |
| 21:43:27 | <dons> | glguy: indeed. |
| 21:43:43 | <glguy> | dons, someone is trying to lure you in? |
| 21:43:49 | <mdmkolbe> | Save the users! Stop the annihilation! |
| 21:43:54 | <ari> | I could advertise a user magma as really hot |
| 21:44:00 | <chessguy> | heh |
| 21:44:00 | <glguy> | this is an elaborate ruse? |
| 21:44:01 | <chessguy> | http://www.meetup.com/search/?keywords=haskell&locationPickerRef=0&dbCo=us&dbOutsideUsLink=&country=us&zip=&go.x=0&go.y=0&go=GO |
| 21:44:03 | <lambdabot> | Title: Search results - Meetup.com, http://tinyurl.com/2mcpd4 |
| 21:44:07 | <dons> | glguy: i got an email from theo asking to test the new wifi driver :) |
| 21:44:13 | <dons> | open source roxors |
| 21:44:33 | <dons> | i note the acpi doesn't work too well, though, as you suspected, glguy |
| 21:44:34 | <oerjan> | ddarius: consequently, a simple group is one where all the users are annihilated if they try moving to a different group |
| 21:44:42 | <dons> | speedstep does, but no suspend/resume, afaik |
| 21:44:46 | <dons> | audio seems to be not working too |
| 21:44:47 | <glguy> | dons, Did you enable the acpi device? |
| 21:45:01 | <glguy> | dons, the wireless driver will not help much though since galois uses wpa |
| 21:45:11 | <dons> | i was poking around in the bios, but couldn't see it on a quick glance last night |
| 21:45:16 | <chessguy> | er...is this channel still about haskell? |
| 21:45:19 | <dons> | i'll have another look for the acpi |
| 21:45:30 | <dons> | the other thing is to get ghci working on amd64 |
| 21:45:35 | <glguy> | chessguy, Haskell and OpenBSD are long lost friends |
| 21:45:43 | <dons> | purely functional and secure! |
| 21:45:45 | <glguy> | dons, what do you mean? |
| 21:45:49 | <glguy> | what doesn't work on amd64? |
| 21:45:55 | <dons> | loadObj fails in Linker.c |
| 21:46:04 | <dons> | so ghci won't load .o's |
| 21:46:20 | <glguy> | didn't we fix something like this a while back? |
| 21:46:21 | <newsham> | are haskell user groups closed under composition? |
| 21:46:36 | <dons> | glguy: yeah, i think its just amd64 that's broken. |
| 21:46:45 | <dons> | kill@ sent me a mail about it |
| 21:46:48 | <dons> | kili |
| 21:46:57 | <glguy> | newsham, they are closed under new users ;) |
| 21:47:00 | <newsham> | glguy: why openbsd in specific and not *bsd? |
| 21:47:05 | <earnest> | haskell is a town in new jersey |
| 21:47:18 | <ddarius> | earnest: As well as Texas, as well as other states no doubt. |
| 21:47:22 | <dons> | newsham: i guess openbsd's slogan, 'free, functional, secure' could also be haskell's :) |
| 21:47:24 | <monochrom> | "The Haskell Haskell User Group" XD |
| 21:47:34 | <earnest> | :) |
| 21:47:38 | <glguy> | dons, I like it, let's fix the topic ;) |
| 21:47:41 | <earnest> | cool name :) |
| 21:48:02 | <monochrom> | free, functional, type-safe |
| 21:49:02 | <newsham> | ironically openbsd is not functional, and sometimes not functional (the other kind :) |
| 21:49:04 | <dons> | looks interesting, http://programming.reddit.com/info/2nik3/comments |
| 21:49:05 | <lambdabot> | Title: Continuation-based stream processors via Arrows (reddit.com) |
| 21:49:08 | <newsham> | but thats marketting for you ;-) |
| 21:49:50 | <dons> | oh, cool, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/funcmp-1.0 |
| 21:49:53 | <lambdabot> | http://tinyurl.com/2hnm68 |
| 21:50:00 | <dons> | `Functional MetaPost is a Haskell frontend to the MetaPost language' |
| 21:50:22 | <ddarius> | Hasn't that been around for quite a while? |
| 21:50:36 | <dons> | v1.0 just got uploaded to hackage? |
| 21:51:03 | <dons> | the cryp.to site hosts a lot of haskell projects |
| 21:51:08 | <glguy> | newsham, which *BSD were you hoping to see included? |
| 21:51:25 | <mdmkolbe> | How do we claim that Haskell is secure? |
| 21:51:38 | <glguy> | safe code has no buffer overflows |
| 21:51:41 | <newsham> | i use freebsd myself. but they're all so similar there's no reason why any effort to make openbsd work shouldnt be easily adjusted to include {net,free,dragonfly}bsd as well |
| 21:51:42 | <glguy> | for 1 |
| 21:52:08 | <dons> | http://programming.reddit.com/info/2niku/comments :) |
| 21:52:08 | <lambdabot> | Title: Functional MetaPost: write graphics programs in Haskell and compile them to Post ... |
| 21:52:12 | <newsham> | mdmkolbe: transforms and optimizations are based on formal semantics and provable? |
| 21:52:15 | <dons> | mdmkolbe: purity. |
| 21:52:29 | <dons> | and the fact entire companies are based around the security properties of the language |
| 21:52:41 | <newsham> | dons: how many companies? :) |
| 21:52:42 | <ddarius> | dons: http://www.informatik.uni-bonn.de/~ralf/software.html |
| 21:52:44 | <lambdabot> | Title: Ralf Hinze's software |
| 21:52:47 | <glguy> | newsham, I always felt like OpenBSD had a simpler /etc |
| 21:52:50 | <dons> | newsham: hmm, at least 2. |
| 21:52:53 | <glguy> | but I haven't used FreeBSD in a while |
| 21:53:02 | <newsham> | entire security companies are built around lots of things.. not to detract from haskell or anything... |
| 21:53:04 | <beelsebob> | what do you guys use for laying out BNF in LaTeX? |
| 21:53:08 | <glguy> | I wasn't saying earlier that ghci shouldn't be fixed on amd64 for freebsd |
| 21:53:15 | <newsham> | dons: whats the other besides galois? |
| 21:53:17 | <glguy> | I don't know if it even needed to be fixed |
| 21:53:17 | <dons> | aetion |
| 21:53:39 | <newsham> | glguy: yah, ghci doesnt work on freebsd/amd64 |
| 21:53:48 | <newsham> | dons: ahh, didnt know about that one. danke. |
| 21:53:50 | <dons> | newsham: do you konw why? |
| 21:54:21 | <newsham> | why aetion? why ghci/amd64? |
| 21:54:53 | <dons> | btw, this is useful, http://www.cse.unsw.edu.au/~cs4181/ `Language-based Software Safety' (i.e. Haskell-based ...) |
| 21:54:54 | <lambdabot> | Title: COMP4181/9181: Language-based Software Safety |
| 21:55:49 | <wincent> | really dumb question: how would I write a function to convert a string like "bar" into "baarrr" (ie. first character appears once,second twice, third thrice etc)... i'm trying to work through the exercises in a text book and am totally stumped with my imperative thinking |
| 21:55:50 | <glguy> | newsham, is Freesbie the only / recommended freebsd live cd? do you know? |
| 21:56:14 | <dons> | wincent: nice little problem :) beautiful solution available |
| 21:56:20 | <newsham> | glguy: dont know. havent used any live cds. does the installer not do live cd? |
| 21:56:25 | <sjanssen> | wincent: concat . zipWith replicate [1..] |
| 21:56:42 | <sjanssen> | > concat . zipWith replicate [1..] $ "bar" |
| 21:56:44 | <lambdabot> | "baarrr" |
| 21:56:51 | <dons> | that's the one. |
| 21:56:53 | <dons> | zipWith++ |
| 21:57:14 | <wincent> | dons: ah, my previous search revealed only this: http://paste.lisp.org/display/33775 -- which just seemed wrong |
| 21:57:44 | <dons> | do you understand sjanssen's zipWith solution? |
| 21:58:01 | <wincent> | trouble is, this is chapter 1 of the textbook, and concat, zipWith and replicate haven't even been introduced yet... i'm having trouble understanding why they introduced the problem at such an early stage |
| 21:58:05 | <dons> | zipwith is a very useful tool to have handy |
| 21:58:11 | <wincent> | dons: vaguely |
| 21:58:15 | <dons> | oh, you could just write a loop, of course |
| 21:58:19 | <newsham> | > take 5 $ zip [1..] "bar" |
| 21:58:21 | <lambdabot> | [(1,'b'),(2,'a'),(3,'r')] |
| 21:58:29 | <newsham> | > replicate 2 'a' |
| 21:58:30 | <dons> | > zip "haskell" [1..] |
| 21:58:31 | <lambdabot> | "aa" |
| 21:58:32 | <lambdabot> | [('h',1),('a',2),('s',3),('k',4),('e',5),('l',6),('l',7)] |
| 21:58:43 | <wincent> | dons: yes, but writing a loop doesn't seem like what they're asking for |
| 21:58:45 | <dons> | so then map over that list, duplicating the char by its occurence |
| 21:59:48 | <therp> | wincent: try to use a recursion, a counter starting with 0, ++ and replicate. |
| 21:59:52 | <newsham> | > [replicate 1 'b', replicate 2 'a', replicate 3 'r'] |
| 21:59:53 | <lambdabot> | ["b","aa","rrr"] |
| 21:59:57 | <newsham> | > concat [replicate 1 'b', replicate 2 'a', replicate 3 'r'] |
| 21:59:58 | <lambdabot> | "baarrr" |
| 22:00:46 | <newsham> | dons: that 4181 course looks interesting. too bad they dont do videos of their lectures :( |
| 22:01:01 | <dons> | ?go 78 degrees in celcius |
| 22:01:05 | <lambdabot> | http://www.texloc.com/closet/cl_cel_fah_chart.html |
| 22:01:05 | <lambdabot> | Title: Celsius To Fahrenheit Chart |
| 22:01:16 | <ddarius> | dons: Don't know how hot it is here? |
| 22:01:16 | <dons> | ?go 78 degrees Fahrenheit in celsius |
| 22:01:18 | <lambdabot> | 78 degrees Fahrenheit = 25.5555556 degrees Celsius |
| 22:01:26 | <dons> | ddarius: still trying to work out what's what. |
| 22:01:30 | <dons> | ?go 90 degrees Fahrenheit in celsius |
| 22:01:31 | <lambdabot> | 90 degrees Fahrenheit = 32.2222222 degrees Celsius |
| 22:01:43 | <newsham> | > (\f -> 100 * (f - 32) / 180) 78 |
| 22:01:45 | <lambdabot> | 25.555555555555557 |
| 22:02:06 | <ddarius> | dons: Yeah I just remember, freezing point, boiling point, "comfortable" 72-21, and body temperature 98.6-37 |
| 22:02:26 | <ddarius> | With those I can usually have an idea what a temperature in Celsius means. |
| 22:02:28 | <newsham> | (32, 0), (32+180, 100) |
| 22:02:33 | <beelsebob> | no recommendations for laying out grammars with LaTeX? |
| 22:03:02 | <oerjan> | > map (\c -> 32+c*9/5) [-40,-30..30] |
| 22:03:04 | <lambdabot> | [-40.0,-22.0,-4.0,14.0,32.0,50.0,68.0,86.0] |
| 22:03:23 | <LoganCapaldo> | > [-40,-30..30,1,2] |
| 22:03:23 | <lambdabot> | Parse error |
| 22:03:28 | <LoganCapaldo> | ah |
| 22:03:35 | <LoganCapaldo> | I got excited for a second there |
| 22:03:53 | <newsham> | > [-40,-30..30]++[1,2] |
| 22:03:54 | <lambdabot> | [-40,-30,-20,-10,0,10,20,30,1,2] |
| 22:04:56 | <dons> | ?go 72 degrees Fahrenheit in celsius |
| 22:04:56 | <lambdabot> | 72 degrees Fahrenheit = 22.2222222 degrees Celsius |
| 22:04:58 | <dons> | ah |
| 22:05:05 | <dons> | that's useful to remember |
| 22:06:09 | <idnar> | heh |
| 22:06:20 | <beelsebob> | dons: all of a sudden, I want to ressurect my "super converter" project |
| 22:07:08 | <oerjan> | ?go 1 lightyear in furlongs |
| 22:07:09 | <lambdabot> | 1 lightyear = 4.70279985 x 10^13 furlongs |
| 22:07:13 | <beelsebob> | you could feed it a set of information, and ask for something completely different out... like you could say force applied: 10N, acceleration: 3 ms/s/s, gravity: 5 N/Kg, to weight in lb |
| 22:07:18 | <beelsebob> | and it would figure out a way to get there |
| 22:07:19 | <ddarius> | string = mapM char |
| 22:07:55 | <Olathe> | ?go 1 lightyear in dog steps |
| 22:07:57 | <lambdabot> | http://www.skepticaldog.com/wp/2007/07/02/diluting-homeopathy |
| 22:07:57 | <lambdabot> | Title: Skeptical Dog » Blog Archive » Diluting Homeopathy |
| 22:08:15 | <beelsebob> | haha |
| 22:08:17 | <beelsebob> | it just uses google |
| 22:08:19 | <beelsebob> | that's cheating |
| 22:08:43 | <ddarius> | beelsebob: @go is just short for @google |
| 22:08:45 | <mrd> | @go 1 cubic lightyear in wales |
| 22:08:48 | <lambdabot> | http://www.physicsforums.com/showthread.php?t=175326 |
| 22:08:48 | <beelsebob> | ah, okay |
| 22:09:29 | <ddarius> | It is one of the emergent features of lambdabot. |
| 22:10:02 | <oerjan> | what are the others? |
| 22:10:15 | <wincent> | ok, this works, but i'm not entirely happy with it -- http://pastie.caboo.se/95583 -- for one thing I've had to make a helper function, and for another I'm using functions which haven't been introduced in the text yet (concat and replicate) |
| 22:10:17 | <lambdabot> | Title: #95583 - Pastie |
| 22:10:41 | <ddarius> | Getting the source of a function by combining djinn and type there are others. |
| 22:11:34 | <oerjan> | wincent: you don't need concat, just ++ |
| 22:11:48 | <wincent> | oerjan: true |
| 22:12:01 | <glguy> | you don't even need ++ |
| 22:12:42 | <wincent> | slightly better: http://pastie.caboo.se/95584 |
| 22:12:43 | <lambdabot> | Title: #95584 - Pastie |
| 22:13:32 | <wincent> | glguy: how do you avoid that? |
| 22:14:02 | <hpaste> | glguy pasted "for wincent" at http://hpaste.org/2652 |
| 22:14:34 | <EvilTerran> | @check \x y -> foldr (:) y x == x ++ (y :: String) |
| 22:14:46 | <lambdabot> | OK, passed 500 tests. |
| 22:14:56 | <wincent> | glguy: hehe, probably a bit beyond chapter 1 of the textbook (where I am now) |
| 22:15:15 | <glguy> | wincent, doubtful... it uses no library functions :) |
| 22:15:32 | <glguy> | well, ... + is from the "library" I suppose |
| 22:15:39 | <beelsebob> | @src (++) |
| 22:15:39 | <lambdabot> | (++) [] ys = ys |
| 22:15:40 | <lambdabot> | (++) (x:xs) ys = x : xs ++ ys |
| 22:15:44 | <beelsebob> | oh okay |
| 22:15:49 | <beelsebob> | not define in terms of foldr |
| 22:15:51 | <wincent> | glguy: which is nice, but still hard for my imperative brain to grok |
| 22:15:52 | <beelsebob> | surprised |
| 22:16:10 | <hpaste> | LoganCapaldo pasted "wincent don't look, I'm a horrible person" at http://hpaste.org/2653 |
| 22:16:43 | <oerjan> | LoganCapaldo: that's already been mentioned |
| 22:16:46 | <wincent> | LoganCapaldo: yes, that's the nicest looking solution |
| 22:16:53 | <LoganCapaldo> | oh good |
| 22:17:05 | <LoganCapaldo> | I'm less horrible than the person who did it first |
| 22:17:19 | <oerjan> | except, it's not pointfree |
| 22:18:09 | <LoganCapaldo> | :t concat . zipWith replicate [1..] |
| 22:18:12 | <lambdabot> | forall a. [a] -> [a] |
| 22:18:19 | <wincent> | @src (replicate) |
| 22:18:19 | <lambdabot> | Source not found. You type like i drive. |
| 22:18:26 | <wincent> | doh |
| 22:18:27 | <LoganCapaldo> | @src replicate |
| 22:18:27 | <lambdabot> | replicate n x = take n (repeat x) |
| 22:18:35 | <Japsu> | @pl \xs -> concat $ zipWith replicate [1..] xs |
| 22:18:35 | <lambdabot> | join . zipWith replicate [1..] |
| 22:18:36 | <ddarius> | (++) = flip (foldr (:)) |
| 22:19:19 | <wincent> | nice, dig the lazy evaluation on replicate |
| 22:19:36 | <LoganCapaldo> | @src (+) -- only need () for operators |
| 22:19:36 | <lambdabot> | Source not found. You type like i drive. |
| 22:19:46 | <LoganCapaldo> | that was a poor choice of operator |
| 22:19:51 | <wincent> | LoganCapald: yep, figured that |
| 22:20:34 | <oerjan> | @src Ratio (+) |
| 22:20:35 | <lambdabot> | Source not found. Are you on drugs? |
| 22:20:40 | <oerjan> | @src Ratio + |
| 22:20:41 | <lambdabot> | Source not found. BOB says: You seem to have forgotten your passwd, enter another! |
| 22:20:51 | <LoganCapaldo> | @src [] (>>=) |
| 22:20:51 | <lambdabot> | m >>= k = foldr ((++) . k) [] m |
| 22:21:25 | <ddarius> | @pl \m k -> foldr ((++) . k) [] m |
| 22:21:25 | <lambdabot> | flip (flip foldr [] . ((++) .)) |
| 22:22:57 | <wincent> | thanks for the help guys, will be back later! |
| 22:23:04 | <beelsebob> | o.O 70 pages and counting |
| 22:31:39 | <hpaste> | LoganCapaldo pasted "I'm an imperative programmer!!!" at http://hpaste.org/2654 |
| 22:32:31 | <beelsebob> | LoganCapaldo: you're a sick sick man |
| 22:35:59 | <LoganCapaldo> | Why thank you :) |
| 22:36:33 | <glguy> | to being called a man? |
| 22:36:35 | <hpaste> | EvilTerran annotated "I'm an imperative programmer!!!" with "no, *I*'m an imperative programmer!!!" at http://hpaste.org/2654#a1 |
| 22:36:47 | <EvilTerran> | look, ma, no recursion" |
| 22:36:48 | <EvilTerran> | ! |
| 22:37:11 | <EvilTerran> | (ignore the superfluous "do", there) |
| 22:37:21 | <glguy> | EvilTerran, you should have used mapM so you wouldn't need to have those "xs" laying around |
| 22:37:25 | <glguy> | making your code more pointful |
| 22:37:47 | <EvilTerran> | meh. i was trying to make it look like an imperative language as far as possible. |
| 22:37:49 | <LoganCapaldo> | EvilTerran, you are the winner |
| 22:37:59 | <LoganCapaldo> | at first I reached for mapM |
| 22:38:06 | <LoganCapaldo> | but I got confused quickly |
| 22:38:17 | <EvilTerran> | :D |
| 22:38:19 | <LoganCapaldo> | I really wanted to do ListT State or something |
| 22:39:42 | <hpaste> | sjanssen annotated "I'm an imperative programmer!!!" with "more imperative than thou" at http://hpaste.org/2654#a2 |
| 22:42:48 | <LoganCapaldo> | sjanssen, yet another idea I had but failed to execute :) |
| 22:43:38 | <LoganCapaldo> | Can anyone beat sjanssen? |
| 22:45:33 | <EvilTerran> | could do it in IORefs |
| 22:46:06 | <LoganCapaldo> | EvilTerran, that almost stops being funny and starts being accurate :( |
| 22:46:20 | <elliottt> | who should i talk to about a hackagedb user account? |
| 22:46:26 | <sioraiocht> | @src iterate |
| 22:46:26 | <lambdabot> | iterate f x = x : iterate f (f x) |
| 22:47:21 | <elliottt> | ah, nevermind ;) |
| 22:48:44 | <hpaste> | sjanssen annotated "I'm an imperative programmer!!!" with "madness" at http://hpaste.org/2654#a3 |
| 22:49:39 | <LoganCapaldo> | madness? This is #haskell! |
| 22:49:52 | <sjanssen> | hahaha |
| 22:49:56 | <sjanssen> | LoganCapaldo++ |
| 22:50:07 | <sioraiocht> | WTF are you guys doing?! |
| 22:50:16 | <sjanssen> | @remember LoganCapaldo madness? This is #haskell! |
| 22:50:16 | <lambdabot> | Done. |
| 22:50:28 | <ddarius> | sjanssen: I'm surprised you didn't pull out the Foreign routines and it's not quite quintessential imperative code without an unchecked cast somewhere. |
| 22:51:32 | <sioraiocht> | Okay. I know that even freaks have freaks, and you guys are the freaks of #haskell. |
| 22:52:23 | <mudge> | hello |
| 22:52:29 | <sioraiocht> | hey mudge |
| 22:52:39 | <mudge> | hi sioraiocht |
| 22:52:55 | <mudge> | has anyone here done the exercises in the book Programming Haskell? |
| 22:53:50 | <sioraiocht> | who is that book by? |
| 22:54:01 | <oerjan> | > let blowup xs = [last x | x <- inits xs, _ <- x] in blowup "bar" |
| 22:54:03 | <lambdabot> | "baarrr" |
| 22:54:14 | <hpaste> | twanvl annotated "I'm an imperative programmer!!!" with "using replicate is cheating" at http://hpaste.org/2654#a4 |
| 22:54:59 | <sjanssen> | nice |
| 22:55:47 | <olliej> | sjanssen: twanvl: you're both *really* scary |
| 22:55:49 | <sioraiocht> | mudge: I guess not, do you have some question about an exercise in there? |
| 22:56:29 | <Tac-Tics> | @src forM |
| 22:56:29 | <lambdabot> | forM = flip mapM |
| 22:56:32 | <hpaste> | EvilTerran annotated "I'm an imperative programmer!!!" with "mmm, sugary." at http://hpaste.org/2654#a5 |
| 22:56:58 | <dons> | you're all imperative programmers :) |
| 22:57:24 | <EvilTerran> | it is imperative that we program! |
| 22:57:29 | <allbery_b> | only in #haskell can we have an imperative programming dsw :) |
| 22:57:47 | <EvilTerran> | dsw? |
| 22:58:04 | <Olathe> | What does this mean ? test.o(.text+0x56):fake: undefined reference to `mtlzm1zi0zi1_ControlziMonadziStateziLazzy_zdf12_closure' |
| 22:58:17 | <EvilTerran> | ah, i think i see it on urbandictionary. never mind. |
| 22:58:19 | <wli> | ACTION points to his Linux kernel contributions. |
| 22:58:25 | <hpaste> | Tac-Tics annotated "I'm an imperative programmer!!!" with "(no title)" at http://hpaste.org/2654#a6 |
| 22:59:02 | <wli> | ACTION expects that will quash the imperative programming DSW. |
| 22:59:05 | <LoganCapaldo> | I should've know that was a mistake |
| 22:59:08 | <LoganCapaldo> | sorry |
| 22:59:24 | <sjanssen> | olliej: it's an important exercise in functional style -- the programmer with the most knowledge of FP will produce the best caricature of imperative style |
| 22:59:25 | <mudge> | sioraiocht: the book is by graham huttton |
| 22:59:48 | <mudge> | I'm looking for someone else who had done the exercises in the book to compare answers |
| 22:59:49 | <EvilTerran> | ACTION quite likes his (out?) syntax |
| 23:00:06 | <mudge> | or who'd want to do some of the exercise and compare answers |
| 23:01:26 | <sioraiocht> | mudge: I'll have a go |
| 23:01:41 | <sioraiocht> | as long as they aren't for school :) |
| 23:01:55 | <wli> | I've got real-life problems to deal with, like finding this earring before 10PM. |
| 23:01:56 | <mudge> | sioraiocht: it's not, I've been doing it on my own self study |
| 23:02:17 | <mudge> | sioraiocht: do you know about Graham Hutton's book Programming in Haskell? |
| 23:02:26 | <sioraiocht> | mudge: I'm afraid not |
| 23:02:43 | <olliej> | sjanssen: uh huh |
| 23:02:58 | <mudge> | sioraiocht: check it out: http://www.cs.nott.ac.uk/~gmh/book.html |
| 23:03:00 | <lambdabot> | Title: Programming in Haskell |
| 23:03:02 | <mudge> | it is a good book on haskell |
| 23:03:57 | <mudge> | wow, I guess it costs $40: http://www.amazon.com/Programming-Haskell-Graham-Hutton/dp/0521692695/ref=pd_bbs_sr_1/105-7372205-6120462?ie=UTF8&s=books&qid=1189378997&sr=8-1 |
| 23:03:59 | <oerjan> | > concat . reverse . transpose . inits . reverse $ "bar" |
| 23:04:01 | <lambdabot> | http://tinyurl.com/22py79 |
| 23:04:10 | <SamB_XP_> | audreyt: why the heck did I just see a customer image uploaded by you on Amazon.com ... as an example? |
| 23:04:11 | <lambdabot> | "baarrr" |
| 23:04:24 | <mudge> | it's only about 150 pages long though |
| 23:04:27 | <allbery_b> | sorry, it being around 7pm here my dsl went out. (no, I have no idea, except I know site wiring is bad) |
| 23:04:36 | <allbery_b> | anyway, size war. you can imagine the rest :) |
| 23:09:05 | <mudge> | \me hi |
| 23:09:08 | <mudge> | ACTION ih |
| 23:09:21 | <mudge> | ACTION no I'm an imperative programmer |
| 23:17:06 | <wli> | People didn't seem to like my idea last night for alternatives to tic tac toe games. |
| 23:18:39 | <LoganCapaldo> | there is an alternative to tic tac toe games? |
| 23:19:09 | <oerjan> | tactical toe games |
| 23:20:01 | <mudge> | ooh teactical toe games sound like fun |
| 23:20:09 | <mudge> | i mean tactical |
| 23:20:27 | <LoganCapaldo> | how do those work? |
| 23:20:46 | <mudge> | definitely more foot work |
| 23:21:24 | <oerjan> | they're often used as a shoe-in |
| 23:22:51 | <mudge> | have any of you guys done any of the exercises in Graham Hutton's Programming in Haskell book? I'm looking for someone to compare answers with |
| 23:31:23 | <Cale> | mudge: I don't have it, but I'd be willing to try problems. |
| 23:31:53 | <LoganCapaldo> | heh |
| 23:32:01 | <LoganCapaldo> | Yes, compare answers with Cale |
| 23:32:31 | <LoganCapaldo> | You'll either learn more than you ever wanted to know about haskell, or go insane with feelings of inadequacy :) |
| 23:32:43 | <mudge> | Cale: that would be really cool, the exercises require the book |
| 23:33:04 | <sioraiocht> | lol |
| 23:33:19 | <chessguy> | LoganCapaldo, i thought those were pretty much equivalent |
| 23:33:34 | <LoganCapaldo> | chessguy, I didn't say xor :) |
| 23:33:35 | <sioraiocht> | chessguy: brings up an EXCELLENT point |
| 23:34:21 | <sioraiocht> | So shouldn't it be: You'll learn more than you ever wanted to know about haskell iff you go insane with feelings of inadequacy? |
| 23:36:12 | <ricky_clarkson> | mudge: Get the author to send Cale a copy for review. |
| 23:36:27 | <ricky_clarkson> | If it's a positive review, there'll likely be sales. |
| 23:36:43 | <sioraiocht> | I didn't realise Cale was so popular |
| 23:36:47 | <sioraiocht> | who is this man behind the nick? |
| 23:37:13 | <Cale> | sioraiocht: hm? |
| 23:37:30 | <Cale> | I'm just popular around here :) |
| 23:37:33 | <sioraiocht> | lol |
| 23:37:49 | <oerjan> | @karma cale |
| 23:37:50 | <lambdabot> | cale has a karma of 42 |
| 23:37:55 | <ricky_clarkson> | @karma police |
| 23:37:56 | <lambdabot> | police has a karma of 0 |
| 23:37:57 | <jbalint> | haha, is that real? |
| 23:38:03 | <ddarius> | @karma |
| 23:38:03 | <lambdabot> | You have a karma of 4 |
| 23:38:06 | <Cale> | @karma Cale |
| 23:38:06 | <lambdabot> | You have a karma of 42 |
| 23:38:09 | <LoganCapaldo> | @karma audreyt |
| 23:38:09 | <lambdabot> | audreyt has a karma of 111 |
| 23:38:09 | <nominolo> | @karma java |
| 23:38:09 | <lambdabot> | java has a karma of -18 |
| 23:38:10 | <jbalint> | 42 is quite coincedence |
| 23:38:17 | <ddarius> | ACTION loses his karma everytime he gets some. |
| 23:38:18 | <LoganCapaldo> | @karma dons |
| 23:38:18 | <lambdabot> | dons has a karma of 125 |
| 23:38:19 | <sioraiocht> | @karma |
| 23:38:20 | <lambdabot> | You have a karma of 0 |
| 23:38:23 | <Cale> | Oh, cool, possibly they fixed it |
| 23:38:26 | <nominolo> | @karma |
| 23:38:26 | <lambdabot> | You have a karma of 0 |
| 23:38:33 | <nominolo> | i used to have more |
| 23:38:37 | <LoganCapaldo> | @karma |
| 23:38:37 | <lambdabot> | You have a karma of 2 |
| 23:38:54 | <mdmkolbe> | @karma ddarius |
| 23:38:55 | <lambdabot> | ddarius has a karma of 4 |
| 23:39:02 | <sioraiocht> | that surprises me ddarius |
| 23:39:07 | <sioraiocht> | do you get a lot of negative karma? =p |
| 23:39:11 | <sioraiocht> | @karma sorear |
| 23:39:11 | <lambdabot> | sorear has a karma of 23 |
| 23:39:13 | <LoganCapaldo> | ddarius++ |
| 23:39:47 | <ddarius> | sioraiocht: Occasionally. More often it gets lost by the bot. That said, I only have like 10 or so at most. |
| 23:39:49 | <mudge> | @karma + |
| 23:39:49 | <lambdabot> | + has a karma of 8 |
| 23:39:55 | <ddarius> | Go +! |
| 23:40:02 | <ddarius> | +++ |
| 23:40:06 | <ddarius> | @karma + |
| 23:40:06 | <lambdabot> | + has a karma of 9 |
| 23:40:10 | <mudge> | @karma+ mudge |
| 23:40:11 | <lambdabot> | You can't change your own karma, silly. |
| 23:40:13 | <ddarius> | :t (+++) |
| 23:40:13 | <mudge> | dang |
| 23:40:14 | <lambdabot> | forall (a :: * -> * -> *) b c b' c'. (ArrowChoice a) => a b c -> a b' c' -> a (Either b b') (Either c c') |
| 23:40:15 | <ricky_clarkson> | > let (*)=const (const 42) in 6*9 |
| 23:40:16 | <lambdabot> | 42 |
| 23:40:18 | <ddarius> | @karma +++ |
| 23:40:19 | <lambdabot> | +++ has a karma of 0 |
| 23:40:20 | <ddarius> | @karma + |
| 23:40:20 | <lambdabot> | + has a karma of 9 |
| 23:40:24 | <ari> | --- |
| 23:40:27 | <ari> | negate++ |
| 23:40:29 | <ari> | subtract++ |
| 23:40:37 | <mdmkolbe> | i++ |
| 23:40:42 | <idnar> | ++i |
| 23:40:43 | <nominolo> | java++ |
| 23:40:44 | <ddarius> | @karma j |
| 23:40:44 | <lambdabot> | j has a karma of 1 |
| 23:40:48 | <mudge> | can there be more than one bot in here? |
| 23:40:49 | <mdmkolbe> | java-- |
| 23:40:57 | <nominolo> | @karma |
| 23:40:57 | <lambdabot> | You have a karma of -1 |
| 23:41:02 | <ddarius> | mudge: Why not? There are actually several bots in here. |
| 23:41:09 | <mudge> | ok |
| 23:41:14 | <nominolo> | do you gain karma if you java-- ? |
| 23:41:20 | <LoganCapaldo> | Doesn't raising java's karma actualy not raise it and lower yours? |
| 23:41:21 | <nominolo> | @karma |
| 23:41:21 | <lambdabot> | You have a karma of -1 |
| 23:41:31 | <nominolo> | LoganCapaldo, it does |
| 23:41:37 | <ricky_clarkson> | I don't think -- and ++ have much to do with lambdabot's karma. |
| 23:41:37 | <LoganCapaldo> | nominolo, that would be a terrible exploit |
| 23:41:37 | <ddarius> | You probably don't want to have a lambdabot sitting around though if it's going to respond to the same requests lambdabot does. |
| 23:41:40 | <nominolo> | that's why i'm negative ;) |
| 23:41:45 | <Pseudonym> | What does lowering Java's karma do, then? |
| 23:41:54 | <ddarius> | @karma ricky_clarkson |
| 23:41:54 | <lambdabot> | ricky_clarkson has a karma of 0 |
| 23:41:56 | <idnar> | @jarma java |
| 23:41:56 | <lambdabot> | java has a karma of -20 |
| 23:41:58 | <nominolo> | Pseudonym, it lowers java's karma |
| 23:41:58 | <LoganCapaldo> | ACTION doesn't have enough karma |
| 23:41:59 | <ddarius> | ricky_clarkson-- |
| 23:42:03 | <ddarius> | @karma ricky_clarkson |
| 23:42:03 | <LoganCapaldo> | java-- |
| 23:42:03 | <lambdabot> | ricky_clarkson has a karma of -1 |
| 23:42:04 | <idnar> | er. what's jarma? |
| 23:42:04 | <Pseudonym> | nominolo: Right. |
| 23:42:09 | <LoganCapaldo> | java- |
| 23:42:15 | <Pseudonym> | That offends my theorist eye. |
| 23:42:17 | <LoganCapaldo> | look at me raising my own karma |
| 23:42:36 | <Pseudonym> | The operations are not symmetric. |
| 23:42:37 | <sioraiocht> | so much karma hate |
| 23:42:42 | <LoganCapaldo> | exactly |
| 23:42:56 | <LoganCapaldo> | @karma+ chameleon |
| 23:42:56 | <lambdabot> | chameleon's karma raised to 2. |
| 23:42:57 | <nominolo> | let's hope it doesn't get reborn |
| 23:43:04 | <LoganCapaldo> | @karma chameleon |
| 23:43:05 | <lambdabot> | chameleon has a karma of 2 |
| 23:43:09 | <ddarius> | @karma+ ricky_clarkson |
| 23:43:09 | <lambdabot> | ricky_clarkson's karma raised to 0. |
| 23:43:17 | <nominolo> | it's gonna be the coffe bean from hell |
| 23:43:23 | <Pseudonym> | ?karma chameleon -- should trigger a humorous response |
| 23:43:23 | <lambdabot> | chameleon has a karma of 2 |
| 23:43:34 | <sioraiocht> | lol |
| 23:43:35 | <LoganCapaldo> | Pseudonym, I agree |
| 23:43:40 | <sioraiocht> | Pseudonym: I started singing... |
| 23:43:48 | <Pseudonym> | Me too, sigh. |
| 23:43:56 | <Pseudonym> | Yes, I _really_ want to hurt you. |
| 23:44:06 | <LoganCapaldo> | I started singing _before_ I typed it :) |
| 23:44:08 | <ddarius> | ACTION started singing... Hanging By A Moment. |
| 23:44:25 | <ricky_clarkson> | @karma c++ |
| 23:44:25 | <lambdabot> | c++ has a karma of -6 |
| 23:44:30 | <ricky_clarkson> | c++-- |
| 23:44:32 | <ricky_clarkson> | @karma c++ |
| 23:44:32 | <lambdabot> | c++ has a karma of -7 |
| 23:44:41 | <Pseudonym> | c--++ |
| 23:44:45 | <sioraiocht> | c++-- |
| 23:44:45 | <Pseudonym> | ?karma c-- |
| 23:44:46 | <lambdabot> | c-- has a karma of 3 |
| 23:44:55 | <LoganCapaldo> | ddarius, must be desperate for changing |
| 23:44:58 | <ddarius> | c++++ |
| 23:45:06 | <ricky_clarkson> | Pseudonym: Evidence of prior art. |
| 23:45:12 | <ari> | @karma+ @karma |
| 23:45:12 | <lambdabot> | @karma's karma raised to 2. |
| 23:45:24 | <Pseudonym> | Recursive fun. |
| 23:45:29 | <balodja> | <Барада> (mPtr->*(mPtr->fLst)[i])(); |
| 23:45:36 | <balodja> | c++-- |
| 23:45:38 | <Pseudonym> | @karma+ @karma karma @karma karma chameleon |
| 23:45:38 | <lambdabot> | @karma's karma raised to 3. |
| 23:46:21 | <nominolo> | you come and go ... |
| 23:47:40 | <LoganCapaldo> | @karma+ dibblego |
| 23:47:40 | <lambdabot> | dibblego's karma raised to 3. |
| 23:47:48 | <dibblego> | hello |
| 23:47:49 | <Pseudonym> | ?let me love and steal, I have danced inside your eyes |
| 23:47:49 | <lambdabot> | Parse error |
| 23:48:03 | <LoganCapaldo> | @karma+ Pseudonym |
| 23:48:03 | <lambdabot> | Pseudonym's karma raised to 10. |
| 23:48:26 | <LoganCapaldo> | @karma+ samreid |
| 23:48:26 | <lambdabot> | samreid's karma raised to 2. |
| 23:48:28 | <Pseudonym> | ACTION is curious why he deserved a karma raise just for being old |
| 23:48:42 | <LoganCapaldo> | because ?let is funny |
| 23:48:58 | <LoganCapaldo> | dibblego, got karma for coming and samreid got karma for going |
| 23:49:02 | <ddarius> | Pseudonym: Not everyone becomes old. |
| 23:49:33 | <wli> | Some die first. |
| 23:49:38 | <ddarius> | wli: Exactly. |
| 23:50:24 | <KatieHuber> | I hate to interrupt when everyone's having so much fun, but I have a real question ;) |
| 23:50:36 | <ddarius> | Oh no! Hide! |
| 23:50:36 | <sorear> | !msg lambdabot @karma+ sorear |
| 23:50:45 | <Cale> | go for it :) |
| 23:50:49 | <LoganCapaldo> | Get in the bunkers |
| 23:50:56 | <LoganCapaldo> | @karma+ bunkers |
| 23:50:56 | <lambdabot> | bunkers's karma raised to 1. |
| 23:51:16 | <KatieHuber> | I'm learning haskell, and one thing I keep coming up against is having some fairly complex data structure, and wanting to create a number of new versions of the structure |
| 23:51:24 | <KatieHuber> | where each version has some minor edit, but the rest of the structure is the same |
| 23:51:40 | <KatieHuber> | (for example, all the legal successor positions in a game of chess, maybe) |
| 23:51:49 | <sorear> | ...okay... |
| 23:51:58 | <Pseudonym> | KatieHuber: You mean the _type_ needs slight differences? |
| 23:52:10 | <KatieHuber> | no, I mean the data itself is slightly different |
| 23:52:23 | <ddarius> | Sorry Pseudonym, not that interesting. |
| 23:52:35 | <SamB_XP_> | and? |
| 23:52:36 | <allbery_b> | use a record |
| 23:52:48 | <SamB_XP_> | allbery_b: for chess positions? |
| 23:53:05 | <sorear> | allbery_b: ack! not the h98 record system! |
| 23:53:11 | <allbery_b> | well, maybe not for that |
| 23:53:31 | <KatieHuber> | like for solving a sudoku puzzle, I want to take a given configuration of numbers, then generate a bunch more configurations with exactly one number added |
| 23:53:32 | <Pseudonym> | KatieHuber: Is the problem that you're worried about memory usage, or that it's just hard to write? |
| 23:53:39 | <KatieHuber> | I'm just finding it hard to write |
| 23:53:42 | <Pseudonym> | Because it is, I agree. |
| 23:53:47 | <Pseudonym> | Right. |
| 23:53:49 | <LoganCapaldo> | I demand more zippers |
| 23:53:51 | <KatieHuber> | not worried about memory or performance or anything (at the moment) |
| 23:53:52 | <SamB_XP_> | I'm not sure what format I'd use, but it would definately involve arrays somehow... |
| 23:53:55 | <Pseudonym> | H98 records aren't too bad. |
| 23:53:55 | <sorear> | ACTION smells a zipper |
| 23:54:01 | <Pseudonym> | And nor are arrays. |
| 23:54:10 | <ddarius> | They could just be better. |
| 23:54:20 | <allbery_b> | h98 records are far from perfect, but also far from unuseable |
| 23:54:20 | <Pseudonym> | sorear: The problem is that this data structure isn't really a recursive type. |
| 23:54:24 | <Pseudonym> | Right. |
| 23:54:25 | <KatieHuber> | I was just wondering whether there was some pattern to doing this that made all the pain go away |
| 23:54:36 | <LoganCapaldo> | code generator :) |
| 23:54:41 | <SamB_XP_> | KatieHuber: no! that's the feeling of thought |
| 23:54:49 | <SamB_XP_> | you'll grow used to it ;-) |
| 23:55:01 | <Pseudonym> | KatieHuber: In the case of things with regular structure, like a chess board or a Sudoku board, it's not a dumb idea to use an array or a Data.Map. |
| 23:55:14 | <KatieHuber> | well, in an imperative language, you could make something to copy the entire data structure, then something to make a couple of tiny edits to the copy |
| 23:55:28 | <Pseudonym> | Records are more useful when you've got something that's logically a structure, rather than logically an indexed dictionary. |
| 23:55:33 | <KatieHuber> | but in haskell you seem to be expected to somehow keep track of what you're editing as you go, to construct the new structure all at once |
| 23:55:43 | <Pseudonym> | That's right, but you can hide it well. |
| 23:55:51 | <SamB_XP_> | what was that array update operator? |
| 23:55:52 | <SamB_XP_> | \\ or //? |
| 23:55:58 | <sorear> | // |
| 23:56:03 | <LoganCapaldo> | @type (//) |
| 23:56:04 | <Pseudonym> | SamB: \\ is list difference. |
| 23:56:05 | <lambdabot> | forall i e. (Ix i) => Array i e -> [(i, e)] -> Array i e |
| 23:56:12 | <KatieHuber> | for sudoku I used arrays, and it was ugly, but worked |
| 23:56:17 | <Pseudonym> | Yeah. |
| 23:56:30 | <SamB_XP_> | Pseudonym: I suppose I should have realized that \\ would be the one that would be list difference ;-) |
| 23:56:33 | <Cale> | It shouldn't be *so* ugly... |
| 23:56:36 | <Pseudonym> | I think the trick is to build an abstract interface on top of it. |
| 23:56:44 | <LoganCapaldo> | word |
| 23:56:57 | <Philippa> | a good rule of thumb when you're learning haskell is to forget arrays exist until you're otherwise happy you're pretty good with it |
| 23:57:02 | <LoganCapaldo> | littleedit :: param -> Thingy -> Thingy |
| 23:57:12 | <Pseudonym> | Seriously, though, an association list isn't so dumb either. |
| 23:57:15 | <SamB_XP_> | okay, lists of lists would work fine too |
| 23:57:21 | <Pseudonym> | Yeah. |
| 23:57:34 | <Pseudonym> | But what I'd suggest is to build a module which encapsulates the representation. |
| 23:57:37 | <SamB_XP_> | but that's basically the same thing as arrays... |
| 23:57:47 | <Pseudonym> | One thing that Haskell does well is abstraction at the micro-scale. |
| 23:57:53 | <Pseudonym> | It's really quite cheap. |
| 23:58:07 | <Cale> | Actually, I think Haskell's arrays are quite a bit nicer than in most other languages -- you can index them using lots of types. |
| 23:58:15 | <Philippa> | yeah, when you can beta-reduce freely inlining is your bestest friend |
| 23:58:24 | <Pseudonym> | Hide the ugliness, and provide a nice interface so that when you need to change it, you can, and nothing breaks. |
| 23:58:37 | <SamB_XP_> | yes, I couldn't decide whether I'd want to index by piece or by square ;-) |
| 23:58:42 | <|Jedai|> | Yes, I feel that one of the strangth of Haskell is that it actually rewards even your smallest abstraction |
| 23:58:47 | <Pseudonym> | Yeah. |
| 23:59:02 | <SamB_XP_> | |Jedai|: you can overdo it, but it's harder than you'd think ;-) |
| 23:59:19 | <Philippa> | yeah, usually you're cursing from syntactic weight first |
| 23:59:23 | <ddarius> | @google Evolution of a Haskell Programmer |
| 23:59:24 | <jedai> | SamB_XP_: Way harder than in any other language I tried |
| 23:59:25 | <lambdabot> | http://www.willamette.edu/~fruehr/haskell/evolution.html |
| 23:59:25 | <lambdabot> | Title: The Evolution of a Haskell Programmer |
| 23:59:28 | <Pseudonym> | So KatieHuber, back to your problem. |
| 23:59:39 | <Pseudonym> | Pick the simplest. List, or list of lists, is fine to start wtih. |
| 23:59:47 | <Pseudonym> | Make a nice interface for it. |
| 23:59:55 | <Pseudonym> | Put it in its own module. |
Back to channel and daily index: content-negotiated html turtle