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:12:31 | <faxathisia> | hello everyone |
| 00:13:57 | <ndm> | hi faxathisia |
| 00:18:19 | <ptolomy> | Yowza. I just implemented cooperative concurrency using callcc for ruby, and had it run the recursive algorithm for fibonacci as a long-running test.. within a few seconds, well over a 1gb of ram. I suspect that MonadCont will be a wee bit more performant. |
| 00:19:23 | <gwydion> | (((.) . (.)) a b c ) is the same as ((.) ( (.) a b ) c ) ? |
| 00:19:26 | <gwydion> | is that right? |
| 00:19:31 | <gwydion> | can anyone tell? |
| 00:19:36 | <faxathisia> | :t (\ a b c -> (((.) . (.)) a b c )) |
| 00:19:38 | <lambdabot> | forall a b c a1. (b -> c) -> (a -> a1 -> b) -> a -> a1 -> c |
| 00:19:44 | <faxathisia> | :t (\ a b c -> ((.) ( (.) a b ) c )) |
| 00:19:44 | <lambdabot> | forall b c b1 a. (b -> c) -> (b1 -> b) -> (a -> b1) -> a -> c |
| 00:19:53 | <faxathisia> | I think they are not the same |
| 00:20:17 | <sjanssen> | ptolomy: I dunno if Haskell will do that much better -- the memory complexity is exponential if you're forking a thread for each recursive call |
| 00:20:50 | <gwydion> | faxathisia: wau, that was quick |
| 00:20:51 | <gwydion> | :-) |
| 00:21:03 | <faxathisia> | you got :t in ghci too btw, if you use that |
| 00:21:05 | <ptolomy> | sjanssen: Oh, I'm not. I'm just calling 'pass' ("yield to another coroutine if any others are running") for each call. |
| 00:21:25 | <balodja> | :t \a c -> ((.) ( (.) a) c ) |
| 00:21:26 | <lambdabot> | forall b c a a1. (b -> c) -> (a1 -> a -> b) -> a1 -> a -> c |
| 00:21:31 | <balodja> | :t (.) . (.) |
| 00:21:32 | <lambdabot> | forall a b c a1. (b -> c) -> (a -> a1 -> b) -> a -> a1 -> c |
| 00:21:51 | <balodja> | these are the same, i think |
| 00:22:31 | <ptolomy> | but I suppose I have to copy the stack every time control is passed, and if it isn't copied cleverly it would cause problems. |
| 00:24:42 | <gwydion> | balodja: thanks, i see the point now |
| 00:25:50 | <dbueno> | @paste |
| 00:25:50 | <lambdabot> | Haskell pastebin: http://hpaste.org/new |
| 00:26:30 | <faxathisia> | oh I asked this before, but.. Is there any haskell code which does some program transformation on an AST which is particularly clear/well written/simple.. anything like that, I might be able to learn some tricks from? |
| 00:29:17 | <faxathisia> | yeah I get the impression that transforming ASTs in haskell is bound to be grimey :S |
| 00:29:51 | <faxathisia> | anyone else has observed this ? |
| 00:30:56 | <Saizan> | well, it seems that you usually want some form of generics |
| 00:31:01 | <kmcallister> | grimey how? |
| 00:31:08 | <kmcallister> | i've written a few compilers in haskell and it's always nice |
| 00:31:22 | <Saizan> | like in SYB, or Uniplate, uniplate has been written by ndm to write supero |
| 00:31:22 | <faxathisia> | kmcallister: are they online? |
| 00:31:44 | <faxathisia> | ohh I didn't know about that |
| 00:31:45 | <ndm> | Uniplate rocks for compilers |
| 00:31:48 | <Philippa> | faxathisia: it's not ideal, but it beats the crap out of doing it in java |
| 00:31:49 | <hpaste> | dbueno pasted "unsafeFreeze error" at http://hpaste.org/4872 |
| 00:32:00 | <kmcallister> | they're not online |
| 00:32:15 | <kmcallister> | i haven't used generics and it's still pretty nice |
| 00:32:31 | <dbueno> | If anyone has a moment, I'd appreciate some help on dealing with MArray's and IArrays. |
| 00:32:35 | <faxathisia> | why not put it up somewhere kmcallister ? |
| 00:32:42 | <thoughtpolice> | is there any easy way to remove escape sequences from strings? i mean, aside from just filter and using Data.Char functions |
| 00:33:05 | <thoughtpolice> | not really a problem if there isn't but i'm just wondering |
| 00:33:06 | <kmcallister> | because they're not useful or production-ready |
| 00:33:14 | <kmcallister> | i wrote them for various undergrad classes |
| 00:33:17 | <Saizan> | dbueno: well, ask :) |
| 00:33:25 | <kmcallister> | i'm not opposed to hosting though |
| 00:33:26 | <sarehu> | thoughpolice: what kind of escape sequences? |
| 00:33:27 | <faxathisia> | kmcallister: aw :( |
| 00:33:33 | <dbueno> | Saizan: To start with, I pasted a compile error I don't understand how to remove. |
| 00:33:53 | <sarehu> | thoughtpolice: and how efficiently? |
| 00:33:57 | <kmcallister> | what sort of language are you manipulating the AST of? |
| 00:34:04 | <dbueno> | But more generally, I have a function taking in a mutable array (Marray) that calls a function that uses an IArray, gets some info, and possibly mutates the MArray before returning. |
| 00:34:17 | <dbueno> | I'll actually be using STUArrays, but this is a helper function in the ST monad. |
| 00:34:19 | <thoughtpolice> | sarehu: doesn't need to be the fastest possible, it's a plugin for my irc bot that uses fortune. |
| 00:34:48 | <sjanssen> | thoughtpolice: are the escape sequences Haskell style? If so, just use read |
| 00:34:48 | <thoughtpolice> | i just used unwords . lines to remove all the newlines but for example tabe characters still show |
| 00:35:21 | <sarehu> | those are escape sequences? You ean you want to remove tabs and newlines? |
| 00:36:00 | <thoughtpolice> | my terminology might be screwed; basically i just want to remove \t's since lines takes care of the newlines. |
| 00:36:12 | <Saizan> | dbueno: you've to instantiate the type of IArray you want there, since it won't appear in the type of f |
| 00:36:23 | <sarehu> | so you have tab characters (not backslashes and t's) in your strings. |
| 00:36:27 | <dbueno> | Saizan: So I need an annotation? |
| 00:36:36 | <thoughtpolice> | yeah. sorry for the confusion :/ |
| 00:37:13 | <dbueno> | i.e. mFrozen :: UArray Int Int? |
| 00:37:38 | <Saizan> | i think so |
| 00:37:54 | <dbueno> | Oooh, it compiles. |
| 00:37:57 | <dbueno> | Saizan, thanks for the help! |
| 00:38:34 | <Saizan> | np |
| 00:38:46 | <Saizan> | the error is a bit confusing |
| 00:39:13 | <Saizan> | it should report ambigous type variable but the MPTC is probably deceiving it |
| 00:39:17 | <dbueno> | I couldn't figure out how I'd tie the 'b' in 'IArray b Int' to anything. |
| 00:39:30 | <dbueno> | MPTC? |
| 00:39:53 | <BMeph> | Multi-Parameter Type Constructors (I think) |
| 00:39:57 | <kmcallister> | type classes |
| 00:40:17 | <BMeph> | Ooh, so close... ;P |
| 00:40:22 | <Saizan> | :) |
| 00:40:46 | <Saizan> | dbueno: that's the inferred type of mFrozen |
| 00:41:54 | <dbueno> | Saizan: When I meant 'tie to anything' I meant by annotations -- I couldn't figure out where to stick a 'b' -- whether in the sig or on the unsafeFreeze line so that GHC didn't compain. |
| 00:42:03 | <dbueno> | s/When I meant/When I said/ |
| 00:42:28 | <faxathisia> | huh http://www-users.cs.york.ac.uk/~ndm/supero/ |
| 00:42:32 | <lambdabot> | Title: Neil Mitchell - Supero |
| 00:42:41 | <faxathisia> | the source code is not released? |
| 00:43:22 | <sarehu> | thoughtpolice: so you want to replace "\n" with " " and "\t" with " "? |
| 00:43:23 | <Saizan> | dbueno: well in the sig you can't since that type doesn't appear there, and annotating unsafeFreeze m is a bit complex due to the ST monad |
| 00:43:26 | <frobar> | source code is not released? |
| 00:43:27 | <frobar> | : Neil Mitchell - Supero |
| 00:43:40 | <ddarius> | faxathisia: Why did (do) you think AST transformation would be "grimey" in Haskell? |
| 00:44:04 | <faxathisia> | ddarius: my code is |
| 00:44:09 | <faxathisia> | at least parts of it |
| 00:44:17 | <ddarius> | faxathisia: How the heck did you manage that? |
| 00:44:24 | <thoughtpolice> | sarehu: yeah, i got it. basically my solution is just unwords . lines $ map (\x -> if isControl x then ' ' else x) |
| 00:44:31 | <thoughtpolice> | probably not the most efficient but it works |
| 00:44:41 | <faxathisia> | well I had to write out val N_foo = 1, val N_bar = 2.. for like 20 things |
| 00:44:42 | <Philippa> | it doesn't do a great job of relationships that smell like subtyping, that can get tedious |
| 00:44:44 | <sarehu> | ah, well ok |
| 00:44:48 | <Philippa> | I wouldn't call it actually grimy though |
| 00:44:53 | <Valodim> | >_< |
| 00:44:56 | <sarehu> | whatever, I don't care then :-) |
| 00:45:17 | <ndm> | faxathisia: its not released, but it is online |
| 00:45:42 | <Feuerbach> | How do I efficiently combine nub and sort? |
| 00:45:44 | <thoughtpolice> | hm well in that case i guess the unwords . lines would be unnecessary but whatever. it works and i am happy. :) |
| 00:45:48 | <Philippa> | faxathisia: that's not grime so much as having to embed a tedious mapping once. Though you shouldn't generally need too many of them |
| 00:45:54 | <Feuerbach> | (like 'sort -u' in Unix) |
| 00:46:01 | <dons> | Feuerbach: use a Set? |
| 00:46:07 | <Philippa> | Feuerbach: write a specialised nub that assumes it's in order? |
| 00:46:09 | <vincenz> | > group $ sort |
| 00:46:19 | <lambdabot> | Couldn't match expected type `[a]' |
| 00:46:19 | <dons> | ndm's thought hard about this |
| 00:46:27 | <dons> | for the case where Ord a => a holds |
| 00:46:28 | <sarehu> | map head . group . sort |
| 00:46:33 | <vincenz> | yp |
| 00:46:40 | <dons> | :t group |
| 00:46:41 | <lambdabot> | forall a. (Eq a) => [a] -> [[a]] |
| 00:46:44 | <dons> | :t nub |
| 00:46:44 | <lambdabot> | forall a. (Eq a) => [a] -> [a] |
| 00:47:02 | <ndm> | the answer was to use a Data.Map |
| 00:47:25 | <dons> | with values of () ? |
| 00:47:35 | <dons> | then pull the keys out? |
| 00:47:37 | <ndm> | oh, Data.Set |
| 00:47:54 | <dons> | :t Data.Set.fromList |
| 00:47:54 | <lambdabot> | forall a. (Ord a) => [a] -> Data.Set.Set a |
| 00:47:59 | <dons> | that's the Ord we want |
| 00:48:05 | <Feuerbach> | ndm: why?? Like Philippa noted, I need just another version of nub (and wish it to be standard :p) |
| 00:48:13 | <ndm> | no, use insert and lookup |
| 00:48:34 | <ddarius> | Feuerbach: The "other version" of nub is just map head . group as sarehu mentioned. |
| 00:48:49 | <ndm> | Feuerbach: i wanted it to be standard |
| 00:50:17 | <Feuerbach> | ok, thank you :) |
| 00:50:17 | <sarehu> | Feuerbach: In place of map head . group , you could use foldr f . sort where { f x xs@(x':_) | x == x' = xs ; f x xs = x:xs } -- maybe that's more efficient |
| 00:50:35 | <sarehu> | but maybe not |
| 00:50:47 | <faxathisia> | Oh here's one example, ddarius |
| 00:50:55 | <bench> | so i've upgraded to ghc6.8.2 |
| 00:51:10 | <bench> | programs used to work don't anymore |
| 00:51:18 | <vincenz> | dons: group groups locally |
| 00:51:22 | <bench> | so how i go about finding the issue? |
| 00:51:25 | <vincenz> | dons: it's O(n) |
| 00:51:30 | <faxathisia> | I wanted to write a simplifier for the AST.. so I made a new AST which enforces the property... and a conversion from it to the old one |
| 00:51:48 | <faxathisia> | so I basically have to define an entire set of new datatypes.. to define an invarient |
| 00:51:55 | <faxathisia> | not sure if there is a way around it though |
| 00:52:12 | <faxathisia> | (well I tried to do it with GADTs but it seems like a hack) |
| 00:52:26 | <Philippa> | not really. Sufficiently ubiquitous generics might sugar things up a little |
| 00:52:26 | <faxathisia> | (that could be my failing though) |
| 00:52:31 | <ndm> | faxathisia: just document the invariant, and don't inforce it with the types |
| 00:52:46 | <ndm> | ACTION has written millions of AST invariants |
| 00:52:56 | <kmcallister> | faxathisia, you can do that with smart constructors instead |
| 00:53:13 | <kmcallister> | and you can use the module system to force use of the smart constructors |
| 00:53:19 | <faxathisia> | yeah, I was thinking about it but... I could not be certain bugs don't exist in that case |
| 00:53:20 | <ndm> | http://www.cs.york.ac.uk/fp/yhc/snapshot/docs/Yhc-Core-Invariant.html |
| 00:53:21 | <lambdabot> | http://tinyurl.com/35tcbe |
| 00:53:53 | <ndm> | faxathisia: can you ever be certain that bugs don't exist? |
| 00:54:03 | <faxathisia> | ndm: Hopefully in the future! |
| 00:54:34 | <ndm> | faxathisia: quickcheck gives it to you now, at some point someone will write a quickcheck prover, and we'll all be sorted :) |
| 00:54:52 | <Philippa> | you can never, ever be certain. It's a question of how many nines you want to pay for |
| 00:54:56 | <ddarius> | faxathisia: There are tricks. The nicest thing would be if Haskell supported refinement types. |
| 00:55:37 | <ndm> | ACTION wants many nines but does not want to pay for any of them |
| 00:55:44 | <ndm> | hence hindley milner is great :) |
| 00:56:27 | <faxathisia> | is refinement types .. DML? |
| 00:56:29 | <faxathisia> | what is that |
| 00:57:31 | <Philippa> | faxathisia: imagine being able to type Cons foo (List foo) - or Cons Bar (List Foo) where Bar's a subtype of Foo, even |
| 00:57:35 | <ac_> | @hoogle unit |
| 00:57:36 | <lambdabot> | No matches found |
| 00:57:47 | <dons> | ndm, swiert's done some Coq proofs for chunks of xmonad's StackSet |
| 00:58:02 | <ddarius> | @google "Refinement types" |
| 00:58:04 | <lambdabot> | http://www.cs.ucla.edu/~palsberg/tba/papers/freeman-thesis94.pdf |
| 00:58:05 | <faxathisia> | oh so.. it is basically subtyping? |
| 00:58:07 | <dons> | so there's an interesting spectrum from QC on xmonad, to HPC coverage, to Catch to Coq |
| 00:58:28 | <ndm> | dons: soon Catch will support 100% of GHC compilable Haskell, then it should get a lot more useful |
| 00:59:12 | <kmcallister> | dons: is there any way to automatically go between Coq and Haskell? |
| 00:59:13 | <faxathisia> | sorry what is Catch? |
| 00:59:21 | <faxathisia> | kmcallister: Coq can print out haskell code |
| 00:59:31 | <faxathisia> | (as well as scheme and Ocaml) |
| 00:59:34 | <ivanm> | faxathisia: it's a game using at least two people, a ball and optionally some type of glove :p |
| 00:59:38 | <kmcallister> | ah, cool |
| 00:59:41 | <faxathisia> | ivanm: In this context? lol |
| 00:59:46 | <ivanm> | heh |
| 00:59:50 | <kmcallister> | faxathisia, http://www-users.cs.york.ac.uk/~ndm/catch/ |
| 00:59:51 | <lambdabot> | Title: Neil Mitchell - Catch: Case Totality Checker for Haskell |
| 01:00:02 | <faxathisia> | ohh ok thanks |
| 01:00:11 | <dons> | kmcallister: there are some research projects that embed parts of haskell in Coq and Isabelle. Also, others that extract Haskell from Isabelle and Coq (i.e. you develop in the theorem prover first) |
| 01:00:17 | <dons> | however, nothing production ready yet. |
| 01:00:19 | <ivanm> | faxathisia: sorry, couldn't resist ;-) |
| 01:00:23 | <faxathisia> | (how do I access that springer link thing on refinement types?) |
| 01:00:26 | <faxathisia> | (I guess I can't?) |
| 01:00:40 | <ddarius> | faxathisia: ? |
| 01:01:01 | <faxathisia> | http://www.cs.ucla.edu/~palsberg/tba/papers/freeman-thesis94.pdf |
| 01:01:14 | <ddarius> | Where do you see springer link? |
| 01:06:35 | <ac_> | faxathisia: hm. So if you write something in Coq, and then emit Scheme, the Scheme code is guaranteed type safe? |
| 01:06:58 | <faxathisia> | I guess.. I don't understand the internals |
| 01:07:09 | <faxathisia> | You'd have to have a bug free scheme interpreter too.... |
| 01:08:36 | <faxathisia> | well say some function took a proof as a parameter and the extracted version didn't.. You might be able to pass in nonsense to it and cause an error |
| 01:09:14 | <faxathisia> | so I think you have to make sure to call procedures with right inputs to ensure it's safe |
| 01:10:09 | <ac> | Hey, does anybody have a fun little Haskell project for me to work on? |
| 01:10:48 | <faxathisia> | ac, model something with Coq and generate a haskell program? : |
| 01:10:50 | <ddarius> | faxathisia: That makes no sense. |
| 01:11:16 | <faxathisia> | ddarius: well I've not used it yet.. just trying to answer the question |
| 01:11:40 | <dons> | prove properties of the Haskell list api in Coq? |
| 01:12:06 | <ddarius> | dons: Why bother? |
| 01:12:29 | <dons> | i suppose a light model checker would be more useful |
| 01:12:56 | <ac> | uhm... emphasis on fun |
| 01:13:07 | <dons> | oh. fun! as in -Ofun? |
| 01:13:17 | <dons> | hmm, emulate ion3 fully in xmonad? |
| 01:13:17 | <loupgaroublond> | -funroll-loops |
| 01:13:37 | <dons> | do a C-- to LLVM translator? |
| 01:13:48 | <dons> | prototype a bit-level parser on top of Data.Binary? |
| 01:13:58 | <dons> | write a version of polyparse for bytestrings? |
| 01:14:12 | <kmcallister> | dons, speaking of emulating ion3 in xmonad, is there an xmonad layout engine that supports ion-like dynamic workspace splitting/unsplitting? |
| 01:14:28 | <sjanssen> | kmcallister: not really |
| 01:14:39 | <glguy> | how do you say (using associated type synonyms) class S b => C a b | a -> b |
| 01:14:57 | <sjanssen> | glguy: I'm not sure that you can |
| 01:15:13 | <dons> | oh, that constraint on b. hmm |
| 01:15:16 | <sjanssen> | (without using a complicated encoding) |
| 01:15:44 | <dons> | I think you can. I've seen: class C a where type Ord b => b something -- or maybe it was an example of a future extension |
| 01:16:06 | <ac> | dons: what's polyparse? |
| 01:16:12 | <dons> | yeah, i think it was a possible extension. glguy, check with Roman or Manuel. they've looked at this, iirc |
| 01:16:22 | <Saizan> | dons: polyparsed already work on bytestring, the module is just not exposed in the .cabal |
| 01:16:26 | <alexj_> | @seen lemmih |
| 01:16:26 | <lambdabot> | lemmih is in #haskell. I last heard lemmih speak 11h 6m 3s ago. |
| 01:16:30 | <dons> | oh, Saizan, very interesting! |
| 01:16:56 | <sjanssen> | class C a where type B a; class (S (B a)) => C_Invariant a -- might work |
| 01:19:29 | <Saizan> | i suppose Data.Binary.Put is much smarter than repeatedly using B.append if you want to concatenate a bunch of bytestrings? |
| 01:20:04 | <sjanssen> | class C_Invariant a => C a where type B a; class (S (B a)) => C_Invariant a -- need to restrain C |
| 01:20:44 | <dons> | Saizan: quite so. |
| 01:20:46 | <sjanssen> | Saizan: or B.concat |
| 01:20:53 | <dons> | or B.concat |
| 01:21:18 | <dons> | though Data.Binary.Put builds a lazy bytestring, so it's O(k) not O(n) as for B.concat |
| 01:21:44 | <sjanssen> | where k is O(n) :P |
| 01:21:56 | <dons> | n/32k == 1 :) |
| 01:22:48 | <dons> | constant factors matter! |
| 01:25:33 | <Saizan> | what's wrong with just class S (B a) => C a where type B a? |
| 01:26:19 | <sjanssen> | Saizan: good point :) |
| 01:26:26 | <sjanssen> | ACTION checks whether that works |
| 01:27:04 | <EvilTerran> | ISTR it did when i tried it |
| 01:27:18 | <Saizan> | compiles at least |
| 01:27:35 | <EvilTerran> | altho the type families support is still a bit buggy |
| 01:27:42 | <EvilTerran> | i've made the impossible happen a few times |
| 01:28:27 | <sjanssen> | funny how often the impossible happens |
| 01:28:40 | <glguy> | EvilTerran: that requires "FlexibleContexts" |
| 01:28:46 | <glguy> | so I just wondered if there was some other way |
| 01:28:55 | <sjanssen> | glguy: FlexibleContexts are well accepted |
| 01:29:08 | <dons> | yeah, that's a fairly mild extension |
| 01:29:17 | <dons> | though I bet Iavor complains anyway, glguy :) |
| 01:29:24 | <glguy> | oh well, translating my fundeps into ATSs 1. causes the type checker to loop in this case |
| 01:29:39 | <glguy> | 2. sucks at evaluating the ATSs away |
| 01:29:42 | <sjanssen> | you can't get much done without those and flexible instances |
| 01:29:43 | <glguy> | when asking for types |
| 01:29:51 | <glguy> | *revert* |
| 01:30:04 | <sjanssen> | sometimes you have to twist GHC's arm -- typeOf and show help |
| 01:30:11 | <glguy> | typeOf? |
| 01:30:38 | <sjanssen> | glguy: it would be a mistake to use type families in production code, IME |
| 01:30:44 | <glguy> | agreed |
| 01:30:46 | <sjanssen> | @type Data.Typeable.typeOf |
| 01:30:48 | <lambdabot> | forall a. (Typeable a) => a -> TypeRep |
| 01:30:57 | <sjanssen> | > typeOf (Just ()) |
| 01:30:58 | <lambdabot> | Maybe () |
| 01:31:23 | <sjanssen> | ACTION can't wait until GHC 6.10! |
| 01:33:34 | <glguy> | ATSs, other than being buggy, seem to make the instances more "verbose" too |
| 01:33:44 | <EvilTerran> | ACTION agrees with that one |
| 01:33:56 | <sjanssen> | oh? I've had the opposite experience |
| 01:34:11 | <EvilTerran> | i find the instance declerations using MPTCs+fundeps are much terser |
| 01:34:15 | <dcoutts_> | dons: n/32k ~= 1 but not quite 1, remember all the people trying to do the icfp dna thing using lazy bytestring, the linear factor bites in the end, it was faster with a finger tree |
| 01:34:21 | <dcoutts_> | dons: yes, polyparse needs investigating for performance with bytestring |
| 01:34:26 | <sjanssen> | glguy: are you doing pure type programming, or do the classes have methods? |
| 01:34:41 | <glguy> | sjanssen: methods |
| 01:34:53 | <EvilTerran> | however, the contexts are significantly more fiddly with MPTCs |
| 01:34:57 | <sjanssen> | too bad. "type family" and "type instance" are nice |
| 01:35:09 | <glguy> | sjanssen: for type level programing that is? |
| 01:35:14 | <sjanssen> | glguy: yeah |
| 01:35:15 | <glguy> | rather than defining method |
| 01:35:16 | <glguy> | ah |
| 01:35:48 | <EvilTerran> | yeah, the non-associated tysyns are significantly more succinct than having classes that serve only as relations on types |
| 01:35:51 | <sjanssen> | they're especially nice with infix type names |
| 01:36:14 | <sjanssen> | eg. type family m :+: n; type instance Zero :+: n = n |
| 01:37:10 | <sjanssen> | type instance Succ m :+: n = Succ (m :+: n) -- the equivalent in FD is quite ugly |
| 01:39:59 | <tehgeekmeister> | does anyone know if there's a haskell mode for emacs that uses ghci instead of hugs? |
| 01:40:25 | <dons> | sjanssen: do you know if there's a limit to the size of files you can create on an off the shelf mac filesystem? |
| 01:40:44 | <sjanssen> | dons: I've got no idea |
| 01:40:51 | <dons> | ok. |
| 01:41:28 | <sjanssen> | ACTION has left that shiny bloat behind :) |
| 01:41:41 | <jsnx> | dons: you mean UFS? |
| 01:41:42 | <shachaf> | dons: http://en.wikipedia.org/wiki/HFS+ says "8 Exbibytes". |
| 01:41:42 | <lambdabot> | Title: HFS Plus - Wikipedia, the free encyclopedia |
| 01:41:52 | <shachaf> | ACTION thought it was HFS+, anyway. |
| 01:42:03 | <yoshi> | anyone know of any examples online that would help me make a function of type String to a Lambda expression? |
| 01:42:06 | <tehgeekmeister> | shachaf: it is HFS+ |
| 01:42:22 | <dmwit> | yoshi: What? |
| 01:42:25 | <dons> | shachaf: thanks |
| 01:42:57 | <dmwit> | yoshi: You mean a two-argument function? |
| 01:43:24 | <tehgeekmeister> | dons: i remember reading something in the past about older versions of OSX having lower limits, whether this was because of using hfs instead of hfs+ or something else i can't tell you, but i do believe there is a smaller limit for some older versions. |
| 01:43:44 | <yoshi> | ex: "2x^3" -> (\x-> 2x^3) |
| 01:44:17 | <dons> | tehgeekmeister: like 2G small? |
| 01:44:27 | <shachaf> | tehgeekmeister: It looks like HFS+ is 2^63, HFS is 2^31 (bytes). |
| 01:44:34 | <dons> | ah |
| 01:44:35 | <tehgeekmeister> | dons: yes, it was 2GiB on HFS, not sure which OSX it's used in. |
| 01:45:20 | <dmwit> | yoshi: Ah, you'll have to parse it yourself, or use one of the existing hot-loading frameworks that call GHC. |
| 01:45:42 | <dmwit> | ?where parsec |
| 01:45:42 | <lambdabot> | http://www.cs.ruu.nl/~daan/parsec.html |
| 01:45:49 | <dmwit> | ?where hsplugins |
| 01:45:50 | <lambdabot> | http://www.cse.unsw.edu.au/~dons/hs-plugins/ |
| 01:46:12 | <dmwit> | I have to go, but good luck! |
| 01:46:26 | <ddarius> | sjanssen: Which shiny bloat did you replace it with then? Were you the one who switched to a BSD? |
| 01:47:09 | <sjanssen> | ddarius: I've been a Gentoo user for a long time |
| 01:47:24 | <sjanssen> | (running xmonad ie. no shine, no bloat) |
| 01:48:04 | <yoshi> | dmwit ah, that helps |
| 01:48:19 | <yoshi> | wow parsing this is going to be a pain |
| 01:48:23 | <jsnx> | sjanssen: i use gentoo, too -- i switched from fbsd |
| 01:49:51 | <EvilTerran> | yoshi, even if you don't want all of haskell, there's probably still an existing parser out there somewhere that'll do, say, simple arithmetic expressions |
| 01:50:03 | <EvilTerran> | if you *do* want all of haskell, hsPlugins is the way to go |
| 01:51:16 | <dons> | main = do h <- openFile "big" WriteMode L.hPut h (L.cycle " haskell ") |
| 01:51:19 | <dons> | is a fun program :) |
| 01:51:28 | <EvilTerran> | if you just want something quick-and-dirty, you can probably implement RPN in half an hour at most |
| 01:51:31 | <dons> | overloaded bytestring literals make me happy |
| 01:51:39 | <ddarius> | sjanssen: xmonad isn't shiny? |
| 01:51:47 | <dons> | its so shiny it burns |
| 01:52:12 | <sjanssen> | ddarius: nah, intentionally not shiny |
| 01:52:17 | <dons> | hah |
| 01:52:19 | <yoshi> | EvilTerran RPN ? |
| 01:52:31 | <dons> | its a different kind of bling |
| 01:52:35 | <sjanssen> | it is "shiny" in the Firefly sense |
| 01:52:52 | <chessguy> | dons, sounds like a tagline :) |
| 01:52:54 | <dons> | gun metal grey, versus blingy bling diamonds :) |
| 01:52:55 | <EvilTerran> | yoshi, "reverse polish notation" |
| 01:53:09 | <chessguy> | "XMonad. It's a different kind of bling." |
| 01:53:10 | <EvilTerran> | yoshi, like postscript, or retro calculators |
| 01:53:53 | <EvilTerran> | uses a stack; constants (say, numbers) are commands that just push that constant onto the stack, functions pop their arguments from the stack and push their result |
| 01:53:54 | <ddarius> | > let calc = foldr f [] . words where f "+" (x:y:xs) = x+y:xs; f "*" (x:y:xs) = x*y:xs; f n xs = read n:xs in calc "3 4 5 * +" |
| 01:53:59 | <lambdabot> | Exception: Prelude.read: no parse |
| 01:54:04 | <lucca> | EvilTerran: or forth |
| 01:54:10 | <EvilTerran> | okay :) |
| 01:54:27 | <sjanssen> | ddarius: don't forget words |
| 01:54:39 | <sjanssen> | oh, you've got it, nevermind |
| 01:55:17 | <ddarius> | > let calc = foldl' (flip f) [] . words where f "+" (x:y:xs) = x+y:xs; f "*" (x:y:xs) = x*y:xs; f n xs = read n:xs in calc "3 4 5 * +" |
| 01:55:33 | <lambdabot> | thread killed |
| 01:55:44 | <EvilTerran> | @vixen feeling a bit sluggish this evening? |
| 01:55:44 | <lambdabot> | isn't it obvious? |
| 01:55:54 | <EvilTerran> | > let calc = foldl' (flip f) [] . words where f "+" (x:y:xs) = x+y:xs; f "*" (x:y:xs) = x*y:xs; f n xs = read n:xs in calc "3 4 5 * +" |
| 01:55:55 | <lambdabot> | [23] |
| 01:56:20 | <EvilTerran> | @bot |
| 01:56:21 | <lambdabot> | :) |
| 01:57:17 | <EvilTerran> | yoshi, there you are; RPN in about 100 characters. the complexity of parsing comes down entirely to what you want. :) |
| 01:58:24 | <lucca> | errr, what is the difference between what ddarius and EvilTerran did? |
| 01:59:08 | <EvilTerran> | the local weather |
| 01:59:21 | <EvilTerran> | ...sometimes \bot seems to get stuck for no particular reason. |
| 01:59:42 | <lucca> | hmmmm |
| 02:00:47 | <blackdog> | well, i'm 8 lines into my haskell->java translation, and 120 lines of java code later... |
| 02:00:57 | <EvilTerran> | @vixen or is it just that you like me better than ddarius? |
| 02:00:58 | <lambdabot> | i'd say i like |
| 02:01:00 | <blackdog> | either java's a terrible language or i'm a terrible java programmer :) |
| 02:01:12 | <EvilTerran> | blackdog, well, the first's definitely true |
| 02:01:24 | <EvilTerran> | but they're not mutexive |
| 02:01:26 | <blackdog> | but it's OR, not XOR? :) |
| 02:01:49 | <blackdog> | go back to flirting with my bot |
| 02:01:50 | <notsmack> | blackdog: writing lots of lines of java is the hallmark of a /good/ java programmer |
| 02:01:55 | <ivanm> | blackdog: isn't the second a badge of pride? :p |
| 02:02:03 | <yoshi> | Haskell is the only language i know / have any interest in learning |
| 02:02:24 | <EvilTerran> | even the best-written java compresses really well with, say, gzip |
| 02:02:52 | <EvilTerran> | this is a bad thing; it shows there's a heck of a lot of redundancy |
| 02:03:07 | <blackdog> | i'm not gonna claim that java's a terribly good language for abstraction, but it's shocking to see how much the translation bloats out |
| 02:03:18 | <EvilTerran> | yoshi, that's not a perfect attitude either, mind |
| 02:03:38 | <EvilTerran> | you don't want to restrict your future job prospects by refusing to learn a more mainstream language ;) |
| 02:03:50 | <blackdog> | my haskell isn't doing anything wildly clever, either - couple of folds, maybe a list comprehension or two. |
| 02:04:14 | <dons> | type inference helps, I guess |
| 02:04:14 | <yoshi> | yeha touschet |
| 02:04:29 | <jcreigh> | HOF FTW! |
| 02:04:35 | <blackdog> | it's just sort of depressing - seems like the way to be a good java programmer is to type fast and be able to turn yourself into an efficient macro processor |
| 02:04:45 | <EvilTerran> | or even restrict your future mind-expansion prospects; there's other languages with features you can't experiment with in haskell |
| 02:04:50 | <blackdog> | dons: it isn't even that |
| 02:05:00 | <blackdog> | i could translate this into ruby or lisp line for line, i think |
| 02:05:05 | <EvilTerran> | blackdog, GoF = a set of macro definitions for brains ;) |
| 02:05:07 | <blackdog> | it helps when you're writing it the first time |
| 02:05:24 | <hpaste> | tehgeekmeister pasted "Type error I don't understand in flowchart dealio." at http://hpaste.org/4873 |
| 02:05:35 | <EvilTerran> | (ha ha only serious) |
| 02:05:55 | <blackdog> | EvilTerran: maybe i could try the Interpreter pattern - just embed a little language in there and call the actual program a resource file :) |
| 02:06:39 | <EvilTerran> | tehgeekmeister, (case')'s second parameter is of type String, but you're returning it as the fst of the pair, which is typed as (a) |
| 02:07:21 | <tehgeekmeister> | EvilTerran: yes, i realized right after i pasted it that i'd swapped the position of the arguments but didn't do the same in the type signature. it gives a new error once i correct that, however. annotating it now. |
| 02:07:22 | <EvilTerran> | tehgeekmeister, maybe you meant case' [] s x = (x, Nothing)? |
| 02:07:38 | <EvilTerran> | ah, okay |
| 02:11:01 | <tehgeekmeister> | hmm. writing the type signature makes it a lot easier to reason about what i'm doing wrong. i think i've got myself back on track. |
| 02:11:03 | <scook0> | blackdog: system("runhaskell")? ;) |
| 02:12:13 | <jsnx> | s/way you would few/way you would fight/ |
| 02:12:17 | <jsnx> | ack! |
| 02:12:44 | <jsnx> | i need to change the way irssi let's me know which window i'm typing in |
| 02:14:28 | <LoganCapaldo> | type signatures rule! |
| 02:22:44 | <jsnx> | yeah, i guess i could annotate all my chats :: #haskell [Char] |
| 02:26:42 | <tehgeekmeister> | can you pattern match in guards? |
| 02:26:54 | <jsnx> | tehgeekmeister: let's see |
| 02:27:04 | <sjanssen> | with an extension called "pattern guards" |
| 02:27:44 | <jsnx> | tehgeekmeister: you know, i can't figure out what that would look like... |
| 02:27:57 | <LoganCapaldo> | well you can always pattern match in guards no? |
| 02:28:20 | <tehgeekmeister> | i don't want to use any extensions, i can get by without it. |
| 02:28:43 | <LoganCapaldo> | > let f x | (case x of { 0 -> True ; _ -> False) } = True in f 0 |
| 02:28:43 | <lambdabot> | Parse error at ")" (column 46) |
| 02:28:49 | <LoganCapaldo> | oops |
| 02:28:56 | <LoganCapaldo> | > let f x | (case x of { 0 -> True ; _ -> False } ) = True in f 0 |
| 02:28:58 | <lambdabot> | True |
| 02:29:15 | <LoganCapaldo> | you just need pattern guards to do f x | (x,y) <- x = .. |
| 02:29:21 | <LoganCapaldo> | type stuff |
| 02:29:26 | <LoganCapaldo> | right? |
| 02:30:09 | <tehgeekmeister> | to match on a maybe, but i can just use the function maybe outside of the guard. |
| 02:30:39 | <LoganCapaldo> | f x | isJust maybeval |
| 02:30:43 | <LoganCapaldo> | ACTION shrugs |
| 02:43:31 | <MyCatVerbs> | Heehee. Interesting little consequence. |
| 02:45:04 | <MyCatVerbs> | I have a program that makes use of concurrent haskell to talk to network sockets and concurrently control other processes. |
| 02:45:43 | <MyCatVerbs> | Since threaded operation makes using GHC's profiler impossible, I've taken to use -Sstderr to check to make sure it doesn't have, say, any crazy space leaks. (None, thankfully.) |
| 02:46:37 | <MyCatVerbs> | Interesting thing is, because it uses so few CPU cycles (it's waiting on the network and the external programs pretty much 99.something% of the time)... |
| 02:47:18 | <MyCatVerbs> | ...and also because of the GHC feature where the garbage collector automatically takes a sniff around if the run-time has been idle for the last 0.3 seconds... |
| 02:48:01 | <MyCatVerbs> | ...it hits the garbage collector over and over again, practically every time it talks to the network (which has a human - slow - operator sat at the other end of it). |
| 02:48:37 | <MyCatVerbs> | So when I kill the program (to recompile, or whatever), the run time system proudly informs me that more than 80% of the CPU cycles spent by my program were all spent in the garbage collector. :D |
| 02:49:02 | <sjanssen> | hmm, can you shut that off with an RTS option? |
| 02:50:07 | <MyCatVerbs> | sjanssen: yes I can, (I ran through the documentation while looking for ways to check for space leaks), but I don't really feel the need to. |
| 02:51:00 | <MyCatVerbs> | sjanssen: I find it kind of cute, really. And fairly harmless, since it's at, oh, 0.09 seconds of CPU time used so far, over something like the last half hour or so, at least. =) |
| 02:54:15 | <MyCatVerbs> | sjanssen: for contrast, I have a C program running as part of the same (application|fucking mess), whose sole job is to cyclically read() from one FIFO and write() into another, at a rate of ~172 kilobytes/second, with a few seconds' buffering between the two. It uses a pair of pthreads threads, one for reading and one for writing, with (prettty durn simple) synchronization provided by POSIX semaphores. |
| 02:55:12 | <MyCatVerbs> | sjanssen: in the same time that my Haskell (controlling) program has eaten 0.09 (oh, call it 0.1-ish) seconds of CPU time, *that* perpetually-blocking-IO-muncher of a C program has eaten slightly over 1.2 seconds. All in all, who gives a flying turd? ^_^ |
| 02:55:21 | <sjanssen> | :) |
| 02:55:32 | <sjanssen> | threads are no fun in C |
| 02:56:42 | <sjanssen> | MyCatVerbs: have you tried re-implementing that part in Haskell? |
| 02:56:59 | <jsnx> | MyCatVerbs: yeah, it would be cool if it worked well |
| 02:57:42 | <MyCatVerbs> | sjanssen: ça depend. If you have only awful crap like mutexes and condition variables at your disposal, multithreading in C is made of fail, pain and woe. OTOH, using better constructs like semaphores in C is actually vaguely pleasant(-ish). But still nowhere near as fun as Haskell. |
| 02:57:51 | <sjanssen> | I think there is a particularly nice implementation with non-blocking IO and lazy ByteString waiting to be written |
| 02:57:54 | <MyCatVerbs> | sjanssen: no, but that's my next step, since I'd rather those *weren't* seperate programs. :) |
| 02:58:08 | <sjanssen> | MyCatVerbs: the program is simply 'cat'? |
| 02:59:10 | <MyCatVerbs> | sjanssen: pretty much, but with a nice big buffer between the input and output. Its input is from a (not particularly smooth) decoder and the output goes straight to the luser's headphones. :) |
| 02:59:14 | <dcoutts_> | MyCatVerbs: so you need an ordinary cat or a delaying cat? |
| 02:59:37 | <MyCatVerbs> | dcoutts_: delaying cat, with a fixed (but large) buffer size. |
| 02:59:37 | <dcoutts_> | a delaying cat, hmm. |
| 02:59:52 | <sjanssen> | dcoutts_: is hGetContents in ByteString non-blocking? |
| 03:00:02 | <sjanssen> | (lazy ByteString, of course) |
| 03:00:03 | <MyCatVerbs> | i.e. I don't want it slurping the whole damn input file in one go, that'll break things - like my brain, for one. |
| 03:00:07 | <dcoutts_> | sjanssen: in lazy bytestring it is non-blocking |
| 03:00:18 | <MyCatVerbs> | sjanssen, dcoutts_: I was thinking of using IOUArrays. |
| 03:00:45 | <sjanssen> | MyCatVerbs: I wouldn't bother with that, personally. Just use ByteString |
| 03:01:32 | <dcoutts_> | sjanssen: using lazy hGetContents would make it tricky since you'd not know how much input was available to be written out |
| 03:01:42 | <MyCatVerbs> | Since I don't want to do *anything* with the bytes passing through. If I use anything intended for text, there's a distinct risk that someone one day might equip the input libraries I depend on with automatic UTF-8 or UTF-16 (en|de)coding, which would potentially cause all Hell to break loose. :) |
| 03:01:53 | <dcoutts_> | I think you'd need to go one layer lower, to a collection of ByteString reads |
| 03:02:06 | <dcoutts_> | then you know how many you've got, ie how big your buffer is |
| 03:02:30 | <dcoutts_> | MyCatVerbs: ByteString IO guarantees to work in bytes not chars |
| 03:02:35 | <dcoutts_> | it's binary |
| 03:02:38 | <ddarius> | MyCatVerbs: As the name suggests, ByteString isn't text |
| 03:02:57 | <dcoutts_> | we'll add a unicode equivalent to bytestring some day when someone has time |
| 03:03:09 | <dcoutts_> | but it'll be complementary to ByteString |
| 03:03:37 | <dcoutts_> | though it'll make Data.ByteString.Char8 rather less needed |
| 03:04:47 | <MyCatVerbs> | ddarius: heh, I see. :) |
| 03:05:35 | <sjanssen> | MyCatVerbs: is there a danger that the 'in' pipe will suddenly output very quickly? |
| 03:05:36 | <MyCatVerbs> | dcoutts_: but I literally -never- touch that data, except to push it out on the other FIFO. So what would using ByteStrings gain me? |
| 03:05:48 | <sjanssen> | fast enough to require that the buffer size is limited |
| 03:06:43 | <MyCatVerbs> | sjanssen: oh definately. The in pipe is from an mp3 decoder (which on today's CPUs is orders of magnitude faster than real-time)... well, indirectly, but the stages in between are effectively irrelevant. |
| 03:07:46 | <dcoutts_> | MyCatVerbs: because it'll make the program a good deal shorter |
| 03:07:58 | <dcoutts_> | rather than manually managing a mutable buffer |
| 03:08:07 | <dcoutts_> | and the performance will be similar |
| 03:11:36 | <MyCatVerbs> | dcoutts_: Data.Array.IO exports hGetArray and hPutArray, which don't seem too troublesome. |
| 03:12:19 | <sjanssen> | this is because you're used to C |
| 03:12:23 | <MyCatVerbs> | dcoutts_: admittedly it leaves me holding the chain to allocate a set of buffers, but that's not particularly awkward. |
| 03:12:32 | <MyCatVerbs> | sjanssen: yep. |
| 03:13:38 | <dcoutts_> | MyCatVerbs: so the question is, is the more complex code worth the very slight performance gains |
| 03:14:00 | <dcoutts_> | it's perhaps difficult to predict. One can try both and benchmark :-) |
| 03:15:24 | <MyCatVerbs> | dcoutts_: the performance is irrelevant either way. The only difference I can see that I'd concievably care about is that ByteStrings will do a fair quantity of allocation, which'll piss off the garbage collector somewhat. :) |
| 03:15:57 | <dcoutts_> | MyCatVerbs: actually a trivial cat (main = interact) is quite speedy and doesn't stress the GC at all |
| 03:16:13 | <dcoutts_> | erm, main = B.interact id |
| 03:16:22 | <MyCatVerbs> | (A garbage collection pause long enough to cause audio stuttering *would* be a performance problem, though. I can't see that happening, though, so no worries.) |
| 03:16:36 | <dcoutts_> | MyCatVerbs: think about how many allocations you're doing |
| 03:16:58 | <dcoutts_> | you could count them on your hands, and since GC time is proportional to the number of allocations |
| 03:17:06 | <dcoutts_> | not their size |
| 03:17:14 | <dcoutts_> | then it's all fine |
| 03:19:41 | <MyCatVerbs> | dcoutts_: problem is that I potentially have about... two or three hundred megs (off the top of my head, estimated by looking at current memory usage and multiplying by five on the (pessimistic) assumption that the DJ has half a terrabyte of music on hand) of live data pretty much permanently resident in memory. |
| 03:20:47 | <dcoutts_> | > (300 * 1024 * 1024) / (64 * 1024) |
| 03:20:51 | <MyCatVerbs> | dcoutts_: also, I call map on that once every three minutes. :) |
| 03:20:56 | <lambdabot> | 4800.0 |
| 03:21:12 | <dcoutts_> | that number of 64k chunks |
| 03:21:17 | <MyCatVerbs> | dcoutts_: (that's song titles, filenames and other metadata, not songs themselves) |
| 03:21:28 | <dcoutts_> | oh right |
| 03:21:51 | <MyCatVerbs> | 300 megs is assuming a DJ with a biiiiig library. Heh. |
| 03:23:53 | <MyCatVerbs> | So I possibly don't want to fold the buffering into the Haskell program at all, since even a very small GC pause could totally piss in my cornflakes. So to speak. Whereas with the buffering (the only really urgently (soft) real-time component that I have to deal with) in an external program, the GC could happily go off into a corner for anything up to something on the other of one and a half CPU seconds, and I wouldn't care. |
| 03:24:13 | <MyCatVerbs> | ...wait, no, I'm being stupid. |
| 03:25:38 | <MyCatVerbs> | I'm using less CPU time than I can conveniently easily measure anyway, and that's with (unneccessarily) over-regular GC-ing. |
| 03:36:59 | <dons> | ?jion #gentoo-uy |
| 03:36:59 | <lambdabot> | Maybe you meant: djinn join |
| 03:37:03 | <dons> | ?join #gentoo-uy |
| 03:37:14 | <Korollary> | uy = ? |
| 03:37:15 | <sjanssen> | @djinn #gentoo-uy |
| 03:37:15 | <lambdabot> | Cannot parse command |
| 03:37:32 | <dons> | heh |
| 03:37:38 | <dons> | uruguay |
| 03:38:34 | <MyCatVerbs> | Why's \bot needed in #gentoo? |
| 03:38:47 | <MyCatVerbs> | (And, naturally, #gentoo-*) |
| 03:39:00 | <dons> | they like it? |
| 03:39:07 | <dons> | it was invited |
| 03:39:24 | <Korollary> | One channel at a time. Lambdabots uber alles. |
| 03:40:25 | <dons> | ?seen lambdabot |
| 03:40:25 | <lambdabot> | Yes, I'm here. I'm in #gentoo-uy, #friendly-coders, #fi.muni.cz, #curry, #scannedinavian, #gentoo-haskell, ##logic, #xmonad, #unicycling, #perl6, #parrot, #jtiger, #haskell-soc, #haskell-overflow, # |
| 03:40:25 | <lambdabot> | haskell-blah, #scala, #haskell, #ghc and #darcs |
| 03:41:19 | <BMeph> | What, no #clean? ;p |
| 03:42:14 | <dons> | 19:42 -- Irssi: #clean: Total of 1 nicks [0 ops, 0 halfops, 0 voices, 1 normal] |
| 03:42:35 | <dons> | clean should have been merged into the haskell effort in 1987 |
| 03:42:37 | <dons> | oh well |
| 03:47:40 | <jsnx> | dons: is it someone on the clean project (can not remember who) working on a haskell compiler extension? |
| 03:47:47 | <MyCatVerbs> | Ah, balls. |
| 03:47:50 | <jsnx> | s/is it/isn't/ |
| 03:48:23 | <MyCatVerbs> | dcoutts_: what would you reccommend doing to set things up such that if the read pipe is closed, the program automatically re-opens it again? |
| 03:49:01 | <MyCatVerbs> | dcoutts_: I have this nicely sorted in C, but naturally that way of doing things involves ridiculous quantities of mutable state. |
| 03:49:29 | <jsnx> | MyCatVerbs: can i look at your C? i've been trying to figure out how to do that in C for some time... |
| 03:49:32 | <dcoutts_> | MyCatVerbs: you'll be using a recursive function in IO so you can make the Handle a parameter |
| 03:49:50 | <dcoutts_> | so when you get an EOF, you can open a new Handle |
| 03:50:01 | <MyCatVerbs> | jsnx: ...my C is *really* ugly. Hehehhe. |
| 03:50:09 | <jsnx> | MyCatVerbs: that is okay |
| 03:50:14 | <jsnx> | MyCatVerbs: it never looks that good |
| 03:50:38 | <dcoutts_> | MyCatVerbs: how would you re-open a new pipe anyway? or do you mean make a new pipe? |
| 03:50:38 | <jsnx> | dcoutts_: depending on what kind of pipe he has, it can be way more complicated than that |
| 03:50:45 | <dcoutts_> | or is it a named pipe / socket? |
| 03:51:07 | <MyCatVerbs> | jsnx: the gist of it is: for (;;) { FILE* fd = fopen(input,"r"); while (!feof(fd)) { /* read from fd */ } } |
| 03:51:20 | <jsnx> | pipes send EOF after you read from them the first tiime |
| 03:51:30 | <jsnx> | then you open them again |
| 03:51:36 | <MyCatVerbs> | dcoutts_: it's a named pipe. FIFO! ^_^ |
| 03:51:59 | <jsnx> | however, if the process on the other end is dead, but waiting to be reaped, then you get SIGPIPE |
| 03:52:12 | <jsnx> | i have some python that deals with this... |
| 03:52:13 | <Cale> | dons: Ouch, did clean ever have much of an IRC channel though? |
| 03:52:21 | <MyCatVerbs> | jsnx: just that I'm putting the bit of the program that opens the file in a for-ever loop (for (;;), heehee), and the bit that actually slurps the data inside that loop too. |
| 03:52:50 | <jsnx> | MyCatVerbs: thanks, i was curious |
| 03:53:02 | <jsnx> | MyCatVerbs: so, the process writing into the pipe is not a child of the reader |
| 03:53:39 | <MyCatVerbs> | jsnx: no. There are a whole pile of different processes, being run from (what else?) a shell script. Of which my Haskell program is only one. :) |
| 03:53:40 | <Cale> | #define ever (;;) |
| 03:53:58 | <jsnx> | Cale: that is the path to madness |
| 03:54:12 | <MyCatVerbs> | Cale: #define EVAR (;;) /* fixed spelling */ |
| 03:54:19 | <MyCatVerbs> | ;) |
| 03:56:29 | <MyCatVerbs> | jsnx: oh and I also make sure not to lose track of each thread's position in the cyclic buffers when re-opening. :) |
| 03:56:45 | <MyCatVerbs> | jsnx: yes, I have had the program deadlock due to a bug of that description. ^_^ |
| 03:57:26 | <jsnx> | MyCatVerbs: the asynchronous message passing thing for dealing with closed processes is annoying |
| 03:57:47 | <jsnx> | i do not understand why can't look this stuff up in the process table |
| 03:58:15 | <jsnx> | my python script feeds a UNIX interactive application from a pipe, hiding EOF from it [https://svn.j-s-n.org/public/i-can-has-root/python/pipe-fitter.py ] |
| 03:58:30 | <dons> | Cale: not that i know of. |
| 03:59:00 | <jsnx> | so you can run `pipe-fitter.py sh` for example, and then talk to sh through the pipes |
| 03:59:15 | <jsnx> | it was not as simple or beautiful as i had hoped |
| 04:00:03 | <MyCatVerbs> | jsnx: handy. Luckily my problems are less complicated than yours, as I don't really have to worry too much (yet) about inter-process interactions. |
| 04:00:11 | <jsnx> | (it's called i-can-has-root because the possibilities for privilege escalation are big!) |
| 04:00:38 | <MyCatVerbs> | jsnx: Unfortunately, that's about to change, as the next two features on my TODO list will require some fair quantity of voodoo with System.Process, but oh well. ^_^ |
| 04:00:50 | <jsnx> | MyCatVerbs: i had this weird idea -- i'd have a web server, and whenever a user logged in it would immediately start a shell with this thing using their credentials |
| 04:01:08 | <jsnx> | voila -- user management courtesy of UNIX |
| 04:01:21 | <MyCatVerbs> | Eeep. |
| 04:01:28 | <jsnx> | whenever they wanted to change their password or whatever, it'd go through my "POSIX compatibility layer" |
| 04:01:43 | <jsnx> | the plan was to virtualize the system the users interacted with |
| 04:02:04 | <jsnx> | so that any mistakes would not allow them access to the servers with the actual database, LDAP directory and so on |
| 04:02:25 | <jsnx> | MyCatVerbs: it would be totally stupid outside of a distributed system |
| 04:02:32 | <MyCatVerbs> | Y'know first use I could see for that? Attach dfrotz to it and play "Pick up the phone booth and die" in your browser. |
| 04:03:36 | <jsnx> | MyCatVerbs: sure, there's that -- but I wanted for a CMS, with version control through mercurial and access control through POSIX groups |
| 04:04:18 | <jsnx> | the idea of reimplementing users, groups and file permissions really within a database really sickened me |
| 04:04:29 | <jsnx> | i'm a lazy coder ;) |
| 04:04:46 | <jsnx> | s/really within/within/ |
| 04:12:06 | <jsnx> | MyCatVerbs: you actually wouldn't need to use sh, either -- i'd make some kind of limited shell, and use that |
| 04:12:20 | <jsnx> | this would be the 'interpreter pattern' in a big way |
| 04:13:40 | <ricky_clarkson> | Ugh, patterns. |
| 04:18:26 | <skew> | ricky_clarkson: It's in quotes, it can't eat you |
| 04:18:45 | <ricky_clarkson> | Ah. |
| 04:19:02 | <ricky_clarkson> | '(0/:l)(_+_)' |
| 04:19:05 | <ricky_clarkson> | phew |
| 04:20:54 | <jsnx> | ricky_clarkson: that's a totally different kind of pattern |
| 04:21:41 | <skew> | Wow, that looks like some kind of Picasso |
| 04:21:47 | <jsnx> | ricky_clarkson: and i'm talking about giving each user on a web site a session with a limited shell, and then using POSIX groups as the basis for permission management |
| 04:21:55 | <jsnx> | not some OO thing |
| 04:22:03 | <ricky_clarkson> | It's Scala. |
| 04:22:10 | <jsnx> | ricky_clarkson: yes, i know |
| 04:22:26 | <ricky_clarkson> | I know you know. |
| 04:22:37 | <jsnx> | ricky_clarkson: lolz |
| 04:22:42 | <jsnx> | >:3 |
| 04:22:57 | <ricky_clarkson> | I wrote the in defence of it blog, and you commented on it in reddit. |
| 04:23:10 | <jsnx> | ricky_clarkson: really? |
| 04:23:10 | <skew> | and I thought the robot monkey operator was getting extreme |
| 04:23:22 | <jsnx> | ricky_clarkson: scala is the devil |
| 04:23:28 | <jsnx> | operators like that are evil |
| 04:23:31 | <jsnx> | use keywords |
| 04:23:48 | <jsnx> | because i do not want to learn any new operators, damn it |
| 04:23:48 | <ricky_clarkson> | It's funny that you're here then, with >>=, $, etc. |
| 04:23:54 | <jsnx> | lolz |
| 04:24:00 | <jsnx> | there are still many key words |
| 04:24:10 | <jsnx> | but they should have used | for >>= |
| 04:24:21 | <jsnx> | as for $, i'm not sure what |
| 04:24:32 | <skew> | The (0/:1) looks like some kind of cyclops |
| 04:24:35 | <BMeph> | ACTION performs an incantation to banish such arcane symbols back into J... |
| 04:24:37 | <ricky_clarkson> | So operators are ok as long as it's the ones you like. |
| 04:24:43 | <jsnx> | ricky_clarkson: no |
| 04:24:49 | <jsnx> | ricky_clarkson: as long as they are not new |
| 04:24:50 | <ricky_clarkson> | skew: It was actually an l, not a 1. |
| 04:25:09 | <jsnx> | ricky_clarkson: the UNIX ones are only okay because they have been around for forty years |
| 04:25:24 | <jsnx> | ricky_clarkson: if they were making that system today, there would be no excuse |
| 04:25:29 | <ricky_clarkson> | jsnx: So at some point in the past they were stupid? |
| 04:25:36 | <jsnx> | ricky_clarkson: no, they had requirements |
| 04:25:49 | <jsnx> | and now it's part of the lexicon -- no point in fighting that |
| 04:26:04 | <jsnx> | but introducing new operators is goofy and bad |
| 04:26:07 | <skew> | so by induction programming languages shouldn't use punctuation! |
| 04:26:09 | <ricky_clarkson> | There's no point in fighting new lexicon. |
| 04:26:14 | <jsnx> | ricky_clarkson: true |
| 04:26:28 | <jsnx> | ricky_clarkson: but i would encourage conservatism in introducing it |
| 04:26:39 | <jsnx> | skew: no |
| 04:26:47 | <ricky_clarkson> | Conservatism isn't very scientific. |
| 04:26:48 | <jsnx> | skew: they should use the usual punctuation |
| 04:26:54 | <ricky_clarkson> | I'd say if it's useful, use it. |
| 04:27:06 | <dons> | why do people stress about operators, but don't care about learning alphabetic function or method names? |
| 04:27:07 | <jsnx> | ricky_clarkson: and i say, if it's unclear, don't |
| 04:27:16 | <jsnx> | dons: it's much easier to learn the longer names |
| 04:27:32 | <dons> | shrug, its all just ascii after a while :) |
| 04:27:39 | <skew> | ricky_clarkson: for what it's worth, I liked the original Christopher Alexander book on patterns |
| 04:27:46 | <jsnx> | dons: the problem with operators is when they are equivocal -- mean half a dozen different things -- as opposed to univocal |
| 04:27:59 | <ricky_clarkson> | Learning the longer names takes less time, but after you've learned them, they're less useful. |
| 04:28:16 | <dons> | f `compose` g would make me cry every day :) |
| 04:28:28 | <jsnx> | dons: yeah, but f |
| 04:28:30 | <ricky_clarkson> | E.g., if ++ was called concatenate in Haskell, it would be far less useful. |
| 04:28:31 | <jsnx> | ack |
| 04:28:35 | <ivanm> | ACTION passes dons a box of tissues |
| 04:28:37 | <jsnx> | f |
| 04:28:50 | <dons> | a `cons` b `cons` nil |
| 04:28:55 | <jsnx> | f ∘ g is fine though |
| 04:29:02 | <dons> | yay symbols |
| 04:29:17 | <jsnx> | UTF8 should help us with lot of this stuff |
| 04:29:18 | <kmcallister> | f `o` g |
| 04:29:26 | <jsnx> | kmcallister: no need |
| 04:29:38 | <ricky_clarkson> | So as long as programmers never invent anything new, operators are ok, I see. |
| 04:29:59 | <jsnx> | ricky_clarkson: look, it's not as black and white as that, i agree |
| 04:30:03 | <MyCatVerbs> | jsnx: uhhh. Where the Hell am I going to find a keyboard that has that many symbols on it? :) |
| 04:30:13 | <jsnx> | MyCatVerbs: dude, use SCIM |
| 04:30:17 | <MyCatVerbs> | SCIM? |
| 04:30:20 | <jsnx> | MyCatVerbs: i don't have that many symbols |
| 04:30:27 | <jsnx> | MyCatVerbs: learn about computers |
| 04:30:29 | <ricky_clarkson> | I think the opposite way. Programmers should try using many new operators, to work out what works best for them. |
| 04:30:33 | <jsnx> | MyCatVerbs: they are awesome |
| 04:30:45 | <MyCatVerbs> | jsnx: :P |
| 04:31:09 | <monochrom> | Why is Haskell so successful? Why are we attracting all kinds of wimps? |
| 04:31:13 | <MyCatVerbs> | jsnx: X11's compose key functionality is nice, but I don't want to memorize that many keystrokes. |
| 04:31:15 | <jsnx> | MyCatVerbs: SCIM == (Smart Common Input Method) for chinese, LaTeX, german, whatever |
| 04:31:16 | <dons> | monochrom: heh. |
| 04:31:41 | <monochrom> | "Symbols are too hard. Let's go spelling." |
| 04:31:44 | <ricky_clarkson> | @bab en es morning |
| 04:31:45 | <MyCatVerbs> | jsnx: sudo apt-getting now. :) |
| 04:31:45 | <lambdabot> | mañana |
| 04:31:52 | <jsnx> | to type ∘ i actually type \circ |
| 04:32:00 | <jsnx> | like in TeX |
| 04:32:01 | <ricky_clarkson> | I still can't type ñ |
| 04:32:23 | <kmcallister> | MyCatVerbs, compose key is mostly mnemonic |
| 04:32:41 | <jsnx> | ricky_clarkson: i don't think there's much reason to make things short in programs, honestly |
| 04:32:52 | <jsnx> | ricky_clarkson: i don't think typing slows me much -- it's thinking that does that |
| 04:33:05 | <ricky_clarkson> | jsnx: Typing is less important than reading. |
| 04:33:17 | <ricky_clarkson> | I got my 110wpm through programming, typing is no barrier. |
| 04:33:19 | <jsnx> | ricky_clarkson: and i prefer, out of fear, i guess, that languages be verbose so i can read them |
| 04:33:22 | <MyCatVerbs> | jsnx: how much you can physically fit in one screenful of text in order to read it is important. |
| 04:33:40 | <ricky_clarkson> | jsnx: I think that's a fear to get over. |
| 04:33:47 | <monochrom> | MULTIPLY X BY Y INTO Z |
| 04:34:02 | <MyCatVerbs> | monochrom: ADD 1 TO COBOL GIVING COBOL |
| 04:34:03 | <jsnx> | MyCatVerbs: then maybe we should strive for languages which make full use of UTF8, instead of ones that reuse ASCII in weird ways |
| 04:34:18 | <monochrom> | APPLY M TO X BINDING RESULT TO Y. (y <- m x) |
| 04:34:38 | <ivanm> | jsnx: I think we should stick to ASCII, as it ensures widest possible usage/coverage |
| 04:34:44 | <ivanm> | since not everyone uses unicode |
| 04:34:48 | <MyCatVerbs> | jsnx: ... |
| 04:34:51 | <ivanm> | (and not everyone can) |
| 04:35:08 | <MyCatVerbs> | jsnx: well, wouldja lookit that? guile & ghc have already achieved that. :) |
| 04:35:08 | <monochrom> | Stick to binary. Then you can even Morse-code it. |
| 04:35:21 | <MyCatVerbs> | jsnx: and those just happen to only be the two that I can name offhand. I'm sure there are more. |
| 04:35:27 | <jsnx> | I HAS A VAR |
| 04:35:29 | <ivanm> | monochrom: short = 0, long = 1? :p |
| 04:35:34 | <jsnx> | UP VAR!!1 |
| 04:35:37 | <monochrom> | ivanm: "not everyone can use unicode" is a self-fulfilling prophecy. |
| 04:35:54 | <jsnx> | MyCatVerbs: ghc doesn't really, i don't think |
| 04:35:55 | <monochrom> | Wonder what came before ASCII? |
| 04:35:58 | <ricky_clarkson> | monochrom: Also, it's a fact. |
| 04:36:05 | <jsnx> | MyCatVerbs: you can't name things in chinese |
| 04:36:12 | <ivanm> | tbh, I find too many symbols in code to be too distracting from the code itself |
| 04:36:17 | <jsnx> | and where the capital sigma for summation, for example? |
| 04:36:32 | <ivanm> | can you imagine what would happen if people started assigning random symbols for function names? |
| 04:36:33 | <monochrom> | There was a time people were like "not everyone can use ascii, some of us are still stuck with ebcdic" |
| 04:36:34 | <MyCatVerbs> | jsnx: can't you? I know it now reads utf-8 string and character literals in properly... *checks* |
| 04:36:39 | <ivanm> | code would look just like gibberish! |
| 04:36:43 | <jsnx> | yeah, but `Σ list` would be cool |
| 04:36:44 | <ricky_clarkson> | Code should look exactly how the writer wants it to. |
| 04:36:58 | <ivanm> | jsnx: true.... |
| 04:37:19 | <MyCatVerbs> | jsnx: uhhh... ghc totally does let you use utf-8 in function names. :) |
| 04:37:20 | <jsnx> | ricky_clarkson: i have seen too many writers who don't want it to look like much... |
| 04:37:23 | <ivanm> | ricky_clarkson: well, yes, but normally code should be maintainable, obfuscated comp entries aside |
| 04:37:25 | <jsnx> | MyCatVerbs: no |
| 04:37:39 | <jsnx> | MyCatVerbs: you can't use character sets that don't have lower and upper case |
| 04:37:48 | <ricky_clarkson> | ivanm: If the writer wants it to be maintainable, yes. |
| 04:38:02 | <MyCatVerbs> | > let ø = (*2) in ø 5 |
| 04:38:03 | <lambdabot> | Illegal character ''\184'' |
| 04:38:03 | <lambdabot> | at "¸" (column 6) |
| 04:38:05 | <jsnx> | the writer must always make maintainable code |
| 04:38:09 | <jsnx> | even at the shell prompt |
| 04:38:12 | <MyCatVerbs> | Huh. |
| 04:38:13 | <oerjan> | what i wonder is, how do you distinguish functions and constructors in chinese? |
| 04:38:17 | <MyCatVerbs> | Works in 6.8.2's ghc, for me. |
| 04:38:29 | <jsnx> | oerjan: case is a bad way to distinguish, i think |
| 04:38:31 | <ricky_clarkson> | jsnx: Maintainability is not scientific. |
| 04:38:42 | <monochrom> | unicode λx→x+1 is gibberish? ascii asdf #$@% is not gibberish? |
| 04:38:51 | <ivanm> | MyCatVerbs: so is it IRC, lambdabot or ghc? |
| 04:39:02 | <jsnx> | oerjan: should use `:constructor` or something like that |
| 04:39:06 | <oerjan> | jsnx: that's my thought, but my question is, does ghc have any solution? |
| 04:39:11 | <MyCatVerbs> | ivanm: I think \bot runs with an old version of ghc |
| 04:39:13 | <ricky_clarkson> | Maintainable by someone who has the same background as you is different from maintainable by a random who doesn't even know the language. |
| 04:39:19 | <oerjan> | @version |
| 04:39:19 | <lambdabot> | lambdabot 4p581, GHC 6.6 (Linux i686 2.40GHz) |
| 04:39:19 | <lambdabot> | darcs get http://code.haskell.org/lambdabot |
| 04:39:25 | <ivanm> | MyCatVerbs: *nod* forgot about that |
| 04:39:26 | <jsnx> | oerjan: they are thinking of making a 'uppercase' character to lead in with, i'm told |
| 04:39:26 | <MyCatVerbs> | ivanm: and support for utf-8 in programs is new in 6.8, AFAIK. |
| 04:39:33 | <oerjan> | jsnx: ah |
| 04:39:44 | <jsnx> | MyCatVerbs: no, it's been around |
| 04:39:44 | <MyCatVerbs> | jsnx: heh. You have one point here. |
| 04:40:07 | <jsnx> | MyCatVerbs: which point? |
| 04:40:25 | <MyCatVerbs> | You could never write Σ list, since Σ is uppercase and Haskell demands that it can hence only be a data constructor. ;) |
| 04:41:14 | <monochrom> | Java already allows unicode source code. Can have Arabic variable names. That's the example in the Java books. |
| 04:41:33 | <ricky_clarkson> | Arabic. Making Java more backward. |
| 04:41:39 | <Hirvinen> | =D |
| 04:42:05 | <monochrom> | haha |
| 04:42:08 | <ricky_clarkson> | SPJ said something along the lines of "type constructors starting with uppercase is only a convention. An enforced convention" |
| 04:42:11 | <jsnx> | yeah, but what i mean is...the language should support Σ, ∘, → and so on |
| 04:42:24 | <jsnx> | as basic function names |
| 04:42:33 | <jsnx> | so that our code could look cool like that |
| 04:42:43 | <ricky_clarkson> | jsnx: I thought it did. |
| 04:42:55 | <jsnx> | ricky_clarkson: what does? |
| 04:43:03 | <jsnx> | ghc does not |
| 04:43:49 | <MyCatVerbs> | jsnx: 6.8 does. It really really does. |
| 04:44:03 | <jsnx> | MyCatVerbs: no, it does not -- you can not define a function Σ |
| 04:44:14 | <jsnx> | and there is no ∘ either |
| 04:44:39 | <ricky_clarkson> | Can you define a type constructor Σ? |
| 04:45:01 | <ricky_clarkson> | ACTION only has 6.6.1. |
| 04:46:15 | <jsnx> | ricky_clarkson: yes |
| 04:46:22 | <jsnx> | type Σ = int |
| 04:46:31 | <jsnx> | @type Σ = int |
| 04:46:33 | <lambdabot> | parse error on input `=' |
| 04:46:38 | <jsnx> | > type Σ = int |
| 04:46:38 | <lambdabot> | Parse error at "type" (column 1) |
| 04:46:42 | <jsnx> | bah |
| 04:46:50 | <jsnx> | on my GHCi it works |
| 04:46:52 | <monochrom> | type Σ a = [a] |
| 04:46:53 | <dons> | you need the unicode flag. and your own ghci. |
| 04:46:58 | <ricky_clarkson> | jsnx: so it does support UTF-8, as MyCatVerbs said, Σ is uppercase. |
| 04:47:06 | <monochrom> | ghci 6.8.1 is fine with that in a file. |
| 04:47:09 | <jsnx> | ricky_clarkson: you can define a function by that name, though |
| 04:47:20 | <jsnx> | ricky_clarkson: so i can't get what i am looking for |
| 04:47:33 | <ricky_clarkson> | Did you mean to say "can't"? |
| 04:47:42 | <jsnx> | ricky_clarkson: yes |
| 04:47:52 | <ricky_clarkson> | I can't define a function called BOB. |
| 04:47:58 | <jsnx> | ricky_clarkson: right |
| 04:48:06 | <jsnx> | ricky_clarkson: which it too bad |
| 04:48:40 | <ricky_clarkson> | I kind of agree, but it doesn't bother me. |
| 04:48:45 | <jsnx> | upper/lower case frustrate use of standard mathematical notation -- as well as alienate users of Chinese, Hebrew, &c. |
| 04:48:53 | <TSC> | You'd have to say σ = sum instead (: |
| 04:49:06 | <jsnx> | TSC: which is totally confusing |
| 04:49:41 | <ricky_clarkson> | Clearly what we need is a language where a ";)" at the end of a line makes the line into a comment. |
| 04:49:45 | <MyCatVerbs> | jsnx: as a bodge, consider writing fΣ for "sum on Foldable instance" |
| 04:49:48 | <jsnx> | because σ is used for other stuff |
| 04:49:54 | <MyCatVerbs> | ? |
| 04:50:21 | <jsnx> | in quantum mechanics, &c. |
| 04:51:42 | <jsnx> | anyways, i hope we at least understand one another, if we don't agree |
| 04:52:03 | <jsnx> | ricky_clarkson: there is a certain attraction to brevity |
| 04:52:14 | <jsnx> | it's just not that attractive to me at this point |
| 04:52:34 | <jsnx> | i hope scala makes headway in the webosphere |
| 04:52:37 | <ricky_clarkson> | jsnx: What attracts me is saying no more than is necessary. |
| 04:52:58 | <jsnx> | ricky_clarkson: i like to say no the new...and yes to the old |
| 04:53:10 | <jsnx> | s/no the/no to the/ |
| 04:53:22 | <sjanssen> | how does the ML family disambiguate constructors and variables? |
| 04:53:28 | <ricky_clarkson> | Hah, I just wrote some crap in Scala so that if I now type "hehe" at the end of the line the rest of the line isn't executed. |
| 04:53:47 | <dons> | hwn up on sequence again, http://sequence.complete.org/hwn/20080105 |
| 04:53:52 | <lambdabot> | Title: Haskell Weekly News: January 05, 2008 | The Haskell Sequence |
| 04:54:47 | <jsnx> | ricky_clarkson: lolz, your language is cool -- i hope you like it, jvm lover |
| 04:55:11 | <ivanm> | dons: so when are you going to update the name of the hwn to better reflect its release schedule? :p |
| 04:55:28 | <ricky_clarkson> | jsnx: I'm looking to move away from the JVM sometime. |
| 04:55:28 | <monochrom> | ML doesn't disambiguate. Once you write "datatype a = whee" then whee refers to that whee everywhere. |
| 04:55:36 | <ivanm> | btw, how _do_ you find all those blog posts? do you google for them, or just rely on planet.haskell? |
| 04:55:41 | <MyCatVerbs> | jsnx: gah. Where on Earth did you learn to use SCIM, please? I can find plenty of information on Google on how to set it up, but bugger all on how to make use of it. |
| 04:55:45 | <jsnx> | monochrom: i honestly prefer that approach |
| 04:56:23 | <ricky_clarkson> | monochrom: That approach makes it less obvious which 'functions' can be pattern-matched on. |
| 04:56:43 | <sjanssen> | monochrom: thanks for the info |
| 04:56:43 | <monochrom> | Eh? Ha. I can still have "fun whee x = x+1" afterwards! |
| 04:56:57 | <monochrom> | But afterwards, whee refers to the function. Shadowing. |
| 04:57:10 | <jsnx> | monochrom: shadowing is yucky |
| 04:57:47 | <sjanssen> | I suppose there are some nice examples where changes in library exports totally change the meaning of your code |
| 05:00:33 | <sjanssen> | I think Haskell took the right approach |
| 05:01:08 | <jsnx> | well, i think they almost did |
| 05:01:18 | <litb> | hello all |
| 05:01:38 | <jsnx> | if the had simply decided on an annotation, instead of upper/lower, it would be much nicer for many languages |
| 05:01:59 | <sjanssen> | eh |
| 05:02:14 | <hpaste> | tehgeekmeister pasted "How do I abstract maintaing state?" at http://hpaste.org/4875 |
| 05:02:15 | <litb> | i've a problem |
| 05:02:21 | <litb> | how can i convert from Int to Double ? |
| 05:02:29 | <monochrom> | @fromIntegral |
| 05:02:30 | <lambdabot> | Unknown command, try @list |
| 05:02:35 | <monochrom> | @quote fromIntegral |
| 05:02:35 | <ricky_clarkson> | fromIntegral |
| 05:02:35 | <lambdabot> | monochrom says: You've got an Int / But you want Double / Who do you call? / "fromIntegral!" |
| 05:02:41 | <sjanssen> | I think if we added magic upper and lower case sigils to Haskell, we'd be set |
| 05:02:47 | <dons> | ivanm: i use rss |
| 05:02:56 | <ivanm> | *nod* |
| 05:02:58 | <jsnx> | sjanssen: why not just a 'constructor' sigil? |
| 05:03:08 | <jsnx> | sjanssen: no point in pretending it's acutally about case |
| 05:03:31 | <sjanssen> | jsnx: I think most choices would add too much noise |
| 05:03:49 | <jsnx> | sjanssen: what about single quote? |
| 05:03:51 | <litb> | let h = (b - a) / fromIntegral anzahlIvl |
| 05:03:52 | <litb> | in h |
| 05:03:58 | <litb> | is that right? |
| 05:04:09 | <litb> | b and a are Double, anzahlIvl is Int |
| 05:04:18 | <litb> | the function returns Double |
| 05:04:19 | <monochrom> | Yes |
| 05:04:45 | <litb> | great, thanks |
| 05:05:51 | <jsnx> | '子 = '子 'Byte |
| 05:06:03 | <jsnx> | data '子 = '子 'Byte |
| 05:06:06 | <jsnx> | that's what i meant |
| 05:06:30 | <jsnx> | though you might not even need the 'data' part with the sigils |
| 05:06:39 | <sjanssen> | ugly |
| 05:06:53 | <totimkopf> | hi i want to learn haskell |
| 05:07:00 | <sjanssen> | ' might be the best character, but I don't think it looks very nice |
| 05:07:04 | <totimkopf> | i dont even know where to start, it all seems so daunting |
| 05:07:04 | <tehgeekmeister> | i know i could use the state monad to abstract the manual state threading, but what's more interesting to me is making it possible to use other data structures for the state, for example a map. I'm just using a list right now while i'm hacking it together, but in the end i really do want to use a map, and only some of the answers will need to be remembered. |
| 05:07:07 | <jsnx> | sjanssen: well, that's what it'd look like in Chinese no matter what, right? |
| 05:07:16 | <ricky_clarkson> | totimkopf: YAHT |
| 05:07:19 | <jsnx> | sjanssen: do you have a way to fix it for Chinese speakers? |
| 05:07:20 | <sjanssen> | jsnx: yep |
| 05:07:21 | <totimkopf> | whats YAHT? |
| 05:07:48 | <TSC> | totimkopf: Try some of the tutorials on haskell.org, like YAHT (http://en.wikibooks.org/wiki/Haskell/YAHT) |
| 05:07:49 | <lambdabot> | Title: Haskell/YAHT - Wikibooks, collection of open-content textbooks |
| 05:07:49 | <tehgeekmeister> | totimkopf: http://www.haskell.org/haskellwiki/Meta-tutorial has a load of good resources. |
| 05:07:51 | <lambdabot> | Title: Meta-tutorial - HaskellWiki |
| 05:08:00 | <jsnx> | sjanssen: please, elaborate -- assuming you can meet the requirement that they be able to reimplement everything in chinese |
| 05:08:07 | <totimkopf> | cool, thank you so much :) |
| 05:08:17 | <TSC> | totimkopf: Good luck! |
| 05:08:22 | <jsnx> | or at least translate all the libs into chinese |
| 05:08:35 | <jsnx> | and do some kind of translation back and forth |
| 05:08:44 | <jsnx> | (source to source in the latter case( |
| 05:08:52 | <sjanssen> | translating libs is an entirely different issue |
| 05:08:55 | <jsnx> | s/\($/)/ |
| 05:09:04 | <jsnx> | sjanssen: your solution, then? |
| 05:09:14 | <jsnx> | just do as much as you can, i guess |
| 05:09:49 | <sjanssen> | okay, translation for token Just is '? where ? is the Chinese for Just |
| 05:10:28 | <monochrom> | data T子 = C子 Byte. I don't think I mind that. "C" is a way to remind me C子 is a constructor. |
| 05:10:38 | <jsnx> | sjanssen: so chinese people have to use the sigils |
| 05:10:49 | <jsnx> | sjanssen: but users of lower/upper languages do not |
| 05:10:53 | <sjanssen> | jsnx: yes |
| 05:11:17 | <monochrom> | Interesting. |
| 05:11:19 | <jsnx> | sjanssen: of course, you can see what i don't like about that |
| 05:11:29 | <jsnx> | however, there is another problem |
| 05:11:38 | <sjanssen> | Haskell is *clearly* oriented towards English already, so I don't see it as a big problem |
| 05:11:42 | <jsnx> | CamelCase is an abomination |
| 05:11:52 | <jsnx> | and i do not want to use it |
| 05:11:58 | <sjanssen> | jsnx: consider the problems with 'then'' |
| 05:11:58 | <monochrom> | But camelCase is optional. |
| 05:12:14 | <skew> | jsnx: This is no more or less of a problem than requiring things to be identified with case already |
| 05:12:25 | <ricky_clarkson> | holes_in_identifiers_are_annoying |
| 05:12:26 | <sjanssen> | ACTION doesn't care about the CamelCase under_score bike shed |
| 05:12:29 | <jsnx> | monochrom: no, it isn't, all my type constructors have to start with uppercase letters |
| 05:12:38 | <jsnx> | sjanssen: it's important in some projects |
| 05:12:51 | <sjanssen> | jsnx: oh? |
| 05:12:52 | <skew> | jsnx: e.g. when binding C libraries with existing case conventions |
| 05:12:56 | <monochrom> | Learn Chinese. We don't need camel case. :) |
| 05:13:01 | <jsnx> | sjanssen: they mandate snake_style, because it helps non-english speakers separate the identitifiers |
| 05:13:11 | <litb> | hmm, if i want to do this: for each i in [1..anzahl] do value_so_far + someFunc i , with starting at 0 |
| 05:13:15 | <litb> | how would i do that? |
| 05:13:16 | <jsnx> | skew: yes, that too |
| 05:13:27 | <ddarius> | jsnx: And Snake_style fails to? |
| 05:13:40 | <jsnx> | ddarius: looks like shit, does it not? |
| 05:13:48 | <skew> | jsnx: you are quite welcome to use Super__Extra__Distinct__Words |
| 05:13:57 | <jsnx> | ugly, though |
| 05:14:05 | <litb> | i have this : foldl (+ (\i -> methode fnct (a + (fromIntegral i - 1) * h) (a + fromIntegral i * h))) 0 [1..anzahlIvl] |
| 05:14:08 | <ricky_clarkson> | litb: sum $ map someFunc [1..anzahl] |
| 05:14:09 | <monochrom> | litb: "do"? "value so far"? |
| 05:14:14 | <litb> | but it doesn't work, since i apply too many things to (+) |
| 05:14:22 | <sjanssen> | skew: you'll want to convert the names anyway, since most C libraries have prefixes that we manage with the module system instead |
| 05:14:34 | <jsnx> | i guess i feel that one little sigil is worth getting rid of all those capital letters in the middle |
| 05:14:41 | <litb> | (it's my try to implement a numeric integration) |
| 05:14:46 | <ricky_clarkson> | > sum $ map (*2) [1..10] |
| 05:14:48 | <lambdabot> | 110 |
| 05:15:07 | <litb> | > sum [1..5] |
| 05:15:08 | <lambdabot> | 15 |
| 05:15:10 | <litb> | nice |
| 05:15:16 | <skew> | jsnx: a little sigil -- like 'C' ? |
| 05:15:18 | <ricky_clarkson> | @src sum |
| 05:15:18 | <lambdabot> | sum = foldl (+) 0 |
| 05:15:25 | <jsnx> | and i rather hate the idea of discriminating large numbers of programmers -- chinese and indian |
| 05:15:30 | <jsnx> | skew: no, ' |
| 05:15:42 | <monochrom> | oleg'writes'like'this |
| 05:15:43 | <litb> | woo, partial application. damn that's nested in each other.. |
| 05:15:59 | <sjanssen> | jsnx: why care with the 'then' situation? |
| 05:16:04 | <jsnx> | data 'char = 'char whatever_chars_are_made_of |
| 05:16:13 | <jsnx> | sjanssen: what is the then situation |
| 05:16:14 | <jsnx> | ? |
| 05:16:14 | <ricky_clarkson> | litb: foldl is a function that returns a function that returns a function. |
| 05:16:22 | <sjanssen> | jsnx: all keywords are English |
| 05:16:30 | <jsnx> | sjanssen: that should be skinnable |
| 05:16:33 | <ricky_clarkson> | litb: foldl (+) 0 is a function that takes a list. |
| 05:16:39 | <litb> | i always forget that haskell supports that curring stuff natively |
| 05:16:44 | <skew> | jsnx: and the word order is left to right, top to bottom, oh noes |
| 05:16:49 | <ricky_clarkson> | @t foldl (+) 0 |
| 05:16:49 | <lambdabot> | Maybe you meant: tell temp thank you thanks thx time tiny-url todo todo-add todo-delete topic-cons topic-init topic-null topic-snoc topic-tail topic-tell type . ? @ ft v |
| 05:16:57 | <ricky_clarkson> | :t foldl (+) 0 |
| 05:16:57 | <lambdabot> | forall a. (Num a) => [a] -> a |
| 05:17:02 | <litb> | yeah, i see. i yet have to think haskell |
| 05:17:06 | <jsnx> | skew: actually, that has nothing to do with haskell |
| 05:17:14 | <jsnx> | skew: the word order is one after another |
| 05:17:36 | <jsnx> | i can just display it the opposite way if i'm writing hebrew or something |
| 05:18:05 | <skew> | hmm, I suppose layout might still work... |
| 05:18:11 | <jsnx> | skew: yes |
| 05:18:27 | <jsnx> | because the spaces would show up first in the stream, even if they were to the right |
| 05:18:30 | <sjanssen> | <- will point the wrong way!! |
| 05:18:41 | <jsnx> | and '\n' is '\n' |
| 05:18:58 | <jsnx> | sjanssen: uhm, yes |
| 05:19:06 | <jsnx> | that would be weird |
| 05:19:31 | <jsnx> | does not matter for chinese, though -- or japanese or urdu or whatever |
| 05:19:47 | <jsnx> | so we could get more, even if we couldn't get all of them |
| 05:19:58 | <jsnx> | and there are going to be lots and lots of indian and chinese programmers |
| 05:20:12 | <jsnx> | (chinese can be read in any of the four directions) |
| 05:20:36 | <monochrom> | Naw! No one has really done bottom-to-top yet. |
| 05:20:36 | <oerjan> | litb: another alternative which might sometimes look nicer is sum [someFunc i | i <- [1..anzahl]] |
| 05:21:01 | <jsnx> | there are famous poems in chinese written as blocks that can be read in any of the four directions |
| 05:21:32 | <oerjan> | especially if someFunc i can be expanded right there |
| 05:22:06 | <monochrom> | They are games for a few intellectuals and never been mainstream. |
| 05:22:40 | <jsnx> | monochrom: yeah, but the other three directions are |
| 05:22:45 | <monochrom> | Whereas top-to-bottom, left-to-right, right-to-left all had been mainstream in various periods of history. |
| 05:23:00 | <jsnx> | monochrom: though most things are written l->r today |
| 05:23:28 | <jsnx> | i, for one, welcome our new eastern overlords |
| 05:23:40 | <jsnx> | we should make haskell pleasing to them |
| 05:23:55 | <litb> | oerjan: oh, i see. that seems to be better |
| 05:24:12 | <jsnx> | before we run out of crappy financial products |
| 05:24:13 | <litb> | but is it also available broadly? |
| 05:24:37 | <oerjan> | sure |
| 05:30:32 | <skew> | jsnx: just who do you expect to object to a language requiring an arc glyph before constructor names but not a short stroke glyph? |
| 05:31:22 | <litb> | hm, one question |
| 05:31:28 | <litb> | what do you like more? $ or () ? |
| 05:31:40 | <ricky_clarkson> | . |
| 05:31:45 | <oerjan> | heh |
| 05:31:57 | <byorgey> | litb: use whatever you think is more readable. |
| 05:32:02 | <litb> | i mean, where should one use the one, and the other? like, () for arithmetrics, and $ for function binding or something? |
| 05:32:28 | <ricky_clarkson> | > sum . map (*2) [1..10] |
| 05:32:29 | <lambdabot> | Couldn't match expected type `a -> [a1]' |
| 05:32:51 | <ricky_clarkson> | > sum $ (*2) <$> [1..10] |
| 05:32:51 | <litb> | yeah, my integration works :) i actually get 0.6826894921370917 for ranges froom -1 to 1 for the normal deviation |
| 05:32:52 | <lambdabot> | 110 |
| 05:32:54 | <byorgey> | litb: IMO, you should start out using () everywhere. Then start using $ when that gets annoying and you know what parentheses you are avoiding by using it. |
| 05:33:42 | <litb> | i cee |
| 05:33:42 | <kmcallister> | wait, what kind of syntax is <$>? |
| 05:33:50 | <nelhage_owl> | :t <$> |
| 05:33:51 | <lambdabot> | parse error on input `<$>' |
| 05:33:53 | <ricky_clarkson> | litb: When you use f $ g $ stuff though, you can replace that with f . g $ stuff, afaik. |
| 05:33:57 | <byorgey> | kmcallister: it's an infix operator |
| 05:33:57 | <nelhage_owl> | :t (<$>) |
| 05:33:58 | <lambdabot> | forall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b |
| 05:34:00 | <ricky_clarkson> | :t (<$>) |
| 05:34:00 | <lambdabot> | forall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b |
| 05:34:01 | <litb> | is it the infix map ? |
| 05:34:04 | <byorgey> | kmcallister: it's a synonym for fmap |
| 05:34:05 | <ricky_clarkson> | It is. |
| 05:34:23 | <litb> | thats insane :) |
| 05:34:23 | <kmcallister> | ah, what module provides it? |
| 05:34:29 | <byorgey> | Control.Applicative |
| 05:34:43 | <byorgey> | litb: think of it as a generalization of map. |
| 05:35:58 | <oerjan> | > sum $ (^2) <$> [1..10] |
| 05:36:00 | <lambdabot> | 385 |
| 05:36:01 | <ricky_clarkson> | > map isJust $ Just 5 |
| 05:36:01 | <lambdabot> | Couldn't match expected type `[Maybe a]' |
| 05:36:07 | <ricky_clarkson> | > fmap isJust $ Just 5 |
| 05:36:07 | <lambdabot> | add an instance declaration for (Num (Maybe a)) |
| 05:36:12 | <oerjan> | litb: so that gives you a third option :) |
| 05:36:33 | <byorgey> | > fmap isJust $ Just Nothing |
| 05:36:33 | <hpaste> | litb pasted "nerdy stuff" at http://hpaste.org/4876 |
| 05:36:36 | <lambdabot> | Just False |
| 05:36:45 | <litb> | you think it's clear? |
| 05:36:55 | <ricky_clarkson> | byorgey: I don't get that. |
| 05:37:05 | <byorgey> | ricky_clarkson: don't get what? |
| 05:37:09 | <litb> | one thing that makes it scary to me is that the type of integriere is so big |
| 05:37:29 | <byorgey> | ricky_clarkson: the fmap 'lifts' isJust inside the Maybe value |
| 05:37:41 | <ricky_clarkson> | byorgey: Ah. |
| 05:37:49 | <byorgey> | ricky_clarkson: so fmap isJust $ Just foo ==> Just (isJust foo) |
| 05:37:59 | <byorgey> | @src Maybe fmap |
| 05:37:59 | <lambdabot> | fmap _ Nothing = Nothing |
| 05:37:59 | <lambdabot> | fmap f (Just a) = Just (f a) |
| 05:38:00 | <nelhage_owl> | > liftM isJust $ Just Nothing |
| 05:38:02 | <lambdabot> | Just False |
| 05:38:02 | <ricky_clarkson> | > fmap (*2) $ Just 4 |
| 05:38:04 | <lambdabot> | Just 8 |
| 05:38:08 | <ricky_clarkson> | > fmap (*2) $ Nothing |
| 05:38:09 | <lambdabot> | Nothing |
| 05:38:18 | <byorgey> | ricky_clarkson: yup, you've got it =) |
| 05:38:26 | <ricky_clarkson> | Can >> or >>= do the same thing somehow? |
| 05:38:41 | <nelhage_owl> | > Just Nothing >>= return . isJust |
| 05:38:41 | <litb> | if i say "data MyHelperFunction = ((Double -> Double) -> Double -> Double -> Double)" is that right? |
| 05:38:42 | <lambdabot> | Just False |
| 05:38:56 | <byorgey> | ricky_clarkson: sort of, yes. |
| 05:38:57 | <sjanssen> | litb: no, you need a constructor name too |
| 05:39:02 | <oerjan> | @src >> |
| 05:39:02 | <lambdabot> | m >> k = m >>= \_ -> k |
| 05:39:06 | <sjanssen> | litb: or perhaps you mean type rather than data |
| 05:39:16 | <litb> | yes, i mean a shortcut for a long type |
| 05:39:18 | <byorgey> | ricky_clarkson: x >>= k = join (fmap k x), so there's an fmap involved |
| 05:39:40 | <ricky_clarkson> | I see, thanks. |
| 05:39:47 | <byorgey> | ricky_clarkson: so in particular, x >>= return . f is the same as fmap f x |
| 05:40:02 | <mauke> | @src liftM |
| 05:40:03 | <lambdabot> | liftM f m1 = do { x1 <- m1; return (f x1) } |
| 05:40:15 | <byorgey> | aka liftM =) |
| 05:40:30 | <litb> | ah i see, sorry to ask that silly question dudes |
| 05:40:36 | <ricky_clarkson> | Is m1 in that a monad? |
| 05:40:41 | <ricky_clarkson> | :t liftM |
| 05:40:42 | <lambdabot> | forall a1 r (m :: * -> *). (Monad m) => (a1 -> r) -> m a1 -> m r |
| 05:40:51 | <byorgey> | litb: no such thing =) |
| 05:41:11 | <sjanssen> | ricky_clarkson: it has a monadic type, yes |
| 05:41:31 | <ricky_clarkson> | litb: This is a much better channel the one you're used to seeing me in. |
| 05:41:35 | <ricky_clarkson> | +than |
| 05:43:45 | <litb> | lolz, youre right. this seem to be very helpful :) |
| 05:44:19 | <ricky_clarkson> | In x1 <- m1, if m1 was of type IO String, would x1 be the String? |
| 05:44:50 | <byorgey> | ACTION gives litb a golden lambda with the inscription, "welcome to #haskell"! |
| 05:45:07 | <byorgey> | ricky_clarkson: yup. |
| 05:45:25 | <byorgey> | ricky_clarkson: it would have type String, at least. |
| 05:45:27 | <jsnx> | skew: what is an 'arc' glyph? |
| 05:45:42 | <ricky_clarkson> | It seems odd that you don't write return (f (<- m1)) or something. |
| 05:45:53 | <byorgey> | ricky_clarkson: it might not be "the" String since the monadic value m1 might contain no Strings, or lots of strings |
| 05:45:54 | <litb> | ACTION places it right beside his bed |
| 05:46:18 | <byorgey> | ricky_clarkson: actually, I think that syntax has been proposed at one time or another. |
| 05:46:37 | <byorgey> | it's trickier to get right than you think. |
| 05:46:51 | <jsnx> | skew: my objection is to any kind of sigil in front of function names -- like i want to call a function Σ |
| 05:47:13 | <jsnx> | skew: or some random chinese thing |
| 05:49:17 | <skew> | jsnx: a mark is just a mark, whether it's ' or C. I don't see how something like ' is much of an improvement |
| 05:49:30 | <jsnx> | skew: the C is okay |
| 05:50:09 | <jsnx> | but, i rather like that you can 'pun' data and constructors |
| 05:50:31 | <jsnx> | data Noses a b = Noses Int Int |
| 05:50:37 | <litb> | > type Funktion Tp = Tp -> Tp |
| 05:50:37 | <lambdabot> | Parse error at "type" (column 1) |
| 05:50:41 | <litb> | hmm |
| 05:50:48 | <jsnx> | whereas the C seems to say 'Constructor' |
| 05:51:03 | <jsnx> | and i just want a sigil to say 'not a value' |
| 05:51:08 | <byorgey> | litb: that won't work in lambdabot, but that's valid Haskell |
| 05:51:22 | <mauke> | litb: variables must start with a lowercase letter |
| 05:51:31 | <litb> | ah, that's the solution |
| 05:51:37 | <byorgey> | oh, right, what mauke said =) |
| 05:52:21 | <mauke> | template<typename T> struct Funktion : Typedef<T (T)> {}; |
| 05:52:36 | <byorgey> | gah |
| 05:54:07 | <mauke> | this assumes you already have template<typename T> struct Typedef { typedef T t; }; somewhere |
| 05:55:35 | <byorgey> | mauke: I assure you that I do not. |
| 05:55:50 | <mauke> | haha |
| 05:59:50 | <u_quark> | hello: with Alex v.2.1.0 i don't get {-# LINE XX "lexer.x" #-} in the produced lexer.hs, in the code for the tokens... is it a bug (maybe solved in 2.2) ? |
| 06:06:13 | <litb> | hm, now i want to use that integrate function , and want to integrate with at least 10^-3 , 10^-6, ... accuracy and display the result for each accuracy |
| 06:07:01 | <litb> | so, i created a tuple acc=(10^(-3), 10^(-6), ....) . then i tried to loop over it, and think i should use map to do that. but i ended up with compile errors |
| 06:07:10 | <Korollary> | goalieca: That was an all star goal Luongo gave up in regulation. |
| 06:07:34 | <litb> | ah, wait. i have a tuple, not a list... |
| 06:07:37 | <goalieca> | the trick to beating luongo... make him skate |
| 06:07:53 | <goalieca> | islanders just shot every time except that once |
| 06:25:24 | <JohnDoeKyrgyz> | Can anyone suggest what might be causing this error? |
| 06:25:27 | <JohnDoeKyrgyz> | Cannot build superclass instance |
| 06:25:27 | <JohnDoeKyrgyz> | *** Instance : Board TicTacToe |
| 06:25:27 | <JohnDoeKyrgyz> | *** Context supplied : () |
| 06:25:27 | <JohnDoeKyrgyz> | *** Required superclass : Show TicTacToe |
| 06:26:07 | <mauke> | sounds like TicTacToe isn't an instance of Show |
| 06:26:13 | <monochrom> | You need to code up a Show instance for TicTacToe? |
| 06:26:26 | <monochrom> | You may using "deriving" or you may hand-code it? |
| 06:27:11 | <JohnDoeKyrgyz> | Here is the definition for tictactoe |
| 06:27:12 | <JohnDoeKyrgyz> | newtype TicTacToe = TicTacToe (Matrix Space) |
| 06:27:24 | <JohnDoeKyrgyz> | Matrix, and Space are members of show |
| 06:28:22 | <mauke> | but your newtype isn't |
| 06:28:47 | <BMeph> | As monochrom said, "You need to code up a Show instance for TicTacToe" |
| 06:29:32 | <JohnDoeKyrgyz> | Hmn, Matrix already has a show instance. I thought that behaviour would be inherited. |
| 06:30:20 | <JohnDoeKyrgyz> | instance Show a => Show (Matrix a) where |
| 06:30:21 | <JohnDoeKyrgyz> | show (Matrix x) = intersperse (map (\x -> intersperse x "|") x) hBorder |
| 06:30:21 | <JohnDoeKyrgyz> | where hBorder = "\n" ++ foldr (++) [] (replicate (length x) "--") ++ "-\n" |
| 06:30:25 | <litb> | hm, when i have [ someLongFunction i | i <- [1..], someLongFunction i > 50 ] how would i do this? |
| 06:30:28 | <nelhage_owl> | Part of the point of newtypes is to let you have different instance definitions for things that are structurally the same type with no performance loss, so newtypes don't inherit any instances by default |
| 06:30:42 | <litb> | so that i only have to enter that function once somewhere beside that? |
| 06:31:31 | <JohnDoeKyrgyz> | That makes sense, but how do I use the existing show routine for the Matrix definition for TicTacToe? |
| 06:31:32 | <monochrom> | let f = blahbhah in [ f i | i <- [1..], f i > 50 ] |
| 06:31:58 | <mauke> | litb: filter (> 50) . map someLongFunction $ [1 ..] |
| 06:32:23 | <mauke> | [ x | i <- [1 ..], let x = f i, x > 50 ] |
| 06:32:24 | <nelhage_owl> | If you're using ghc extensions, you can just add 'deriving (Show)' to the newtype declaration |
| 06:32:26 | <monochrom> | oh, even better |
| 06:32:36 | <mauke> | nelhage_owl: that doesn't need any extensions |
| 06:32:40 | <mauke> | Show is autoderivable |
| 06:32:42 | <nelhage_owl> | Oh, right |
| 06:32:55 | <nelhage_owl> | If it were something other than Show (or a few others), you'd need them. |
| 06:33:24 | <skew> | deriving Show for a newtype always draws it with the newtype constructor |
| 06:33:35 | <JohnDoeKyrgyz> | Do I have to do something to make TicTacToe 'autoderive' show from Matrix? |
| 06:33:54 | <mauke> | <monochrom> You may using "deriving" or you may hand-code it |
| 06:35:06 | <JohnDoeKyrgyz> | Thanks again! |
| 06:40:02 | <litb> | > 10^(-4) |
| 06:40:12 | <lambdabot> | Exception: Prelude.^: negative exponent |
| 06:40:17 | <litb> | hm |
| 06:43:07 | <mauke> | > 10^^(-4) |
| 06:43:08 | <lambdabot> | 1.0e-4 |
| 06:43:19 | <litb> | ah |
| 06:43:19 | <mauke> | > 10^^(-4) :: Rational |
| 06:43:22 | <lambdabot> | 1%10000 |
| 06:43:32 | <litb> | nice |
| 06:44:12 | <pa-ching> | Hmm, is it possible to alias a type constructor? |
| 06:44:27 | <pa-ching> | I could just make a function, but I kinda want to keep the caps |
| 06:44:44 | <pa-ching> | er, data constructor* |
| 06:45:11 | <byorgey> | pa-ching: no |
| 06:47:36 | <pa-ching> | Darn, I guess this change will have to leak out of the module then... |
| 06:47:58 | <pa-ching> | I guess you can aoivd that by wrapping everything, but... |
| 06:56:07 | <glguy> | Why must type synonyms always be fully applied? |
| 06:56:29 | <glguy> | It would seem that partially applied type synonyms would solve the need for type level lambdas and parameter reordering |
| 06:57:22 | <glguy> | data T a b = U a b ; type L a b = T b a ; now L Int can be used where a *->* is needed |
| 06:57:48 | <bos> | glguy: wha? |
| 06:58:02 | <bos> | something like this works fine: type Poo = State StdGen |
| 06:58:29 | <glguy> | right, because the parameter was already at the end |
| 06:58:47 | <glguy> | but for: SimilarToState some_monad StdGen , say |
| 06:58:51 | <glguy> | there's no way |
| 06:59:00 | <bos> | ah |
| 06:59:00 | <glguy> | err |
| 06:59:05 | <glguy> | no necessarily some_monad |
| 06:59:11 | <glguy> | some_type |
| 06:59:37 | <glguy> | where type P a = SimilarTo a StdGen |
| 06:59:41 | <glguy> | would give the desired result |
| 07:00:05 | <glguy> | hmm |
| 07:00:08 | <glguy> | maybe it does then |
| 07:00:22 | <glguy> | you just need a unique "type" declaration for each use |
| 07:03:39 | <skew> | glguy: that would be the problem, allowing type level synonyms would give you unrestricted type lambdas |
| 07:04:06 | <skew> | and make typechecking not terminate |
| 07:11:46 | <ddarius> | type S f g x = f x (g x); type K a b = a |
| 07:21:18 | <dons> | lovely read, 20 years on. though with only a little awkwardness in how little has changed, |
| 07:21:21 | <dons> | http://programming.reddit.com/info/64yka/details |
| 07:21:26 | <dons> | "A critique of Abelson and Sussman or why calculating is better than scheming" :: PDF |
| 07:26:51 | <glguy> | zomg pdf warning |
| 07:26:53 | <sclv> | back to an earlier discussion, I reiterate my proposal for colorHaskell. |
| 07:27:20 | <dons> | these 3 posts are just depressing, |
| 07:27:22 | <dons> | * * C# LINQ v Python for List Processing |
| 07:27:22 | <dons> | * Python vs C# 3.0: Tuples vs. Anonymous Types |
| 07:27:22 | <dons> | * Python vs Scheme: Simple list comprehensions |
| 07:27:30 | <dons> | now i know how the lisp guys feel |
| 07:27:43 | <glguy> | how? |
| 07:28:09 | <glguy> | old? |
| 07:28:18 | <skew> | don't get all old and bitter! |
| 07:28:20 | <sclv> | classes are red. type constructors are blue. infix is either green or orange depending on associativity. |
| 07:28:35 | <glguy> | What is KRC? |
| 07:28:51 | <glguy> | sclv: it's called syntax highlighting and it's here today! |
| 07:29:07 | <skew> | Kent Recursive Calculator, apparently |
| 07:29:09 | <sarehu> | what about infix type constructors? |
| 07:29:11 | <sclv> | glguy: i mean instead of case conventions. |
| 07:29:12 | <dons> | predecessor to haskell, influenced Orwell |
| 07:29:13 | <sclv> | like colorForth. |
| 07:29:25 | <glguy> | sclv: oh, that? yeah, that'd be awful |
| 07:29:30 | <dons> | (wadler's pre-haskell) |
| 07:29:36 | <sarehu> | And what about infix multiparameter type classes? :) |
| 07:29:56 | <glguy> | sclv: when I write code out I don't want to need 4 colors of ink |
| 07:30:08 | <dons> | "Some readers may object that languages like KRC or Miranda are not "credible" for teaching, because they are not used in the real world." is also kind of depressing |
| 07:30:33 | <sclv> | sarehu: blend the colors! |
| 07:30:39 | <bos> | meh. taking reddit seriously requires some zoloft. |
| 07:30:59 | <bos> | i loved the java rant from the ada people yesterday. |
| 07:31:06 | <dons> | that was awesome |
| 07:31:08 | <skew> | sclv: the : convention for infix symbols also applies to typeclasses |
| 07:31:09 | <bos> | "the terrorist threat requires ada!" |
| 07:31:21 | <dons> | damn straight. your either with us, or ill-typed! |
| 07:31:30 | <bos> | it was better than awesome. it was alsome! |
| 07:31:40 | <dons> | hah |
| 07:33:42 | <litb> | hm, strange thing |
| 07:34:25 | <hpaste> | litb pasted "strange" at http://hpaste.org/4877 |
| 07:34:34 | <glguy> | bos: link? |
| 07:34:40 | <glguy> | need I just search proggramming.? |
| 07:34:46 | <bos> | glguy: it's all over slashdot, programming, etc |
| 07:34:49 | <glguy> | ok |
| 07:35:06 | <bos> | ACTION had a fun lunch with augustss today |
| 07:35:25 | <litb> | it integrates for the given max blurriness fine, but when i try to integrate the sin function, it never happens that it exits the loop in intMitEpsilon |
| 07:35:31 | <bos> | nice to have a few haskellers in town. i caught a glimpse of oleg and several others, too. |
| 07:35:42 | <glguy> | That Defense Dept. paper dons linked to today mentioned that Ada was the language "par excellence of software engineering" |
| 07:35:55 | <litb> | but when i call int directly whithout using intMitEpsilon, it just works |
| 07:35:55 | <bos> | glguy: that's the one |
| 07:36:29 | <bos> | ada isn't all that bad a language. it's like ML with all the functional stuff bludgeoned out and replaced with ad-hoc constructs instead. |
| 07:36:33 | <litb> | so there must be something in this thing: (head (let i = (\y -> (int stdNormvtl simpsonQuadratur 0 1 y)) in [ i y | y <- [1..], abs (ref - i y) <= eps ])) that makes it never end the loo |
| 07:36:37 | <litb> | p |
| 07:36:58 | <dons> | ada is serious like that :) |
| 07:37:20 | <Japsu> | ADA - SERIOUS BUSINESS |
| 07:37:38 | <Japsu> | ACTION wants Ada's numeric range subtypes in Haskell |
| 07:38:17 | <bos> | Japsu: that's doable, efficiently even. |
| 07:38:33 | <sclv> | same problem as with ada though: you end up with runtime checking. |
| 07:38:44 | <Japsu> | bos: you mean like "type Foo is Integer range (35, 42)"? |
| 07:38:58 | <bos> | Japsu: not as succinctly. |
| 07:39:29 | <bos> | Japsu: but with a newtype and a rederivation of Num and Bounded, sure. |
| 07:39:51 | <sclv> | someone could probably write a neat lib to encapsulate all that though. |
| 07:40:04 | <sclv> | but again, what do you do when you go out of bounds? |
| 07:40:15 | <bos> | you could write a bit of TH to do the code generation. |
| 07:40:32 | <Japsu> | hmm, TH was what I was thinking, too |
| 07:40:53 | <bos> | ada raises a constraint_error exception. |
| 07:41:37 | <sclv> | right: but now that means that every numeric operation, almost, is potentially undefined |
| 07:41:45 | <sclv> | which is very un-haskell. |
| 07:42:03 | <bos> | the advantage with bounded subtypes being baked into the language is that the optimiser can prove that some checks don't need to be performed. |
| 07:42:26 | <sclv> | ada's compiler is smart like that? |
| 07:42:42 | <bos> | i'd expect so, it's a common enough thing to need to do. |
| 07:43:16 | <bos> | that's the sort of thing compilers do when there's language-level enforcement of array bounds, for example. |
| 07:44:54 | <dons> | i wonder if there's something in the statically-checked dimensions, or numbers, libs that get us there? though we do have types for some of these things already (e.g. E6 E12 Fixed) |
| 07:45:09 | <dons> | all done via Num instances |
| 07:45:39 | <dons> | dimensional is one of the cooler haskell libs around, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dimensional-0.7.2 |
| 07:45:40 | <lambdabot> | http://tinyurl.com/2obfql |
| 07:45:57 | <dons> | "the library is designed to, as far as is practical, enforce/encourage best practices of unit usage" |
| 07:46:01 | <dons> | that's the Ada way :) |
| 07:46:25 | <dons> | encourage and enforce. mm, maybe that should be haskell's slogan |
| 07:47:42 | <bos> | dons: have you looked at adam langley's Cont-based Binary hack? |
| 07:47:50 | <sclv> | I came up with an idea for a statically typed data (as opposed to codata) type the other day. simple enough: just permit construction only through valid enumerations and only allow operations that produce something of the same or smaller size. |
| 07:47:51 | <bos> | it's super-nice. |
| 07:48:13 | <dons> | bos, yeah, looks like we might be getting something of an api together here |
| 07:48:23 | <dons> | i'd like to merge it back in, esp. if he's using it for real stuff |
| 07:48:31 | <bos> | dons: i'll be needing it for real stuff. |
| 07:48:51 | <bos> | tcp stream reconstruction based on captured link-level packets. |
| 07:49:03 | <dons> | so the main thing is strict parsing, with the ability to resume parsing? |
| 07:49:29 | <dons> | i'm not sure whether this should be a separate package or not. |
| 07:50:34 | <bos> | not the strictness, but the ability to resume parsing without having to restart. |
| 07:50:55 | <bos> | it would be really nice to have it in the same package. it's another side of the same coin. |
| 07:51:26 | <bos> | (certainly, in my case, the strictness is *nice*. i can use strict packet chunks to construct a pair of lazy tcp bytestrings..) |
| 07:51:49 | <bos> | (but the lazy parser just requires a bit of extra unwrapping and rewrapping.) |
| 07:52:20 | <dons> | yeah, that's a good argument - if its just going to be a different api to the underlying binary mechanism, fair enough to have both interfaces |
| 07:53:05 | <bos> | right. |
| 07:53:23 | <bos> | be interesting to see what effect the addition of Cont has on performance. |
| 07:54:22 | <dons> | well, Cont can be inlined too (the original Binary was Cont, that got unfolded) |
| 07:55:14 | <bos> | right. |
| 07:55:36 | <bos> | and we've seen that judicious use of Cont can speed the use of other monads. |
| 08:11:57 | <bparkis> | wow |
| 08:12:43 | <Korollary> | wow |
| 08:12:50 | <glguy> | ?yow |
| 08:12:50 | <lambdabot> | Is this an out-take from the "BRADY BUNCH"? |
| 08:12:58 | <ADEpt> | NO WAI |
| 08:13:57 | <u_quark> | can anyone tell me what is this---> data AlexPosn = AlexPn !Int !Int !Int ??? |
| 08:14:36 | <Lemmih> | u_quark: Three strict ints. |
| 08:16:00 | <C-Keen> | <interactive>:1:40: Not in scope: `main' <- this is not very helpful, maybe an indentation error? |
| 08:16:54 | <Lemmih> | C-Keen: Are you not calling 'main' or do you think 'main' should be in scope? |
| 08:17:19 | <C-Keen> | Lemmih: it definitely should be in scope as it is there |
| 08:17:59 | <psi> | i think that has happened to me a few times when i've been running through emacs |
| 08:18:14 | <C-Keen> | ah a reload solved it |
| 08:18:16 | <C-Keen> | strange |
| 08:18:59 | <psi> | then again i'm always running through emacs so... |
| 08:19:13 | <u_quark> | Lemmih: a tutorial to Strict types? |
| 08:20:05 | <litb> | return $ map (\x -> let erg = intMitEpsilon sin simpsonQuadratur x 2.0 0 pi in putStrLn ("Erg: " ++ (show erg) ++ "; Abw.: " ++ (show (2-erg)))) |
| 08:20:15 | <litb> | someList |
| 08:20:22 | <litb> | why doesn't that output anything ? |
| 08:20:30 | <litb> | evne though i do putStrLn there? |
| 08:20:31 | <Lemmih> | u_quark: I don't think it's complex enough to merit a tutorial. |
| 08:21:15 | <u_quark> | xmmm anyway tnx Lemmih |
| 08:21:43 | <Lemmih> | litb: That's not enough. You also have to run 'em. |
| 08:21:52 | <Lemmih> | u_quark: You can safely ignore them. |
| 08:22:33 | <litb> | Lemmih: doesn't that run it? i thought it runs the putStrLn, and in the returned list, it saves the return of putStrLn then |
| 08:23:12 | <litb> | basicially, what i want is just iterating through the list and do someaction with each item. maybe i do it all wrong now |
| 08:23:43 | <Lemmih> | litb: Drop the 'return', use 'mapM_' instead of 'map'. |
| 08:24:07 | <Lemmih> | litb: Or: forM_ someList $ \x -> let ... in putStrLn ... |
| 08:25:10 | <Corun> | Good morning. Oh funky functional channel. |
| 08:25:16 | <litb> | ah, the normal map doesn't allow me to run them, as it would have side effects? |
| 08:25:43 | <matthew-_> | sheesh, I'm getting old. I can't do the 2am coding sessinos that I once could |
| 08:25:49 | <psi> | putStrLn itself doesn't have side effects |
| 08:26:00 | <psi> | you just produced a list of IO actions |
| 08:26:04 | <Corun> | It's not 2AM, matt :-P |
| 08:26:06 | <Korollary> | @localtime matthew-_ |
| 08:26:07 | <lambdabot> | Local time for matthew-_ is Wed Jan 9 08:26:06 2008 |
| 08:26:12 | <matthew-_> | mind you, they used to be in Java and you can pretty much write java whilst sleeping |
| 08:26:23 | <matthew-_> | Korollary: I've just got up again |
| 08:26:34 | <Corun> | After only 6 hours sleep? |
| 08:26:46 | <Lemmih> | litb: Mapping over putStrLn creates a list of actions that, when executed, generates output. |
| 08:27:29 | <matthew-_> | Corun: yeah. things to do. PhD's to avoid... |
| 08:27:33 | <Korollary> | matthew-_: what are you writing in nowadays? |
| 08:28:13 | <litb> | Lemmih: oh , i see. putStrLn doesn't output anything itself, but just returns a IO action, which then does the work i suppose |
| 08:28:17 | <matthew-_> | err, well I've not touched the games for many months now I'm afraid |
| 08:28:31 | <Corun> | Matt, can't you just make what you want to do in to your PhD somehow? |
| 08:28:33 | <matthew-_> | I've been donig website stuff for my research group |
| 08:28:35 | <u_quark> | Lemmih: i ignored them tnx ! |
| 08:29:42 | <C-Keen> | what does this mean? out of stack? *** Exception: Data.ByteString.index: index too large: 188, length = 188 |
| 08:29:53 | <C-Keen> | oh *duh* |
| 08:29:55 | <C-Keen> | nevermind |
| 08:30:40 | <psi> | litb: yeah, it's pure :) |
| 08:49:14 | <glguy> | ?seen dons |
| 08:49:15 | <lambdabot> | dons is in #xmonad and #haskell. I last heard dons speak 54m 52s ago. |
| 09:00:45 | <jsnx> | @src ! |
| 09:00:45 | <lambdabot> | arr@(Array l u _) ! i = unsafeAt arr (index (l,u) i) |
| 09:01:03 | <litb> | hm, maybe i could write a type class to represent one integration method? |
| 09:02:35 | <jsnx> | i have a weird syntactic requirement -- i'd like a 'reversible map' with a (!) that takes either a key or a value |
| 09:03:06 | <jsnx> | how do i do that? i don't know much about typeclasses yet. |
| 09:03:25 | <matthew-_> | (Map k a, Map a k) |
| 09:03:35 | <integral> | Map (Either key value) (key, value) |
| 09:03:58 | <jsnx> | i do not understand :( |
| 09:04:02 | <matthew-_> | now use the type system to enfore that the function represented by the Map is invertible ;) |
| 09:04:27 | <jsnx> | oh, i sorta see |
| 09:05:44 | <Korollary> | If keys and values are both integers, how would (!) know whether a given integer is a key or a value? |
| 09:06:14 | <jsnx> | Korollary: it will diverge in that case |
| 09:06:25 | <jsnx> | what i really want, is an 'ordered map' |
| 09:06:35 | <jsnx> | if i look up with a key, i get an integer |
| 09:06:45 | <jsnx> | if i look up with an integer, i get a key |
| 09:06:55 | <jsnx> | maybe they should be separate functions |
| 09:07:53 | <jsnx> | if i want to control how the search for the key is performed -- i.e. with a hash and what not -- do i have to make a new monad? |
| 09:08:02 | <Korollary> | If this was a database table, your select statements would be different. |
| 09:08:12 | <jsnx> | Korollary: it is not a database table |
| 09:08:18 | <jsnx> | it is a column in the table |
| 09:08:52 | <jsnx> | i use the index to find the stuff in the other columns |
| 09:08:57 | <jsnx> | to reconstruct the tuple |
| 09:09:01 | <jsnx> | (this is the idea, anyway) |
| 09:10:05 | <jsnx> | is that stupid? |
| 09:10:48 | <Korollary> | Is the key the column name? |
| 09:11:08 | <jsnx> | Korollary: well...not really |
| 09:11:17 | <jsnx> | the key should be called the value, really |
| 09:11:40 | <jsnx> | like if i have a column for, uhm, description |
| 09:12:04 | <jsnx> | then the column can be queried with a String to see if a particular description is in there |
| 09:12:30 | <jsnx> | if it is, i get a list of Int |
| 09:12:30 | <Korollary> | ok |
| 09:13:00 | <jsnx> | then i take those Ints to index into all the other columns, reconstructing the tuples |
| 09:13:04 | <jsnx> | then i pass those on |
| 09:14:05 | <Korollary> | Normally you'd have a map from descriptions to row id's, and once you have the row id, you can retrieve the entire row. |
| 09:15:40 | <jsnx> | Korollary: well, i don't actually store the row anywhere |
| 09:15:46 | <jsnx> | i just have these indexes |
| 09:16:06 | <jsnx> | i'm trying to implement a database (with simple equality lookup) |
| 09:16:13 | <jsnx> | not make an interface to one |
| 09:16:30 | <jsnx> | basically, the only thing i want to have copies of are the indices |
| 09:16:55 | <jsnx> | instead of copying the values at least twice |
| 09:18:45 | <C-Keen> | hm how do I print the current file postition? I used hGetPosn f >>= \pos -> putStr pos, and this prints {handle: filename}, not quite what I expected |
| 09:19:46 | <jsnx> | (one copy for each Map key Int, and then again for [(keyA, keyB...)] |
| 09:20:03 | <jsnx> | unless they aren't actually copied? |
| 09:20:36 | <jsnx> | hmm, how would i do that... |
| 09:21:09 | <jsnx> | no, i don't think there's anyway the maps could share values with the list |
| 09:22:06 | <jsnx> | damn |
| 09:24:46 | <jsnx> | ah, well -- i've managed to get by without type level programming for too long -- now the weirdness begins! |
| 09:25:28 | <Lemmih> | C-Keen: hTell, perhaps? |
| 09:25:57 | <C-Keen> | this is so cool |
| 09:45:13 | <sarah> | in a type declaration how do you say it returns an instance of a type class? |
| 09:47:01 | <Toxaris> | sarah: foo :: (MyTypeClass a) => Int -> a |
| 09:47:50 | <Toxaris> | sarah: this means that foo can return whatever instance of MyTypeClass the caller wants to get |
| 09:48:00 | <sarah> | thx |
| 09:49:22 | <sarah> | why int? |
| 09:49:33 | <sarah> | (my type class has nothing to do with them) |
| 09:51:06 | <kmcallister> | it's an arbitrary example |
| 09:51:11 | <Toxaris> | sarah: Int was only an example |
| 09:54:11 | <sarah> | so for it to return an instance of mytypeclass it would be foo :: someinput -> (MyTypeClass a) => a? |
| 09:54:37 | <quicksilver> | no, the constraints always go on the far left |
| 09:54:52 | <quicksilver> | foo :: (MyTypeClass a) => some -> input -> types -> a |
| 09:55:22 | <sarah> | ah thanks i was confused |
| 09:57:38 | <sarah> | are using polymorphic datatypes in data definitions illegal? |
| 09:58:04 | <quicksilver> | you can read it as "For any member of MyTypeClass, let's call it 'a', foo can have the type 'some -> input -> types -> a' |
| 09:58:16 | <quicksilver> | no, they're not |
| 09:58:22 | <quicksilver> | but it depends what you mean by polymorphic, I suppose |
| 09:58:31 | <quicksilver> | data Foo a = Foo [a] |
| 09:58:40 | <quicksilver> | ^^ data definition using the polymorphic type [] |
| 10:00:18 | <sarah> | ah meant like data Foo = Foo { myVar :: (MyTypeClass a) => a } |
| 10:00:53 | <quicksilver> | what you probably want is an existential type there |
| 10:01:01 | <quicksilver> | they are not haskell98, but they're widely supported |
| 10:01:22 | <quicksilver> | unfortunately you are forced to give via an intermediate data type |
| 10:04:18 | <kmcallister> | you can also do |
| 10:04:47 | <kmcallister> | data (MyTypeClass a) => Foo a = Bar a |
| 10:05:17 | <kmcallister> | which has a different meaning |
| 10:05:17 | <glguy> | which means something else |
| 10:06:49 | <quicksilver> | and is a bad idea IMO |
| 10:07:02 | <quicksilver> | constraints on data types are seldom useful |
| 10:07:17 | <quicksilver> | constaints on constructors (GHC extension) are slightly more useful in principle |
| 10:07:23 | <quicksilver> | although I've never needed it myself |
| 10:49:18 | <quicksilver> | ACTION answers a #jquery question in haskell. Oops. |
| 11:31:10 | <ac> | I would imagine people here find Haskell + HaXml to be easier to use than XSLT. Is this true? |
| 11:31:59 | <ndm> | ac: XSLT is very verbose, and quite painful to use, so I would assume so |
| 11:38:12 | <ac> | ndm: yeah that's my experience. It's absurd, considering it was supposedly designed to manipulate XML |
| 11:38:49 | <quicksilver> | Well, would you expect anything designed by the XML guys to be anything other than verbose? |
| 11:39:05 | <quicksilver> | I don't really think XSL is designed for direct human use |
| 11:39:12 | <quicksilver> | it's expected you'll use it via some kinds of tools |
| 11:39:18 | <ndm> | ac, the problem is that it has a syntax described in XML, hence is a bad idea |
| 11:39:20 | <EvilTerran> | i hear it's turing complete |
| 11:39:24 | <opqdonut> | it is |
| 11:39:27 | <quicksilver> | well, I'm sure it is |
| 11:39:33 | <opqdonut> | a functional programming language practically |
| 11:39:37 | <ndm> | quicksilver: that only works if you have a solid abstraction, since XSLT implementations all have their own bugs, you are forced to work at the low level |
| 11:39:40 | <EvilTerran> | (that's a bad thing) |
| 11:39:53 | <ndm> | EvilTerran: not necessarily, it can be a good thing |
| 11:39:55 | <quicksilver> | reasonable transformation description languages more-or-less have to be turing complete |
| 11:39:56 | <opqdonut> | compiling something higher level into xsl might be useful |
| 11:40:08 | <quicksilver> | because you need recursive transformations |
| 11:40:10 | <EvilTerran> | ndm, for glorified stylesheets? i'm suspicious |
| 11:40:19 | <quicksilver> | (things like transitive closure) |
| 11:40:28 | <opqdonut> | quicksilver: yep, one quickly reach the level of post systems |
| 11:40:39 | <quicksilver> | It's quite hard to design a language which admits things like transitive closure without introducing non-termination. |
| 11:40:43 | <EvilTerran> | sounds like the sort of thing that'd benefit from statically-checkable finite runtime |
| 11:41:05 | <quicksilver> | once you've introduced non-termination, you might as well go turing complete and just use recursion |
| 11:41:19 | <quicksilver> | q.v. SQL 3 and its recursive queries |
| 11:41:26 | <quicksilver> | or whatever that thing is called |
| 11:41:48 | <ndm> | EvilTerran: depends if you see it as a stylesheet, or a transformation engine for templates, which is how i use it |
| 11:42:04 | <quicksilver> | it would be an interesting research project to get query languages / transformation languages which admit useful notions like transitive closure without going turing complete |
| 11:42:06 | <EvilTerran> | eh, i guess. gotta use the right tool for the job, eh. :) |
| 11:42:06 | <ndm> | EvilTerran: non-termination is not hte biggest flaw in XSLT, there are many many others |
| 11:42:10 | <quicksilver> | but I can' understnad why they didn't bother. |
| 11:42:18 | <EvilTerran> | ndm, like the "xml" bit? :P |
| 11:42:29 | <quicksilver> | some kind of bounded recursion like structural recursion, perhaps. |
| 11:42:37 | <ndm> | quicksilver: they have recursion |
| 11:42:41 | <quicksilver> | I know they do. |
| 11:42:48 | <EvilTerran> | ACTION wanders off |
| 11:42:50 | <quicksilver> | I'm talking about what you might do, if you were trying to avoid turing-completeness. |
| 11:42:58 | <ac> | ndm: if you're actually using XSLT, I assume you're doing it because of browser support. Why not use JavaScript? |
| 11:43:18 | <ndm> | ac, i preprocess the XSLT and dump out HTML which gets shoved on the web |
| 11:43:36 | <ndm> | ac, I can also view hte pages in Firefox or IE, but there is more processing overhead, and it doesn't work as reliably |
| 11:43:48 | <ndm> | ac, Javascript solves a very different problem :) |
| 11:44:15 | <ac> | ndm: so you are doing it server side. Why not use whatever language you're using to generate the XML to transform it as well? I've never understood why anybody would bother to use XSLT |
| 11:44:52 | <ndm> | ac, i wanted to try XSLT, i did, i probably wouldn't use it again |
| 11:45:10 | <ndm> | ac, plus I don't use any language to write the XML, I hand wrote it |
| 11:45:26 | <quicksilver> | ndm: since you have aroused our curiousity, what are in your opinion the biggest flaws in xslt? |
| 11:45:40 | <ndm> | quicksilver: verbose |
| 11:45:50 | <quicksilver> | ACTION nods |
| 11:45:52 | <quicksilver> | definitely |
| 11:45:55 | <quicksilver> | btu not surprising |
| 11:46:04 | <quicksilver> | like I say, I think the XML guys expect you to use tools |
| 11:46:12 | <quicksilver> | most (all?) XML based stuff is verbose |
| 11:46:35 | <ndm> | quicksilver: i wrote a blog post on it years ago, will try and find it... |
| 11:46:37 | <wolverian> | xquery is nice |
| 11:46:45 | <ac> | ndm: yeah, I'm finding myself wanting to do the same thing. Hand write XML and write a Makefile to transform it with probably Haskell I guess |
| 11:46:56 | <wolverian> | ...because it's not written in xml. of course it has its xml representation, xqueryx, which _is_ verbose. |
| 11:47:02 | <osfameron> | xpath is lovely and compact |
| 11:47:16 | <wolverian> | xpath is another nice example of how non-xml tools are not verbose, even if they work on xml. :) |
| 11:47:23 | <wolverian> | so xml doesn't quite pollute everything it touches... |
| 11:47:45 | <ac> | wolverian: oh but it does... you mentioned it yourself: xqueryx |
| 11:47:57 | <quicksilver> | xpath is nice for simple queries |
| 11:48:05 | <quicksilver> | does it scale well to complex manipulations though? |
| 11:48:13 | <wolverian> | ac, right. but afaik you can translate between xquery and xqueryx mechanically, so you never need to see xqueryx yourself |
| 11:48:26 | <quicksilver> | I've used xmlstarlet for some transformations, which uses xpath syntax and was handy |
| 11:48:27 | <wolverian> | quicksilver, it doesn't manipulate. it's purely a lookup language. |
| 11:48:52 | <wolverian> | well, I suppose that was too imperative of me |
| 11:49:06 | <quicksilver> | xmlstarlet sel -T -t -m tv/channel -v @id -o "," -v display-name[1] -o "," -v display-name[2] -n list.channels |
| 11:49:23 | <wolverian> | no, it doesn't scale like e.g. xquery does. but xquery is a complete functional language. |
| 11:49:23 | <quicksilver> | but, IIRC the actual transformational behaviour is controlled by that bunch of command line options |
| 11:49:34 | <quicksilver> | reasonably concise but not excatly readable :) |
| 11:49:49 | <wolverian> | right. long flags would be nice, at least. :) |
| 11:52:53 | <ac> | Why are web standards so idiotic? I doubt everybody, or even most people, participating on w3c are idiots... |
| 11:53:14 | <mmmdonuts> | Nature of committees. |
| 11:53:51 | <quicksilver> | there are certainly a bunch of smart people at w3c |
| 11:54:06 | <quicksilver> | I suspect often the problem is that they are aiming for certain goals |
| 11:54:13 | <quicksilver> | which might not be the goals we're interested in :) |
| 11:54:23 | <ndm> | quicksilver: http://nmitchell.livejournal.com/28742.html |
| 11:54:24 | <lambdabot> | Title: nmitchell: Haskell vs XSL |
| 11:54:59 | <wolverian> | I don't see that much idiocy in web standards, really. it's a very hard job. |
| 11:55:10 | <mauke> | ndm: what happened to your > signs? |
| 11:55:36 | <quicksilver> | ndm: yeah :) |
| 11:55:37 | <ndm> | mauke: i replace them with [ ] so the software in the blog didn't eat them |
| 11:55:39 | <wolverian> | ndm, now compare HXT and XSL? :) |
| 11:55:51 | <ac> | wolverian: what about XML? And CSS? |
| 11:55:54 | <ndm> | wolverian: that is pure computation |
| 11:56:03 | <ndm> | ac: XML and CSS are totally different from XSLT |
| 11:56:09 | <wolverian> | hm? |
| 11:56:23 | <ac> | ndm: yes... I was just providing those two as examples of idiocy |
| 11:56:25 | <ndm> | wolverian: in that sample there is no transformation of XML |
| 11:56:31 | <wolverian> | ac, yes, I don't see them as idiotic. this might not be a very popular opinion. |
| 11:56:36 | <ndm> | ac, i kinda like CSS - much is wrong, but its quite solid |
| 11:56:47 | <ndm> | ditto XML, a reasonable spec |
| 11:57:05 | <ndm> | i would probably have not had attributes and gone for tag nesting instead, but XML isn't bad |
| 11:57:10 | <mux> | CSS, the concept, is great and incredibly useful, too bad that it's hellish in practice because of the numerous browser incompatibilities |
| 11:57:13 | <quicksilver> | I think CSS is fine as a language. |
| 11:57:17 | <quicksilver> | I think the box-model is a bit weird :) |
| 11:57:35 | <quicksilver> | but that's partly because they had to design something which somehow extended/incorporated the old non-standard stuff. |
| 11:58:03 | <FalconNL> | Does anyone know if it would be technologically possible to determine for which inputs a given function will produce a runtime error? e.g.: errors head == [[]] or errors (/) == [(_,0)] ? |
| 11:58:04 | <ac> | yeah, I guess I agree CSS could be great if it wasn't backwards compatible |
| 11:58:21 | <quicksilver> | FalconNL: you should read about ndm's program "catch" |
| 11:58:33 | <quicksilver> | FalconNL: it is certainly impossible in general, q.v. halting problem |
| 11:58:37 | <ndm> | @where catch |
| 11:58:38 | <ac> | FalconNL: isn't that equivalent to the halting problem? |
| 11:58:38 | <lambdabot> | http://www.cs.york.ac.uk/~ndm/projects/catch.php |
| 11:58:51 | <ndm> | FalconNL: it is impossible, in general, but i've already got a tool that does it |
| 11:59:01 | <ndm> | @where+ catch http://www-users.cs.york.ac.uk/~ndm/catch/ |
| 11:59:02 | <lambdabot> | It is forever etched in my memory. |
| 11:59:19 | <ndm> | lambdabot: liar! i've told you that about 5 times and you keep forgetting! |
| 11:59:22 | <FalconNL> | ah. Evidently I wasn't the first to come up with the idea of eliminating runtime errors once and for all :) |
| 11:59:26 | <quicksilver> | ;) |
| 11:59:29 | <quicksilver> | no, nor the last |
| 11:59:44 | <quicksilver> | that doesn't reduce the worthiness of the idea, though :) |
| 11:59:48 | <quicksilver> | quite the contrary. |
| 12:00:05 | <ac> | FalconNL: as an asside, I believe GHC 6.8 is much nicer for debugging bugs like taking head of an empty list |
| 12:00:42 | <ndm> | ac, you've tried it, or heard it? |
| 12:00:50 | <ndm> | i heard it, then tried it, and was rather disappointed |
| 12:00:59 | <ac> | ndm: unfortunately only read so :-P |
| 12:01:04 | <FalconNL> | yeah, I heard Simon peyton Jones mention in a lecture that the compiler could catch non-exhaustive guards. Is there some compiler option I have to turn or for that? |
| 12:01:16 | <koeien> | FalconNL: I believe it' |
| 12:01:18 | <koeien> | s the default |
| 12:01:31 | <mauke> | if it needs an option, -Wall |
| 12:01:32 | <mux> | I know that it's the case at least when using -Wall |
| 12:01:40 | <koeien> | aw yes that was it |
| 12:01:49 | <FalconNL> | ah, thanks, I'll go try it |
| 12:01:51 | <koeien> | *my* default is using -Wall :) |
| 12:02:34 | <ac> | koeien: hm. Maybe I should alias ghc to "ghc -Wall" |
| 12:02:50 | <ndm> | FalconNL: it does catch some, but it gets it wrong, and doesn't eliminate things like head [] |
| 12:02:52 | <quicksilver> | the problem is that there are lots of times when you do in fact want to write code with incomplete pattern matches |
| 12:03:00 | <u_quark> | there are many project that try to eliminate run-time bug... most extreme approach (that i know of) is implementing a self-proving that caries the proof that it is correct and can be tested by the user! |
| 12:03:03 | <quicksilver> | that's the point of catch :) |
| 12:03:05 | <mauke> | I've aliased cc to gcc -std=gnu99 -pedantic -Wall -W -Wno-missing-field-initializers -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -O2 -pipe -march=native |
| 12:03:16 | <ndm> | it basically warns at the definition of an incomplete function, not the use, which would be much more useful! |
| 12:03:26 | <mauke> | compared to that, ghc -Wall is nothing :-) |
| 12:03:31 | <mux> | ACTION is tempted to paste the gcc flags he's using, but that would be spam :) |
| 12:03:34 | <opqdonut> | -pedantic? |
| 12:03:51 | <opqdonut> | why not -Werror too :P |
| 12:03:59 | <mux> | I use -Werror |
| 12:05:26 | <opqdonut> | i tend not to with large code bases |
| 12:05:53 | <mux> | we use -Werror for FreeBSD's kernel and a good deal of the userland |
| 12:05:55 | <ndm> | i find the warnings more annoying, many of those in GHC are a bit pointless |
| 12:05:57 | <opqdonut> | as there always are some "wanted" errors |
| 12:06:02 | <opqdonut> | *warnings |
| 12:06:17 | <koeien> | opqdonut: #pragma ? |
| 12:06:28 | <opqdonut> | yeh but that's kinda ugly |
| 12:06:45 | <opqdonut> | as is specifying a million -W flags to catch just the warnings one wants |
| 12:06:57 | <koeien> | C is ugly :) |
| 12:07:25 | <FalconNL> | btw, ghc 6.8.2 doesn't detect non-exhaustive patterns by default. It needs a -W* flag |
| 12:08:14 | <koeien> | is ghc 6.8.2 in debian sid yet? if it is, i'll try out some new features tonight |
| 12:10:38 | <koeien> | it looks like it is: cool |
| 12:20:47 | <quicksilver> | I'm beginning to think @quote stereo applies even more to the -cafe than it does to here |
| 12:21:02 | <ac> | koeien: bleh. Not in ubuntu yet |
| 12:21:12 | <quicksilver> | that's the price you pay for using ubuntu :P |
| 12:21:16 | <ac> | waaaah |
| 12:21:27 | <Cale> | What's not in ubuntu yet? GHC 6.8? |
| 12:21:35 | <ac> | Cale: yeah, it's still at 6.6-3 |
| 12:21:44 | <osfameron> | otoh you can usually apt-get your deps and compile stuff fairly easily |
| 12:21:45 | <Cale> | Yeah, I just installed the binary. |
| 12:22:02 | <koeien> | sure but i like to use the package manager :) |
| 12:22:04 | <osfameron> | I compiled more recent ghc's without major problems on ubuntu (and I *hate* debugging builds) |
| 12:22:16 | <Sizur> | opensuse had it for a log time already |
| 12:22:17 | <Cale> | You can use alien to convert the rpm package for the old readline too. |
| 12:22:20 | <shachaf> | koeien: That doesn't work for the darcs version anyway. :-) |
| 12:22:29 | <ac> | osfameron: yeah me too, I'm just lazy |
| 12:22:37 | <koeien> | yeah but i'm not a dev :) |
| 12:22:48 | <resiak> | it's faintly possible that the sid packages will install on Ubuntu. the Ubuntu packages are just pulled straight from Debian anyway |
| 12:22:57 | <koeien> | yeah, ubuntu == debian sid forked |
| 12:23:41 | <osfameron> | ACTION is too stupid and lazy to volunteer to host contributed ubuntu ghc builds as packages |
| 12:23:49 | <osfameron> | but somebody definitely *should* do it :-) |
| 12:24:27 | <jsnx> | osfameron: just switch to gentoo :) |
| 12:24:30 | <resiak> | koeien: well, only universe is mostly still just sid in disguise |
| 12:24:30 | <ac> | it'd be annoying to be a package mantainer |
| 12:25:27 | <jsnx> | ac: well, you might feel positive about it, too -- that you were giving something to the other users in your community |
| 12:26:11 | <koeien> | it's probably not too much work |
| 12:26:13 | <osfameron> | yeah, I think it would be lovely. Just I know that I'm not always online and available, and my motivation fluctuates too much to volunteer for something like that |
| 12:30:21 | <koeien> | but the debian packages are very up-to-date |
| 12:31:22 | <quicksilver> | one of the GHC core team is a debian developer |
| 12:31:28 | <koeien> | i suppose so |
| 12:31:36 | <quicksilver> | Igloo IIRC. |
| 13:03:44 | <litb> | hello again all |
| 13:03:48 | <litb> | [ (10 ** fromIntegral x) | x <- reverse [ x | x <- [-12 .. -3], mod x 3 == 0] ] |
| 13:03:58 | <litb> | is there some better way to do that? |
| 13:05:49 | <jedbrown> | > map (10**) [-3,(-6)..(-12)] |
| 13:05:50 | <lambdabot> | [1.0e-3,1.0e-6,1.0e-9,1.0e-12] |
| 13:06:09 | <mauke> | > [ 10 ^^ (-x) | x <- [3, 6 .. 12] ] |
| 13:06:11 | <lambdabot> | [1.0e-3,1.0e-6,1.0e-9,1.0e-12] |
| 13:06:16 | <litb> | wow, simply beautiful :) |
| 13:06:50 | <sarah> | wow didnt know you could do stuff like [3, 6 .. 12]\ |
| 13:06:59 | <litb> | i think i take the one by mauke :) |
| 13:07:11 | <mauke> | > map ((10 ^^) . negate) . enumFromThenTo 3 6 $ 12 |
| 13:07:12 | <lambdabot> | [1.0e-3,1.0e-6,1.0e-9,1.0e-12] |
| 13:07:13 | <ac> | mauke's looks cuter |
| 13:08:11 | <mauke> | > take 4 $ iterate (/ 1e3) 1e-3 |
| 13:08:12 | <lambdabot> | [1.0e-3,1.0e-6,9.999999999999999e-10,9.999999999999998e-13] |
| 13:08:34 | <mauke> | > take 4 $ iterate (* 1e-3) 1e-3 |
| 13:08:35 | <lambdabot> | [1.0e-3,1.0e-6,1.0e-9,1.0000000000000002e-12] |
| 13:08:48 | <litb> | something i don't get is, there is x^y , and x^^y . and the former just accepts positive y. why is this? |
| 13:08:55 | <quicksilver> | because of the types |
| 13:09:01 | <quicksilver> | a^b will always be another integer |
| 13:09:06 | <quicksilver> | (since a and b are integral) |
| 13:09:10 | <mauke> | they are? |
| 13:09:11 | <mauke> | :t (^) |
| 13:09:12 | <quicksilver> | and b is positive |
| 13:09:13 | <lambdabot> | forall a b. (Integral b, Num a) => a -> b -> a |
| 13:09:29 | <quicksilver> | sorry s/since/if/ |
| 13:09:35 | <mauke> | litb: ^ works on any Num since it only requires multiplication |
| 13:09:41 | <quicksilver> | if a is integral, result is integral is what I mean |
| 13:09:44 | <mauke> | ^^ needs recip for negative exponents |
| 13:09:48 | <quicksilver> | more generally, whatever a is, the result is |
| 13:10:22 | <ac> | :t (^^) |
| 13:10:24 | <lambdabot> | forall a b. (Integral b, Fractional a) => a -> b -> a |
| 13:10:58 | <litb> | ahm i see. so 3^^(2.4) should'nt be possible |
| 13:11:23 | <litb> | :t (**) |
| 13:11:24 | <lambdabot> | forall a. (Floating a) => a -> a -> a |
| 13:11:30 | <litb> | nice |
| 13:11:46 | <ricky_clarkson> | > 3^^2.4 |
| 13:11:47 | <lambdabot> | Add a type signature |
| 13:12:01 | <ricky_clarkson> | > (3 :: Integer)^^2.4 |
| 13:12:01 | <lambdabot> | add an instance declaration for (Fractional Integer) |
| 13:12:02 | <lambdabot> | In the expression:... |
| 13:12:15 | <ricky_clarkson> | > (3 :: Integer)^^24%10 |
| 13:12:16 | <lambdabot> | add an instance declaration for (Fractional Integer) |
| 13:12:52 | <oerjan> | > 3^24%10 |
| 13:12:53 | <lambdabot> | 282429536481%10 |
| 13:13:42 | <ac> | @where % |
| 13:13:42 | <lambdabot> | I know nothing about %. |
| 13:13:48 | <mauke> | @index (%) |
| 13:13:49 | <lambdabot> | Data.Ratio |
| 13:13:58 | <mauke> | @docs Data.Ratio |
| 13:13:59 | <lambdabot> | http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Ratio.html |
| 13:14:45 | <ac> | so @where is a general purpose index for anything, @index finds something in the standard libs? |
| 13:14:46 | <oerjan> | ricky_clarkson: ah, you want 3^^(24%10) ? that won't work, ^ and ^^ both require integral exponents |
| 13:15:00 | <mauke> | ac: yes |
| 13:15:10 | <ac> | seems like @where and @index should be reversed :P |
| 13:15:13 | <oerjan> | ac: @where is just what we put in it, really |
| 13:15:18 | <quicksilver> | @where is user-controlled |
| 13:15:19 | <lambdabot> | I know nothing about is. |
| 13:15:24 | <ricky_clarkson> | oerjan: Grr, the type signature confused me. |
| 13:15:28 | <ricky_clarkson> | :t (^^) |
| 13:15:28 | <lambdabot> | forall a b. (Integral b, Fractional a) => a -> b -> a |
| 13:15:33 | <quicksilver> | while @index is is based on hoogle indoces, I believe |
| 13:15:34 | <oerjan> | :t (**) |
| 13:15:35 | <lambdabot> | forall a. (Floating a) => a -> a -> a |
| 13:15:40 | <quicksilver> | and @docs is just calculated |
| 13:15:52 | <ricky_clarkson> | Why would it not be written (Fractional a, Integral b) => a -> b -> a? |
| 13:15:58 | <mauke> | > (-1) ** 0.5 |
| 13:16:01 | <lambdabot> | NaN |
| 13:16:07 | <mauke> | > (-1) ** 0.5 :: Complex Double |
| 13:16:11 | <lambdabot> | 6.123031769111886e-17 :+ (-1.0) |
| 13:16:17 | <oerjan> | ricky_clarkson: beats me |
| 13:17:14 | <ac> | @source Fractional |
| 13:17:14 | <lambdabot> | Fractional not available |
| 13:17:28 | <mauke> | @src Fractional |
| 13:17:28 | <lambdabot> | class (Num a) => Fractional a where |
| 13:17:28 | <lambdabot> | (/) :: a -> a -> a |
| 13:17:28 | <lambdabot> | recip :: a -> a |
| 13:17:28 | <lambdabot> | fromRational :: Rational -> a |
| 13:17:49 | <ac> | @index Infinity |
| 13:17:49 | <lambdabot> | bzzt |
| 13:17:58 | <oerjan> | @docs Data.Nonexistent |
| 13:17:58 | <lambdabot> | Data.Nonexistent not available |
| 13:18:07 | <oerjan> | quicksilver: not quite calculated |
| 13:18:10 | <ac> | @hoogle Infinity |
| 13:18:11 | <lambdabot> | No matches found |
| 13:18:22 | <mauke> | there is no infinity |
| 13:18:28 | <ac> | > 1/0 |
| 13:18:31 | <lambdabot> | Infinity |
| 13:18:38 | <oerjan> | but @wiki and @hackage are iirc |
| 13:18:45 | <litb> | hmm |
| 13:18:48 | <mauke> | @wiki is calculated? |
| 13:18:49 | <lambdabot> | http://www.haskell.org/haskellwiki/is_calculated? |
| 13:18:52 | <litb> | i thought 1/0 wasn't defined |
| 13:19:18 | <litb> | and isn't even. how is it infinity ? |
| 13:19:41 | <mauke> | because 0 is really small |
| 13:19:50 | <oerjan> | litb: it's IEEE floating point |
| 13:19:51 | <mauke> | > 1/0 :: Rational |
| 13:19:52 | <lambdabot> | Exception: Ratio.%: zero denominator |
| 13:20:22 | <ac> | @src Floating |
| 13:20:23 | <lambdabot> | class (Fractional a) => Floating a where |
| 13:20:23 | <lambdabot> | pi :: a |
| 13:20:23 | <lambdabot> | exp, log, sqrt, sin, cos, tan :: a -> a |
| 13:20:23 | <lambdabot> | asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh :: a -> a |
| 13:20:23 | <lambdabot> | (**), logBase :: a -> a -> a |
| 13:20:37 | <oerjan> | mauke: i think it is hard for lambdabot to check wiki pages - trying that URL does bring up _something_ |
| 13:21:36 | <oerjan> | > read "1%0" :: Rational -- i recall there was a bug |
| 13:21:44 | <lambdabot> | Exception: Ratio.%: zero denominator |
| 13:21:54 | <oerjan> | hm... |
| 13:22:23 | <ndm> | oerjan: it brings up an error pages, easy enough to spot! |
| 13:22:24 | <oerjan> | must have been somewhere else |
| 13:23:20 | <ac> | how do I test if something's equal to Infinity, other than "a == (1/0)"? |
| 13:23:40 | <oerjan> | ndm: well it does require wading through the code - the only clue is "(There is currently no text in this page)" |
| 13:23:53 | <oerjan> | @src RealFloat |
| 13:23:53 | <lambdabot> | Source not found. I am sorry. |
| 13:24:00 | <ac> | ah. isInfinite |
| 13:24:04 | <oerjan> | :t isInfinity |
| 13:24:05 | <lambdabot> | Not in scope: `isInfinity' |
| 13:24:11 | <oerjan> | :t isInfinite |
| 13:24:12 | <lambdabot> | forall a. (RealFloat a) => a -> Bool |
| 13:24:17 | <ndm> | oerjan: isSubstrOf - half a line of code which executes in absolutely no time |
| 13:24:21 | <quicksilver> | oerjan: it's only IEEE floating point if the underlying OS is, I believe. |
| 13:24:38 | <quicksilver> | ndm: isInfixOf, IYTM :) |
| 13:24:39 | <oerjan> | quicksilver: could be |
| 13:24:51 | <quicksilver> | that is, the haskell standard doesn't define what 1/0 returns |
| 13:25:01 | <quicksilver> | but allows implementatiosn to do whatever the 'native system' wants to do. |
| 13:25:22 | <ndm> | quicksilver: i remember the conversation, and about 5 different names for it, but can never remember what the end result was |
| 13:25:26 | <quicksilver> | ndm: ;) |
| 13:25:30 | <ac> | that's kind of smart |
| 13:25:43 | <oerjan> | > 0/0 == 0/0 -- warping ac's brain |
| 13:25:45 | <quicksilver> | ndm: isInfixOf was chosen by comparisin with isPrefixOf and isSuffixOf, I have assumed. |
| 13:25:45 | <lambdabot> | False |
| 13:26:03 | <ac> | > (0/0) == (0/0) |
| 13:26:03 | <lambdabot> | False |
| 13:26:11 | <quicksilver> | ndm: it's a typically logical-but-daft kind of thing CS types like :) |
| 13:26:19 | <ndm> | quicksilver: it was indeed, and it does make logical sense |
| 13:26:34 | <ndm> | i'll remember it as soon as i start using it, which will be a short while yet |
| 13:27:21 | <ac> | oerjan: floats are tricky beasts |
| 13:27:55 | <litb> | for a lambda expression, i cannot have a where clause? |
| 13:28:02 | <oerjan> | litb: nope |
| 13:28:08 | <oerjan> | only let |
| 13:28:27 | <ac> | and top level functions |
| 13:28:41 | <quicksilver> | you can have a where clause anywhere you can have a declaration |
| 13:28:46 | <oerjan> | where clauses technically go on declarations, not expressions |
| 13:28:54 | <quicksilver> | which is, the top level, lets, and other wheres. |
| 13:29:00 | <quicksilver> | unless I miss something |
| 13:29:02 | <oerjan> | as well as case matches |
| 13:29:33 | <koeien> | @src lookup |
| 13:29:33 | <lambdabot> | lookup _key [] = Nothing |
| 13:29:33 | <lambdabot> | lookup key ((x,y):xys) | key == x = Just y |
| 13:29:33 | <lambdabot> | | otherwise = lookup key xys |
| 13:29:49 | <quicksilver> | oerjan: eh? |
| 13:30:13 | <oerjan> | > case [1,2,3] of (x:y) -> z:y where z = last y |
| 13:30:18 | <lambdabot> | [3,2,3] |
| 13:30:23 | <mauke> | > case () of { _ -> x where x = "zomg" } |
| 13:30:24 | <lambdabot> | "zomg" |
| 13:30:41 | <quicksilver> | oh, that's odd |
| 13:31:03 | <quicksilver> | interesting, thanks |
| 13:38:08 | <shag> | how can i get my code ghc 6.6 compatible when using Data.IntMap.maxViewWithKey? |
| 13:39:16 | <kfish> | shag, copy the code for that function into your program? :-/ |
| 13:39:36 | <shag> | well, that code uses some internal function of IntMap ... |
| 13:39:54 | <kfish> | :-( |
| 13:45:53 | <litb> | case [1,2,3] of (x:y) -> z:y where z = last y <<- it's confusing me . what the hell does it do? |
| 13:46:01 | <ddarius> | "Encourage and Enforce"? |
| 13:46:20 | <koeien> | it first binds x to 1 and y to [2,3] and the expression evaluates to z:y |
| 13:46:27 | <litb> | isn't it saying "if [1, 2, 3] is (x:y) , then let it be z:y ? |
| 13:46:33 | <ddarius> | > case [1,2,3] of (x:y) -> z:y where z = last y |
| 13:46:33 | <faxathisia> | > let y = tail [1,2,3] in (last y):y |
| 13:46:35 | <lambdabot> | [3,2,3] |
| 13:46:35 | <lambdabot> | [3,2,3] |
| 13:46:40 | <ac> | > case [1,2,3] of { (x:y) -> z:y where z = last y; } |
| 13:46:41 | <lambdabot> | [3,2,3] |
| 13:47:05 | <ac> | litb: the where is for one of the cases, not the whole case statement |
| 13:47:20 | <litb> | ah, now i understand it |
| 13:47:33 | <litb> | quite a bit around-the-corner thinking |
| 13:48:06 | <quicksilver> | it surprised me |
| 13:48:12 | <quicksilver> | it's there for the benefit of guards I suppose |
| 13:48:15 | <ddarius> | Wow. I didn't realize consciously that you could use wheres there (though it makes sense and I'm almost sure I've done it before) |
| 13:48:21 | <ddarius> | quicksilver: Indeed. |
| 13:48:22 | <quicksilver> | (cases can have guards) |
| 13:48:40 | <koeien> | i am almost 100% positive that i've used this before |
| 13:48:46 | <koeien> | it's quite useful in some cases |
| 13:48:47 | <ac> | I'd like to see guards on a case |
| 13:49:02 | <ddarius> | ac: You can use guards with a case |
| 13:49:23 | <oerjan> | > case 5 of x | even x -> True | otherwise -> False |
| 13:49:24 | <lambdabot> | False |
| 13:50:18 | <ddarius> | > case undefined of x -> 3 |
| 13:50:20 | <lambdabot> | 3 |
| 13:50:41 | <mux> | @src otherwise |
| 13:50:42 | <lambdabot> | otherwise = True |
| 13:51:08 | <ddarius> | > case 5 of x | even x -> otherwise | True -> False |
| 13:51:11 | <lambdabot> | False |
| 13:51:13 | <faxathisia> | > case 5 of x | even x -> True ; otherwise -> False |
| 13:51:14 | <lambdabot> | False |
| 13:52:19 | <ac> | > otherwise == true -- funny |
| 13:52:20 | <lambdabot> | Not in scope: `true' |
| 13:52:49 | <litb> | :t _ |
| 13:52:50 | <lambdabot> | Pattern syntax in expression context: _ |
| 13:53:02 | <litb> | i supposed it's the same as otherwise o.O |
| 13:53:09 | <faxathisia> | no it's not |
| 13:53:17 | <ndm> | dcoutts, i know i use tests on one of my cabal projects, but can't remember which one... |
| 13:53:19 | <faxathisia> | _ has no value |
| 13:53:33 | <ac> | litb: _ is special because you can use it more than once |
| 13:53:35 | <ddarius> | As the error says, _ isn't even an expression |
| 13:59:42 | <koeien> | @src span |
| 13:59:43 | <lambdabot> | Source not found. |
| 13:59:45 | <quicksilver> | litb: it has similar effect in practice to otherwise, but it's quit different. otherwise is just a shortcut for True. |
| 13:59:49 | <quicksilver> | > otherwise |
| 13:59:50 | <lambdabot> | True |
| 13:59:58 | <quicksilver> | litb: i.e. it's a boolean guard which matches. |
| 14:00:48 | <litb> | ah, i see. anyway. if i want to use a fractional number with arbitrary precision, is Rational the right thing to choose ? |
| 14:02:24 | <koeien> | litb: yes, iirc type Rational = Ratio Integer |
| 14:02:29 | <quicksilver> | that's the only one in the standard lib, yes |
| 14:02:41 | <quicksilver> | it lacks transcendental functions, you need something much cleverer for that |
| 14:02:44 | <koeien> | since Integer has arbitrary precision it is OK |
| 14:02:48 | <quicksilver> | but it's fine for arithmetic. |
| 14:04:35 | <koeien> | quicksilver: what do you mean by 'it lacks transcendental functions' |
| 14:04:38 | <koeien> | quicksilver: like sine, cosine? |
| 14:05:18 | <koeien> | quicksilver: but they don't necessarily have f (x::Rational) :: Rational ? |
| 14:05:33 | <litb> | hm, yes. that's bad. i cannot use sin, pi and so on then |
| 14:05:56 | <koeien> | yes those are not fractions anyway |
| 14:06:04 | <litb> | (for example, i would have been happy if there was an acos where i can say "up to this precision please") |
| 14:06:16 | <ddarius> | There are quite a few exact reals implementations on the Applications and Libraries page on Haskell.org |
| 14:06:24 | <koeien> | there is such a library iirc |
| 14:06:30 | <quicksilver> | koeien: right. They are not rational, but they are certinaly fractional. |
| 14:06:43 | <quicksilver> | koeien: and he asked for arbitrary precision, he didn't *ask* for rational :) |
| 14:07:02 | <koeien> | quicksilver: yes, true |
| 14:07:17 | <ddarius> | litb: Using rationals, it wouldn't be hard to implement such things via power series (though this would definitely be wheel reinvention, but it is a fun wheel to reinvent) |
| 14:07:18 | <koeien> | so Integer is "more" than arbitrary precision |
| 14:08:34 | <koeien> | an arbitrary-precision integer type would be an Int where you can specify a range (possibly at run-time) |
| 14:08:36 | <litb> | quicksilver: well, i would be happy if there is precision of < inf =) |
| 14:08:40 | <koeien> | and Integer is more |
| 14:08:53 | <koeien> | quicksilver: correct? |
| 14:09:24 | <ddarius> | litb: Don't worry, I assure you that the precisions of Integers is bounded. |
| 14:09:40 | <litb> | ddarius: you are very right, i will try to wheel it when it's becoming boring again here |
| 14:09:41 | <ddarius> | (Well, magnitude as precision isn't really the issue here) |
| 14:10:07 | <ddarius> | @google "Power series, power serious" |
| 14:10:08 | <lambdabot> | http://www.cs.princeton.edu/courses/archive/fall05/cos318/precepts/pearl.ps |
| 14:10:20 | <koeien> | cool i'll check it out |
| 14:10:21 | <Sizur> | :t ((1/)::Int->Rational) undefined |
| 14:10:23 | <lambdabot> | Couldn't match expected type `Rational' against inferred type `Int' |
| 14:10:23 | <lambdabot> | In the expression: (1 /) |
| 14:10:54 | <litb> | at least for sin, i know it off of my head =) for pi, i've already implemented in C . so it wouldn't be all that hard i think |
| 14:11:39 | <koeien> | :t ( ((1/).toRational) :: Int->Rational ) undefined |
| 14:11:41 | <lambdabot> | Rational |
| 14:12:28 | <litb> | oh wait, we can say .toRational on every Fractional ? |
| 14:15:05 | <doserj> | @src Real |
| 14:15:05 | <lambdabot> | class (Num a, Ord a) => Real a where |
| 14:15:05 | <lambdabot> | toRational :: a -> Rational |
| 14:16:03 | <quicksilver> | very confusingly named class, that one |
| 14:16:09 | <ddarius> | > let integrate x0 = (x0:); toFunction f x = scanl (+) 0 (zipWith t f [0..]) where t a n = a*x^n/fromIntegral (product [0..n]); sin = integrate 1 (integrate 0 (map negate sin)) in toFunction sin (pi/4) |
| 14:16:10 | <lambdabot> | Couldn't match expected type `[a]' against inferred type `a1 -> a1' |
| 14:16:12 | <quicksilver> | it means "Real not Complex" |
| 14:16:20 | <Sizur> | ofcourse... undefined always passes the type check |
| 14:16:21 | <quicksilver> | rather than "Real not necessarily Rational" |
| 14:17:17 | <koeien> | @pl \p->span (not.p) |
| 14:17:17 | <lambdabot> | span . (not .) |
| 14:17:53 | <Sizur> | quicksilver: doesn't math's Real satisfy both statements? |
| 14:18:24 | <shachaf> | Sizur: Which is why the name is confusing. |
| 14:19:17 | <Sizur> | well, we cannot really have an irrational number represented... only derived |
| 14:19:35 | <Sizur> | i'm not defending at all, just thinking outloud |
| 14:20:24 | <shachaf> | Sizur: Well, you could do some things symbolically. |
| 14:21:04 | <quicksilver> | you can represent irrational numbers |
| 14:21:12 | <quicksilver> | sqrt(2) is a representation of an irrational number |
| 14:21:24 | <Sizur> | not if you evaluate it ;) |
| 14:21:34 | <quicksilver> | "10134" is a representation of an irrational number, if I decided to tell you that's in base pi |
| 14:22:02 | <quicksilver> | math's real does satisfy both constraints, yes |
| 14:22:20 | <quicksilver> | but conventionally in CS, people use "real" as meaning "including irrationals" |
| 14:22:27 | <quicksilver> | as in the phrase "computable reals" and "real arithmetic" |
| 14:22:34 | <shachaf> | When I think "real", though, I think of the latter constraint. |
| 14:22:40 | <Sizur> | hmm, i wonder if irrationality depends on the base |
| 14:23:04 | <Sizur> | definition of irrationality is not possible to express as a ratio |
| 14:23:06 | <shachaf> | Sizur: "Irrational" means a number isn't a ratio. |
| 14:23:23 | <shachaf> | Sizur: Yes, that's independent of base. |
| 14:23:30 | <Sizur> | then 10134 is rational in base pi but irrational if you convert it to base10 |
| 14:24:30 | <shachaf> | Well, OK, in an irrational base. |
| 14:27:42 | <quicksilver> | Sizur: no. 10134 (base pi) is an irrational number |
| 14:27:51 | <quicksilver> | rational/irrational are not relative concepts |
| 14:27:57 | <quicksilver> | they are absolute |
| 14:27:58 | <litb> | ddarius: i don't know what that integrate function was supposed to do, but it certainly is smaller than my integrate function done myself o.O |
| 14:28:07 | <quicksilver> | x is rational == x \in \Q |
| 14:28:39 | <quicksilver> | I should say, actually, that proving 10134 (base pi) to be irrational may not be entirely trivial, of course :) |
| 14:28:48 | <quicksilver> | however, it is. |
| 14:30:45 | <Sizur> | quicksilver: what's the definition of irrationality? |
| 14:31:09 | <jedbrown> | What does `base pi' mean here? |
| 14:31:13 | <koeien> | not being in {a/b:a in Z, b in N} ? |
| 14:31:23 | <quicksilver> | right, koeien typed it faster |
| 14:31:39 | <quicksilver> | jedbrown: 333 in base pi is 3*pi*pi + 3*pi + 3 |
| 14:31:46 | <koeien> | jedbrown: 1*pi^4 + 0 * pi^3 + 1 * pi^2 + 3 *pi^1 + 4 * pi^0 |
| 14:31:56 | <quicksilver> | this time I tped it faster! |
| 14:31:57 | <quicksilver> | one all! |
| 14:32:01 | <koeien> | quicksilver: :) |
| 14:32:38 | <Sizur> | what's the Z there? |
| 14:32:43 | <koeien> | integers |
| 14:32:48 | <quicksilver> | integers (includes negative ones) |
| 14:38:43 | <hpaste> | (anonymous) pasted "(no title)" at http://hpaste.org/4879 |
| 14:39:42 | <jedbrown> | I suppose `rational in base pi' is meant to mean in \Q[pi^n | n \in \N]. The definition of rationality has nothing to do with the base, so this discussion seemed odd to me. |
| 14:40:10 | <quicksilver> | jedbrown: I don't think "rational in base pi" is particularly meaningful |
| 14:40:28 | <quicksilver> | jedbrown: what you've written is the best bet, but I'd call that 'polynomial in pi' personally. |
| 14:40:48 | <quicksilver> | jedbrown: the point I'm trying to make to Sizur is that this stuff about computers being unable to represent irrationals is codswallop. |
| 14:40:50 | <koeien> | yes, is this different from a polynomial in X ? |
| 14:41:28 | <quicksilver> | computers can represent what I tell them to represent, dammnit :P |
| 14:41:39 | <quicksilver> | koeien: that is a hard question. |
| 14:41:54 | <quicksilver> | koeien: the answer depends on whether or not pi satistfies any non-trivial polynomials. |
| 14:41:58 | <quicksilver> | the answer is no |
| 14:42:03 | <quicksilver> | (because pi is transcendental) |
| 14:42:06 | <quicksilver> | but the proof is hard. |
| 14:42:10 | <koeien> | quicksilver: wouldn't that make it algebraic? |
| 14:42:10 | <koeien> | ok |
| 14:42:36 | <quicksilver> | I have a great proof that pi is transcendental but it won't fit in the margin of this IRC channel. |
| 14:42:45 | <koeien> | :) i've seen it once or twice |
| 14:42:53 | <ndm> | @src any |
| 14:42:53 | <lambdabot> | any p = or . map p |
| 14:43:11 | <koeien> | i've never seen the other proof in the margin |
| 14:43:24 | <ndm> | @src or |
| 14:43:24 | <lambdabot> | or = foldr (||) False |
| 14:44:12 | <Sizur> | ok, point taken, but unless we will have symbolic processors, or a language that does it for is, it will never be easy |
| 14:44:18 | <Sizur> | for us* |
| 14:44:29 | <quicksilver> | since we have both of those things, though |
| 14:44:30 | <quicksilver> | it is easy :) |
| 14:44:44 | <Sizur> | you shouldnt care of the order of your computation to affect the result |
| 14:45:35 | <Sizur> | and if you evaluate sin(x) now and then do something with it, the answer will turn out to have a larger error |
| 14:46:15 | <litb> | hm, i'm unsure about this: [ i y | y <- [1..], abs (ref - i y) <= eps ] |
| 14:46:18 | <Sizur> | if i have sin(x) here and -sin(x) there, then they should cancel |
| 14:46:26 | <litb> | can i somehow make it that i y is only evaluated one time? |
| 14:46:27 | <jedbrown> | It gets hard when you want to represent *all* irrationals. But if you choose any particular ones, it is still easy. |
| 14:46:44 | <koeien> | litb: why would it be evaluated more often? |
| 14:47:05 | <jedbrown> | koeien: Because GHC doesn't do CSE |
| 14:47:20 | <litb> | hm, i thought because i have it more than one time there |
| 14:47:30 | <quicksilver> | yes, you can |
| 14:47:34 | <koeien> | litb: aw i mussed the second i y, sorry :) |
| 14:47:52 | <quicksilver> | [ iy | y <- [1..], let iy = i y, abs (ref - iy) <= eps ] |
| 14:47:55 | <koeien> | would a let-binding work? |
| 14:48:27 | <litb> | wow, that's really a nice piece of code :) |
| 14:50:54 | <EvilTerran> | ... is someone trying to make a list of all irrationals? |
| 14:51:01 | <EvilTerran> | that sounds tricky |
| 14:51:08 | <koeien> | that would be impossible :) "a list" |
| 14:51:09 | <EvilTerran> | (impossible, for starters) |
| 14:51:31 | <EvilTerran> | indeed, there's the problem of countability |
| 14:51:42 | <jedbrown> | Although a well-ordering exists, if you accept the axiom of choice. |
| 14:52:10 | <koeien> | jedbrown: what implicaties would that have on this particular problem? |
| 14:52:36 | <EvilTerran> | but then there's the matter of representing *one* irrational in finite space in the general case |
| 14:53:04 | <Sizur> | rational#1 ;P |
| 14:53:11 | <jedbrown> | koeien: Probably none, but a well-ordering has some properties of lists. |
| 14:53:30 | <jedbrown> | koeien: Namely, a next element. |
| 14:53:31 | <quicksilver> | EvilTerran: depends what you mean by *one*, of course |
| 14:53:40 | <quicksilver> | EvilTerran: all the numbers you and I can talk about, we can represent. |
| 14:53:45 | <EvilTerran> | well, yes |
| 14:53:47 | <quicksilver> | the problem is the ones we can't talk about |
| 14:53:53 | <EvilTerran> | exactly :) |
| 14:53:53 | <quicksilver> | (turn out to be a lot of them) |
| 14:54:01 | <quicksilver> | but, should we care about them ;) |
| 14:54:04 | <quicksilver> | do they talk about us? |
| 14:54:11 | <EvilTerran> | "the smallest positive real number we can't talk about" :D |
| 14:54:30 | <jedbrown> | An irrational to a rational power is irrational. That makes a lot already. |
| 14:54:50 | <jedbrown> | Rather, a rational to an irrational power. Sorry. |
| 14:55:00 | <Japsu> | rational cat is rational. irrational cat is irrational |
| 14:55:03 | <EvilTerran> | ACTION was gonna say... sqrt(2)^2 |
| 14:55:04 | <koeien> | of course, sqrt(2)^2 |
| 14:55:10 | <EvilTerran> | ha |
| 14:55:48 | <jedbrown> | A nice example: sqrt(2)^sqrt(2)^sqrt(2) is rational. |
| 14:56:16 | <mauke> | > sqrt(2)**sqrt(2)**sqrt(2) |
| 14:56:20 | <lambdabot> | 1.7608395558800285 |
| 14:56:21 | <koeien> | with right-associative ^ ? |
| 14:56:33 | <idnar> | > sqrt(2) ** (sqrt(2) ** sqrt(2)) |
| 14:56:33 | <lambdabot> | 1.7608395558800285 |
| 14:56:36 | <jedbrown> | left-associative |
| 14:56:38 | <oerjan> | jedbrown: neither irrational to rational nor rational to irrational power is necessarily irrational |
| 14:56:47 | <idnar> | > (sqrt(2) ** sqrt(2)) ** sqrt(2) |
| 14:56:48 | <lambdabot> | 2.0000000000000004 |
| 14:56:53 | <idnar> | oh, duh |
| 14:57:00 | <idnar> | that's sqrt(2) ** 2 |
| 14:57:11 | <Sizur> | there goes the symbolysm |
| 14:57:11 | <quicksilver> | idnar: u wuz tricked! |
| 14:57:12 | <jedbrown> | It's stronger. Rational to an irrational power is transcendental. |
| 14:57:12 | <quicksilver> | :P |
| 14:57:39 | <idnar> | > sqrt(2) ** sqrt(2) |
| 14:57:40 | <lambdabot> | 1.632526919438153 |
| 14:58:04 | <litb> | that's even more interesting than #math here. |
| 14:58:16 | <quicksilver> | jedbrown: except for 0 and 1. |
| 14:58:18 | <oerjan> | jedbrown: no. |
| 14:58:24 | <EvilTerran> | ACTION is reminded of the non-constructive proof that an irrational to an irrational power can be rational |
| 14:58:31 | <oerjan> | the power must be algebraic. |
| 14:58:37 | <quicksilver> | and that :) |
| 14:58:55 | <litb> | is the power of love rational ? |
| 14:59:03 | <jedbrown> | oerjan: Gelfond-Schneider Theorem. |
| 14:59:16 | <oerjan> | jedbrown: i know. |
| 14:59:17 | <Sizur> | is love rational? |
| 14:59:26 | <quicksilver> | correct, but the power must be irrational algebraic |
| 14:59:32 | <quicksilver> | not general "irrational" |
| 14:59:34 | <jedbrown> | oerjan: Right. |
| 15:00:09 | <EvilTerran> | is rt2^rt2 rational? if so, we're done. if not, consider (rt2^rt2)^rt2 = rt2^(rt2*rt2) = rt2^2 = 2, in which case rt2^rt2 is irrational (by assumption) and (rt2^rt2)^rt2 is rational, so we're done |
| 15:00:26 | <jedbrown> | ACTION kicks himself for mixing things up. |
| 15:00:45 | <koeien> | EvilTerran: nice proof, saw it on wiki once |
| 15:01:11 | <hpaste> | pyx annotated "(no title)" with "(no title)" at http://hpaste.org/4879#a1 |
| 15:01:22 | <Sizur> | > let r = sqrt(2) in (r**r)**r |
| 15:01:22 | <lambdabot> | 2.0000000000000004 |
| 15:03:01 | <Sizur> | quicksilver: so the easy part you were talking about is simplifying by hand? |
| 15:03:42 | <Sizur> | i think the compiler should do it |
| 15:03:47 | <Sizur> | someday |
| 15:06:10 | <quicksilver> | Sizur: well you were talking about more than one thing |
| 15:06:19 | <quicksilver> | it's not necessary to simplify, necessairly |
| 15:06:36 | <quicksilver> | most computable real implementations jsut allow you to calculate up to whatever precision you want |
| 15:06:45 | <quicksilver> | on the other hand if you *do* want to work symbolically |
| 15:07:00 | <quicksilver> | there are pretty impresive simplifiers out there |
| 15:07:00 | <quicksilver> | just look at mathematica and friends |
| 15:07:24 | <Sizur> | i'm just arguing that symbolic simplification should be part of the compiler |
| 15:08:17 | <Sizur> | optimized to do the least operations on irrational (already evaluated evaluated) values |
| 15:08:31 | <hpaste> | bsdemon annotated "(no title)" with "check it!" at http://hpaste.org/4879#a2 |
| 15:08:50 | <koeien> | http://hpaste.org/4879#a2 |
| 15:08:58 | <koeien> | sorry |
| 15:14:32 | <hpaste> | (anonymous) annotated "(no title)" with "(no title)" at http://hpaste.org/4879#a3 |
| 15:17:31 | <Sizur> | but it's always easy to say how things should be ;) |
| 15:18:25 | <glen_quagmire> | hey, if you're bored, give me a one liner that calculates all dates in the form of YYYY-MM-DD which evaluates to 1970. for example, 2005-11-24 = 1970 |
| 15:18:49 | <Sizur> | you can do same stuff you're doing in haskell with perl. we love haskell because it checks for more errors automatically |
| 15:19:24 | <faxathisia> | > 2005-11-24 -- uh?? |
| 15:19:28 | <lambdabot> | 1970 |
| 15:19:52 | <faxathisia> | oh... stupid APL evaluation rules confusing me... |
| 15:20:38 | <shachaf> | glen_quagmire: Is there a particular reason you want those dates? :-) |
| 15:20:53 | <glen_quagmire> | shachaf: so that i can blog my nerdiness |
| 15:21:15 | <glen_quagmire> | i found that 1970 + 12 + 31 = 2013. so 2013 is a significant year |
| 15:21:32 | <byorgey> | > [(y,m,d) | y <- [1970..1970+12+31], m <- [1..12], d <- [1..31], y-m-d == 1970 ] -- a simple start, but obviously months with less than 31 days screw it up |
| 15:21:35 | <lambdabot> | [(1972,1,1),(1973,1,2),(1973,2,1),(1974,1,3),(1974,2,2),(1974,3,1),(1975,1,4... |
| 15:21:41 | <Sizur> | sorry, why is 2013 significant again? |
| 15:22:13 | <glen_quagmire> | > 2013-12-31 |
| 15:22:13 | <lambdabot> | 1970 |
| 15:22:15 | <oerjan> | byorgey: you don't need that y list |
| 15:22:19 | <Sizur> | you can filter based on date validity |
| 15:22:25 | <shachaf> | glen_quagmire: Why does that make it significant? |
| 15:22:29 | <oerjan> | just let y = 1970+m+d |
| 15:22:45 | <glen_quagmire> | because epoch time starts from 1970 |
| 15:23:09 | <C-Keen> | can I use a where clause that is valid for all guards of a function definition? |
| 15:23:10 | <shachaf> | glen_quagmire: But that's arbitrary. |
| 15:23:16 | <quicksilver> | let mons = [undefined,31,28,31,30,31,30,31,31,30,31,30,31] |
| 15:23:24 | <shachaf> | glen_quagmire: And why are you looking at the end of the year? |
| 15:23:34 | <quicksilver> | then change "d" to "d <- mons !! m" |
| 15:23:35 | <faxathisia> | C-Keen: I don't think so |
| 15:23:39 | <shachaf> | C-Keen: I don't think so. |
| 15:23:40 | <oerjan> | C-Keen: only if there is just one set of argument patterns |
| 15:23:43 | <hpaste> | gg annotated "(no title)" with "(no title)" at http://hpaste.org/4879#a4 |
| 15:23:54 | <glen_quagmire> | i'm a pseudo scientist. |
| 15:24:16 | <C-Keen> | So I have to write this out for each guard? Maybe I should define a little function instead |
| 15:24:24 | <quicksilver> | not for each guard, no |
| 15:24:27 | <oerjan> | C-Keen: not for each guard |
| 15:24:33 | <quicksilver> | but for each equation |
| 15:24:38 | <quicksilver> | if there is only one equation, it's fine |
| 15:24:52 | <quicksilver> | otherwise you can pull it into a case |
| 15:24:53 | <oerjan> | quicksilver: um equation is not the right word |
| 15:25:00 | <quicksilver> | I believe it is? |
| 15:25:09 | <oerjan> | the = goes to the right of each guard, remember |
| 15:25:11 | <C-Keen> | there is just one equation that should use the where but the other one returns nothing |
| 15:25:18 | <quicksilver> | "f 1 = 0; f 0 = 1" <-- this is a function defined in two equations. |
| 15:25:59 | <oerjan> | f x | even x = 0 | otherwise = 1 -- two equations, but can share a where |
| 15:26:08 | <quicksilver> | I think that's one equation, personally |
| 15:26:11 | <Sizur> | Data.Time.Calendar does not have a data validity function :/ |
| 15:26:15 | <quicksilver> | but I agree it could be confusing ;) |
| 15:26:39 | <Sizur> | :t fromGregorian |
| 15:26:41 | <lambdabot> | Not in scope: `fromGregorian' |
| 15:27:13 | <Sizur> | :t Data.Time.Calendar.fromGregorian |
| 15:27:13 | <C-Keen> | I have f x | cond1 = Nothing | otherwise Just some stuff x where stuff = something else |
| 15:27:14 | <lambdabot> | Couldn't find qualified module. |
| 15:28:03 | <faxathisia> | :t "[Char]" |
| 15:28:04 | <lambdabot> | [Char] |
| 15:28:15 | <oerjan> | C-Keen: are you missing = after otherwise? |
| 15:28:45 | <oerjan> | C-Keen: a where should be fine in that case |
| 15:28:49 | <resiak> | > fix (\x -> x `asTypeOf` x) |
| 15:28:49 | <lambdabot> | Exception: <<loop>> |
| 15:28:50 | <resiak> | aww. |
| 15:29:03 | <C-Keen> | oerjan: yes you where right *blush* |
| 15:29:29 | <Saizan> | > fix id |
| 15:29:30 | <lambdabot> | Exception: <<loop>> |
| 15:29:43 | <C-Keen> | I feel like an idiot in doing things in haskell :\ |
| 15:29:55 | <Saizan> | > fix typeOf |
| 15:29:55 | <lambdabot> | TypeRep |
| 15:29:57 | <glen_quagmire> | > Data.Time.Calendar.fromGregorian 2000 2 (-1) |
| 15:29:57 | <lambdabot> | Not in scope: `Data.Time.Calendar.fromGregorian' |
| 15:30:05 | <earthy> | c-keen: so do I. and I mostly know what I'm doing. :) |
| 15:30:33 | <faxathisia> | @pl @pl |
| 15:30:33 | <faxathisia> | :t asTypeOf |
| 15:30:33 | <lambdabot> | (line 1, column 1): |
| 15:30:33 | <lambdabot> | unexpected "@" |
| 15:30:33 | <lambdabot> | expecting white space, natural, identifier, lambda abstraction or expression |
| 15:30:34 | <lambdabot> | forall a. a -> a -> a |
| 15:32:46 | <idnar> | @djinn forall a. a -> a -> a |
| 15:32:47 | <lambdabot> | f _ a = a |
| 15:32:53 | <byorgey> | C-Keen: that's ok, it takes a while to get used to. we were all there at one point. =) |
| 15:32:58 | <oerjan> | that's the wrong one |
| 15:33:25 | <faxathisia> | @djinn a -> b |
| 15:33:25 | <lambdabot> | -- f cannot be realized. |
| 15:33:34 | <yrlnry> | @djinn (a->a)->a |
| 15:33:34 | <lambdabot> | -- f cannot be realized. |
| 15:33:39 | <yrlnry> | @type fix |
| 15:33:40 | <lambdabot> | forall a. (a -> a) -> a |
| 15:34:00 | <yrlnry> | Speaking of which, just yesterday I read Turner's paper on guaranteed-to-terminate computation. |
| 15:34:27 | <quicksilver> | s'a good paper |
| 15:35:49 | <faxathisia> | What's it about? |
| 15:36:27 | <oerjan> | guaranteed-to-terminate computation, i'd hazard to guess. |
| 15:37:06 | <quicksilver> | weaker notions of computation |
| 15:37:11 | <quicksilver> | like inductive data types |
| 15:37:36 | <yrlnry> | That you can fix a nuber of glaring problems in the Haskell type system by restricting your notion of computation to only those functions that are guaranteed to terminate. |
| 15:37:44 | <yrlnry> | Just a minute, I'll hunt up the reference. |
| 15:38:51 | <yrlnry> | http://portal.acm.org/citation.cfm?id=652567 |
| 15:38:53 | <lambdabot> | Title: Elementary Strong Functional Programming |
| 15:38:55 | <yrlnry> | Just a sec. |
| 15:39:36 | <yrlnry> | http://www.google.com/url?sa=t&ct=res&cd=6&url=http%3A%2F%2Fwww.jucs.org%2Fjucs_10_7%2Ftotal_functional_programming%2Fjucs_10_07_0751_0768_turner.pdf&ei=fuqER8_NN4aKesCclFA&usg=AFQjCNHnOZlyo8eLnHqIjs9pglWLSI-m4w&sig2=orcVpNrqKkzw45SaqItavw |
| 15:39:40 | <lambdabot> | http://tinyurl.com/2p9y9l |
| 15:39:44 | <yrlnry> | Bah, Google. |
| 15:39:50 | <yrlnry> | Anyway, that's the PDF. |
| 15:39:54 | <faxathisia> | cool thank you |
| 15:39:55 | <quicksilver> | the tinyurl works, anyhow |
| 15:40:00 | <quicksilver> | despite the longness of the long url :) |
| 15:40:01 | <yrlnry> | You are very welcome. |
| 15:40:45 | <matthew_-> | will "\tv -> atomically (readTVar tv)" ever abort? |
| 15:40:52 | <matthew_-> | s/abort/retry/ |
| 15:41:09 | <quicksilver> | no |
| 15:41:19 | <quicksilver> | only transactions which write stuff can retry, as I understand it |
| 15:41:23 | <matthew_-> | ahh |
| 15:41:23 | <quicksilver> | (which may not be very well) |
| 15:41:41 | <quicksilver> | unless you retry yourself explicitly, of course! |
| 15:41:42 | <mauke> | quicksilver: that doesn't sound right |
| 15:41:43 | <matthew_-> | will "\tvLst -> atomically (mapM readTVar tvLst)" ever retry? |
| 15:42:06 | <matthew_-> | yeah, you see with that one, surely the idea is that the reads are reading a consistent snapshot of the world |
| 15:42:14 | <matthew_-> | so they should abort if there are writes mixed in there no? |
| 15:42:21 | <mauke> | atomically $ liftM2 (,) (readTVar v) (readTVar v) |
| 15:42:22 | <quicksilver> | ah, perhaps you're right. |
| 15:42:29 | <matthew_-> | I dunno |
| 15:42:30 | <quicksilver> | yes, good point. |
| 15:42:38 | <yrlnry> | I got to the Total Functional Programming paper from here: http://en.wikipedia.org/wiki/Corecursion |
| 15:42:38 | <lambdabot> | Title: Corecursion - Wikipedia, the free encyclopedia |
| 15:42:39 | <Tac-Tics> | yeah, if one of those variables in tvLst is changed, it would need to retry |
| 15:42:51 | <quicksilver> | but reading only one can't retry. |
| 15:42:53 | <BMeph> | Weird: I cal'd that there are 366 of those == 1970 days. |
| 15:43:13 | <matthew_-> | actually, I'm really not convinced of my arguement at all |
| 15:43:31 | <thoughtpolice> | judging from the docs it doesn't look like it will retry |
| 15:44:02 | <Tac-Tics> | stay pure, and the O(1)ness of assignment will ensure it won't even matter |
| 15:44:09 | <BMeph> | Whoops, had one that was off; there are 365 of them. |
| 15:44:34 | <matthew_-> | reading a TVar is by definition consistent as inconsistent values are by definition hidden by the transactions |
| 15:44:47 | <matthew_-> | so I think it shouldn't retry, as quicksilver originally suggested |
| 15:45:02 | <quicksilver> | I don't think you're right |
| 15:45:07 | <quicksilver> | STM is not MVCC |
| 15:45:09 | <oerjan> | BMeph: that's not immensely surprising ;) |
| 15:45:12 | <quicksilver> | it's optimistic concurrency |
| 15:45:31 | <oerjan> | 1970+any day other than february 29 |
| 15:45:32 | <quicksilver> | it doesn't actually maintain "alternative realities" |
| 15:45:48 | <oerjan> | which happens not to give a leap year |
| 15:46:24 | <hpaste> | bhondu pasted "(no title)" at http://hpaste.org/4881 |
| 15:46:25 | <matthew_-> | well, there's the alternative reality where people believe STM is the magic bullet that'll save us all ;) |
| 15:46:38 | <BMeph> | Yeah - once I threw in the leap year check, it tossed that one out. I found it more impressive as 366. |
| 15:46:39 | <quicksilver> | ;) |
| 15:46:50 | <Apocalisp> | quicksilver: "Alternative realities" boil down to sequencing anyway. |
| 15:47:04 | <quicksilver> | Apocalisp: not quite. |
| 15:47:16 | <quicksilver> | Apocalisp: they allow long-running read transactions to overlap termporally |
| 15:47:20 | <quicksilver> | (with write operations) |
| 15:47:30 | <quicksilver> | instead of having to abort once a conflicting write commits |
| 15:48:23 | <matthew_-> | you see, if you have a transaction that only reads, then it's never going to change the world, so it can't have any write conflicts. So I think it should just go straight through without any retrys |
| 15:48:24 | <Apocalisp> | Oh, right. But the client can't tell the difference between that and sequencing. |
| 15:48:46 | <quicksilver> | Apocalisp: but nonetheless it is this exact point we are dicussing :) |
| 15:48:47 | <Apocalisp> | :-o It's a monad! |
| 15:48:58 | <quicksilver> | Apocalisp: whether or not a multiple read can ever retry. |
| 15:49:08 | <quicksilver> | matthew_-: it has a sort of "return" conflict |
| 15:49:18 | <quicksilver> | matthew_-: when the transaciton commits, it returns a value to the calling IO code |
| 15:49:32 | <matthew_-> | the point of the retry is that you're trying to update the world with new values that are based on now out-of-date data |
| 15:49:45 | <quicksilver> | matthew_-: it's not only out of date you have to worry about |
| 15:49:48 | <quicksilver> | it's inconsistent |
| 15:49:57 | <quicksilver> | and that's why your multiple read can, in fact, retry |
| 15:50:07 | <quicksilver> | it will retry if the data it has read turns out to be inconsistent. |
| 15:51:54 | <quicksilver> | "When execution returns |
| 15:51:54 | <quicksilver> | to the AtomicFrame, the log is validated, using STMIsValid, to |
| 15:51:54 | <quicksilver> | check that it reflects a consistent view of memory. For each log |
| 15:51:54 | <quicksilver> | entry, validation checks that the old value is pointer-equal to the |
| 15:51:54 | <quicksilver> | current contents of the TVar.locates new wait-queue entries, held in doubly-linked lists attached |
| 15:51:57 | <quicksilver> | to the TVars that the transaction has read, using the previously-null |
| 15:51:57 | <Apocalisp> | So STM has atomicity and isolation, but not consistency? |
| 15:51:59 | <Sizur> | matthew_-: what if you begin to read and then another transaction modifies the stuff you are about to continue to read? |
| 15:51:59 | <quicksilver> | field in each TVar. Once this is done, the calling thread is respon- |
| 15:52:02 | <quicksilver> | sible for blocking itself and re-entering the scheduler. |
| 15:52:09 | <quicksilver> | Apocalisp: no, it has consistency, in fact :) |
| 15:52:26 | <matthew_-> | ahh, I see, eg assume x and y are both initially 0; atomically (writeTVar x 1 >> writeTVar y 2); || atomically (readTVar x >>= \xv -> readTVar y >>= \yv -> return [xv, yv]). Here - the values of xv and yv should be [0,0] or [1,2] not any other combination? |
| 15:52:34 | <quicksilver> | Apocalisp: what I'm trying to convince matthew_- of, is that because it has consistency, multiple reads can retry. |
| 15:52:49 | <Apocalisp> | ohhh |
| 15:53:11 | <quicksilver> | matthew_-: yes, exactly what you said. |
| 15:53:19 | <quicksilver> | this condition is called serializability. |
| 15:53:24 | <matthew_-> | yep. |
| 15:53:36 | <quicksilver> | A property which STM has but none of the SQL databases have. |
| 15:53:48 | <quicksilver> | despite the existence of the poorly named 'transaction isolation serializable' |
| 15:53:48 | <Apocalisp> | ;-) No, they don't. |
| 15:54:24 | <quicksilver> | matthew_-: in fact, for implementation reasons, I suspect even a single read transaction might retry |
| 15:54:33 | <quicksilver> | matthew_-: although it should be very unlikely in practice. |
| 15:54:42 | <C-Keen> | :t Word8 |
| 15:54:44 | <lambdabot> | Not in scope: data constructor `Word8' |
| 15:54:50 | <quicksilver> | because the test of consistency which GHC uses is conservative |
| 15:54:58 | <quicksilver> | they use "equal to the current state" for consistent |
| 15:55:08 | <quicksilver> | not "equal to any consistent state" |
| 15:55:15 | <quicksilver> | which is conservative, and feasible. |
| 15:56:06 | <matthew_-> | gotcha |
| 15:56:50 | <quicksilver> | so atomically (x <- readTVar foo; do something slow ; return x ) |
| 15:57:01 | <quicksilver> | could retry because foo might change during the slow bit |
| 15:57:12 | <oerjan> | @index Word8 |
| 15:57:12 | <lambdabot> | Data.Word, Foreign |
| 15:57:17 | <quicksilver> | but in practice you'd be unlikely to write something like that |
| 15:57:52 | <matthew_-> | "in pactice" not in "academia" |
| 15:58:48 | <quicksilver> | ;) |
| 15:59:00 | <quicksilver> | well you don't normally do slow stuff inside STM |
| 15:59:25 | <quicksilver> | without STM writes |
| 15:59:33 | <quicksilver> | because you might as well do it outside |
| 16:00:19 | <matthew_-> | so, atomically (mapM_ (flip writeTVar 0)) should never retry |
| 16:01:01 | <matthew_-> | no that's wrong |
| 16:01:15 | <matthew_-> | ugh, this is vastly trickier than something else |
| 16:01:51 | <matthew_-> | because you could do two of those in parallel, one with 0 and one with 1 and the same list of tvars and they must not interleave |
| 16:02:28 | <quicksilver> | exactly |
| 16:02:45 | <quicksilver> | I wonder if you could get starvation that way |
| 16:02:54 | <matthew_-> | it wouldn't surprise me |
| 16:03:07 | <quicksilver> | I thought STM had a progress guarantee |
| 16:03:21 | <quicksilver> | yes, it does |
| 16:03:26 | <quicksilver> | one of those would commit first |
| 16:03:29 | <quicksilver> | of course |
| 16:03:33 | <quicksilver> | so progress would be made |
| 16:04:48 | <matthew_-> | hmm. I'm not convinced |
| 16:05:17 | <quicksilver> | matthew_-: whichever one tries to commit first will succeed |
| 16:05:29 | <quicksilver> | matthew_-: it will not see the partial results of the other, because the other has not yet committed. |
| 16:05:34 | <quicksilver> | matthew_-: but then, the other will fail. |
| 16:05:48 | <matthew_-> | yes yes. of course. Sorry I was entertaining the idea that they would commit in parallel |
| 16:05:53 | <quicksilver> | in fact, I think the implementation described in that paper is stricter than needed |
| 16:06:01 | <quicksilver> | I think if you have a write with no preceding read |
| 16:06:01 | <matthew_-> | which is, I'm sure you'll agree, an entertaining idea |
| 16:06:10 | <quicksilver> | there would be no need to check that variable |
| 16:06:15 | <hpaste> | resiak pasted "Is this a sensible way to optionally serialize access to a global MVar?" at http://hpaste.org/4882 |
| 16:06:17 | <quicksilver> | because it doesn't matter if it's changed or not |
| 16:06:30 | <quicksilver> | resiak: yes |
| 16:06:44 | <resiak> | and, is this already done in some library that i should just reuse? |
| 16:06:45 | <quicksilver> | resiak: that's exactly what MVars are for :) |
| 16:06:48 | <quicksilver> | no, it's not |
| 16:06:52 | <quicksilver> | AFAIK> |
| 16:07:02 | <resiak> | quicksilver: sure, but I meant the MVar -> State "lifting" (is that the right word?) |
| 16:07:13 | <quicksilver> | not really the right word, but it makes perfect sense |
| 16:07:22 | <faxathisia> | ?djinn (a->b)->(a->c)->(b->d)->(c->e)->a->(a,b,c,d,e) |
| 16:07:24 | <lambdabot> | f a b c d e = (e, a e, b e, c (a e), d (b e)) |
| 16:07:32 | <resiak> | I contemplated making all access serialized, but then you'd block reading a huge file even if it doesn't use the global state |
| 16:07:49 | <quicksilver> | resiak: I went into some detail on how to do that with IORefs to thread state through IO callbacks. |
| 16:07:52 | <quicksilver> | resiak: in a -cafe post |
| 16:08:02 | <quicksilver> | resiak: I briefly mentioned there was an obvious generalisation to MVars |
| 16:08:08 | <quicksilver> | but I didn't bother to write it out :) |
| 16:08:19 | <resiak> | hah |
| 16:08:26 | <resiak> | i was in fact reading exactly that post a few hours ago |
| 16:08:59 | <resiak> | so i'm glad that my implementation meets with its author's approval :) |
| 16:12:28 | <resiak> | When you just want to read the state, \f -> do { v <- ask; state <- readMVar v; return (f state) } seems like it should have a standardish name; maybe 'askState' ? |
| 16:18:54 | <hpaste> | mmorrow pasted "{.c,.hs} -> (gcc,ghc) -> {.s,.s}" at http://hpaste.org/4883 |
| 16:20:02 | <quicksilver> | matthew_-: after some discussions with one of the STM authors, he seems to agree that write-only transactions shouldn't need to check the log. |
| 16:20:09 | <quicksilver> | matthew_-: but they do, in the current implementation. |
| 16:21:49 | <hpaste> | (anonymous) annotated "{.c,.hs} -> (gcc,ghc) -> {.s,.s}" with "the rest" at http://hpaste.org/4883#a1 |
| 16:23:41 | <evil08> | hola atodos |
| 16:25:25 | <matthew_-> | quicksilver: ahh, interesting. |
| 16:25:38 | <matthew_-> | who's at glasgow doing STM? |
| 16:25:56 | <matthew_-> | (or were these non-inperson discussions?) |
| 16:26:30 | <quicksilver> | I'm in london! |
| 16:26:35 | <quicksilver> | Simon M is in cambridge. |
| 16:26:43 | <quicksilver> | But geography is no barrier in this world. |
| 16:26:50 | <quicksilver> | matthew_-: http://hackage.haskell.org/trac/ghc/ticket/2028 |
| 16:26:52 | <lambdabot> | Title: #2028 (STM slightly conservative on write-only transactions) - GHC - Trac |
| 16:28:52 | <pejo> | quicksilver, you just say that because you can get anywhere in UK within a couple of hours. ;) |
| 16:29:03 | <quicksilver> | well, there is that |
| 16:29:09 | <ndm> | anyone any idea how expensive unsafePerformIO $ readIORef / writeIORef is |
| 16:29:16 | <quicksilver> | although it took 3 and a half hours to get to sheffield at the weekend. |
| 16:29:19 | <ndm> | pejo: i spent 9 hours on the train the day i went to oxford |
| 16:29:26 | <matthew_-> | quicksilver: where are you in london? |
| 16:29:27 | <Apocalisp> | > join $ map (\x -> map (* x) [0..9]) [0..9] |
| 16:29:30 | <lambdabot> | [0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,0,2,4,6,8,10,12,14,16,18,0,3,6,9,12... |
| 16:29:34 | <quicksilver> | matthew_-: just by Mansion House tube |
| 16:29:43 | <Apocalisp> | What's a more general way of doing that? |
| 16:29:44 | <pejo> | ndm, isn't London somewhat of a hub though? |
| 16:29:50 | <matthew_-> | ahh, fancy a pint tomorrow? |
| 16:30:00 | <ndm> | pejo: kinda, its also very expensive to travel to and from |
| 16:30:22 | <dcoutts> | ndm: unsafePerformIO is not free, read/write on IORefs is pretty cheap |
| 16:30:24 | <oerjan> | > liftM2 (*) [0..9] [0..9] |
| 16:30:24 | <lambdabot> | [0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,0,2,4,6,8,10,12,14,16,18,0,3,6,9,12... |
| 16:30:28 | <faxathisia> | > join [1,2,3] |
| 16:30:29 | <lambdabot> | add an instance declaration for (Num [a]) |
| 16:30:29 | <lambdabot> | In the expression: 3 |
| 16:30:49 | <Apocalisp> | oerjan: Nice! That's what I was looking for. |
| 16:30:55 | <matthew_-> | quicksilver: or are you leaving london soon? |
| 16:31:13 | <faxathisia> | > liftM2 (,) [1,2,3,4,5] [88,55] |
| 16:31:14 | <lambdabot> | [(1,88),(1,55),(2,88),(2,55),(3,88),(3,55),(4,88),(4,55),(5,88),(5,55)] |
| 16:31:22 | <ndm> | mmm, i think i might even be safe with inlinePerformIO here |
| 16:31:33 | <faxathisia> | @src liftM2 |
| 16:31:33 | <lambdabot> | liftM2 f m1 m2 = do { x1 <- m1; x2 <- m2; return (f x1 x2) } |
| 16:31:34 | <ndm> | dcoutts, are you going to propose inlinePerformIO for System.IO.Unsafe |
| 16:31:38 | <yrlnry> | How does liftM2 know which monad to lift (,) into? |
| 16:31:48 | <faxathisia> | I think it is using lists |
| 16:31:55 | <faxathisia> | since I passed in some |
| 16:32:00 | <dcoutts> | ndm: probably not, and certainly not under that name |
| 16:32:08 | <faxathisia> | :t liftM |
| 16:32:09 | <faxathisia> | :t liftM2 |
| 16:32:09 | <lambdabot> | forall a1 r (m :: * -> *). (Monad m) => (a1 -> r) -> m a1 -> m r |
| 16:32:10 | <yrlnry> | Evidently. But if the later arguments were in some other monad, wouldn't it lift into that monad? |
| 16:32:10 | <lambdabot> | forall a1 a2 r (m :: * -> *). (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r |
| 16:32:13 | <Sizur> | > liftM2 (,) (Just 1) Nothing |
| 16:32:16 | <lambdabot> | Nothing |
| 16:32:28 | <yrlnry> | Huh. I did not know the Haskell type system was that expressive. |
| 16:32:34 | <Sizur> | > liftM2 (,) (Just 1) (Just 2) |
| 16:32:34 | <lambdabot> | Just (1,2) |
| 16:32:36 | <faxathisia> | parametric polymorphism ???? |
| 16:32:55 | <dcoutts> | ndm: there is also another form of unsafePerformIO that is intermediate in safety between unsafePerformIO and inlinePerformIO, one might informally call it unlockedPerformIO |
| 16:33:03 | <yrlnry> | It's the declaration of m as a type of kind "* -> *" that I didn't realize was allowed. I thought that the * -> * was only metasyntax. |
| 16:33:13 | <ndm> | dcoutts, then submit them all with plenty of docs! |
| 16:33:22 | <oerjan> | yrlnry: it's an extension |
| 16:33:34 | <dcoutts> | ndm: well exactly, I'd have to recall what the safety properties are |
| 16:33:36 | <yrlnry> | Ahhhh. |
| 16:33:41 | <quicksilver> | yrlnry: yeah, it's not haskell98, but it's handy in some circumstances. |
| 16:33:41 | <oerjan> | as is the forall keyword |
| 16:33:58 | <quicksilver> | matthew_-: not leaving, no. I work here every day :) |
| 16:34:05 | <yrlnry> | I learned haskell by reading the report :) |
| 16:34:31 | <bos> | ACTION reads some java code samples, and his head bursts into flames. "they're all wrong!" |
| 16:34:51 | <matthew_-> | quicksilver: ok, for some reason I thought you were at glasgow uni |
| 16:34:59 | <quicksilver> | ACTION shakes his head |
| 16:35:07 | <bos> | morons earnestly informing the even more ignorant that "volatile" means almost the same thing as "synchronized". jaypers., |
| 16:35:13 | <matthew_-> | ok, I'm delusional then |
| 16:35:15 | <quicksilver> | once upon a time I was at QM. |
| 16:35:24 | <quicksilver> | more recently, I'm in a dark pit called 'The City'. |
| 16:35:30 | <matthew_-> | ahh, with Ross? |
| 16:36:25 | <matthew_-> | oh, "The" City? Not City Uni? |
| 16:36:31 | <quicksilver> | "The" City. |
| 16:36:40 | <matthew_-> | right. With Lennart? |
| 16:36:42 | <quicksilver> | where the suits live. |
| 16:36:51 | <matthew_-> | yep. I avoid it well |
| 16:37:13 | <matthew_-> | good, well I'm glad we got that cleared up... |
| 16:45:52 | <Apocalisp> | How does liftM2 know to apply f x1 x2 for every x1 in m1 and every x2 in m2? |
| 16:46:00 | <idnar> | @src liftM2 |
| 16:46:00 | <lambdabot> | liftM2 f m1 m2 = do { x1 <- m1; x2 <- m2; return (f x1 x2) } |
| 16:46:22 | <faxathisia> | I thinnk thats' becase of th list moand |
| 16:46:24 | <faxathisia> | monad.. |
| 16:46:31 | <faxathisia> | It would do something else with different monads |
| 16:46:39 | <idnar> | Apocalisp: it sounds like you're talking about the list monad specifically, in which case the answer is "because that's how the list monad works" |
| 16:46:46 | <faxathisia> | @src [] Monad |
| 16:46:47 | <lambdabot> | Source not found. You type like i drive. |
| 16:46:54 | <oerjan> | another way to write it for lists is with comprehensions: |
| 16:46:54 | <faxathisia> | @src [] (>>=) |
| 16:46:55 | <lambdabot> | m >>= k = foldr ((++) . k) [] m |
| 16:47:03 | <idnar> | > liftM2 (+) (Just 5) Nothing |
| 16:47:06 | <lambdabot> | Nothing |
| 16:47:08 | <idnar> | > liftM2 (+) (Just 5) (Just 10) |
| 16:47:09 | <lambdabot> | Just 15 |
| 16:47:10 | <oerjan> | [f x1 x2 | x1 <- l1, x2 <- l2] |
| 16:47:13 | <idnar> | > liftM2 (+) [1, 2] [3, 4] |
| 16:47:14 | <lambdabot> | [4,5,5,6] |
| 16:47:16 | <faxathisia> | > [1,2,3,4] >>= id |
| 16:47:16 | <lambdabot> | add an instance declaration for (Num [b]) |
| 16:47:16 | <lambdabot> | In the expression: 4 |
| 16:47:26 | <Apocalisp> | @src [] liftM |
| 16:47:27 | <lambdabot> | Source not found. BOB says: You seem to have forgotten your passwd, enter another! |
| 16:47:37 | <quicksilver> | liftM is uniform |
| 16:47:40 | <quicksilver> | it's not per-instance |
| 16:47:42 | <quicksilver> | @src liftM |
| 16:47:43 | <lambdabot> | liftM f m1 = do { x1 <- m1; return (f x1) } |
| 16:47:45 | <faxathisia> | > [1,2,3,4] >>= [] |
| 16:47:45 | <lambdabot> | Couldn't match expected type `t -> [b]' against inferred type `[a]' |
| 16:48:06 | <yrlnry> | liftM2 (liftM2 (+)) [Just 1, Nothing] [Just 2, Just 4] |
| 16:48:07 | <resiak> | > [1..4] >>= (:[]) |
| 16:48:08 | <lambdabot> | [1,2,3,4] |
| 16:48:11 | <yrlnry> | > liftM2 (liftM2 (+)) [Just 1, Nothing] [Just 2, Just 4] |
| 16:48:12 | <lambdabot> | [Just 3,Just 5,Nothing,Nothing] |
| 16:48:16 | <oerjan> | > [1,2,3,4] >> [] |
| 16:48:16 | <lambdabot> | [] |
| 16:48:17 | <yrlnry> | Wow. |
| 16:48:55 | <resiak> | Maybe Data.List should define monster = (:[]) |
| 16:48:57 | <yrlnry> | @ty liftM2 |
| 16:49:03 | <dons> | it's been called 'box' in the past |
| 16:49:06 | <faxathisia> | > [1,2,3,4] >>= (:[666]) |
| 16:49:07 | <yrlnry> | @t liftM2 |
| 16:49:07 | <lambdabot> | Maybe you meant: tell temp thank you thanks thx time tiny-url todo todo-add todo-delete topic-cons topic-init topic-null topic-snoc topic-tail topic-tell type . ? @ ft v |
| 16:49:07 | <idnar> | @pl liftM2 . liftM2 |
| 16:49:12 | <lambdabot> | forall a1 a2 r (m :: * -> *). (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r |
| 16:49:12 | <lambdabot> | liftM2 . liftM2 |
| 16:49:13 | <lambdabot> | [1,666,2,666,3,666,4,666] |
| 16:49:24 | <yrlnry> | @type liftM2 |
| 16:49:25 | <lambdabot> | forall a1 a2 r (m :: * -> *). (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r |
| 16:49:34 | <idnar> | :t liftM2 . liftM2 |
| 16:49:35 | <faxathisia> | intersperse = butLast . (>>= (:[666])) |
| 16:49:35 | <lambdabot> | forall (m :: * -> *) a1 a2 r (m1 :: * -> *). (Monad m, Monad m1) => (a1 -> a2 -> r) -> m (m1 a1) -> m (m1 a2) -> m (m1 r) |
| 16:49:36 | <yrlnry> | @type liftM2 . liftM2 |
| 16:49:37 | <lambdabot> | forall (m :: * -> *) a1 a2 r (m1 :: * -> *). (Monad m, Monad m1) => (a1 -> a2 -> r) -> m (m1 a1) -> m (m1 a2) -> m (m1 r) |
| 16:49:44 | <idnar> | is there some shortcut for lifting multiple times? |
| 16:49:53 | <quicksilver> | no |
| 16:49:55 | <faxathisia> | > (reverse . tail . reverse . (>>= (:[666]))) [1,2,3,4,5] |
| 16:49:56 | <lambdabot> | [1,666,2,666,3,666,4,666,5] |
| 16:50:00 | <resiak> | @pl \f -> (f . f . f) |
| 16:50:00 | <lambdabot> | ap (.) (join (.)) |
| 16:50:03 | <resiak> | aww |
| 16:50:11 | <quicksilver> | although sometimes if m is a monad and n is a monad then m n is also a monad |
| 16:50:19 | <quicksilver> | and then it's liftM2 for the combined monad |
| 16:50:21 | <quicksilver> | not always, though. |
| 16:50:25 | <yrlnry> | exponential monads. |
| 16:50:30 | <idnar> | heh |
| 16:50:35 | <Apocalisp> | ACTION is looking for the "every" in in the list monad that tells liftM2 how to do its thing. |
| 16:50:35 | <quicksilver> | in particular, I don't believe it's true for [] and Maybe, either way around. |
| 16:50:46 | <quicksilver> | Apocalisp: it's the definition of >>= |
| 16:50:50 | <oerjan> | @src [] >>= |
| 16:50:50 | <lambdabot> | Source not found. This mission is too important for me to allow you to jeopardize it. |
| 16:50:55 | <faxathisia> | > (reverse . tail . reverse . (>>= (:[666]))) [1,2,3,4,5] |
| 16:50:55 | <oerjan> | @src [] (>>=) |
| 16:50:55 | <lambdabot> | [1,666,2,666,3,666,4,666,5] |
| 16:50:55 | <lambdabot> | m >>= k = foldr ((++) . k) [] m |
| 16:51:01 | <quicksilver> | Apocalisp: which turns out to be concatmap, with args the other way around. |
| 16:51:02 | <faxathisia> | for example |
| 16:51:20 | <faxathisia> | (>>=) = flip concatMap?? |
| 16:51:21 | <faxathisia> | :D |
| 16:51:35 | <Apocalisp> | Oh! It's do notation. |
| 16:52:11 | <yrlnry> | yeah, list (and monad) comprehensions are syntactic sugar for "do" notation. |
| 16:52:19 | <Apocalisp> | Alright, sweet. Thanks! |
| 16:52:45 | <shapr> | @yow ! |
| 16:52:47 | <lambdabot> | Here I am in 53 B.C. and all I want is a dill pickle!! |
| 16:53:05 | <faxathisia> | @yow |
| 16:53:05 | <lambdabot> | I was born in a Hostess Cupcake factory before the sexual revolution! |
| 16:53:10 | <yrlnry> | Me too! |
| 16:53:12 | <faxathisia> | lol |
| 16:53:20 | <faxathisia> | hello shapr |
| 16:53:26 | <shapr> | hiya faxathisia |
| 16:53:31 | <shapr> | How's code? |
| 16:53:43 | <faxathisia> | I almost finished something! |
| 16:54:45 | <shapr> | grr, windows... |
| 16:54:49 | <ToRA> | random question, that may not even be sensible... if I have a Monad m, and a Monoid x, is it sane/sensible/theoretically ok to try and make a Monoid (m x)? |
| 16:54:55 | <shapr> | What have you almost finished? |
| 16:55:20 | <ToRA> | (I have a lot of liftM2s that i want to remove from some hypothetical code i'm writing) |
| 16:55:20 | <faxathisia> | shapr: an interpreter for Janus, let's you run programs forwards and backwards |
| 16:55:44 | <faxathisia> | it's a lot of fun, biggest thing I've written in haskell |
| 16:56:01 | <Saizan> | ToRA: i think so, mempty = return mempty, mappend = liftM2 mappend if that suits your needs |
| 16:56:04 | <quicksilver> | ToRA: no, not for a general m and x. |
| 16:56:08 | <shapr> | That's cool, I don't know Janus. |
| 16:56:29 | <quicksilver> | hmm, oh, I see |
| 16:56:30 | <shapr> | @users |
| 16:56:31 | <lambdabot> | Maximum users seen in #haskell: 426, currently: 409 (96.0%), active: 23 (5.6%) |
| 16:56:37 | <ToRA> | quicksilver: in terms of what haskell typeclasses requre? |
| 16:56:52 | <shapr> | oh joy, time to reboot windows |
| 16:57:02 | <quicksilver> | no, what Saizan says is not a monoid |
| 16:57:04 | <quicksilver> | I don't think. |
| 16:57:05 | <ToRA> | Saizan: that's what i thought, just dont want to write a load of code for it to trip me up when i have to go and implement the hypothetical monad my code is written to use... |
| 16:57:08 | <quicksilver> | it won't be associative. |
| 16:57:19 | <dons> | is anyone working on any fun, new library? |
| 16:57:34 | <quicksilver> | or.. |
| 16:57:53 | <Sizur> | dons: just done i18n |
| 16:58:08 | <ToRA> | associative in terms of the "effects" of the monad? |
| 16:58:20 | <Sizur> | would appreciate help with implementing plural forms |
| 16:58:22 | <dons> | Sizur: yeah, I saw. i18n is awesome. pity gettext is GPL though |
| 16:58:32 | <dons> | or i'd be able to use it at work |
| 16:58:37 | <resiak> | I don't suppose anyone is sitting on bindings for beagle or tracker, are they? |
| 16:58:49 | <Sizur> | dons: what do you need it to me? |
| 16:59:00 | <Sizur> | to be |
| 16:59:08 | <dons> | or BSD-ish would be best. |
| 16:59:33 | <dons> | that's the default for haskell libs, to enable commercial use (which we want to encourage!) |
| 16:59:43 | <Sizur> | ok, do they hold a copyright to the .po format? |
| 16:59:56 | <dons> | for apps, GPL is ok, of course. but for libraries, its harder |
| 17:00:03 | <dons> | not sure. |
| 17:00:18 | <quicksilver> | you can't copyright a file format |
| 17:00:27 | <faxathisia> | @brain |
| 17:00:27 | <lambdabot> | I think so, Brain, but Lederhosen won't stretch that far. |
| 17:00:30 | <quicksilver> | that's fairly nonsensical. |
| 17:00:31 | <Sizur> | then i will simply change my licence |
| 17:00:36 | <resiak> | ACTION .oO(copyright isn't a verb) |
| 17:00:46 | <quicksilver> | you could copyright a "description" of a file format, I guess. |
| 17:01:00 | <resiak> | (you mean "hold copyright on"</pedant>) |
| 17:01:02 | <dons> | Sizur: wonderful! |
| 17:01:03 | <quicksilver> | ToRA: yes, that's what I meant |
| 17:01:04 | <pejo> | dons, any idea what netbsd use instead of gettext? |
| 17:01:12 | <quicksilver> | ToRA: I'm actually not sure if I'm right :) |
| 17:01:21 | <dons> | pejo: it uses gettext |
| 17:01:23 | <Sizur> | i want it to be used afterall |
| 17:01:44 | <dons> | Sizur: that's great. it should fit right in with a suite of haskell web stuff i'm trying to get released. |
| 17:02:03 | <Sizur> | dons: did you see the implementation? |
| 17:02:11 | <dons> | i've not had a look at the code yet |
| 17:02:53 | <Sizur> | it's very simple, but since there was nothing at all yet... |
| 17:03:31 | <ToRA> | quicksilver: if the Monad is just a reader monad it should be associative? |
| 17:03:53 | <Sizur> | i will change the license later today, going home now. ttyl all |
| 17:04:53 | <quicksilver> | ToRA: yes, definitely |
| 17:05:05 | <Apocalisp> | @type (\f x -> x >>= return . f) |
| 17:05:13 | <lambdabot> | forall a b (m :: * -> *). (Monad m) => (a -> b) -> m a -> m b |
| 17:05:16 | <ToRA> | quicksilver: cool, cheers |
| 17:05:26 | <Apocalisp> | @pl (\f x -> x >>= return . f) |
| 17:05:26 | <lambdabot> | fmap |
| 17:05:29 | <Apocalisp> | hehe |
| 17:05:38 | <faxathisia> | :t (>>=) . (return) |
| 17:05:39 | <lambdabot> | forall (m :: * -> *) b a. (Monad m) => a -> (a -> m b) -> m b |
| 17:05:52 | <faxathisia> | :t (return) . (>>=) |
| 17:05:53 | <lambdabot> | forall (m :: * -> *) (m1 :: * -> *) a b. (Monad m, Monad m1) => m1 a -> m ((a -> m1 b) -> m1 b) |
| 17:06:08 | <Apocalisp> | @src fmap |
| 17:06:09 | <lambdabot> | Source not found. |
| 17:06:14 | <Apocalisp> | @src [] fmap |
| 17:06:14 | <lambdabot> | fmap = map |
| 17:06:39 | <Apocalisp> | har! |
| 17:07:27 | <Apocalisp> | Why both fmap and liftM ? |
| 17:07:29 | <faxathisia> | @src ((->)e) fmap |
| 17:07:29 | <lambdabot> | Source not found. Sorry. |
| 17:07:34 | <faxathisia> | :L |
| 17:07:46 | <BMeph> | ACTION wants to rename "map as "zipWith1"... |
| 17:08:18 | <quicksilver> | and repeat as zipWith0 ? |
| 17:09:00 | <BMeph> | Apocalisp: fmap uses a Functor. |
| 17:09:10 | <roconnor> | Apocalisp: because Haskell's class system is broken :( |
| 17:09:28 | <quicksilver> | I think in this particular case it's just the prelude that's broken |
| 17:09:52 | <faxathisia> | Can you write zipWith n ? |
| 17:09:55 | <faxathisia> | like printf |
| 17:10:20 | <quicksilver> | yes, you could write it like printf |
| 17:10:29 | <quicksilver> | applicative is nicer though |
| 17:10:41 | <faxathisia> | huh ? |
| 17:10:48 | <BMeph> | faxathasia: It's more fun to use the Applicative version, though. |
| 17:10:50 | <faxathisia> | I don't see how to use applicative |
| 17:12:12 | <BMeph> | repeat and (zipWith ($)) are viable definitions for pure (or return if you prefer) and ap. |
| 17:12:46 | <quicksilver> | not just viable, already defined |
| 17:13:11 | <faxathisia> | does not understand .. :[ |
| 17:13:31 | <quicksilver> | > getZipList ((+) <$> ZipList [1,2,3] <*> ZipList [4,5,6]) |
| 17:13:32 | <lambdabot> | [5,7,9] |
| 17:13:37 | <BMeph> | Which is why I've taken up my campaign to rename map as "zipWith1", since zipWith is actually zipWith2. |
| 17:13:41 | <faxathisia> | ooooh |
| 17:14:00 | <gwern> | I forgot, what kind of -morphism is an unfold, does anyone know? |
| 17:14:00 | <faxathisia> | :t ((+) <$> ZipList [1,2,3] <*> ZipList [4,5,6]) |
| 17:14:01 | <lambdabot> | forall a. (Num a) => ZipList a |
| 17:14:20 | <dons> | ana- |
| 17:14:21 | <BMeph> | gwern: Anamorphism. |
| 17:14:39 | <gwern> | 'k |
| 17:14:39 | <dons> | catamorphisms are catastrophic, they destroy /fold the data |
| 17:15:27 | <Apocalisp> | And anamorphisms are... anastrophic? |
| 17:15:30 | <cognomore> | ...which go to the catacombs |
| 17:15:35 | <Apocalisp> | anacombs |
| 17:15:35 | <mrd> | scaredy catamorphism |
| 17:15:38 | <gwern> | cute mnemonic. i'll have to remember that |
| 17:15:56 | <dons> | its the only way i ever remember :) |
| 17:16:06 | <cognomore> | its just playing etymology |
| 17:16:11 | <quicksilver> | can I play to? |
| 17:16:12 | <BMeph> | Apocalisp: No, anastatic! ;) |
| 17:16:13 | <dons> | yep |
| 17:16:15 | <quicksilver> | what's the prise |
| 17:16:43 | <Apocalisp> | cataprise |
| 17:17:13 | <gwern> | 'A paramorphism (from Greek παρα, meaning "close together") is an extension of the concept of catamorphism to deal with a form which “eats its argument and keeps it too”[1], as exemplified by the factorial function.' <-- what on earth does that mean? |
| 17:17:18 | <cognomore> | a catalog is a log that has falled down |
| 17:17:36 | <gwern> | the definition for apomorphism is even worse >.< |
| 17:17:39 | <faxathisia> | n * f (n-1) |
| 17:17:43 | <faxathisia> | keep * eat |
| 17:17:46 | <faxathisia> | I suppse? |
| 17:18:13 | <quicksilver> | gwern: you apply the function to this level as well as recursing |
| 17:18:20 | <quicksilver> | gwern: e.g., for lists : |
| 17:18:22 | <BMeph> | faxathasia: Exactly! :) |
| 17:18:28 | <dons> | we like giving names to our loops :) |
| 17:18:44 | <quicksilver> | para f (x:xs) = f (x:xs) x (para xs) |
| 17:18:55 | <quicksilver> | gwern: it gets the whole list, the head, and the recursive call |
| 17:18:56 | <faxathisia> | I wonder if there is something like, a quickref for all these types of thing? |
| 17:18:59 | <quicksilver> | para f (x:xs) = f (x:xs) x (para f xs) |
| 17:19:02 | <quicksilver> | I should say |
| 17:19:23 | <opqdonut> | quicksilver: want to define something with para? |
| 17:19:32 | <opqdonut> | the factorial for example |
| 17:19:39 | <opqdonut> | (or is that a paramorphism) |
| 17:19:46 | <BMeph> | hylo f (x:xs) = (f x) : (hylo xs) |
| 17:19:47 | <quicksilver> | opqdonut: is that a particularly oblique way of saying I got it wrong? |
| 17:19:48 | <quicksilver> | ;) |
| 17:20:01 | <ndm> | Uniplate has a para function, and the paper has an example |
| 17:20:02 | <gwern> | so it's when on the right side you find one of the arguments unaltered as well as an altered form of it? |
| 17:20:04 | <opqdonut> | no, just wondering :) |
| 17:20:18 | <quicksilver> | well, for nat, para is: |
| 17:20:28 | <quicksilver> | para f n = f n (para f (n-1)) |
| 17:20:33 | <opqdonut> | para over nat is primitive recursion right? |
| 17:20:41 | <opqdonut> | no, not really |
| 17:20:50 | <quicksilver> | so factorial is almost para (*) |
| 17:20:57 | <quicksilver> | but you have to be careful about the base case :) |
| 17:21:04 | <opqdonut> | mhmm |
| 17:21:12 | <ddarius> | quicksilver you have it right |
| 17:21:12 | <quicksilver> | a proper para for Nat takes another parameter for "what to do in base case" |
| 17:21:25 | <quicksilver> | as my example for lists really needs one for "what to do with empty list" |
| 17:21:39 | <faxathisia> | hmmm |
| 17:21:58 | <quicksilver> | so para f z n = if n == 0 then z else f n (para f z (n-1)) |
| 17:22:00 | <faxathisia> | Is it necesary the type you have is Unit and Unit -> Unit... e.g. [] and :, or 0 and 1+ |
| 17:22:11 | <faxathisia> | I don't know if there is a name of that kind of data type.? |
| 17:22:12 | <quicksilver> | and with that second definition, I think factorial = para (*) 1 |
| 17:22:14 | <idnar> | > let para f n = f n (para f (n-1)) in para (*) 5 |
| 17:22:23 | <ddarius> | > let paraNat s z 0 = z; paraNat s z n = s n (paraNat s z (n-1)) in paraNat (*) 1 5 |
| 17:22:26 | <idnar> | oh, oops |
| 17:22:28 | <idnar> | infinite recursion |
| 17:22:29 | <lambdabot> | 120 |
| 17:22:29 | <lambdabot> | Exception: stack overflow |
| 17:22:44 | <quicksilver> | > let para f z n = if n == 0 then z else f n (para f z (n-1)) in para (*) 1 5 |
| 17:22:45 | <lambdabot> | 120 |
| 17:22:47 | <quicksilver> | yeah |
| 17:22:50 | <opqdonut> | faxathisia: ?? |
| 17:22:55 | <quicksilver> | I did get it right! \o/ |
| 17:23:18 | <opqdonut> | faxathisia: ah, for catamorphisms |
| 17:23:21 | <quicksilver> | for lists, including base case: |
| 17:23:26 | <faxathisia> | opqdonut: The para thing is working on nat (0, 1+) or lists ([], (\x -> (x:))) |
| 17:23:35 | <opqdonut> | no, i guess you could have for example trees |
| 17:23:41 | <opqdonut> | but then f would take more arguments |
| 17:23:45 | <opqdonut> | right? |
| 17:24:00 | <quicksilver> | para f e [] = e; para f e (x:xs) = f x (x:xs) (para f e xs) |
| 17:24:02 | <quicksilver> | I think |
| 17:24:16 | <opqdonut> | something like: para f (Tree l r) = f n (para f l) (para f r) |
| 17:24:16 | <quicksilver> | opqdonut: yes, as many arguments as tehre are constructors in the type |
| 17:24:20 | <opqdonut> | yep |
| 17:24:27 | <BMeph> | quicksilver: You got it. :) |
| 17:24:29 | <ddarius> | quicksilver: Yes (though the order of the arguments would "usually" be different |
| 17:24:34 | <ddarius> | (in my opinion) |
| 17:24:37 | <dons> | can someone who's got unicode working reply to "[Haskell-cafe] Problems with Unicode Symbols as Infix Function Names" |
| 17:24:49 | <dons> | unicode is a real faq suddenly |
| 17:24:59 | <ddarius> | In Recursion Schemes from Comonads, a paramorphism is induced from the state-in-context comonad if I remember correctly. |
| 17:27:54 | <BMeph> | I liked the "Bananas, Envelopes..." explanations, even though I need a few more lessons in maths before tackling CT. |
| 17:29:07 | <ddarius> | BMeph: There is very little CT used in those and they don't assume prior knowledge. |
| 17:30:13 | <BMeph> | ddarius: So YOU say! For some reason, though, the triangle for the list structure kept confusing me. |
| 17:31:14 | <ToRA> | dons: replying in 2 seconds |
| 17:31:39 | <quicksilver> | BMeph: release your inner (zapf) dingbat! open your mind to the use of nice non-ascii symbols! |
| 17:31:46 | <ddarius> | BMeph: "triangle for the list structure"? |
| 17:32:11 | <faxathisia> | unicode is nice but... without mixfix I don't know if it's so great |
| 17:32:19 | <quicksilver> | BMeph: I often dreamt of publishing a paper which used, for example, a multicoloured SVG christmas tree as a symbol. |
| 17:32:20 | <ddarius> | BMeph: The upside-down and right-side up triangles used for pairing and sums? |
| 17:32:36 | <quicksilver> | let <christmas tree> denote a Q-algebra, and... |
| 17:32:48 | <faxathisia> | lol |
| 17:33:37 | <ddarius> | @google the dual of substitution is redecoration |
| 17:33:39 | <lambdabot> | http://citeseer.ist.psu.edu/510658.html |
| 17:33:39 | <lambdabot> | Title: The Dual of Substitution is Redecoration - Uustalu, Vene (ResearchIndex) |
| 17:33:43 | <ddarius> | quicksilver: There you go. |
| 17:33:46 | <BMeph> | ddarius: Yes, that. |
| 17:34:22 | <ddarius> | BMeph: Yes, this supports my point. That stuff isn't what categorists normally use, or at least not that syntax. |
| 17:34:38 | <ddarius> | The syntax of that paper is rather bizarre even beyond the "bananas and barbed wire" |
| 17:34:40 | <BMeph> | I haven't done any more algebra since what I needed for Vector Calculus...about twenty years ago. |
| 17:36:14 | <ddarius> | The more common notation for the up and down triangle in that paper is <f,g> and [f,g] |
| 17:36:44 | <ddarius> | || is almost always x and | + |
| 17:37:32 | <quicksilver> | sometimes bizarre syntax is chosen to deliberately try to break preconceptions. |
| 17:37:44 | <quicksilver> | sometimes it's just chosen for fun or bloodymindness though :) |
| 17:38:18 | <ddarius> | quicksilver: In this case the former is certainly not the case. |
| 17:40:51 | <BMeph> | Maybe that's what was so confusing. Sometimes they used x and +, and sometimes | and ||. |
| 17:47:22 | <fadec> | Is there a way to do this? [IO String] -> IO [String] |
| 17:47:31 | <dcoutts> | @hoogle [IO String] -> IO [String] |
| 17:47:31 | <opqdonut> | :t sequence |
| 17:47:32 | <lambdabot> | No matches, try a more general search |
| 17:47:32 | <faxathisia> | @hoogle [IO String] -> IO [String] |
| 17:47:32 | <lambdabot> | No matches, try a more general search |
| 17:47:33 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => [m a] -> m [a] |
| 17:47:34 | <faxathisia> | :t seq |
| 17:47:34 | <BMeph> | Then again, maybe they don't even use + and X in that one (re-reading it, I haven't seen them yet)... |
| 17:47:35 | <lambdabot> | forall a t. a -> t -> t |
| 17:47:36 | <Botje> | yes, sequence |
| 17:47:38 | <faxathisia> | hm... |
| 17:47:53 | <faxathisia> | @src seq |
| 17:47:53 | <lambdabot> | Source not found. You untyped fool! |
| 17:48:07 | <BMeph> | fadec: Yes, that's the "sequence" function. |
| 17:48:42 | <BMeph> | fadec: Well, It's "sequence" specifically for the IO monad. |
| 17:48:51 | <dcoutts> | @tell ndm test case for hoogle 4: [IO String] -> IO [String] should find sequence :: Monad m => [m a] -> m [a] |
| 17:48:51 | <lambdabot> | Consider it noted. |
| 17:49:04 | <desegnis> | @hoogle [m a] -> m [a] |
| 17:49:04 | <lambdabot> | Prelude.head :: [a] -> a |
| 17:49:04 | <lambdabot> | Prelude.last :: [a] -> a |
| 17:49:04 | <lambdabot> | Data.List.head :: [a] -> a |
| 17:49:13 | <fadec> | Makes some sense. I have a list of filenames and I want to read them all intro strings - not IO String. Thanks guys. |
| 17:49:29 | <desegnis> | Hoogle doesn't like me, never :) |
| 17:49:30 | <faxathisia> | :t mplus |
| 17:49:32 | <lambdabot> | forall (m :: * -> *) a. (MonadPlus m) => m a -> m a -> m a |
| 17:49:36 | <faxathisia> | :t msum |
| 17:49:37 | <lambdabot> | forall (m :: * -> *) a. (MonadPlus m) => [m a] -> m a |
| 17:49:43 | <faxathisia> | oh .. right |
| 17:49:57 | <faxathisia> | I think I use msum sometimes when I should use sequence.. |
| 17:51:37 | <litb> | haskell for nice source , ocaml for fast bins |
| 17:51:40 | <litb> | is that right? |
| 17:52:08 | <BMeph> | Is OCaml that much faster than Haskell? |
| 17:52:15 | <ddarius> | litb: The difference in speed between Haskell and O'Caml is not significant. |
| 17:52:31 | <Apocalisp> | Now... I want the effect of liftM2 (*) a b, but I want them ordered a0, b0, a1, b1 rather than a0, a1... b0, b1 |
| 17:52:34 | <faxathisia> | the same algorithm might be fsater in haskell |
| 17:52:38 | <faxathisia> | because of lazyness I think ? |
| 17:52:43 | <faxathisia> | like isInfixOf ? |
| 17:53:02 | <faxathisia> | You'd have to write it differently in Ocaml wouldn't you |
| 17:53:20 | <litb> | i read that OCaml is nearly as fast as c++ is |
| 17:53:48 | <ddarius> | Haskell can be made nearly as fast as C++ too oftentimes |
| 17:54:03 | <Apocalisp> | ddarius: Faster, sometimes. ;-) |
| 17:54:11 | <mrd> | C++ can be very slow, when your program terminates with signal 11 |
| 17:55:37 | <fadec> | Check out Clean for speed. It uses uniqueness typing for IO and I think that's the reason for it's speed. Otherwise it's like haskell. |
| 17:55:59 | <idnar> | Apocalisp: zipWith (*) a b? |
| 17:56:33 | <litb> | i see.. is ghc considered to be a good choice? |
| 17:56:43 | <nelhage> | http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=ocaml&lang2=ghc |
| 17:56:45 | <lambdabot> | Title: OCaml benchmarks | Debian : AMD™ Sempron™ Computer Language Benchmar ..., http://tinyurl.com/38wpzd |
| 17:56:52 | <faxathisia> | litb: I like ghc |
| 17:57:43 | <fadec> | http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=ocaml&lang2=clean |
| 17:57:44 | <lambdabot> | Title: OCaml benchmarks | Debian : AMD™ Sempron™ Computer Language Benchmar ..., http://tinyurl.com/3a3856 |
| 17:57:54 | <fadec> | ocaml vs clean |
| 18:01:03 | <Apocalisp> | idnar: I still want the cartesian product, but I want the two lists traversed simultaneously. I.e. [1*1, 1*2, 2*2, 2*3...] instead of [1*1, 1*2, 1*3,... 2*1, 2*2] |
| 18:01:22 | <ddarius> | fadec: Uniqueness types are part of it, but not because they are used for IO. |
| 18:01:22 | <faxathisia> | Apocalisp: You want to traverse them diagonally? |
| 18:01:32 | <faxathisia> | like so that you'd still go though them all i they are infinite length? |
| 18:01:37 | <idnar> | Apocalisp: where does 2 * 1 come in that list? |
| 18:02:18 | <Apocalisp> | idnar: Good question. I don't really want it. |
| 18:02:50 | <fadec> | ddarius: Is it because they are essentially a hand optimization of the GC where with Haskell we depend on GHC to use monadic regions? |
| 18:03:12 | <fadec> | Just a hunch |
| 18:05:46 | <faxathisia> | > cycle ['a'..'z'] |
| 18:05:48 | <lambdabot> | "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvw... |
| 18:06:33 | <BMeph> | I've also heard that Clean's compiler is specialized to a higher degree than GHC's, although it (GHC) is coming along. |
| 18:10:20 | <BMeph> | Would someone refresh my memory: only type construction operators can start with a ':', correct? |
| 18:10:42 | <faxathisia> | yes infix constructors |
| 18:10:47 | <faxathisia> | e.g cons |
| 18:11:45 | <litb> | sorry, can't answer. i'm going out now. btw, seeing you at ICFP :P |
| 18:12:03 | <gio123> | may i convert haskell code to prolog? |
| 18:12:17 | <BMeph> | gio123: Yes, I give you my permission. ;) |
| 18:12:23 | <koeien> | i want to create a function f, such that, informally, f [f1, f2, ..., fn] = f1. f2 . ... . fn |
| 18:12:33 | <gio123> | <BMeph> i need translator ;) |
| 18:12:34 | <koeien> | of course f = foldr (.) id |
| 18:12:45 | <koeien> | but i want it more generic, with heteregenous lists |
| 18:13:05 | <pejo> | gio123, translating between any two languages is difficult, and last time you wanted to make performance comparisons between languages, which isn't really suitable for automatically translated code. |
| 18:13:13 | <koeien> | would it be possible to create instances like Composable HNil a a and such? |
| 18:14:01 | <gio123> | pejo: currently what i want is, i have haskell program and would like to convert it to prolog |
| 18:14:47 | <Saizan> | koeien: i think that may work, but what's the use case? |
| 18:14:51 | <gio123> | faxathisia: since u know prolog and haskell both, do u know is it possible? |
| 18:15:31 | <koeien> | Saizan: just playing around with the type system, not really anything welse |
| 18:15:38 | <koeien> | else* |
| 18:16:22 | <ohnoes> | koeien: maybe use a list of type [forall a b. a->b] as an argument? I could be wrong here |
| 18:16:48 | <hpaste> | Apocalisp pasted "Can this be generalized?" at http://hpaste.org/4886 |
| 18:16:56 | <Saizan> | ohnoes: that can only be a list of bottoms |
| 18:17:01 | <koeien> | ohnoes: how would that work? |
| 18:17:02 | <FunctorSalad> | ohnoes was me ;) |
| 18:17:16 | <FunctorSalad> | Saizan: oh right, of course they must be composable |
| 18:17:47 | <chadz> | Apocalisp: zipWith ? |
| 18:18:12 | <Apocalisp> | *Main> zipWith (*) [1..9] [1..9] |
| 18:18:12 | <Apocalisp> | [1,4,9,16,25,36,49,64,81] |
| 18:18:19 | <Apocalisp> | *Main> myZip (*) [1..9] [1..9] |
| 18:18:19 | <Apocalisp> | [1,2,4,6,9,12,16,20,25,30,36,42,49,56,64,72,81] |
| 18:18:29 | <chadz> | oh |
| 18:18:55 | <koeien> | Apocalisp: isn't myZip' f = flip (myZip (flip f)) |
| 18:19:09 | <Apocalisp> | oh yeah! |
| 18:19:18 | <koeien> | (didn't check though) |
| 18:20:01 | <ptolomy> | Is it surprising that when looking at GHC Core, unboxed int arguments seem to be listed as 'L'? (lazy) |
| 18:21:14 | <Apocalisp> | koeien: You're totally right |
| 18:21:58 | <FunctorSalad> | koeien: or something like this: data List dom cod = Nil | Cons (a -> cod) (List (dom -> a)) |
| 18:22:13 | <FunctorSalad> | but I'm not sure what is a here :) |
| 18:22:21 | <FunctorSalad> | would that parse? |
| 18:22:33 | <Saizan> | you need to add forall a. |
| 18:22:40 | <FunctorSalad> | yeah, but where? |
| 18:23:09 | <ptolomy> | ACTION is getting stack overflows in his virtual machine, which really just recursively pattern matches over a relatively small set of bytecodes, updates a IOUArray Int Int, then calls itself. I've strictified pretty much everything, and still I get overflows. :-/ |
| 18:23:11 | <Saizan> | data List dom cod = forall a. Nil | Cons (a -> cod) (List dom a) |
| 18:23:24 | <Saizan> | mmh no |
| 18:23:46 | <Saizan> | data List dom cod = Nil | forall a. Cons (a -> cod) (List dom a) and you need -fglasgow-exts |
| 18:24:02 | <roconnor> | doesn't strictifying things cause more stack overflows? |
| 18:24:08 | <desegnis> | FunctorSalad: With GADT syntax it should be easier to figure out where to put the forall |
| 18:24:22 | <FunctorSalad> | desegnis: good point |
| 18:24:35 | <koeien> | hmm i'll try that, i'm not that familiar with GADT's, should be a good exercise |
| 18:24:44 | <desegnis> | and since we're using extensions anyway... ;) |
| 18:25:00 | <ptolomy> | Well, I'm dealing with a relatively small set of finite data and doing IO in pretty much every op.. I'd think that laziness wouldn't do anything but eat space for me. |
| 18:25:20 | <koeien> | yes those are probably needed (multiparameter type classes or this forall-stuff) |
| 18:28:22 | <desegnis> | You may of course question what is the point of writing Cons instead of (.), but the important thing is that it works |
| 18:28:33 | <Saizan> | i wonder what would be the right type for Nil, i'd say Nil :: List a a, but maybe there's a need for List a b? |
| 18:28:41 | <desegnis> | yea |
| 18:28:46 | <desegnis> | or List dom cod |
| 18:29:51 | <Saizan> | well the name of the variables doesn't matter |
| 18:32:29 | <Saizan> | however you're quite limited in manipulating these lists |
| 18:32:29 | <FunctorSalad> | hmm something's still wrong |
| 18:33:00 | <FunctorSalad> | the domain will always be undefined I think |
| 18:36:05 | <ptolomy> | ACTION considers using mallocArray and peek/poke instead of IOUArray |
| 18:37:23 | <Saizan> | i'm convinced that Nil should have the type of id |
| 18:38:27 | <dons> | ptolomy: or STUArray? |
| 18:38:55 | <dons> | ptolomy: the performance should be identical, but i have observed one program, using lots of unboxwed Doubles, that was faster with FFI arrays |
| 18:39:34 | <ptolomy> | dons: Hm. Well, I'm dealing with unboxed ints only, so it's probably not worth the danger. Thanks. |
| 18:39:55 | <Storm> | hello everybody |
| 18:40:00 | <dons> | i'd go with STUArray, personally |
| 18:40:14 | <dons> | they're much fun, and you have the option to purify the result |
| 18:40:26 | <Storm> | i want to try and build a irc bot but have no clue where to start |
| 18:40:41 | <Valodim_> | so read a tutorial about it |
| 18:40:46 | <dons> | Storm: how about one of the Haskell irc bot tutorials? |
| 18:40:48 | <ptolomy> | dons: well, my inner loop requires IO as it is.. I figured the overhead (conceptual/effort, if not performance) wouldn't be worth it. |
| 18:40:54 | <dons> | ?go roll your own irc bot |
| 18:40:56 | <lambdabot> | http://www.haskell.org/haskellwiki/Roll_your_own_IRC_bot |
| 18:40:56 | <lambdabot> | Title: Roll your own IRC bot - HaskellWiki |
| 18:40:59 | <dons> | that one is good :) |
| 18:41:04 | <Storm> | ok thanx |
| 18:41:10 | <dons> | ptolomy: well, IO/ST are the same for arrays |
| 18:41:25 | <dons> | but there's no huge difference |
| 18:43:35 | <sjanssen> | @src IOUArray |
| 18:43:35 | <lambdabot> | Source not found. Maybe you made a typo? |
| 18:47:47 | <ptolomy> | dons: Does the bytestring release for GHC 6.8 have the fix for the 'memcmp is called every time we want to compare two bytestrings' thing? |
| 18:48:18 | <dcoutts> | ptolomy: what problem was that? I'm not familiar with it |
| 18:48:20 | <dons> | hmm? |
| 18:48:51 | <dcoutts> | ptolomy: as far as I remember we've used the pointer comparison shortcut for ever |
| 18:48:57 | <dons> | right |
| 18:49:37 | <hpaste> | FunctorSalad pasted "List of composable functions" at http://hpaste.org/4887 |
| 18:49:46 | <ptolomy> | I remember there being talk on the libraries list about how short bytestrings are inefficient because the overhead for calling memcmp outweighs the benefit. |
| 18:49:50 | <ptolomy> | Or I could be completely delusional. |
| 18:50:11 | <dcoutts> | ptolomy: oh, that may be the case |
| 18:50:20 | <dcoutts> | but it'd need careful measurement to confirm |
| 18:50:31 | <FunctorSalad> | Saizan: it works with (Nil a a), with (Nil a b) the compose function wouldn't work I think |
| 18:50:38 | <dons> | yes, that's still the case |
| 18:50:50 | <dcoutts> | since memcmp implements it's own checks for short strings so the overhead is probably only the function call which is pretty minimal |
| 18:50:53 | <ptolomy> | ACTION asks because he has more than one program whose speed is pretty much directly proportional to the cost of ByteString Map lookups. |
| 18:51:01 | <dons> | there's some length threshold (20 chars or so ??) where the ffi call costs is offset by the speed increase |
| 18:51:13 | <dcoutts> | ptolomy: perhaps you should be hashing |
| 18:51:29 | <desegnis> | FunctorSalad: Now I'm back from dinner, I see that too |
| 18:51:37 | <dcoutts> | dons: is there? are there any measurements to confirm that? |
| 18:51:53 | <FunctorSalad> | desegnis: I agree this look pretty useless though (equivalent to (.)) |
| 18:51:54 | <dons> | we did some numbers last year, i think ChrisK did it |
| 18:52:07 | <dons> | we'd need to look at it again, (since haskell's faster now) |
| 18:52:55 | <dcoutts> | dons: it's be an interesting benchmark to add to the bytestring repo, a program we can run to test the current threshold |
| 18:53:03 | <ptolomy> | I probably should be hashing, but I seem to recall that Data.Hashtable is no speed demon, and it requires IO. Data.Map is just so much nicer. Maybe I'll need to restart my quickly abandoned project to make a fast HashTable that can be used with ST and doesn't require IO for lookups. |
| 18:53:18 | <gio123> | is somebody familier about: Subtyping among Regular expressions |
| 18:53:25 | <dcoutts> | ptolomy: I don't mean Data.Hashtable, you could use Data.IntMap |
| 18:53:25 | <dons> | dcoutts: yeah. i'll put this in the TODO |
| 18:53:38 | <ptolomy> | dcoutts: Oh. True. |
| 18:53:46 | <dcoutts> | ptolomy: there's no need for it to be mutable |
| 18:53:55 | <dcoutts> | an IntMap is pretty quick |
| 18:53:59 | <ptolomy> | ACTION goes off to test ByteString hash functions. |
| 18:54:00 | <dcoutts> | or of course there are Tries |
| 18:54:11 | <FunctorSalad> | desegnis: well, there is a use. it remembers its component functions, could be used for reflection (but then the functions should prolly be showable or something) |
| 18:54:21 | <dcoutts> | ptolomy: tries are probably fastest for string maps |
| 18:54:33 | <dons> | probably a lot faster :) |
| 18:54:57 | <dons> | the high-perf hashtables in the shootout were all blown away by an (illegal :( haskell trie version |
| 18:55:00 | <desegnis> | FunctorSalad: Alas, you don't even know the types of the component functions |
| 18:55:09 | <ptolomy> | Wasn't there a plan to put Tries in the standard library at some point? |
| 18:55:16 | <dcoutts> | ptolomy: I'd hope so |
| 18:55:23 | <dons> | yes. we need a data structure task force |
| 18:55:26 | <FunctorSalad> | desegnis: not? well, at least ":t" knows them |
| 18:55:41 | <FunctorSalad> | or wait, I don't have a "head" function |
| 18:55:47 | <dons> | getting the edison maps and tries into a releasable state should be a 2008 result |
| 18:56:36 | <FunctorSalad> | I see, "head" would have to return something with unknown domain |
| 18:56:54 | <desegnis> | FunctorSalad, yeah, you only know the outer type. But you can count the component functions at least :) |
| 18:57:17 | <chadz> | what's the name of the automatic hackage utility? iirc, one was sortof in development |
| 18:57:26 | <dons> | which one? |
| 18:57:29 | <dons> | cabal install ? |
| 18:57:29 | <nelhage> | cabal-install? |
| 18:57:40 | <dons> | it'd be cabal-install you're seeking, yeah |
| 18:57:40 | <dcoutts> | @where cabal-install |
| 18:57:40 | <lambdabot> | I know nothing about cabal-install. |
| 18:57:43 | <dcoutts> | bah |
| 18:57:44 | <chadz> | that one, i suppose. anyone use it? |
| 18:57:47 | <dons> | yes! |
| 18:57:50 | <dcoutts> | chadz: yep |
| 18:58:06 | <dons> | its a becoming a piece of infrastructure at my workplace |
| 18:58:08 | <chadz> | i get pretty sad when I have update 12 directories for each new xmonad release :) |
| 18:58:12 | <dons> | right. |
| 18:58:19 | <dcoutts> | chadz: though the latest and greatest version requires the darcs version of Cabal too |
| 18:58:21 | <dons> | i've even got instructions for using cabal-install with xmonad |
| 18:58:31 | <chadz> | dons: on the xmonad page? |
| 18:58:37 | <nelhage> | I'm running a cabal-install'd xmonad here |
| 18:58:46 | <dcoutts> | dons: are you using the cabal-install bash command line completion yet? :-) |
| 18:58:57 | <dons> | http://xmonad.org/intro.html#cabal-install |
| 18:58:57 | <lambdabot> | Title: xmonad : building and installation |
| 18:59:05 | <dons> | dcoutts: no, but that sounds awesome |
| 18:59:16 | <dcoutts> | dons: it's in the cabal-install repo already |
| 18:59:25 | <dons> | dcoutts: we should think about ICFP/HW papers sometime soon, too. :) |
| 18:59:44 | <dcoutts> | dons: I'm not sure what the technical contribution is |
| 18:59:48 | <chadz> | or worry about releasing a windows client :) |
| 18:59:52 | <dons> | dcoutts: for what? |
| 18:59:57 | <dcoutts> | chadz: it works on windows too (mostly) |
| 19:00:09 | <dcoutts> | dons: oh, you mean more generally |
| 19:00:11 | <dons> | yeah. |
| 19:00:13 | <chadz> | dcoutts: oh, my fault. I mean for xmonad :D |
| 19:00:20 | <dcoutts> | dons: right, well jfp first |
| 19:00:28 | <dons> | chadz: if you follow those xmonad.org instructions, can you let me know if anything goes wrong |
| 19:00:31 | <dons> | dcoutts: yep. |
| 19:00:56 | <chadz> | dons: i'll let you know when I do. |
| 19:00:57 | <dons> | i think it really is time we tried to write up Data.Binary, too |
| 19:01:08 | <chadz> | is binary still in v3? |
| 19:01:20 | <dcoutts> | dons: yes, there's that, and there's been plenty more feedback on what people want from a binary lib |
| 19:01:22 | <dons> | binary-0.4.1 |
| 19:01:38 | <dons> | right. i think we've got some interesting use cases to ponder |
| 19:01:40 | <bos> | you think binary would be worth writing up? |
| 19:01:55 | <dcoutts> | bos: if done well, yes. |
| 19:02:05 | <dons> | bos, yeah, as a 10-year sequel to 'The Bits Between the Lambdas" |
| 19:02:10 | <bos> | heh. |
| 19:02:12 | <dons> | or like the erlang bitstream series of papers |
| 19:02:18 | <nelhage> | Is anyone going around urging everyone who's written a random haskell package that's floating around on the internet to upload it to hackage? |
| 19:02:26 | <chadz> | my binary-using application was pretty muddy :) |
| 19:02:28 | <dons> | but faster :) and with rewrite rules and applicative functors |
| 19:02:40 | <dons> | nelhage: me. |
| 19:02:42 | <nelhage> | Because it still seems like google is a better way to find haskell bindings for $FOO than hackage for a lot of $FOO |
| 19:02:46 | <dcoutts> | nelhage: lots of us, yes |
| 19:02:48 | <dons> | nelhage: hmm. really? |
| 19:02:57 | <dons> | i never google first anymore |
| 19:03:05 | <chadz> | well, the sorting for hackage isn't very optimal |
| 19:03:05 | <dcoutts> | nelhage: I was under the impression most stuff was on hackage now |
| 19:03:10 | <chadz> | keywords might be nice? |
| 19:03:10 | <profmakx> | i always look at hackage first |
| 19:03:11 | <gwern> | @pl (\x -> runStmt ses x SingleStep) |
| 19:03:11 | <lambdabot> | flip (runStmt ses) SingleStep |
| 19:03:13 | <dons> | nelhage: are you thinking more like, we should email people ? |
| 19:03:34 | <dcoutts> | chadz: certainly a better search interface would be good |
| 19:03:43 | <dons> | i suppose i could set up a script to google for haskell .tar.gz bundles, firing off a 'please upload to hackage' mail to the author, until no more hits match :) |
| 19:03:57 | <dcoutts> | chadz: cabal list does a search btw :-) |
| 19:04:08 | <dcoutts> | I typically load the packages page and use the text search in my browser |
| 19:04:11 | <nelhage> | Possibly. Like, recently I've been looking for haskell libs for e.g. xmpp, and found them on google but not hackage |
| 19:04:14 | <dcoutts> | or use cabal list |
| 19:04:27 | <chadz> | dcoutts: oh, how I must play with cabal. typically, I hate it, but that might just turn around. |
| 19:04:39 | <nelhage> | (http://www.dtek.chalmers.se/~henoch/text/hsxmpp.html) |
| 19:04:46 | <lambdabot> | Title: XMPP |
| 19:04:47 | <chadz> | I always have to hack in extra-lib directories due to lack of modern libs on this work machine. |
| 19:04:48 | <dcoutts> | chadz: remember to file bugs about the bits you hate :-) |
| 19:04:54 | <dons> | oh, if there at chalmers we can get the big guns out |
| 19:05:03 | <dons> | chalmers guys have no excuse for not uploading :) |
| 19:05:05 | <nelhage> | hsgnutls also appears to not be on hackage (http://www.cs.helsinki.fi/u/ekarttun/hsgnutls/) |
| 19:05:10 | <lambdabot> | Title: hsgnutls |
| 19:05:16 | <dons> | ok. and musasabi's stuff |
| 19:05:36 | <dcoutts> | nelhage: but is it still maintained? there are lots of dead projects via google that are not on hackage |
| 19:05:36 | <dons> | nelhage: feel free to start a wiki page for non-hacakged libs of note |
| 19:05:42 | <dons> | i'll be happy to chase things up |
| 19:05:42 | <dcoutts> | we've got one... |
| 19:05:47 | <dcoutts> | ACTION finds it |
| 19:05:54 | <nelhage> | dcoutts: No clue |
| 19:05:55 | <dons> | the QtHaskell guy really needs to move to hackage too. i'm not sure why he likes sourceforge :/ |
| 19:06:05 | <chadz> | has anyone played with qthaskell? |
| 19:06:14 | <dons> | yeah, the danger of google is that it finds mostly bitrotted code |
| 19:06:15 | <dcoutts> | nelhage: http://hackage.haskell.org/trac/hackage/wiki/CabalPackages |
| 19:06:18 | <lambdabot> | Title: CabalPackages - Hackage - Trac |
| 19:06:19 | <gio123> | is somebody familier about: Subtyping among Regular expressions |
| 19:06:40 | <Sizur> | what's up with this: Parse of field 'license' failed: |
| 19:06:46 | <dons> | gio123: i've not heard of anything in that area. nor type systems for regexes either... |
| 19:06:53 | <dons> | Sizur: old version of cabal? |
| 19:06:55 | <dcoutts> | Sizur: it's not one of the Licence enum values |
| 19:07:07 | <Valodim_> | what is "bitrotten"? |
| 19:07:13 | <Valodim_> | or bitrotted, whatever |
| 19:07:14 | <dons> | Valodim_: out of date/broken |
| 19:07:18 | <dcoutts> | Valodim_: "doesn't work any more" |
| 19:07:18 | <Valodim_> | ah |
| 19:07:37 | <dons> | bit rotted is a misnomer. its more that the bits are in stasis |
| 19:07:38 | <Sizur> | what's this, i cannot use the original BSD? |
| 19:07:43 | <roconnor> | doesn't work any more even though / because it hasn't changed. |
| 19:07:44 | <dons> | while the environment around them has evolved |
| 19:07:55 | <dons> | so they don't really rot, they just become obsolete bits |
| 19:08:01 | <dons> | :) |
| 19:08:10 | <Valodim> | ah |
| 19:08:14 | <Valodim> | makes sense :) |
| 19:08:27 | <nelhage> | I've always interpreted `bitrot' as intentionally ironic |
| 19:08:57 | <dcoutts> | Sizur: the old BSD licence is the 4-clause one, so you want BSD4 |
| 19:09:10 | <dcoutts> | the new one without the advertising clause is BSD3 |
| 19:09:22 | <dcoutts> | somewhat confusing I guess, it's not a version number |
| 19:09:58 | <Sizur> | their template doesn't state the version http://www.opensource.org/licenses/bsd-license.php |
| 19:10:00 | <lambdabot> | Title: Open Source Initiative OSI - The BSD License:Licensing | Open Source Initiative |
| 19:10:05 | <Sizur> | i see |
| 19:10:10 | <dcoutts> | it's not versioned |
| 19:10:15 | <Sizur> | the number is the number of clauses |
| 19:10:28 | <Igloo> | dcoutts: I think BSD4 should be removed. I doubt any Haskell code uses it, and it'll just cause confusion |
| 19:10:35 | <dcoutts> | Sizur: what you see there is the 3 clause version |
| 19:10:43 | <dcoutts> | Igloo: aye, perhaps |
| 19:10:49 | <dcoutts> | Igloo: file a bug |
| 19:11:13 | <syscrash> | if i call an external program using 'system', i get something of type IO ExitCode. how do I get the string containing the command's output? for example, if i do 'let p = system("ls")', and then type 'p', it shows me the output of the command on one line, and ExitSuccess on another line. how do I get the output of the command as a string? |
| 19:12:04 | <dcoutts> | it's unfortunately not that easy :-( there's code in Cabal to do it |
| 19:12:41 | <sjanssen> | syscrash: the monads are confusing you |
| 19:13:03 | <dons> | syscrash: using System.Process or one of its wrappers, not 'system' |
| 19:13:05 | <syscrash> | certainly, since i don't really know haskell at this point :P |
| 19:13:13 | <syscrash> | aha, i'll look into that, thanks |
| 19:13:18 | <sjanssen> | 'let p = system("ls")' means bind 'p' to a *computation* that calls system |
| 19:13:27 | <syscrash> | ah! |
| 19:13:35 | <dons> | e.g. http://www.cse.unsw.edu.au/~dons/code/newpopen/System/Process/Run.hs |
| 19:13:37 | <lambdabot> | http://tinyurl.com/2f7j8l |
| 19:13:42 | <syscrash> | 'x <- p' would actually carry out the computation?? |
| 19:13:42 | <dons> | which i should really release. |
| 19:13:48 | <sjanssen> | instead, you want something like "p <- system ..." |
| 19:14:07 | <sjanssen> | also, you need to use another function because vanilla 'system' doesn't return the output as a string ;) |
| 19:14:43 | <monochrom> | evaluate (length output) is sad. |
| 19:14:47 | <syscrash> | dons' thing seems like what i want! thanks |
| 19:15:00 | <syscrash> | and i'll work on my understanding of monads |
| 19:15:50 | <dons> | if anyone, sjanssen, bos, dcoutts ... has any feedback on the popen interface, i'd welcome that. i'll probably toss it onto hackage in the next couple of days, |
| 19:15:56 | <dons> | http://www.cse.unsw.edu.au/~dons/code/newpopen/ |
| 19:15:56 | <lambdabot> | Title: Index of /~dons/code/newpopen |
| 19:16:01 | <chadz> | isn't there that hsh lib, haskell shell or what not. |
| 19:16:07 | <chadz> | there's a popen interface now? |
| 19:16:10 | <chadz> | ahh |
| 19:16:31 | <dons> | there was an old unix popen one |
| 19:16:43 | <dons> | and the above is a portable version with a similar interface |
| 19:17:00 | <dcoutts> | dons: why not return the ExitCode and the String ? |
| 19:17:19 | <bos> | dons: it's a bit weird that you can get output or exit code, but not both |
| 19:17:21 | <tibbe> | dons, argh! I want Firefox to display the code inline! |
| 19:17:28 | <dons> | yeah, bos/dcoutts |
| 19:17:33 | <bos> | tibbe: it does for me |
| 19:17:34 | <Sizur> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/i18n-0.2 |
| 19:17:35 | <lambdabot> | http://tinyurl.com/2pvdee |
| 19:17:36 | <monochrom> | If you get the String case, it is only because of one known definite exitcode. |
| 19:17:37 | <dcoutts> | dons: and in Cabal we use a version that throws the ExitCode as an exception if it's non-0 which is very useful most of the time, though we also provide the raw version as that's needed occasionally |
| 19:17:46 | <bos> | dcoutts++ |
| 19:17:47 | <Sizur> | dons: i would love to hear your critique |
| 19:17:59 | <dons> | throwing an exception feels maybe wrong. |
| 19:18:09 | <tibbe> | bos: I guess it depends on the server's mime type, works in this case |
| 19:18:18 | <dons> | depends how defensive we want to be |
| 19:18:24 | <bos> | it's often very useful. |
| 19:18:28 | <dcoutts> | dons: see http://darcs.haskell.org/cabal/Distribution/Simple/Utils.hs |
| 19:18:44 | <dcoutts> | dons: rawSystemStdout and rawSystemStdout' |
| 19:18:45 | <monochrom> | The haddock can say something more specific than "returns exitcode or string". |
| 19:18:50 | <bos> | as in, you have something in the bowels of your code that just has to work, and you don't want to fap with Either just so you can throw an exception yourself. |
| 19:19:54 | <dons> | i think originally i noticed every use i had for popen was wrapped in catch/handle |
| 19:20:09 | <dcoutts> | dons: we converted in Cabal to using exceptions as the default since there were far to many cases where ExitCodes were getting ignored |
| 19:20:25 | <chadz> | woo, cabal works :) |
| 19:20:29 | <bos> | i like that observation. |
| 19:20:40 | <bos> | matches my own experience. |
| 19:20:49 | <dons> | dcoutts: right. so either exceptions, or Left/Right. or are you saying people just match the Right case? |
| 19:20:53 | <dcoutts> | dons: now we just call stuff and don't worry and catch stuff at the top level and only very occasionally have to use local try |
| 19:20:54 | <bos> | someone found a bug in code of mine just today that ignored exit codes, in fact. |
| 19:21:17 | <dons> | yeah, so Left/Right only works if we expect the burden of checking to be light |
| 19:21:28 | <dcoutts> | dons: I suggest the default should return IO String and provide IO (String, ExitCode) as an alternative |
| 19:21:36 | <dons> | yeah. |
| 19:21:40 | <bos> | ACTION agrees with dcoutts |
| 19:21:41 | <monochrom> | Instead of bikeshed colouring between IO (Either x y) and IO y + Exception x, an isomorphism between the two should be given. Then any user can convert any side to the other as needed. |
| 19:21:51 | <dons> | i think both seem reasonable. for different safety cases |
| 19:22:01 | <dons> | a lot of uses will be scripting jobs |
| 19:22:06 | <dons> | so IO String seems best there |
| 19:22:15 | <bos> | monochrom: no, the contention is that the Either case is not actually useful. |
| 19:22:45 | <monochrom> | Why is it not actually useful? dons just said he found it useful. |
| 19:23:03 | <roconnor> | monochrom: how do we feel about bottoms in there? |
| 19:23:04 | <dcoutts> | dons: make it clear in the docs that it runs the process 'til it terninates, so you cannot communicate with it concurrently |
| 19:23:15 | <dons> | yep |
| 19:23:25 | <chadz> | dons: hmm, after installing cabal-install, it only appears to like working from within the src directory due to the dist/ directory. otherwise, it yells "cabal: dist/Conftest.c: openFile: does not exist (No such file or directory" |
| 19:23:31 | <chadz> | this isn't regular, is it? |
| 19:23:46 | <monochrom> | roconnor: I assumed some strictness. |
| 19:23:51 | <bos> | monochrom: it falsely separates getting output from getting the exit status. |
| 19:24:16 | <dcoutts> | chadz: you're using cabal-install from hackage or the latest darcs version? |
| 19:24:23 | <FunctorSalad> | hope this is on-topic here... what is "haskell-mode-menu" in haskell-mode? |
| 19:24:29 | <dcoutts> | chadz: the hackage version still has that bug you describe |
| 19:24:29 | <sjanssen> | shouldn't the return be (ExitCode, String)? |
| 19:24:49 | <chadz> | dcoutts: yah, hackage. i'm following don's tut per his request. |
| 19:24:52 | <monochrom> | It truely separates (success /\ output) from (failure /\ reason) |
| 19:25:10 | <chadz> | cabal-install-0.4.0 |
| 19:25:25 | <bos> | monochrom: the point being that that isn't actually helpful. you often want to capture the output of a failed command. |
| 19:25:38 | <monochrom> | OK I see. Sorry. |
| 19:25:43 | <dcoutts> | chadz: ok, well just so you know, that bug and many more are fixed in the darcs version which you can use if you like |
| 19:25:44 | <yrlnry> | Where "failure" means "non-zero exit status"? |
| 19:25:45 | <dons> | sjanssen: yeah |
| 19:26:11 | <chadz> | dcoutts: k |
| 19:26:11 | <sjanssen> | and what about stderr? |
| 19:26:19 | <monochrom> | "Instead of bikeshed colouring between IO (Either x y) and IO y + Exception x, an isomorphism between the two should be given. Then any user can convert any side to the other as needed." <--- I said that not just for Run.hs. It is useful for all IO actions. |
| 19:26:40 | <chadz> | dons: might want to update your page to include directions for darcs cabal-install :) |
| 19:26:57 | <hpaste> | sclv annotated "Can this be generalized?" with "(no title)" at http://hpaste.org/4886#a1 |
| 19:26:59 | <murr^^> | what large haskell programs would you recommend for a newbie to check out? Which ones have the most beautiful, readable code, plenty of documentation? ghc, xmonad, darcs, others? |
| 19:27:03 | <dons> | chadz: can you send me a diff? |
| 19:27:03 | <chadz> | @where cabal-install |
| 19:27:03 | <lambdabot> | I know nothing about cabal-install. |
| 19:27:22 | <bos> | murr^^: start with xmonad. you really don't want to begin with a large haskell program. |
| 19:27:30 | <dcoutts> | dons: I feel the name of the function is not right, but I'm not sure what it should be |
| 19:27:45 | <dcoutts> | dons: it's more like system/rawSystem that runs a process to completion |
| 19:27:50 | <bos> | i quite like readProcess. |
| 19:28:12 | <chadz> | dons: of intro.html? |
| 19:28:13 | <murr^^> | bos: I could just read a file or two of a large program if it's very modularly written. But I suppose I'll start with xmonad.. |
| 19:28:50 | <bos> | murr^^: xmonad is particularly clean, and it's not complicated. darcs and ghc will make your head explode. |
| 19:28:57 | <sjanssen> | murr^^: xmonad is the only one I'd recommend. GHC and darcs have far too many "hysterical raisins" |
| 19:28:58 | <dcoutts> | @where+ cabal-install http://hackage.haskell.org/trac/hackage/wiki/CabalInstall |
| 19:28:58 | <lambdabot> | Nice! |
| 19:29:06 | <dcoutts> | @where cabal-install |
| 19:29:06 | <lambdabot> | http://hackage.haskell.org/trac/hackage/wiki/CabalInstall |
| 19:29:07 | <murr^^> | OK, thanks |
| 19:29:23 | <chadz> | i for one would like hackage to provide a darcs link |
| 19:29:38 | <chadz> | % cabal darcs xmonad -- would be a nice ability |
| 19:29:50 | <dcoutts> | chadz: me too, if you can come up with a design for a repo spec in the .cabal file that'd be great |
| 19:29:53 | <bos> | yeah, that would be nice. |
| 19:30:05 | <chadz> | dcoutts: I got work too, y'know :) |
| 19:30:19 | <dcoutts> | chadz: we need to identify the kind of scm (ie darcs, svn etc) the url, the branch and the path to the project within the repo |
| 19:30:42 | <dcoutts> | chadz: aye, that's why the feature doesn't exist yet :-) we've all got plenty to do |
| 19:30:46 | <bos> | ACTION watches darcs crawl up its own behind. sigh. |
| 19:31:08 | <chadz> | what's hackage running on? database, happs, ... ? |
| 19:31:21 | <dcoutts> | chadz: apache + cgi + haskell scripts |
| 19:31:46 | <tibbe> | anyone gotten the latest haskell-mode to work? it hangs when i do C-c C-l |
| 19:32:23 | <monochrom> | I just saw a similar report on haskell-cafe or something. Involved Windows. |
| 19:32:24 | <alexj_> | dcoutts: http://searchpath.org/package-info.rnc |
| 19:32:46 | <bos> | what's a reasonable amount of time to wait for darcs to apply a patch? i have a notion that if it spins for 30 seconds, it's likely to spin for a month. |
| 19:33:06 | <alexj_> | dcoutts: that is my beginning attempt to come up with a clean format for describing packages. |
| 19:33:36 | <dcoutts> | alexj_: is this related to my comment on scm repos or just in general? |
| 19:33:55 | <alexj_> | yes. |
| 19:34:03 | <alexj_> | there is a line there for repos. |
| 19:34:11 | <alexj_> | should probably have a tag attribute. |
| 19:34:37 | <resiak> | Hrm, is Cabal usable for pure C projects? It deals well enough with mixed Haskell/C projects… |
| 19:35:02 | <monochrom> | Oh well, same person. :) |
| 19:35:10 | <alexj_> | dcoutts: you were talking about a rebuild of hackage yesterday. is there a requirements doc? |
| 19:35:47 | <dcoutts> | alexj_: not written down, just lots of feature requests in the trac and in people's heads |
| 19:36:17 | <tibbe> | dcoutts: I want pretty pixels! :) |
| 19:36:21 | <dcoutts> | alexj_: I was thinking that HApps might be a good platform for it but I don't have a great deal of experience with web apps |
| 19:36:36 | <alexj_> | yeah, I was thinking it might be a good demo app. |
| 19:36:43 | <dcoutts> | alexj_: it would yes :-) |
| 19:37:12 | <alexj_> | which trac has the hackage requests? |
| 19:37:30 | <dcoutts> | alexj_: http://hackage.haskell.org/trac/hackage |
| 19:37:31 | <lambdabot> | Title: Hackage - Trac |
| 19:38:12 | <alexj_> | ok will review. |
| 19:38:13 | <alexj_> | thanks |
| 19:38:15 | <dcoutts> | alexj_: so that scm stuff has a flavour and a url, but I wonder if that's enough to identify a package, since projects are often not in the root of a repo, and then there are tags/branches etc which are not always part of the repo url |
| 19:38:53 | <dcoutts> | alexj_: there are more features that are only in our heads, like sending package authors emails, getting build feedback from clients |
| 19:38:59 | <alexj_> | yeah I think the remaining bit is just to add a branch attribute at the top. |
| 19:39:19 | <alexj_> | dcoutts: that last was re scm |
| 19:39:19 | <tibbe> | dcoutts: maybe my WSGI like web server will be done |
| 19:39:55 | <dcoutts> | alexj_: the main thing it does is manage the package archive, but it's also got users & authentication for uploads and has a lot of meta-data about packages which we'd like to present in various ways |
| 19:40:19 | <alexj_> | yeah, I've been thinking through a bunch of these issues for searchpath and package-info. |
| 19:40:52 | <dcoutts> | alexj_: and caching could be important too, the package archive is supposed to be purely functional so .tar.gz files should never expire so it should be possible to tell a proxy to cache pretty effectively |
| 19:40:58 | <chadz> | i think flavor/url is enough. |
| 19:41:16 | <dcoutts> | chadz: it's not enough to rebuild a project from a darcs repo |
| 19:41:33 | <dcoutts> | chadz: and certainly not enough to identify the exact version that corresponds to a release |
| 19:41:52 | <litb> | why is darcs so famous in the haskell world? |
| 19:41:52 | <chadz> | i wasn't expecting cabal to handle buildling of darcs repositories |
| 19:42:09 | <alexj_> | chadz: searchpath currently handles darcs repos. |
| 19:42:30 | <chadz> | litb: it's one of the largest industrial applications |
| 19:42:42 | <Philippa> | it's also a good example of an app that was enabled by the 'haskell mindset' |
| 19:42:46 | <dcoutts> | chadz: perhaps not, but what do you want the url for? and perhaps there's a need to identify both the latest development branch and also the branch/tag that corresponds to this release |
| 19:43:27 | <chadz> | dcoutts: (flavor,[url]) :) |
| 19:44:16 | <Zao> | Philippa: "Theory, in practice"? |
| 19:44:44 | <chadz> | dcoutts: i figure if one's wanting the darcs version, there's probaly going to be some manual intervention. |
| 19:45:08 | <dcoutts> | chadz: for hackage we want to get stats from the darcs repo so we need to do it automatically |
| 19:45:25 | <chadz> | ah |
| 19:45:42 | <Philippa> | Zao: that's part, but not all, of it |
| 19:45:56 | <kib> | Hi |
| 19:46:05 | <Philippa> | typeful programming's a big deal as well |
| 19:47:40 | <dcoutts> | alexj_: the main reason I was thinking about HApps is that it serialises the requests so it should make presenting a consistent view of the archive easier |
| 19:48:10 | <dcoutts> | alexj_: that, and it'd be nice to have an easy way for people to deploy their own hackage servers and having just one program to run is nice |
| 19:48:34 | <alexj_> | dcoutts those are the general arguments for happs for any project (-: |
| 19:48:41 | <dcoutts> | alexj_: right |
| 19:51:29 | <dcoutts> | alexj_: then there are ideas like having a hoogle instance that covers all the packages on hackage, for that to be fast we'd probably want to keep the whole index in memory all the time |
| 19:52:23 | <alexj_> | not sure i understand that feature. but I think I can put together enough of a base so that people can easily add. |
| 19:52:49 | <dcoutts> | alexj_: right, you found the existing hackage-script repo? |
| 19:53:07 | <alexj_> | dcoutts: no haven't looked yet. |
| 19:53:09 | <alexj_> | where is it? |
| 19:53:21 | <dcoutts> | darcs.haskell.org/hackage-scripts/ |
| 19:54:07 | <dcoutts> | alexj_: hoogle currently works in a one-shot mode where it reads its indexes out of files, does one search and terminates. For best response times with a large index covering all packages we'd want to keep that index in ram rather than reading it from disk all the time |
| 19:54:45 | <dcoutts> | alexj_: and then of course as packages are added the hoogle index has to be updated in a consistent way, happs should be great for that |
| 19:55:23 | <sjanssen> | dcoutts: can't you trust the OS to keep it in cache? |
| 19:55:46 | <alexj_> | dcoutts: yes then happs-state is what you want. |
| 19:56:23 | <dcoutts> | sjanssen: perhaps, but that just means it' being kept in memory in a slightly weird and duplicative representation |
| 19:56:45 | <dcoutts> | alexj_: I presume it's possible for long running stuff to be forkIO'd and to submit extra messages to the incoming queue? |
| 19:57:05 | <alexj_> | dcoutts: yes that is indeed the design pattern. |
| 19:57:27 | <dcoutts> | alexj_: ok, good |
| 19:58:01 | <alexj_> | dcoutts: happs-state is basically type indexed ACID state. you make query/update it from IO with types that identify the part of state you want. |
| 19:58:04 | <tibbe> | on-the fly indexing of new packages can be tricky |
| 19:58:48 | <dcoutts> | alexj_: happs-state is different from ordinary happs in that it keeps the state in memory rather than disk? |
| 19:59:38 | <alexj_> | happs-state is just the part of happs uses for ACID. all state updates are written to a log before returned. the state is also checkpointed so if you reboot, happs-state reads the last checkpoint and replays the log to get back to the current state in memory. |
| 20:00:03 | <dcoutts> | ah ok, so it's a component rather than a variant |
| 20:00:10 | <alexj_> | yes. sorry if that was unclear. |
| 20:00:19 | <dcoutts> | ACTION reads the happs.org page |
| 20:00:35 | <alexj_> | the docs need some improvement. |
| 20:01:17 | <dons> | dcoutts: you thinking of running some of the fancier hackage ideas in happs? |
| 20:01:29 | <dcoutts> | dons: it seems like a natural fit |
| 20:01:31 | <dons> | yeah |
| 20:01:39 | <dcoutts> | and would be nice for deployment |
| 20:01:45 | <dons> | should help happs get some more stress testing too |
| 20:01:51 | <dcoutts> | cabal install hackagedb |
| 20:01:59 | <alexj_> | dons: exactly what I was thinking. |
| 20:02:19 | <dcoutts> | yes, the central hackage.haskell.org could see fairly high usage |
| 20:02:53 | <dcoutts> | dons: you've worked with happs before right? for hpaste.org? |
| 20:03:49 | <dons> | yep |
| 20:03:54 | <dcoutts> | alexj_: oh and download logs, that's a bit annoying with apache, we want to present download stats for eahc package and it's a pain to have to go and parse apache logs |
| 20:04:14 | <dons> | and it was as advertised: easy to deploy, and we got to concentrate on core features, not infrastructure hassle. |
| 20:04:22 | <dcoutts> | alexj_: I presume that'd be a lot easier with an api in happs than parsing some text log |
| 20:04:26 | <dons> | though happs kept moving, meaning hpaste was unbuildable for a long time. |
| 20:04:31 | <dons> | stability is good for frameworks. |
| 20:04:43 | <dcoutts> | true, though so are features :-) |
| 20:04:45 | <alexj_> | dons: happs is getting much more stable now. |
| 20:05:13 | <dons> | yep. it looks like things are heading in the right direction |
| 20:05:38 | <dons> | i saw the deutsche bank guy also talking about how things are stabilising nicely, for their use |
| 20:06:40 | <alexj_> | which deutsche bank guy where? |
| 20:08:31 | <dcoutts> | alexj_: quick, potential customer :-) |
| 20:09:18 | <BMeph> | Has anyone compiled Haddock 2.0 yet? |
| 20:10:17 | <byte-> | hello. |
| 20:12:14 | <byte-> | let's say I have code like this: http://lambda-the-ultimate.org/node/2595#comment-39078 |
| 20:12:16 | <lambdabot> | Title: The Land of the Terminal | Lambda the Ultimate |
| 20:12:38 | <byte-> | I don't suppose there's a way to get rid of those useless variable bindings, are there? |
| 20:12:42 | <byte-> | s:are:is: |
| 20:13:08 | <byorgey> | byte-: sure there is. |
| 20:13:25 | <byte-> | how? |
| 20:13:35 | <monochrom> | Are they useless? |
| 20:14:00 | <byorgey> | byte-: in that case, use liftM3, or even better, Applicative |
| 20:14:02 | <byte-> | giving them names doesn't contribute to the readability of the function. |
| 20:14:45 | <byte-> | "applicative"? |
| 20:14:52 | <byorgey> | oh, wait, I see, they're in a weird order |
| 20:15:11 | <byorgey> | Control.Applicative |
| 20:15:22 | <byte-> | ok, thanks. |
| 20:18:05 | <byte-> | how would I use Control.Applicative in this case? |
| 20:18:09 | <monochrom> | Hughes's pretty printing paper has a typo. Page 6, section 4.1, "albegra"! |
| 20:18:10 | <Saizan> | ?. pl undo foo x = do y <- dox x; z <- doy y; blah <- doz z; return $ whatever blah z y x |
| 20:18:10 | <lambdabot> | foo = liftM2 (>>=) dox (liftM2 (>>=) doy . ((liftM2 (>>=) doz . ((return .) .)) .) . flip (flip . (flip .) . flip (flip . flip whatever))) |
| 20:18:19 | <Saizan> | aaargh. |
| 20:18:25 | <monochrom> | haha |
| 20:18:38 | <Saizan> | ?undo foo x = do y <- dox x; z <- doy y; blah <- doz z; return $ whatever blah z y x |
| 20:18:39 | <lambdabot> | foo x = dox x >>= \ y -> doy y >>= \ z -> doz z >>= \ blah -> return $ whatever blah z y x |
| 20:18:46 | <monochrom> | pl is not the best pl engine. |
| 20:19:23 | <Saizan> | it's still not easy here, because you want to both channel and keep the results |
| 20:20:58 | <EvilTerran> | ?pl \x y z -> whatever z y x |
| 20:20:58 | <lambdabot> | flip (flip . flip whatever) |
| 20:21:38 | <sclv_> | haha yeah -- the big problem is that whatever takes its args in a hideous order. |
| 20:21:58 | <EvilTerran> | ?unpl liftM3 . flip $ flip . flip whatever |
| 20:21:58 | <lambdabot> | (liftM3 (\ b c f -> whatever f c b)) |
| 20:22:14 | <EvilTerran> | ?redo liftM3 f x y z |
| 20:22:14 | <lambdabot> | liftM3 f x y z |
| 20:22:16 | <EvilTerran> | hm |
| 20:22:28 | <Saizan> | ?. pl undo foo x = do y <- dox x; z <- doy y; blah <- doz z; return $ whatever x y z blah |
| 20:22:29 | <lambdabot> | foo = liftM2 (>>=) dox (liftM2 (>>=) doy . ((liftM2 (>>=) doz . ((return .) .)) .) . whatever) |
| 20:22:37 | <litb> | > flip (1, 2) |
| 20:22:37 | <lambdabot> | Couldn't match expected type `a -> b -> c' |
| 20:22:40 | <litb> | hm |
| 20:22:49 | <EvilTerran> | ?type flip |
| 20:22:49 | <lambdabot> | forall a b c. (a -> b -> c) -> b -> a -> c |
| 20:22:57 | <EvilTerran> | ?src flip |
| 20:22:57 | <lambdabot> | flip f x y = f y x |
| 20:23:35 | <byte-> | ?src liftM3 |
| 20:23:36 | <lambdabot> | liftM3 f m1 m2 m3 = do { x1 <- m1; x2 <- m2; x3 <- m3; return (f x1 x2 x3) } |
| 20:23:50 | <byte-> | interesting. |
| 20:24:00 | <byte-> | always wondered what those liftM* functions did. |
| 20:24:02 | <litb> | hmm |
| 20:24:06 | <EvilTerran> | heh |
| 20:24:18 | <byte-> | still, a bit too specific for what I was looking for. |
| 20:24:46 | <byte-> | :t liftM1 |
| 20:24:47 | <EvilTerran> | thing is, i don't think you can reasonably do that example without binding some names |
| 20:24:47 | <lambdabot> | Not in scope: `liftM1' |
| 20:24:49 | <byte-> | :t liftM2 |
| 20:24:50 | <EvilTerran> | i guess that's his point |
| 20:24:50 | <lambdabot> | forall a1 a2 r (m :: * -> *). (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r |
| 20:24:54 | <EvilTerran> | :t liftM |
| 20:24:54 | <lambdabot> | forall a1 r (m :: * -> *). (Monad m) => (a1 -> r) -> m a1 -> m r |
| 20:25:01 | <EvilTerran> | and liftM0 = return ;) |
| 20:25:08 | <byte-> | ah, naming conventions ftl :( |
| 20:25:15 | <sclv_> | once whatever is in the right order though, some set of applicative combinators should to the trick, no? |
| 20:25:19 | <byte-> | ?src liftM |
| 20:25:19 | <lambdabot> | liftM f m1 = do { x1 <- m1; return (f x1) } |
| 20:25:38 | <EvilTerran> | sclv_, the problem then is that x is needed to find y, and y to find z |
| 20:25:43 | <byte-> | holy crap. |
| 20:25:49 | <byte-> | that is so much nicer looking than =<< |
| 20:26:00 | <litb> | hm, i don't understand the type of flip |
| 20:26:08 | <EvilTerran> | litb, look at the src |
| 20:26:11 | <roconnor> | liftMn f x1 x2 ... xn = return f `ap` x1 `ap` x2 `ap` ... `ap` xn |
| 20:26:41 | <kmcallister> | ?src flip |
| 20:26:42 | <lambdabot> | flip f x y = f y x |
| 20:26:54 | <litb> | it takes a function f, which is (a -> b -> c) but after that, i'm getting confused |
| 20:27:21 | <sclv_> | EvilTerran -- but you can handle splitting with the reader applicative, no? |
| 20:27:22 | <roconnor> | litb: it returns a function which is (b -> a -> c) |
| 20:27:22 | <byte-> | :t flip |
| 20:27:23 | <lambdabot> | forall a b c. (a -> b -> c) -> b -> a -> c |
| 20:27:58 | <kmcallister> | which is the same as (a -> b -> c) -> (b -> a -> c) |
| 20:28:00 | <litb> | hm, i thought that would be written as (a -> b -> c) -> (b -> a -> c) then |
| 20:28:04 | <byte-> | currying ftw. |
| 20:28:20 | <litb> | oh, it's the same |
| 20:28:22 | <byte-> | litb, parens are optional for the last function. |
| 20:28:23 | <Saizan> | -> is right associative |
| 20:28:28 | <EvilTerran> | sclv_, yes, but would it be clearer?] |
| 20:28:35 | <gio123> | somebody knows about algorithm to decide R1<R2 where R1 and R2 is regular types |
| 20:28:48 | <kmcallister> | a -> b -> c -> d == a -> (b -> (c -> d)) |
| 20:28:49 | <byte-> | that's why you can do things like 'f $ g $ x' |
| 20:28:54 | <byte-> | when $ = id |
| 20:29:04 | <litb> | ah, i understand. |
| 20:29:14 | <EvilTerran> | well, that's because ($) is right-associative |
| 20:29:14 | <sclv_> | EvilTerran: oh, absolutely not. :-) |
| 20:29:22 | <EvilTerran> | (which is independent of the associativity of (->) |
| 20:32:04 | <gio123> | somebody knows about algorithm to decide R1<R2 where R1 and R2 is regular types |
| 20:32:20 | <byte-> | :t () |
| 20:32:22 | <litb> | > flip (-) 3 5 -- should become 2 ? lets see.. |
| 20:32:22 | <lambdabot> | () |
| 20:32:23 | <lambdabot> | 2 |
| 20:32:31 | <litb> | yeah, it works :) |
| 20:32:48 | <byte-> | is () the 'unit' type in haskell? |
| 20:32:55 | <byte-> | or am I just imagining things? |
| 20:32:56 | <kmcallister> | yeah |
| 20:33:02 | <Saizan> | gio123: regular you mean build with product and coproduct? |
| 20:33:08 | <kmcallister> | it's a type with only one value, also written as () |
| 20:33:14 | <litb> | could one write a flip function for arbitrary many arguments too ? |
| 20:33:25 | <gio123> | Saizan: regular expresions |
| 20:33:42 | <kmcallister> | litb: for any fixed permutation, yes |
| 20:33:44 | <byte-> | litb, you can write one for a certain number of arguments. |
| 20:34:02 | <litb> | meh, no variadic templates here o.O |
| 20:34:05 | <kmcallister> | if you wanted a function which takes a description of how to permute the arguments as an argument, you'd need to use template haskell or similar |
| 20:34:08 | <gio123> | Saizan: u have concatinaton and sum |
| 20:34:18 | <gio123> | Saizan: u have concatinaton and choice |
| 20:34:19 | <byte-> | you could use template haskell to make a generic version. |
| 20:34:38 | <byte-> | although it seems like it would be easier to do if haskell was more dynamic. |
| 20:34:45 | <Saizan> | gio123: no recursion? |
| 20:34:55 | <litb> | byte-: oh, i see. but that's another language i suppose |
| 20:35:05 | <gio123> | Saizan: can u pm? |
| 20:35:09 | <kmcallister> | litb, in TH you use haskell to manipulate haskell source |
| 20:35:23 | <kmcallister> | (as an abstract syntax tree) |
| 20:35:24 | <EvilTerran> | you might be able to do something 'orrible using typeclasses and overlapping instances, too |
| 20:35:27 | <litb> | ah i see. interesting |
| 20:35:36 | <kmcallister> | and there are splice and quasiquotation operators |
| 20:35:42 | <litb> | the ast part sounds scary tho |
| 20:35:52 | <byte-> | I guess you've never used lisp then, have you? |
| 20:35:54 | <kmcallister> | it's not that bad, haskell is a nice language for manipulating ASTs |
| 20:36:01 | <byte-> | also, it comes with a free sponge bath. |
| 20:36:05 | <EvilTerran> | you can do a lot of stuff just using splice $(...) and quasiquote [|...|] |
| 20:36:21 | <kmcallister> | [| e |] evaluates to the AST for the expression e |
| 20:36:29 | <EvilTerran> | there's various places you can't splice into, tho |
| 20:36:35 | <gio123> | Saizan: can u pm? |
| 20:36:35 | <kmcallister> | and $(e) evaluates e to an AST and inserts it there |
| 20:36:40 | <EvilTerran> | (types and patterns, for starters, iirc) |
| 20:36:48 | <kmcallister> | yeah |
| 20:36:56 | <byte-> | eh? |
| 20:36:57 | <byte-> | why's that? |
| 20:37:00 | <litb> | hmm, i'm still drinking the milk of my haskell mother. i suppose the best is to stay as simple as possible for the moment =) |
| 20:37:05 | <EvilTerran> | gio123, we've told you before: don't repeat yourself |
| 20:37:11 | <byte-> | it's not like the type checker can run before macro expansion, anyway. |
| 20:37:15 | <EvilTerran> | gio123, he'll have seen your message. don't be so impatient. |
| 20:37:17 | <monochrom> | You have a haskell mother? I want one too... |
| 20:37:29 | <EvilTerran> | byte-, because the implementation's incomplete, i guess |
| 20:37:37 | <byte-> | I see. |
| 20:37:40 | <gio123> | EvilTerran: thank u |
| 20:37:52 | <EvilTerran> | the paper didn't go through specifying everywhere splicing would be allowed, iirc |
| 20:38:05 | <EvilTerran> | also, there's no pattern quasiquoting |
| 20:38:13 | <EvilTerran> | (the paper didn't even suggest it) |
| 20:38:27 | <byte-> | eww, papers. |
| 20:38:28 | <byte-> | they have cooties. |
| 20:39:02 | <byte-> | and also, the people that write them know nothing about writing things for _humans_. |
| 20:39:08 | <EvilTerran> | ([|...|] yields the AST of the enclosed expression, [t|...|] of the enclosed type, and [d|...|] the enclosed decleration(s) |
| 20:39:21 | <EvilTerran> | ... and I want [p|...|], say, for patterns) |
| 20:39:31 | <Toxaris> | gio123: my theoretical computer science textbook tells me that: (1) the language defined by a regular expression is regular (surprise) |
| 20:40:18 | <Toxaris> | gio123: (2) for two regular languages L1 and L2, L1 & L2, L1 | L2 and not L1 are also regular |
| 20:40:34 | <gio123> | Toxaris: yes |
| 20:40:42 | <Toxaris> | gio123: and (3) for a regular language L, L = {} is decidable |
| 20:40:44 | <byte-> | heh. |
| 20:40:47 | <byte-> | the definition of 'ap' is cute. |
| 20:40:52 | <byte-> | ?src app |
| 20:40:53 | <lambdabot> | Source not found. I feel much better now. |
| 20:40:55 | <Toxaris> | gio123: that said, there should be an algorithm wich does what you want :) |
| 20:40:56 | <byte-> | ?src ap |
| 20:40:56 | <lambdabot> | ap = liftM2 id |
| 20:41:13 | <EvilTerran> | ACTION didn't think intersection and negation necessarily yielded a regular language |
| 20:41:47 | <gio123> | Toxaris: yes, there is very unconstructive paper which i didnt undestand so far |
| 20:41:49 | <gio123> | :) |
| 20:41:51 | <EvilTerran> | i'm quite possibly mistaken, tho; i may be thinking of the context-free languages |
| 20:42:34 | <mrd> | intersection and complement are closed for regular languages |
| 20:42:42 | <EvilTerran> | ok |
| 20:42:46 | <monochrom> | Using nondet automata, you can prove neg reg is reg. |
| 20:42:53 | <gio123> | Toxaris: there is a proof, but to take from this proof working algorithm looks quit hard |
| 20:42:54 | <monochrom> | Also union. |
| 20:42:55 | <Toxaris> | gio123: my textbook suggests this algorithm: construct a DFA accepting the language, check if their are any paths from start to an accepting node. if none, the language is empty |
| 20:43:11 | <monochrom> | Then at least you can use de Morgan to also deduce int. |
| 20:43:12 | <EvilTerran> | i guess it'd be possible to do intersection by DFA, too |
| 20:43:12 | <Toxaris> | gio123: their -> there are |
| 20:43:24 | <EvilTerran> | union's pretty easy, anyway |
| 20:43:35 | <EvilTerran> | union(L(A),L(B)) = L(A|B) |
| 20:43:46 | <mrd> | with non-det, trivial |
| 20:43:53 | <monochrom> | However, a direct construction of the intersection automaton is well known. |
| 20:43:54 | <gio123> | Toxaris: it is one way to convert it to DFA and then check DFA's but it is very expencive |
| 20:44:03 | <mrd> | yea they can both be directly constructed |
| 20:44:09 | <mrd> | i have some haskell around for this stuff |
| 20:44:56 | <EvilTerran> | this is starting to come back to me now; i envisage constructing the cross-product of the node sets of the two DFAs |
| 20:45:07 | <EvilTerran> | er, cartesian product |
| 20:46:26 | <EvilTerran> | (to determine the DFA for the intersection, that is) |
| 20:46:36 | <pgavin> | has anyone been able to ghc 6.9.2 to build on mac os x leopard |
| 20:46:40 | <pgavin> | ? |
| 20:46:57 | <pgavin> | sorry, I mean 6.8.2 |
| 20:47:27 | <monochrom> | L1 ⊆ L2 iff L1 ∩ complement L2 = empty. The RHS is the standard algorithm for answering the LHS. |
| 20:48:41 | <monochrom> | Yes, intersection involves product. |
| 20:49:50 | <EvilTerran> | although it seems to me it might also be possible to devise an algorithm for "pushing & through" a regex 'til it's eliminate |
| 20:49:51 | <EvilTerran> | d |
| 20:50:36 | <byte-> | any thoughts on this? http://lambda-the-ultimate.org/node/2595#comment-39113 |
| 20:50:38 | <lambdabot> | Title: The Land of the Terminal | Lambda the Ultimate |
| 20:51:09 | <__pao__> | is correct to say that the sequence of statement in a "do" block represent a composition of functions by >>= operator? |
| 20:51:11 | <byte-> | the 1, 2, and 3. |
| 20:51:14 | <monochrom> | Anyway, all homework questions have well-known solutions. |
| 20:51:18 | <EvilTerran> | (a|b)&c -> (a&c)|(b&c), a&(b|c) -> (a|b)&(a|c), ... |
| 20:51:28 | <EvilTerran> | ... altho i'm not sure how you'd deal with concatenation |
| 20:51:42 | <EvilTerran> | or * |
| 20:51:44 | <monochrom> | That is the hard part. |
| 20:51:56 | <bos> | __pao__: sort of. it can also involve >> and rewriting of let expressions. |
| 20:52:28 | <EvilTerran> | you'd probably need to introduce at least one further operator or sth; easier to just make a graph |
| 20:52:31 | <__pao__> | bos: thanks |
| 20:52:48 | <EvilTerran> | __pao__, the report explains the desugaring in full |
| 20:53:01 | <EvilTerran> | @where report |
| 20:53:01 | <lambdabot> | http://www.haskell.org/onlinereport/ |
| 20:53:16 | <monochrom> | Hudak's book also does. |
| 20:53:29 | <__pao__> | EvilTerran: is it approchable even with basic mathematics basics? :-) |
| 20:53:33 | <monochrom> | When learning anything, read at least three books. |
| 20:53:34 | <ndm> | @seen dcoutts |
| 20:53:35 | <lambdabot> | dcoutts is in #haskell-overflow, #ghc, #haskell and #gentoo-haskell. I last heard dcoutts speak 31m 49s ago. |
| 20:53:59 | <EvilTerran> | @where+ do http://www.haskell.org/onlinereport/exps.html#do-expressions |
| 20:54:00 | <lambdabot> | It is forever etched in my memory. |
| 20:54:03 | <ndm> | @slap dcoutts |
| 20:54:04 | <lambdabot> | ACTION moulds dcoutts into a delicous cookie, and places it in her oven |
| 20:54:34 | <chadz> | haha |
| 20:54:46 | <chadz> | mh must go be graced by ungaro now |
| 20:54:50 | <gio123> | https://dl.comp.nus.edu.sg/dspace/bitstream/1900.100/1453/3/report.pdf |
| 20:54:53 | <lambdabot> | http://tinyurl.com/23wdrm |
| 20:54:53 | <chadz> | oh, wrong channel. |
| 20:54:53 | <__pao__> | thanks all :-) |
| 20:55:31 | <gio123> | can somebbody look this paper page 19 and advice me to take constructive algorithme for subtypeing |
| 20:56:11 | <byte-> | http://www.areallylongnamethatsobviouslyfaketotestsomething.com/3.1415926535897932384/blah |
| 20:56:12 | <lambdabot> | Title: Com.org - Only the best links ..., http://tinyurl.com/2arz55 |
| 20:56:17 | <byte-> | wtf? |
| 20:56:32 | <byte-> | that domain's actually registered. |
| 20:56:32 | <byte-> | wow. |
| 20:56:35 | <byte-> | I gotta check that out. |
| 20:56:46 | <EvilTerran> | it's not, tho; i think the bot does something odd about it |
| 20:56:49 | <ndm> | its official, cabal's syntax sucks |
| 20:56:50 | <lambdabot> | ndm: You have 3 new messages. '/msg lambdabot @messages' to read them. |
| 20:57:02 | <ndm> | Foo: Bar is not equal to Foo: \n\t Bar |
| 20:57:05 | <ndm> | @messages |
| 20:57:06 | <lambdabot> | dcoutts said 3h 8m 14s ago: test case for hoogle 4: [IO String] -> IO [String] should find sequence :: Monad m => [m a] -> m [a] |
| 20:57:06 | <lambdabot> | dcoutts asked 2h 31m 4s ago: btw, do you like the improved text on the http://hackage.haskell.org/ home page? |
| 20:57:06 | <lambdabot> | dcoutts said 2h 28m 14s ago: I assume Ross updated it (it certainly wasn't me) |
| 20:57:06 | <byte-> | oh. |
| 20:57:19 | <byte-> | ohh, it looked up com.org, apparently. |
| 20:57:47 | <byte-> | ndm, shouldn't those be things you should be reading in, uhh, private? |
| 20:58:07 | <ndm> | byte-: i strongly suspect dcoutts messaged them at me in the public IRC |
| 20:58:21 | <byte-> | lol |
| 20:58:34 | <ndm> | and its useful if i need to respond to one of the points in the channel to keep the conversation around |
| 20:58:35 | <Toxaris> | gio123: from a short scan, that paper seems to do what you want :) but I don't understand a single idea, so I cannot help you there... maybe you can look that Antimorov's algorithm up somewhere else? |
| 20:58:44 | <byte-> | so nobody has any comments on http://lambda-the-ultimate.org/node/2595#comment-39113? |
| 20:58:45 | <lambdabot> | Title: The Land of the Terminal | Lambda the Ultimate |
| 20:58:54 | <byte-> | http://lambda-the-ultimate.org/node/2595#comment-39113 without the question mark |
| 20:58:56 | <lambdabot> | Title: The Land of the Terminal | Lambda the Ultimate |
| 20:58:58 | <byte-> | probably should've used a space. |
| 20:59:22 | <byte-> | I wonder if there's a way to slip urls passed lambdabot so as not to spam the channel twice. |
| 20:59:25 | <ndm> | @tell dcoutts Hoogle 3 drops anything with Monads (or higher-kinded type classes) on the floor - a well known issue which will be fixed in 4. The hackage web page is substantially improved, much much nicer! |
| 20:59:26 | <lambdabot> | Consider it noted. |
| 20:59:26 | <__pao__> | monochrom: you were referring to this, right? http://www.haskell.org/tutorial/ |
| 20:59:28 | <lambdabot> | Title: A Gentle Introduction to Haskell, Version 98 |
| 20:59:29 | <gio123> | Toxaris: i have paper about artimirovs algorithm but very hard to take algorithme from there |
| 20:59:45 | <EvilTerran> | byte-, the convention in general is to use <http://example.com>, i believe |
| 20:59:54 | <ndm> | @karma+ ross |
| 20:59:55 | <lambdabot> | ross's karma raised to 2. |
| 20:59:55 | <byte-> | ah, nice. |
| 21:00:15 | <byte-> | I was just thinking of dropping the http:// |
| 21:00:19 | <byte-> | but that makes it annoying to click. |
| 21:00:22 | <EvilTerran> | there's some RFC that suggests <URL:http://example.com>, but that was from the days when people might not recognise something with a :// in it as a URL |
| 21:00:28 | <monochrom> | No. "the haskell school of expression". |
| 21:00:38 | <monochrom> | book. I really mean book. three. |
| 21:00:45 | <gio123> | Toxaris: so, what i need is, in that paper i showed above they dont present complete inference system for subtyping, but they have haskell implemetation of subtyping what i need is to know whether that implemetation give complete inference system |
| 21:00:53 | <byte-> | monochrom, what's so special about books? |
| 21:00:55 | <__pao__> | monochrom: thanks |
| 21:01:11 | <Toxaris> | gio123: so try it out :) |
| 21:01:17 | <EvilTerran> | __pao__, did you see my link to the description in the report? |
| 21:01:22 | <byte-> | they're generally poorly written and you can learn faster by idling on IRC. |
| 21:01:28 | <monochrom> | comprehensive. reviewed and edited. coherent. |
| 21:01:31 | <__pao__> | yep |
| 21:01:33 | <__pao__> | EvilTerran: yep |
| 21:01:35 | <byte-> | monochrom, IRC isn't? |
| 21:01:36 | <byte-> | ;) |
| 21:01:39 | <EvilTerran> | 'cos IRC is better written than books, byte- :P |
| 21:01:44 | <gio123> | Toxaris: what? |
| 21:01:57 | <byte-> | IRC conversations generally are, actually. |
| 21:02:02 | <__pao__> | EvilTerran: it explain the formalism of desugaring... I'm really trying to grasp the semantics of monads |
| 21:02:17 | <EvilTerran> | @go you could have invented monads |
| 21:02:18 | <lambdabot> | http://sigfpe.blogspot.com/2006/08/you-could-have-invented-monads-and.html |
| 21:02:18 | <lambdabot> | Title: A Neighborhood of Infinity: You Could Have Invented Monads! (And Maybe You Alrea ... |
| 21:02:25 | <hpaste> | nbarterd pasted "anything I can do to clean up this error checking mess? (nested maybes)" at http://hpaste.org/4888 |
| 21:02:32 | <EvilTerran> | __pao__, i found that one pretty useful |
| 21:02:36 | <Toxaris> | gio123: well that Haskell source they give in the paper. if it (1) compiles and (2) does something usefull for some made-up examples, you can investigate further :) |
| 21:03:05 | <__pao__> | EvilTerran: I'm kind of convinced that I can claim to be a real haskell programmer when I'll be able to see the need of designing a custom monad when it'll be needed :-) |
| 21:03:21 | <gio123> | Toxaris: I am interested whether that implemetation discrabes compete proof system |
| 21:03:53 | <byte-> | ?src const |
| 21:03:54 | <lambdabot> | const x _ = x |
| 21:04:33 | <EvilTerran> | __pao__, it explains nicely why the standard monad instances are what they are, though |
| 21:04:34 | <Toxaris> | __pao__: learning Haskell is like mountain climbing. when you've learned something, you understand what you will try to learn next. (in my opinion, this is a good thing) |
| 21:04:53 | <monochrom> | You will never learn category theory by sitting on IRC. I certainly wouldn't have the patience to type it all out on IRC. |
| 21:05:03 | <__pao__> | Toxaris: it reminds me about windsurfing ;-) |
| 21:05:04 | <byte-> | why would I need to learn category theory? |
| 21:05:08 | <monochrom> | But a book author does. That's the job of a book author. |
| 21:05:12 | <yrlnry> | "Mom, what's an epimorphism?" |
| 21:05:22 | <__pao__> | EvilTerran: I'll give a look, thx |
| 21:05:26 | <byte-> | IRC + intarweb = infinite knoweldge! |
| 21:05:29 | <byte-> | !!!111 |
| 21:05:35 | <monochrom> | It takes hundreds of pages. Impractical to do on IRC. |
| 21:05:42 | <sclv_> | byte-: the example at the bottom of that new post on ltu looks like applicative would work fine. |
| 21:05:43 | <byte-> | monochrom, intarweb. |
| 21:05:58 | <FunctorSalad> | hundreds of pages for basic CT? IMHO that's exaggerated |
| 21:06:00 | <monochrom> | Category theory is just an example. Replace that by monads, arrows, whatever. |
| 21:06:12 | <__pao__> | byte-: intarweb? |
| 21:06:17 | <FunctorSalad> | I for one prefer IRC :) |
| 21:06:28 | <Toxaris> | ACTION would buy a book written by monochrom about category theory. are there any? |
| 21:06:31 | <byte-> | sclv, yeah, I realized that when I learned what 'ap' and liftM* do. |
| 21:06:40 | <monochrom> | You can prefer what you want. |
| 21:07:14 | <byte-> | __pao__, means "internet." |
| 21:07:23 | <yrlnry> | Oh, serious question. Where do I look to find out what a "final algebra" and a "cofinal algebra" are? |
| 21:07:27 | <__pao__> | byte-: sorry :-) |
| 21:07:37 | <monochrom> | The objectively measurable result is, likely but I can't of course be sure, that I learn Haskell from books and I am more fluent, you learn Haskell from the Internet and you are less fluent. |
| 21:07:41 | <yrlnry> | I have a fair amount of background in logic and in category theory. |
| 21:08:10 | <__pao__> | monochrom: can you please suggest your ideal reading list? |
| 21:08:14 | <byte-> | monochrom, I learn everything from the internet. |
| 21:08:26 | <__pao__> | monochrom: I'm definitely of your same type class ;-) |
| 21:08:28 | <byte-> | monochrom, but you're ignoring a fairly critical factor. |
| 21:08:36 | <byte-> | namely, that we're two different people. |
| 21:08:43 | <byte-> | that apparently prefer to learn using different means. |
| 21:08:49 | <monochrom> | Jacob Barts has a co-algebra tutorial. http://www.cs.ru.nl/B.Jacobs/PAPERS/JR.pdf |
| 21:09:03 | <FunctorSalad> | monochrom: I'm not sure whether you mean general "I" and "you" there, but if you weren't - I've been learning for like two weeks |
| 21:09:06 | <yrlnry> | Thanks. |
| 21:09:12 | <byte-> | (I use the term "learn" grudgingly. I prefer to discover.) |
| 21:09:45 | <EvilTerran> | it's surely worth at least having a quick look at a couple of books if you're serious about learning something |
| 21:09:53 | <FunctorSalad> | and I agree with byte- that it is a bit presumptuous to state as objective fact that your style of learning is better for everyone. |
| 21:09:55 | <byte-> | lol |
| 21:10:15 | <EvilTerran> | trying to pick something up over the internet might not be as tedious, but it tends to leave gaps |
| 21:10:18 | <monochrom> | Did I even state that? |
| 21:10:19 | <yrlnry> | Learning stuff from chitchat on IRC is going to be bad for anyone. |
| 21:10:38 | <sclv_> | do_something_maybe x = doxyz <$> x <*> gety x<*> getz x |
| 21:10:49 | <byte-> | monochrom, you implied it, whether you intended to or not. |
| 21:10:55 | <dcoutts_> | yrlnry: are you sure you don't mean initial algebra and final co-algebra? |
| 21:11:22 | <FunctorSalad> | monochrom: yeah... it came across as "you can prefer what you want, but of course I'm right", intended or not |
| 21:11:29 | <dcoutts_> | yrlnry: is this in relation to the encoding of data types in lambda calculus? |
| 21:11:39 | <byte-> | ?src <$> |
| 21:11:40 | <lambdabot> | f <$> a = fmap f a |
| 21:11:44 | <byte-> | ?src <*> |
| 21:11:45 | <lambdabot> | Source not found. |
| 21:11:49 | <byte-> | damn. |
| 21:11:51 | <byte-> | curse you, lambdabot! |
| 21:12:13 | <sclv_> | look in Control.Applicative |
| 21:12:27 | <byte-> | I know it's in there, I'm just too lazy to go there :/ |
| 21:12:28 | <monochrom> | I think you people are imagining the "of course I'm right" part just because you don't like what I said. |
| 21:12:31 | <__pao__> | monochrom: sorry to get back again... what would be your ideal reading list for haskell (books)? 3 is the perfect number |
| 21:12:45 | <yrlnry> | dcoutts: Turner's paper on "Total Functional Programming" says: " Codata definitions are equations over types that produce final algebras, in- |
| 21:12:45 | <yrlnry> | stead of the initial algebras we get for data definitions. |
| 21:12:45 | <yrlnry> | " |
| 21:13:00 | <yrlnry> | Maybe that answers both of your questions at once. |
| 21:13:04 | <EvilTerran> | byte-, <*> is instance-dependent, i believe |
| 21:13:05 | <byte-> | monochrom, I think you're ignoring the "of course I'm right" part because you're being defensive ;) |
| 21:13:09 | <EvilTerran> | @src Applicative |
| 21:13:09 | <lambdabot> | class Functor f => Applicative f where |
| 21:13:09 | <lambdabot> | pure :: a -> f a |
| 21:13:09 | <lambdabot> | (<*>) :: f (a -> b) -> f a -> f b |
| 21:13:15 | <monochrom> | Bird, Hudak, then either Thomson or Hutton. |
| 21:13:32 | <EvilTerran> | byte-, monochrom, watch your tone, guys. this isn't reddit. ;) |
| 21:13:37 | <byte-> | isn't that the same as ap? |
| 21:13:38 | <byte-> | :t ap |
| 21:13:38 | <monochrom> | "The objectively measurable result is, likely but I can't of course be sure" is "of course I am right"? |
| 21:13:42 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => m (a -> b) -> m a -> m b |
| 21:13:43 | <EvilTerran> | byte-, for monads, yes |
| 21:13:43 | <__pao__> | monochrom: thx |
| 21:13:54 | <EvilTerran> | but not all Applicatives are Monads |
| 21:14:06 | <byte-> | EvilTerran, I guess you missed the ";)" at the end of my sentence ;) |
| 21:14:09 | <monochrom> | I even allow for "I can't of course be sure". |
| 21:14:10 | <EvilTerran> | byte-, it'd be more accurate to say "ap is the same as <*> (for Monads)" |
| 21:14:48 | <jsnx> | monochrom: i'm reticent to hold you responsible for things you didn't actually say |
| 21:15:00 | <EvilTerran> | byte-, 'twas just a friendly warning, is all. i had a ;), too :) |
| 21:15:24 | <byte-> |