Experimental IRC log haskell-2009-05-22

Available formats: content-negotiated html turtle (see SIOC for the vocabulary)

Back to channel and daily index: content-negotiated html turtle

These logs are provided as an experiment in indexing discussions using IRCHub.py, Irc2RDF.hs, and SIOC.

00:00:23<ray>besides function application, which goes up to 11
00:00:33<Baughn>10
00:00:35<mauke>I thought application was 10
00:00:39<alexsuraci>I'm curious how haskell does the infix parsing, it seems to me that you'd want to first scan for infixr/infixl/infix to determine how to parse the operators
00:00:47<ray>i skipped 10 so i could say "goes to 11"
00:00:59<Baughn>ray: No, that's token parsing
00:01:12<Baughn>It's why mapconcat isn't map concat
00:02:23<mauke>ray: Haskell does go to 11 but only if you leave function application at 10
00:25:34<A1kmm>Hmm, I have a program which segfaults early on when run with ghc head on threaded mode... any tips on how to go about debugging this?
00:26:15<A1kmm>(the problems only happen if I use +RTS -N2 or higher to enable parallel Haskell...)
00:29:20<Tobsan>what is the main use of monoids in Haskell?
00:30:54<Apocalisp>Tobsan: Summing over functors, deriving other monoids. They're rather useful, really.
00:31:33<Tobsan>Alright. I was writing a tree structure just now and i happened to implement Monoid
00:31:41<Tobsan>but then i realized i didnt know why
00:31:52<Apocalisp>@type Data.Foldable.foldMap
00:31:53<lambdabot>forall a m (t :: * -> *). (Monoid m, Data.Foldable.Foldable t) => (a -> m) -> t a -> m
00:31:56<Apocalisp>that's why!
00:32:00<Tobsan>oh snap!
00:33:22<Apocalisp>You'll want to instance Foldable for your tree structure, I think.
00:34:46<Baughn>> foldMap show [1..4]
00:34:47<lambdabot> Not in scope: `foldMap'
00:34:53<Baughn>> Data.Foldable.foldMap show [1..4]
00:34:55<lambdabot> "1234"
00:41:20<Peaker>does the lack of axiom of choice in intuition(SP?) logic (which total value types are isomorphic to) not a problem, in dependent types language, that use this isomorphism?
00:42:42<opqdonut>well AC is non-constructive
00:43:03<opqdonut>constructiveness is generally a nice property in logics relating to programming languages
00:43:17<Peaker>opqdonut: I guess I have a lot more reading to do?
00:43:23<Peaker>opqdonut: or is that easy to explain?
00:43:34<opqdonut>probably yes (more reading)
00:43:49<opqdonut>it might be easy to explain, however i am in no condition to do so
00:44:09<Peaker>ok, thanks
00:44:53<opqdonut>AC is only relevant when the logic we are studying has a rich enough model under it (sets, for example)
00:45:39<opqdonut>i
00:45:53<opqdonut>'m not really sure what the c-h correspondence looks like wrt. dependent types
00:47:42<conal>Baughn, Peaker: i just released new versions of checkers, reactive, and reactive-glut. if you find version problems etc, please let me know.
00:48:17<abbe>hi everyone
00:48:35<abbe>is there any way to perform mapM_ like operation on Data.Map ?
00:48:54<opqdonut>yes
00:48:59<opqdonut>?src Traversable
00:49:00<lambdabot>class (Functor t, Foldable t) => Traversable t where
00:49:00<lambdabot> traverse :: Applicative f => (a -> f b) -> t a -> f (t b)
00:49:00<lambdabot> sequenceA :: Applicative f => t (f a) -> f (t a)
00:49:00<lambdabot> mapM :: Monad m => (a -> m b) -> t a -> m (t b)
00:49:00<lambdabot> sequence :: Monad m => t (m a) -> m (t a)
00:49:06<abbe>opqdonut: how ?
00:49:22<opqdonut>there's a Traversable instance for Data.Map
00:50:00<opqdonut>http://hackage.haskell.org/packages/archive/base/4.1.0.0/doc/html/Data-Traversable.html#t%3ATraversable <- the relevant documentation
00:50:48<opqdonut>however, mapM_ f $ elems m might also be sufficient
00:51:17<abbe>opqdonut: oops, didn't thought of that. thanks :)
00:51:38<opqdonut>np
00:51:40<Baughn>conal: That fixes my most serious problem (event->behavior->snapshot working very badly) nicely, but the monad instance for Event now locks up at 100% cpu use
00:52:03<Baughn>conal: (Earlier it deadlocked at no use, iirc. Or maybe I just didn't notice.)
00:52:17<Baughn>Oh.. yeah, it deadlocked and GHC killed my program. Worked fine without -threaded.
00:52:21<Baughn>Now it doesn't work, period.
00:52:48<Baughn>I'll look closely at your patches, I guess. :)
00:53:29<conal>Baughn: sigh :(
00:53:40<conal>Baughn: thx.
00:54:06<Baughn>conal: Oh, I almost forgot. Inside Timer.hs, specifically in the adaptE implementation (where it sleeps), there's a > comparison that I'm pretty sure should be >=
00:54:15<Baughn>conal: Doesn't cause anything worse than a spurious sleep, though
00:54:23<Baughn>(A spurious 0-length sleep)
00:55:34<abbe>> mapM (putStrLn . show) (Data.Map.insert 5 10 (Data.Map.empty))
00:55:35<lambdabot> Couldn't match expected type `[a]'
00:55:46<Baughn>conal: Make that Timing.hs and sleepPast
00:56:04<abbe>any ideas what is error in this ?
00:56:20<conal>Baughn: i see it now. hm. the comment says "-- Snooze until strictly after the target."
00:56:21<mauke>yeah, this mapM takes a list
00:57:10<abbe>mauke: oh, so i've to import from Traversable. and explicitly qualify it, right ?
00:57:22<Baughn>conal: Which is a questionable idea. How do you even know you're "strictly after" after calling sleep with *0*?
00:57:33<mauke>yeah, or hide the prelude version
00:57:41<mauke>also, putStrLn . show = print
00:57:44<Baughn>conal: But if that's important, better replace the loop
00:58:22<conal>Baughn: i guess i don't. that whole input timing thing is still shaky. not just in the details.
00:58:23<abbe>mauke: any ideas how to assign import a module in GHCi under a separate name. equivalent of import Data.Map as M ?
00:58:31<abbe>s/assign i/i/
00:58:41<Baughn>conal: That said, for what adaptE's using it for, I don't think I'd want "strictly past"
00:58:43<MonadBaastad>BTW, isn't Data.Map an instance of Monad? :)
00:58:52<mauke>abbe: I don't know a way to do that
00:59:01<mauke>MonadBaastad: no
00:59:15<abbe>okay, thanks mauke :)
00:59:18<Baughn>conal: If I ask for an action to be executed at 2 seconds, I don't really wish for it to wait for 2.00001 seconds. ;)
00:59:57<conal>MonadBaastad: maybe no one thought to implement the Map Monad instance.
01:00:21<Baughn>It's not entirely obvious what it'd do
01:00:28<mauke>return x = ?
01:00:33<Baughn>singleton
01:00:33<conal>Baughn: maybe there are other uses. i forget.
01:00:41<mauke>Baughn: what
01:01:04<Baughn>mauke: Or maybe not. I haven't give it much thought. :)
01:01:12<Baughn>mauke: I got stuck trying to implement Applicative for Map
01:01:27<conal>my "denotational design" paper answers this question.
01:01:31<conal>about Map monad.
01:02:19<conal>there's a simple, general principle for answering questions like this one.
01:02:41<MonadBaastad>There *is* an Applicative inst. for Map, though. :)
01:02:43<Baughn>"First implement it, then notice you implemented a monad"?
01:02:51<conal>:)
01:03:15<mauke>what is pure for Maps?
01:03:22<MonadBaastad>Baughn: The Force is _strong_ with you. :)
01:04:02<copumpki>Map as in Data.Map?
01:04:21<Baughn>mauke: ..am I allowed to have it read a global variable updated with the last key to be written into a map?
01:04:30<mauke>Baughn: hah
01:04:45<mauke>that doesn't even work
01:05:09<duke83>hi there.. how can I read a file, which contains some haskell code, and execute what it has read? is it possible. using import a module is not an option for me... the file mainly contains some variable declarations
01:05:42<Baughn>@src Ord
01:05:43<lambdabot>class (Eq a) => Ord a where
01:05:43<lambdabot> compare :: a -> a -> Ordering
01:05:43<lambdabot> (<), (<=), (>), (>=) :: a -> a -> Bool
01:05:43<lambdabot> max, min :: a -> a -> a
01:06:12<mauke>duke83: if it's just some variables, why do you have to execute code?
01:06:35<duke83>you are right... execute is the wrong word
01:06:45<Baughn>duke83: Easier (and safer) to use something like JSON, perhaps
01:06:53<mauke>sounds like you want a config parser
01:07:04<mauke>for a quick and dirty solution, see Read
01:08:15<duke83>thx, I thought it will read everything as a string, but I am probably wrong
01:08:20<Baughn>mauke: I've got it. pure = undefined.
01:09:06<solidsnack>It's dawned on me that a container which is also a monoid is filterable.
01:09:21<solidsnack>However, a container that is a MonadPlus is also filterable.
01:09:29<solidsnack>So say we want a generic filter.
01:11:05<solidsnack>So say I create a Filterable class and then set instances for `(MonadPlus m)` and also `(Monoid (m t))` -- then they will overlap in some cases.
01:11:11<solidsnack>What will happen?
01:11:40<shapr>ACTION grumbles
01:11:52<shapr>Ubuntu server only has ghc 6.8, I guess I'm switching to debian.
01:12:17<solidsnack>Maybe is is best to insist that an MonadPlus be given Monoid instance.
01:12:28<conal>solidsnack: theoretically (ignoring how instance selection really works in haskell), there's no problem unless the instances disagree.
01:12:28<Baughn>solidsnack: To begin with, you can't do that. IIRC, "instance Foo a => Bar a" works the same way as just "instance Bar a", presumably on the idea that you can always define a Foo /somewhere/, so if it didn't you might get overlaps
01:12:36<solidsnack>s/an MonadPlus/any MonadPlus/
01:12:54<conal>solidsnack: secondly, what Baughn just said.
01:12:58<Baughn>solidsnack: ISTR there was some incredibly complicated solution involving overlapping and incoherent types for that, but...
01:13:34<Baughn>solidsnack: You're better off just picking one and putting the restriction in the class definition
01:13:41<solidsnack>Ah.
01:13:43<solidsnack>Okay.
01:13:48<conal>not having the instance constraints considered during instance selection is a real pain sometimes.
01:14:04<conal>e.g., two functors compose to a functor, but to contravariant functors compose to a functor also.
01:14:33<conal>also a contra-functor composed with a functor is a contra-functor; and a functor composed with a contra-functor is a contra-functor
01:14:52<FunctorSalad>conal: add a dummy parameter to the typeclass?
01:14:53<solidsnack>conal: So this would be in an instance of which class?
01:15:10<FunctorSalad>(assuming you're using your own functor class)
01:15:14<conal>FunctorSalad: to the Functor typeclass?
01:15:29<conal>solidsnack: Functor in the first example and Co(ntra)Functor in the second
01:16:06<FunctorSalad>not sure whether this would work
01:16:07<Baughn>What's the type signature of contrafmap?
01:16:33<FunctorSalad>class Functor tag f where fmap :: (a->b)->f a->f b
01:16:42<FunctorSalad>or does tag have to occur in the body?
01:16:51<conal>Baughn: cofmap :: (a -> b) -> (f b -> f a)
01:16:57<mauke>FunctorSalad: only if you want to actually use fmap
01:17:16<Baughn>conal: ..that's even /possible/?
01:17:17<conal>Baughn: it's in the TypeCompose package. very handy!
01:17:30<conal>Baughn: i run into it a lot.
01:17:48<conal>Baughn: for any *reciever* of values.
01:17:54<FunctorSalad>mauke: wasn't there some trick to make it choose the instance for any tag?
01:18:11<mauke>unknown
01:18:28<solidsnack>So the problem in this case is that we want an instance like `instance (CoFunctor a, CoFunctor b) => Functor (something) where fmap = cofmap . cofmap` ?
01:19:00<pumpkin>isn't it contramap?
01:19:03<conal>Baughn: if i know how to receive b and i know how to turn an a to b, then i know how to recieve a. nice, huh?
01:19:24<conal>solidsnack: yeah
01:19:32<solidsnack>pumpkin: Maybe so. I'm asking because the context for the example is a little unfamiliar.
01:19:39<pumpkin>http://comonad.com/haskell/category-extras/dist/doc/html/category-extras/Control-Functor-Contra.html#v%3Acontramap
01:20:16<Baughn>conal: Right you are. Huh..
01:20:25<solidsnack>I guess something would be, uhm, well, I have no idea. Would it be `TypeCompose a b` ?
01:20:27<Baughn>conal: ..that's my dose of brain-mangling for today, I think.
01:20:47<conal>pumpkin: oh, thx. didn't know about that class. geez, there's a lot in category-extras.
01:20:50<solidsnack>(Or something else to accomplish type composition.)
01:20:53<conal>Baughn: :)
01:21:03<pumpkin>I remember making a contrafunctor instance for the composable folds thing
01:21:09<pumpkin>but it was a bit of a stretch
01:21:23<conal>solidsnack: yes. see the TypeCompose package.
01:21:35<conal>solidsnack: @hackage TypeCompose
01:21:40<conal>@hackage TypeCompose
01:21:41<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/TypeCompose
01:22:08<solidsnack>Aha, thank you -- that would be the missing context.
01:22:11<conal>i got type (constructor) composition from the applicative functor paper.
01:22:23<conal>functors compose to functors, and applicatives compose to applicatives.
01:22:33<conal>monads sometimes compose to monads, but sometimes not.
01:22:42<conal>and even when monads compose, they don't compose uniformly.
01:22:51<conal>unlike functors & applicatives
01:23:07<conal>that's why we don't need "applicative transformers".
01:23:17<conal>applicatives + compose are their own transformers
01:23:53<conal>in practice the composition newtype wrapper ("O") is awkward.
01:26:32<solidsnack>Interesting.
01:28:54<conal>using type composition, i've been able to replace code with type compositions.
01:30:06<solidsnack>Through default instances in type classes?
01:31:33<conal>not defaults. if a type is defined to be a composition, then it doesn't need (and can't have) an functor or applicative instance.
01:32:16<solidsnack>So through the, uhm, "obvious" composition of their respective operations?
01:32:45<conal>solidsnack: i don't know if it'd be obvious to you or not. it's in the applicative functor paper.
01:33:09<solidsnack>Ah, okay.
01:33:11<idnar>hooray for applicative functors, I guess
01:33:34<pumpkin>yay
01:33:44<solidsnack>So it looks like I'm wrong about this monoid/filterable thing.
01:33:58<conal>by getting familiar with the functor & applicative instances for maybe, pairing, functions, etc, and composition, i've been able to make lots of code just vanish.
01:34:25<solidsnack>I need `toList` or something `:: monoid (monoid t) -> monoid t` (`join` would suffice in many cases)
01:34:48<mauke>:t mconcat
01:34:49<lambdabot>forall a. (Monoid a) => [a] -> a
01:35:02<solidsnack>I don't get to start with a list, though.
01:35:07<pumpkin>a joinable monoid :o
01:35:15<idnar>solidsnack: `:: monoid (monoid t) -> monoid t` doesn't make any sense
01:35:20<conal>solidsnack: hm. Monoid classifies types, not type constructors.
01:35:23<pumpkin>Sum (Sum Int)
01:35:31<solidsnack>filter :: (a -> Bool) -> monoid t -> monoid t
01:35:32<pumpkin>:P
01:35:40<solidsnack>monoid is a type variable
01:35:45<solidsnack>Monoid is a type class
01:35:48<mauke>oh, so it's not a Monoid?
01:35:56<idnar>solidsnack: right, so monoid t is impossible
01:35:58<mauke>\o_O/
01:36:06<solidsnack>right,
01:36:23<solidsnack>i mean, the thing such that `monoid t` is in `Monoid`
01:36:38<idnar>I wonder if type constructors that construct monoids are a useful class by themselves
01:36:57<conal>TypeCompose has the class Monoid_f
01:37:00<conal>for that purpose
01:37:23<idnar>ah, so (Monoid_f m) => m (m t) -> m t
01:37:42<pumpkin>joinoid!
01:37:49<conal>maybe. though i'd guess Monad & join
01:37:49<pumpkin>moin!
01:37:59<idnar>but you'd need some kind of extension to include a join-like operation
01:38:21<conal>solidsnack: why not use Monad & join?
01:38:35<solidsnack>Well, I need it to be MonadPlus, I think.
01:38:43<solidsnack>That's the route I'm going to take, actually.
01:39:04<idnar>@type msum
01:39:05<lambdabot>forall (m :: * -> *) a. (MonadPlus m) => [m a] -> m a
01:39:11<idnar>@type mplus
01:39:12<lambdabot>forall (m :: * -> *) a. (MonadPlus m) => m a -> m a -> m a
01:39:17<idnar>mplus isn't always the same thing as mappend, though
01:39:53<idnar>uhm, do you have an example Monoid instance in mind? I'm trying to think of a concrete scenario here, and I'm not coming up with anything
01:39:57<conal>and join isn't necessarily related to mplus, is it?
01:40:11<idnar>conal: yeah...
01:40:19<solidsnack>I'll be done in a second and paste it.
01:40:28<idnar>uhm, and msum is only for lists
01:40:36<solidsnack>Not using it :)
01:40:41<Peaker>conal: src/FRP/Reactive/GLUT/Adapter.hs:48:39: Not in scope: type constructor or class `:+->'
01:40:48<idnar>ACTION twists his brain some more
01:40:48<Peaker>conal: but the quickcheck version issues seem to be fixed
01:40:49<conal>oops!
01:41:04<amckinley>hey, would anyone like to help me with a small parsec parser? :)
01:41:05<idnar>> join [[5, 6], [7, 8]]
01:41:06<lambdabot> [5,6,7,8]
01:41:07<idnar>> msum [[5, 6], [7, 8]]
01:41:11<lambdabot> [5,6,7,8]
01:41:13<amckinley>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5108#a5108
01:41:58<idnar>oh man, parsec; I think that signals sleeptime for me
01:42:03<conal>Peaker: oh, i see. i missed a version dependency.
01:42:24<idnar>amckinley: uhm, you seem to have a spelling or search/replace problem there
01:42:32<amckinley>idnar: come on; its fun :)
01:42:36<amckinley>orly?
01:42:45<idnar>oh, wait, this is worse than I thought
01:42:56<idnar>my poor head
01:43:01<amckinley>:D
01:43:19<amckinley>i decided to learn haskell by writing a parser for bind config files
01:43:46<amckinley>the problem im having is with input that looks like this: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5109#a5109
01:43:58<idnar>uhm, so, I'm confused; is the mangling in that paste a joke, or what?
01:44:18<idnar>or is my browser doing something silly?
01:44:27<idnar>oh, my browser is doing something silly
01:44:40<amckinley>idnar: not sure; it looks reasonable to me, but that might be wishful thinking :)
01:44:44<conal>Peaker: released reactive-glut 0.1.9, with reactive version dependency fixed.
01:44:58<Peaker>conal: reinstalling..
01:45:10<idnar>this is what firefox is doing: http://slipgate.za.net/~mithrandi/dear-firefox-wtf.png
01:45:25<Peaker>conal: It really seems like this cabal business needs more automation of the dependencies...
01:45:28<idnar>but, for example, if I copy the text into gnome-terminal, it comes out okay
01:45:35<amckinley>madness
01:45:42<conal>Peaker: indeed! :(
01:45:56<conal>Peaker: we need more static checking.
01:46:40<idnar>what about static electricity!
01:46:45<conal>:)
01:46:49<Peaker>conal: yeah.. a type signature of the exported modules to check against -- verifying the version dependency holds
01:46:53<conal>maybe if we had a real module system, like ML
01:46:58<Peaker>conal: seems to compile now
01:47:01<conal>:)
01:47:05<Peaker>conal: :-)
01:47:05<solidsnack>Okay, this works for lists.
01:47:06<amckinley>idnar: very weird; my firefox is fine. i could switch over to regular pastebin...
01:47:06<solidsnack>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5110#a5110
01:47:16<idnar>amckinley: I think it's because I haven't restarted it since I upgraded the binary
01:47:30<Peaker>conal: hey cool, you fixed fieldtrip?
01:47:34<conal>this reactive version may have broken integral. one example in reactive-fieldtrip just sits there.
01:47:38<stepnem>please, what is the most painless way to get only the elements occuring more than once in a list?
01:47:42<idnar>amckinley: another fun thing is that some dialogs just have XML parse errors instead of their expected contents
01:47:46<conal>Peaker: great :)
01:47:59<amckinley>idnar: yeah, ive seen that before :)
01:48:02<Peaker>conal: reactive-fieldtrip fails, though
01:48:07<idnar>amckinley: another fun thing is that some dialogs just have XML parse errors instead of their expected contents
01:48:37<Peaker>src/FRP/Reactive/FieldTrip.hs:30:9: Could not deduce (Bounded tr) from the context (Transform (BehaviorG tr tf xf) (BehaviorG tr tf a), Ord tr, Transform xf a)
01:48:54<solidsnack>So it looks like things in `MonadPlus` have enough structure to be generically filtered; monoids don't because you can't walk them and aggregate the walk.
01:48:56<conal>Peaker: hm. i'll release a new reactive-fieldtrip then.
01:49:07<Peaker>conal: awesome :-)
01:49:14<idnar>solidsnack: yeah, monoids are values not containers
01:49:41<Peaker>conal: I am really anxious to start toying with Reactive.. Feel more comfortable with my understanding of things now to actually debug stuff even, hopefully
01:49:48<idnar>solidsnack: it might be useful for the values /in/ the container to be monoids, though
01:50:03<Peaker>conal: ghc could use more debugging tools.. especially for threads
01:50:11<solidsnack>idnar: How?
01:50:30<Peaker>Something visualizing threads/mvar state could be pretty cool
01:50:31<idnar>solidsnack: I just mean (Monad m, Monoid a) => m a
01:50:45<conal>Peaker: and how. this stuff drives me nuts.
01:50:49<solidsnack>idnar: I don't see that as helping with filter, though.
01:50:52<codebliss>So what do you guys say when you read (::)? I got a new idea
01:50:54<Baughn>conal: checkers-0.1.4 appears broken; you've forgotten to depend on quickcheck at all
01:50:55<idnar>solidsnack: no, not really
01:51:06<conal>really?!
01:51:06<codebliss>"Has the type of" is pretty good, but when you think functions, it's kinda meh
01:51:07<idnar>solidsnack: what you really want is some kind of sequence / enumerable / traversable / whatever typeclass
01:51:08<solidsnack>codebliss: I say "has type".
01:51:21<codebliss>solidsnack: I just thought of "represents." It seems to fit nice.
01:51:22<idnar>solidsnack: MonadPlus isn't really enough to "walk" it either
01:51:38<solidsnack>idnar: Well, it seems I just need `MonadPlus`
01:51:47<idnar>codebliss: (::) reads silently in my head
01:51:56<Baughn>conal: No, not really. Hmm
01:51:59<codebliss>idnar: Of course, what if you were explaining to newbies? =P
01:52:01<solidsnack>idnar: `fmap` let's me walk it and `join` let's me collapse it again.
01:52:17<Baughn>conal: You've forgotten to specify the version, and installing reactive pulled in a newer version at one point
01:52:24<Baughn>conal: So the one checkers actually depends on is hidden
01:52:38<idnar>codebliss: I'd just say that it's syntax for a type declaration
01:52:39<codebliss>idnar: map represents an A to a B to an A list to a B list
01:52:44<solidsnack>idnar: The presence of a zero element is what allows the collapse to accomplish the filtration.
01:52:49<idnar>codebliss: I'm not big on translating programming language syntax to english
01:52:52<Peaker>Baughn: sounds like an installed-package-depends-on-specific-version-it-happens-to-be-compiled-with issue
01:52:54<conal>Baughn: i think someone (you?) suggested i leave off the version. i'm in a muddle about what version to use for what.
01:52:57<codebliss>idnar: Yeah, it doesn't work well.
01:53:09<codebliss>idnar: I was teaching one of my professors and kind of hit a wall once
01:53:15<Peaker>conal: I suggested that, and I think if you are version neutral, it is a good idea
01:53:25<conal>okay new reactive-fieldtrip
01:53:28<Peaker>conal: but maybe I'm missing something
01:53:30<solidsnack>(It was the zero element that led me to monoid in the first place.)
01:53:35<idnar>codebliss: I'm not sure why "has type" is any worse for functions, though
01:53:37<Baughn>conal: It's a good idea only if all the possible versions of quickcheck would actually work with checkers
01:53:43<Peaker>Baughn: they don't?
01:53:53<Baughn>conal: quickcheck-2.1.0.1 doesn't; they've changed the interface
01:53:57<idnar>f :: a -> b would read something like "f has type function from a to b"
01:54:16<Baughn>conal: Say QuickCheck<2 or something, at least
01:54:24<Peaker>conal: reactive-fieldtrip installed successfully, yay!
01:54:40<conal>Baughn: i think QuickCheck<2 is what it said before i updated.
01:54:46<codebliss>idnar: I think more of a currying sense. Functions represent conversions of types to me, so when I think foo has type (A list to B list) to A list to B list, it kinda clashes
01:55:03<Peaker>conal, Baughn: If that's truly the case then reactive truly conflicts with Stream >= 0.3.1 ?
01:55:09<conal>clearly, i could use some help sorting out this stuff.
01:55:26<idnar>codebliss: any non-trivial function type seems like a mess to me if you try read it out loud ;)
01:55:28<Peaker>conal, Baughn: Maybe its better to update checkers/reactive to use the new quickcheck interface so that bugfixes/etc in Stream can be used?
01:55:37<codebliss>idnar: Very true XD
01:55:41<conal>Peaker: yes!
01:56:01<Peaker>Baughn: do you know exactly what interface changed in quickcheck 2.1.0.1?
01:56:24<amckinley>Cale: around? im back for more parsec abuse :)
01:56:38<idnar>codebliss: I used to work with a friend, and every now and then I'd shout some code out to him, but I'd sorta leave out half of it because we both knew what I meant; everyone else in earshot used to get horribly confused, though
01:56:43<Baughn>Peaker: No, but if you try compiling it it'll become obvious in short order. :)
01:56:50<codebliss>idnar: Hahahah XD
01:57:09<codebliss>idnar: You got haskell in a real job?
01:57:26<Peaker>Baughn, conal: Ok, trying...
01:57:26<idnar>codebliss: unfortunately not, this was mostly Python code
01:57:36<Peaker>aha, no more: Test.QuickCheck.Utils
01:57:39<codebliss>Python is much better than C's/Java
01:58:02<Baughn>conal: Meanwhile, I'm just specifying Stream-0.3 manually. THat's the quick fix to get it working on hackage; you can port to quickcheck-2 later
01:58:02<idnar>I'm still hoping that Haskell is going to be my primary language in the long run, but I'm wondering if it'll ever be ready for that
01:58:16<conal>Baughn: which package?
01:58:24<Baughn>conal: Basically, wherever you depend on Stream, say Stream == 0.3
01:58:25<conal>hm. how does one get QuickCheck 2?
01:58:31<Baughn>cabal-install. :P
01:58:41<conal>just tried.
01:58:49<conal>maybe i need a cabal update.
01:58:54<Baughn>Oh, right..
01:59:00<Baughn>No, it defaults to quickcheck-1
01:59:05<conal>oh
01:59:10<Baughn>You need to say cabal install quickcheck-2.1.0.1
01:59:17<conal>ah! thx.
01:59:29<idnar>is that version number in trinary? >:)
01:59:34<Baughn>Yes
01:59:41<Peaker>ACTION tries to figure out exactly what old quickcheck stuff checkers needs and where they are in the new quickcheck
01:59:52<idnar>that's, what, 0x64?
02:00:03<idnar>er, 0x40
02:00:27<idnar>I'd better find a bed before I pass out on my keyboard and spam the channel
02:02:01<Zao>conal: Kudos for the post on C, it had me laughing a bit.
02:02:05<Peaker>hmm.. testAssocativeBy/etc from Test.QuickCheck.Utils just disappeared in the new quickcheck?
02:02:13<Peaker>Zao: where?
02:02:17<conal>Zao: thanks! :D
02:02:25<Zao>Peaker: http://conal.net/blog/posts/the-c-language-is-purely-functional/
02:02:34<Zao>Trying to catch up on my RSS, two days old :)
02:03:05<conal>Peaker: i see the same thing (no Test.QuickCheck.Utils)
02:03:28<conal>coarbitrary moved out of Arbitrary
02:03:42<Peaker>conal: I can't find any alternative either, and nothing on google about those functions
02:04:00<Peaker>conal: which quickcheck had some release notes or such
02:04:09<Peaker>conal: can just duplicate the old library code into checkers :-(
02:05:30<p_l>conal: That post is ... I lack the words to describe its awesomness
02:06:08<conal>p_l: wow! :D
02:06:39<Baughn>conal: And now I can go back to my original proof-of-concept code. server :: Event Command -> Reader (Event Reply)
02:07:03<gnuvince_>If I have the following code: do { t1 <- getPOSIXTime; let x = f y; t2 <- getPOSIXTime; return (x, t2 - t1) }, is the time difference the time it took to run the f function or the time it took to generate the thunk?
02:07:06<p_l>conal: the possibilities for Mind Screw among other langauge lawyers are too big for lower grade :D
02:07:08<Baughn>p_l: Also, link to post of Kamina-like awesomness?
02:07:08<Peaker>conal: nice post :-) The Haskell functional part is significantly stronger than cpp, though :-)
02:07:15<Baughn>Wait..
02:07:20<Baughn>The C=FP one? o_O
02:07:23<p_l>Yeah
02:07:27<conal>Peaker: it sure is.
02:07:32<Baughn>Yeah, that was amusing
02:07:38<p_l>Imagine the possibilities for screwing with people's minds :D
02:07:50<Peaker>conal: any idea why the quickcheck guys would eliminate seemingly useful functions like testAssociativeBy?
02:07:56<Baughn>I always thought C was more functional than a lot of other languages, though.
02:08:01<Baughn>At least it /has/ function pointers. ;)
02:08:05<conal>Peaker: the functional parts differ in *degree* only. so if you call one pure you have to call the other pure.
02:08:23<Baughn>conal: ..and my intelligence differs in degree only from a rock.
02:08:25<conal>Peaker: that's the real point of my post. i'd been wondering for a while how to make that point in a way that people would hear.
02:08:38<conal>Baughn: then you're equally "pure"
02:09:40<p_l>Baughn: And some stuff that can be done with those when using C as second stage can be quite amusing :D
02:10:18<Peaker>conal: I do think that there's an interesting point to be made about Haskell's power/referential transparency, even when dealing with IO. As you say, its probably mostly a quantitive rather than a qualitive thing, but also there's the issue of cpp handling possibly invalid syntactic elements and pure Haskell handling type-safe imperative actions
02:11:01<conal>the post is my way of challenging the common description of Haskell-with-IO as "purely functional". the defense that people often make, when pressed, applies also to C.
02:11:12<conal>that's what i was getting at.
02:11:39<conal>perhaps with humor, i won't be flame-broiled when i point it out.
02:11:46<Peaker>conal: what if you ignore the existence of CPP?
02:11:48<sohum>so I'm trying to use cabal for the first time, and I get 'Could not find module Data.Data'
02:12:08<gwern>Peaker: personally, I'm wondering what you get by combining CPP+Haskell
02:12:10<conal>Peaker: then you're left with just IO (C)
02:12:22<Baughn>sohum: What GHC version are you on? o_O
02:12:23<conal>gwern: without IO?
02:12:31<gwern>sohum: need more details. possibly you are missing a dep in the .cabal
02:12:41<Baughn>No, Data.Data is in base
02:12:54<sohum>Baughn: "The Glorious Glasgow Haskell Compilation System, version 6.8.2"
02:12:57<gwern>Baughn: maybe he's missing base as a dep!
02:12:59<conal>Baughn: hey -- when someone acts strangely here, we can ask "What (GHC version) are you on?"
02:13:34<gwern>conal: heck, I dunno. you're the one with all this C IO stuff. (I didn't follow it even reading the blog post, so how would I know?)
02:13:53<sohum>it was trying to install containers-0.2.0.1, if that helps
02:14:31<sohum>ghc and co are installed via debian, and now I'm just starting to try to use cabal
02:14:42<Peaker>is the quickcheck maintainer in #haskell ?
02:14:54<gwern>Peaker: don't think so
02:15:16<gwern>sohum: containers is one of the core packages; trying to install it generally says you're doing something wrong
02:15:24<Peaker>gwern: the point is that even the C AST is a referentially transparent value that when compiled/executed, will yield a value, has similar semantics to IO () values in Haskell, even if the combinators on it are pretty crappy
02:15:45<conal>Peaker: spot on!
02:15:55<gwern>Peaker: see, I don't know what it means to say an ast is a referentially transparent value
02:15:57<sohum>gwern: ok, so odds are that cabal doesn't know how to find the preinstalled packages?
02:16:00<Peaker>So C is purely functional like Haskell, except the purely functional part is really really weak and cannot do anything with these action values
02:16:39<gwern>sohum: I really have no idea. I ran into so many issues installing anything with debian I quickly gave up
02:16:50<conal>Peaker: you got it. :) so if we want to talk about how Haskell is different from C, we cannot (honestly) use the word "purely".
02:16:57<gwern>as far as I'm concerned, if you're intermingling debian and cabal-install, don't waste #haskell's time asking about it
02:17:03<Peaker>gwern: the AST is stateless, calling a CPP macro or using the expanded AST instead is equivalent. Or without CPP, you simply cannot call functions, so its referentially transparent in an .. empty way
02:17:05<conal>more honestly, we can say that haskell is a "very functional programming language"
02:17:33<Peaker>conal: I think the qualitive difference is the fact Haskell has powerful purely functional combinators on these IO values
02:17:41<conal>and if we really want to say "purely", we can stop using IO and come up with something genuinely functional to replace it.
02:18:03<conal>Peaker: yes. *more* powerful than cpp's
02:18:09<conal>it's still relative.
02:18:11<solidsnack>conal: I think this is the point where we all say "and what is that?"
02:18:15<conal>not absolute.
02:18:53<conal>solidsnack: for now, it's getting back to exploring that very question, as people used to do before monadic imperative functional programming was invented.
02:18:53<Peaker>conal: Yeah, I agree -- so the words "purely functional" are not that great to describe "powerful combinators on actions as first-class values"
02:19:04<Peaker>conal: which is a true, genuine advantage of Haskell as an *imperative language*
02:19:10<conal>Peaker: yeah. because "purely" is an absolute, not a relative.
02:19:22<conal>Peaker: yep. haskell is a better C
02:19:29<conal>so we can call it that.
02:19:33<mmorrow_>and we have a better CPP
02:19:39<mmorrow_>, ppDoc `fmap` fmaps 8
02:19:42<lunabot> fmap . (fmap . (fmap . (fmap . (fmap . (fmap . (fmap . fmap))))))
02:19:43<solidsnack>As far as I can tell, Haskell without unsafePerformIO is pure, per Amr Sabry's paper.
02:19:46<conal>on haskell.org: "Haskell: a better C"
02:19:55<Peaker>conal: but this advantage is so huge that it makes others' languages Haskell libraries. It deserves a name, more than "better C" :)
02:20:03<conal>solidsnack: yes. just like cpp+c.
02:20:20<solidsnack>Oh, so CPP is a purely functional langauge?
02:20:30<conal>solidsnack: did you read my post?
02:20:33<solidsnack>That's a little different.
02:20:36<conal>Peaker: i agree. "better C" is honest, but lacks something.
02:20:40<Peaker>solidsnack: whose output is an action, that when executed will perform side effects and yield a result, like Haskell's main :)
02:20:53<solidsnack>Peaker: Sure. Haskell is a better CPP.
02:21:17<solidsnack>Or a better `++`
02:21:30<mmorrow_>(+1)
02:21:38<solidsnack>I'd much rather get my abstraction from Haskell :)
02:21:50<conal>the reason i suggest "Haskell: a better C" is that we typically use "haskell" to mean "haskell+IO", and use "C" to mean "cpp+C"
02:21:54<Peaker>conal: In Haskell, I can have an imperative program be typed via some newtype or type synonym, which is actually some monad transformer, and by changing this monad transformer in one place, I'm changing the statement bind operator behavior, something unheard of in other imperative languages.. Perhaps Haskell is an "overridable semicolon language" :)
02:21:58<jeffz`>sohum, you might find it easier to ditch the debian specific stuff and use the haskell platform instead, that way things "just work"
02:22:02<solidsnack>conal: Sure, I understand that.
02:22:09<solidsnack>However, grauenwolf doesn't.
02:22:19<conal>Peaker: yes. that's part of what makes haskell a better C.
02:22:23<solidsnack>Altough you don't mean to, you are feeding the trolls.
02:22:27<dibblego>solidsnack, grauenwolf doesn't understand very much -- it's best to accept that fact
02:22:38<Peaker>conal: But its a huge, qualitive, and not just quantitive advantage. Even if the quality happens not to have much to do with functional-ness or purity
02:22:57<solidsnack>dibblego: He's unique in his aggressiveness but not in his confusion.
02:23:16<conal>Peaker: yep. i don't seriously want us to change hakskell's motto to "a better C". i want it to be honest.
02:23:24<Peaker>conal: I think that maybe because Haskell tends to be mind bending for a while, until you grasp the concepts well (and then its pretty simple, in retrospect :-) there's a lot of bad terminology and communication around
02:23:35<conal>Peaker: yeah.
02:24:10<Peaker>so we ought to rename "purely functional" to "overridable language semantics" or some such :)
02:24:32<conal>something. let's keep working on it until it's both honest and compelling.
02:24:52<conal>now that i've spilled what my post is really about, maybe some of you will want to add comments on the post.
02:24:59<Baughn>"A Kamina-like language"?
02:26:31<conal>when i've talked about these issues more directly on #haskell, i get some defensive reactions.
02:27:11<dibblego>conal, s/wisdon/wisdom
02:27:44<conal>dibblego: thx!
02:28:22<solidsnack>conal: I think this topic is under-developed.
02:28:51<conal>solidsnack: yeah? please say more.
02:29:07<conal>dibblego: fixed
02:30:01<solidsnack>It seems that this problem basically boils down to how deterministic we can make things.
02:30:19<solidsnack>Or rather, how much of their determinism can we make observable.
02:31:19<solidsnack>It seems like their should be some dovetailing with distributed systems -- in particular, the proof techniques being developed there.
02:32:13<solidsnack>This is something which I still need to learn more about, naturally.
02:32:19<conal>solidsnack: i'm not tracking you at all
02:32:47<mmorrow_>444444444444444444444555555555555555555555555555555555555555555555555555555555555555555555555555555555553333333
02:32:54<mmorrow_>heh
02:32:57<mmorrow_>good kittay
02:33:14<copumpkin>:o
02:33:19<copumpkin>u haz a cat
02:33:25<solidsnack>conal: Well, my ideas are not very well developed, either.
02:34:02<conal>solidsnack: ok. np.
02:34:04<p_l>Baughn: whut?
02:34:31<solidsnack>Having said that, the root of my objection is that, as far as I can tell, as long as you expect components to communicate across a network with unsynchronized time and lossy links, IO is the best that there is.
02:35:12<conal>solidsnack: best that there is or the best that we know?
02:35:30<solidsnack>Given lossy links and unsynched time, best that there is.
02:35:43<solidsnack>This could be a very interesting discussion, actually.
02:36:16<conal>offhand, i can't imagine how you could prove "best there is".
02:36:34<solidsnack>Fair enough.
02:36:36<conal>pretty strong claim.
02:37:08<conal>solidsnack: nice points to keep in mind while looking for something better than IO.
02:37:16<conal>where better == semantically tractable
02:37:52<conal>Peaker: eep. lots breaks in checkers with quickcheck 2.
02:38:10<Peaker>conal: except Utils dependency?
02:38:12<copumpkin>thoughtpolice: around?
02:38:21<conal>Peaker: yeah. i've fixed the Arbitrary/CoArbitrary instances.
02:38:35<conal>Peaker: and now i get to the Utils dependency.
02:38:46<Peaker>conal: I'm not very familiar with quickcheck. I couldn't find the functions from Utils in the new quickcheck
02:39:04<solidsnack>conal: That's fine to cast doubt on my certainties; but you can see how I look at these remarks about an alternative and remain unconvinced.
02:39:06<Peaker>conal: I guess the quick&dirty fix would be to just port that module to new quickcheck and put it in checkers?
02:39:26<conal>Peaker: i could, though i'm not a big fan of q&d.
02:40:12<conal>Peaker: interested in giving it a try?
02:40:51<solidsnack>conal: I guess a fair direction to take this is, what is intractable about IO and can I prove that it falls out of the traits that I described?
02:40:51<conal>Peaker: or we could ask koen or andy or dons
02:41:12<solidsnack>So maybe you can give me a property or something and I can look at that.
02:41:14<conal>solidsnack: i like that direction!
02:42:13<conal>solidsnack: i measure tractability by looking at the denotational domain (a mathematical type). if it's simple, then it's tractable. that's my measure.
02:42:22<solidsnack>Okay.
02:43:06<Peaker>conal: I'm not sure I can do it today (way beyond my sleep time), but I can try to hunt where the functionality has gone to in the next few days
02:43:07<boblo2>can someone pls tell me what the | does in haskell?
02:43:10<conal>solidsnack: IO is such a mess that it doesn't even have a denotational model, afaik.
02:43:37<copumpkin>boblo2: it's like an if in disguise!
02:43:42<Peaker>boblo2: Type sums -- declares that a type can have alternate data constructors (with their alternate fields) as potential values
02:43:53<conal>Peaker: thanks. i sure appreciate it. i'm lousy at tracking a lot of details, so i probably can't do a good job of library maintenance on my own.
02:43:58<Peaker>boblo2: do you know structs, unions and enums?
02:44:18<conal>Peaker: which is also why i like genuinely functional programming (tm)
02:44:26<boblo2>i am playing a "hacker" game that used haskell iv been learneing it the past few days
02:44:28<Peaker>conal: Looking through your code, it certainly doesn't seem that you have trouble tracking details..
02:44:37<conal>hah!
02:44:54<conal>Peaker: i wonder if you mean the code that works or the code that doesn't.
02:45:08<Peaker>conal: even your imperative implementation of Reactive is pretty nifty :) btw: I wondered why you put the action serializer into Clock?
02:45:17<Peaker>conal: I mean that its beautifully structured
02:45:40<conal>Peaker: if it were's beautifully structured, i wouldn't have a chance.
02:45:46<solidsnack>conal: My suspicion is that anything better depends on a transactional store at some level.
02:46:32<conal>solidsnack: wow. that would an amazing result if one could prove it.
02:47:03<solidsnack>conal: Well, schema consistency would be the canonical example.
02:47:14<solidsnack>As long as you have named (instead of structural) types.
02:47:18<conal>solidsnack: there are non-existence proofs. hard for me to imagine how we'd come up with one.
02:47:31<Peaker>conal: Ugly code does not work very well in general, not just for you. Its just that most people have a lower standard of quality that they expect from their code
02:47:36<conal>solidsnack: i.e., prove the nonexistence of a solution that doesn't use transactional store.
02:47:49<boblo2>can someone tell me what +++ does in ParseLib? forgive me for the noobness
02:48:03<conal>Peaker: yeah. i don't trust code that "works". i only trust code that's "true".
02:48:17<solidsnack>It depends very much on what you want to do, of course.
02:48:24<conal>Peaker: compellingly true. code that's "inevitable".
02:48:39<Peaker>conal: You might have encountered this mentality, its very common, that is saying that it is utterly impossible to write *anything* without bugs, and even security problems, no less. IMO: This mentality stems from the fact that most people don't know how to write beautiful/well-structured code, and that badly structured code is true to that mentality
02:48:41<solidsnack>If you don't want hot update and such, you don't worry about having a transactional store of modules.
02:49:39<conal>Peaker: indeed. and like most claims of "impossible", it's a self-fulfilling prophecy.
02:50:04<conal>in other words when someone says something is impossible, i conclude that it's indeed impossible for them.
02:50:05<copumpkin>boblo2: is it the same one as Arrow? I haven't used ParseLib
02:50:13<copumpkin>:t (+++)
02:50:14<lambdabot>forall (a :: * -> * -> *) b c b' c'. (ArrowChoice a) => a b c -> a b' c' -> a (Either b b') (Either c c')
02:50:14<p_l>Peaker: I wouldn't say impossible, but I'd classify some of it beyond scope of the program itself :)
02:50:15<conal>Peaker: in part because people like to be right.
02:51:25<Peaker>conal: I think many are also very unimaginative :(
02:51:54<boblo2>(+++) :: Parser a -> Parser a -> Parser a
02:52:09<boblo2>what does that mean
02:52:30<QtPlaty[HireMe]>boblo2: That means that the function is a parser combinator.
02:52:35<solidsnack>A statement about possibility is, unfortunately, no more trustworthy than one about impossibility.
02:52:38<copumpkin>boo, not (+++) :: Parser a -> Parser b -> Parser (Either a b)
02:52:55<conal>solidsnack: because it's a statement and not a proof.
02:52:59<solidsnack>I've had a lot more trouble with requirements dictated by "possible" people than by "impossible" people.
02:53:09<solidsnack>Indeed.
02:53:46<Berengal>solidsnack: Without the "possible" people you wouldn't have requirements at all
02:54:09<conal>solidsnack: proof of possibility/existence merely requires an example. proofs of impossibility/non-existence are deeper.
02:54:11<solidsnack>Probably shouldn't pay attention to either kind of person.
02:54:18<copumpkin>who's excited for GHC plugins?
02:54:20<copumpkin>ACTION raises hand
02:54:27<conal>ACTION too
02:54:45<copumpkin>there are so many things I want to fool around with in GHC's compilation pipeline
02:55:00<sclv_>ACTION wants units!
02:55:08<Peaker>conal: added a comment there
02:55:15<copumpkin>:t undefined :: 1
02:55:17<lambdabot>Unit
02:55:21<copumpkin>there, a unit!
02:56:01<solidsnack>I look forward to a system better than IO.
02:56:25<copumpkin>I want IO à la carte as described in that paper (with inferrable type)
02:56:43<solidsnack>That's not the same thing, though.
02:56:47<copumpkin>still
02:56:55<conal>Peaker: thx for the comment.
02:57:01<copumpkin>it's better than the current situtation :)
02:57:04<copumpkin>-t
02:57:14<boblo2>what do you call the | (so i can look it up without typing | )
02:57:27<copumpkin>boblo2: it does different things in different places
02:57:33<copumpkin>guard
02:57:39<Peaker>conal: have any idea if Lisp macros can define call-cc?
02:57:52<boblo2>| (length (check (x ++ "p")) == 49 = False = mzero
02:57:52<boblo2> | otherwise = result [papply code2 x]
02:57:55<conal>Peaker: sure they can.
02:57:57<p_l>Peaker: As for "impossibility", what about condition where you might arrive at bugfree and secure code, but can rest assured that universe will find a way to screw you over?
02:58:02<copumpkin>boblo2: that's a guard
02:58:07<conal>Peaker: i've messed *quite* a lot with lisp macros.
02:58:08<p_l>Peaker: Well, they are turing complete...
02:58:10<boblo2>guard thanks
02:58:28<conal>Peaker: you can write a whole syntactic CPS transformer as a lisp macro.
02:58:43<Peaker>conal, p_l: Assuming the call-cc itself is a macro, but it doesn't get to transform the code called by the call-cc?
02:59:00<conal>my first functional 3D & functional animation system was implemented as an optimizing compiler packaged as a lisp macro.
02:59:09<Peaker>I am no expert on the exact details of how Lisp macros typically work
02:59:28<p_l>Peaker: Why shouldn't it get possibility to transform that code?
02:59:37<conal>Peaker: lisp macros are functions from syntax to syntax.
02:59:39<phenrique>Algum brasileiro?
02:59:57<Peaker>conal, p_l: btw: Turing completeness of Lisp macros does not necessarily mean that they can perform all types of desirable transformations on code (Halting problem)
03:00:09<Peaker>conal: Yeah, but what subset of the program do they get to transform?
03:00:32<phenrique>Hi all, Any tutorial for GHC in Eclipse?
03:00:34<conal>Peaker: only the part they're explicitly wrapped around.
03:00:39<Peaker>conal: I guess if you define the functions call-cc calls with some defun-callable-by-call-cc instead of defun, then you get syntax transform of the called function as well?
03:01:01<conal>Peaker: right. you make your own defun replacement and use it.
03:01:04<p_l>Peaker: If you want, you can make macro that emits code that will transform code that you call
03:01:16<conal>that's what i did. i *loved* lisp macro hacking.
03:01:29<conal>it's compiler writing with no syntactic hassle at all.
03:01:36<Peaker>conal: ah - that's almost as good as ContT, but ContT allows keeping your existing code..
03:01:36<Berengal>macro hacking does have a certain allure to it...
03:01:53<p_l>I'm pretty sure that with cl-walker, one can modify whatever the hell one wants...
03:01:56<Peaker>conal: (no need to change all existing defuns or such)
03:02:02<phenrique>Hi all, Any tutorial for GHC in Eclipse?
03:02:06<conal>Peaker: yeah. macros allow for non-semantic transformation. haskell doesn't.
03:02:22<conal>that's the beauty of each.
03:02:46<p_l>Berengal: there are reasons, though, why CL community (outside of the cll trolls) has a certain dislike of macros...
03:02:52<conal>lisp is awesome for what it permits; haskell for what it forbids.
03:03:05<Peaker>conal: In a non-textual language, you might want to have ASG transformers, which are probably much easier to work with than textual AST transformers
03:03:41<p_l>Peaker: Well, Lisp is not textual (unless you count having identifiers in form of strings as textual...)
03:03:47<conal>Peaker: could be, though AST transformers are super easy in lisp
03:03:54<Berengal>To be fair, lisp doesn't have an AST
03:04:03<conal>yeah.
03:04:10<Peaker>p_l: it is limited to text, e.g: Cannot have references to other positions in the tree, so need namespaces and text atoms, instead
03:04:17<Berengal>There's syntax, and it forms a tree, but it's in no way abstract
03:04:29<conal>Berengal: agreed
03:04:41<solidsnack>conal: So perhaps I have misunderstood you all this time.
03:04:50<conal>ACTION is getting misty eyed about his old lisp days
03:04:50<Berengal>That's one part of what makes lisp so fun, and macros so easy
03:05:16<solidsnack>What you mean by all this is you think there might be something better than IO?
03:05:26<solidsnack>That you're not sure but you have a strong hunch?
03:05:27<Peaker>p_l: all code is truly a graph, not a tree.. Since encoding trees in text is easy, and encoding graphs is hard, most programming languages devise the concept of text namespaces and text names to form links in the tree, so the ASG (graph) is encoded in two steps, ASG+namespaces+names -> AST+syntax -> Text
03:05:37<p_l>Peaker: Well, you can have those references... let's say that what you write is "textual represantation that is somewhat limited compared to language"
03:05:41<solidsnack>In that case, it's much hard to take offense.
03:05:48<solidsnack>s/hard/harder/
03:06:26<p_l>Peaker: In fact, there were graph-based editors for Lisp, though I don't know how far did they went with the concept
03:07:06<Peaker>p_l: Are there dynamic Lisp namespaces, or are namespaces basically static like Haskell, except for allowing some late binding to allow redefinitions?
03:07:08<dibblego>what is the join . intersperse function?
03:07:12<conal>solidsnack: what part of my perceived message changes, and how it easier to hear without taking offense?
03:07:23<Peaker>@type intersperse
03:07:24<lambdabot>forall a. a -> [a] -> [a]
03:07:37<Peaker>dibblego: (join . intersperse) literally?
03:07:44<Peaker>@type (join . intersperse)
03:07:46<lambdabot> Couldn't match expected type `(->) [a]' against inferred type `[]'
03:07:46<lambdabot> Probable cause: `intersperse' is applied to too many arguments
03:07:46<lambdabot> In the second argument of `(.)', namely `intersperse'
03:07:50<solidsnack>Well, it's one thing to suggest there is definitely something better than IO and quite another to suggest that you're actively looking for it.
03:07:54<dibblego>(join .) . intersperse
03:07:58<aavogt>@type intercalate
03:08:00<lambdabot>forall a. [a] -> [[a]] -> [a]
03:08:01<p_l>Peaker: namespaces in CL are fully dynamic
03:08:09<conal>hurray for fmap.fmap
03:08:10<dibblego>ah cheers
03:08:13<Peaker>solidsnack: conal is probably at the forefront of researchers looking for that better IO alternative
03:08:23<conal>@type (fmap.fmap) join intersperse
03:08:24<lambdabot>forall a. [a] -> [[a]] -> [a]
03:08:31<conal>semantic editor combinators rule!
03:08:32<RyanT5000>is there an ubuntu repository that has GHC 6.10.3?
03:08:34<Peaker>p_l: so how can a static editor for a dynamic-namespace graph work?
03:08:40<Peaker>p_l: the graph links are only known at runtime?
03:08:42<solidsnack>Peaker: I think Lynch and Lamport are, as well.
03:08:50<solidsnack>You guys just don't know it, yet.
03:08:57<p_l>Peaker: Who said it was static? It ran *inside* a lisp system
03:09:03<copumpkin>RyanT5000: most linux distros have ghc packages made by people who don't use haskell enough to understand it right :P
03:09:45<p_l>and thus could edit data that made up a lisp program (which might be separated from the editor itself) directly, instead of feeding it a textual representation
03:09:49<RyanT5000>copumpkin: :(
03:10:00<solidsnack>(And neither do they, to be fair.)
03:10:08<Peaker>p_l: well, every time a function is invoked, only then the links are formed. In that case, how do you edit that function as a graph? Do you snapshot its last execution and assume the links will remain that way?
03:10:15<copumpkin>RyanT5000: download the binary distribution from the ghc site
03:10:34<RyanT5000>copumpkin: yeah, i was just hoping to "set it and forget it" :P
03:10:48<p_l>Peaker: Why links should be made only during execution? Shouldn't compiler find connections?
03:11:06<Peaker>Someone asked me to give a Haskell presentation in a local university. I've never lectured about Haskell before. Anyone have any ideas/slides/etc?
03:11:24<Berengal>Peaker: What kind of an audience are we talking?
03:11:25<conal>solidsnack: i ask because i'd love to learn to express my message in a way that captures it without people taking offense (getting defensive).
03:11:35<RyanT5000>Peaker: are you supposed to be teaching Haskell or talking about it?
03:11:35<Peaker>p_l: if the connections can be found at compile-time, it means the connections are static. But if all the names/namespaces are dynamic, then they are not known by the compiler
03:11:36<wli>Peaker: monad transformer stacks
03:11:36<roconnor>Peaker: I have
03:12:18<Peaker>Berengal, RyanT5000: Just talking about it, to a bunch of literate CS people who probably know SML, but not referential transparency, type-classes, etc
03:12:18<roconnor>Peaker: I was asked to give a one of the talks for the last class for a programming languages course.
03:12:23<p_l>Peaker: Have you ever worked with a modern Common Lisp system?
03:12:30<Peaker>p_l: nope
03:12:36<roconnor>Peaker: I have slides, but the are a little personal. You can have/look at them if you want.
03:12:38<Berengal>Peaker: Needs more fix, possibly even mfix :)
03:12:43<solidsnack>conal: Maybe describe everything that would lead one not to believe what you are saying.
03:12:51<Peaker>roconnor: sure, thanks
03:12:54<solidsnack>Instead of leaving it to the imagination.
03:13:14<RyanT5000>Peaker: well, you might want to mention Tim Sweeney's presentation on Haskell as a language for writing video games (Tim wrote Unreal)
03:13:40<Peaker>wli: is that an idea of something to talk about, to people who don't know laziness, type-classes, or how to combine side-effects with referential transparency? :)
03:13:46<RyanT5000>Peaker: that's if you have a "why haskell?" slide or something
03:13:55<roconnor>Peaker: http://r6.ca/Haskell/FPI.pdf and http://r6.ca/Haskell/FPI.odp -- Functional Programming Imperative
03:14:00<p_l>Peaker: I guessed so :D Basically imagine that introducing code into system in many of them includes compilation, and (compile a) requires that a is of apriopriate type...
03:14:14<Peaker>RyanT5000: thanks
03:14:31<conal>solidsnack: parsing trouble on my end. would you mind trying again.
03:14:38<RyanT5000>Peaker: www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/sweeny.pdf
03:14:51<RyanT5000>Peaker: summary here: beust.com/weblog/archives/000375.html
03:14:57<Peaker>p_l: well, if the dynamism you talked about is pre-compilation dynamism, then its quite different to what I meant :)
03:15:00<solidsnack>conal: Sure. There are sound reasons to reject the notion of something better than IO.
03:15:09<solidsnack>Network communication is IO.
03:15:18<solidsnack>There's one.
03:15:23<wli>Peaker: More of an overarching direction. Since monad transformer stacks are what you ultimately do then the idea is to lead them toward that.
03:15:27<p_l>Peaker: In Lisp there's no write-compile-run cycle, so it's a little weird :P
03:15:28<conal>solidsnack: so are register and stack frame munging.
03:15:35<solidsnack>conal: Right.
03:15:48<solidsnack>With memory protection you have something, though.
03:15:48<conal>solidsnack: that's why i distinguish between a language's implementation and it's semantic model.
03:16:04<solidsnack>There's no such thing as network memory protection, though.
03:16:07<Peaker>wli: It would probably take more than a 2 hour talk or so to get so far
03:16:16<conal>solidsnack: no such thing ever? or just not yet?
03:16:18<solidsnack>At least, not unless you introduce it as an assumption.
03:16:26<solidsnack>conal: Must at least be mentioned.
03:16:30<Peaker>p_l: by the time a function exists, all of the links from that function are static, right?
03:16:55<Berengal>Peaker: The type system and how it enforces discipline without the usual S&M
03:17:07<Peaker>Berengal: any good examples of such discipline?
03:17:26<Berengal>Peaker: No casts
03:17:33<conal>solidsnack: sigh. i figure if people want to open their minds they will, and if not, then no amount of spoon-feeding will get them past their attachment to impossibility.
03:17:51<solidsnack>conal: Well, you don't understand teaching, then.
03:17:52<p_l>Peaker: You could say that link goes through resolver, and said resolver maps Keyword -> Location
03:17:59<wli>Peaker: Well, one may have to stop short.
03:18:11<solidsnack>conal: If you have a message, you have to deliver it; it's not something you can do at your liesure.
03:18:11<conal>solidsnack: sure i do. differently from you, though, it seems. :)
03:18:21<solidsnack>No one's going to crawl to you.
03:18:30<conal>solidsnack: those who have ears, let them hear.
03:18:40<conal>that's why i don't push.
03:18:52<conal>it's not worth the effort. others hear easily.
03:18:55<conal>that's enough for me.
03:19:01<p_l>Peaker: Believe me, incremental programming is probably the single weirdest thing for many newbies to Lisp
03:19:12<solidsnack>There's a difference between not pushing and not addressing reasonable concerns.
03:19:28<conal>solidsnack: when people ask me i tell them.
03:19:42<Berengal>p_l: I found it to be perhaps the most sexy thing about it
03:19:52<Berengal>Macros came close
03:19:55<solidsnack>You also tell them when they don't ask you.
03:20:34<conal>solidsnack: sure i can. i prefer letting people have their own curiosity or lack of it. not everyone is interested in everything.
03:20:35<p_l>And I won't claim that I've mastered macros, which requires understanding of all stages code goes through, so that you know how to properly call (eval-when)
03:20:49<Peaker>solidsnack: when you say "<solidsnack> Network communication is IO. There's one" -- you're basically saying: "I know you're saying there might be an abstraction more fitting than IO, but you are wrong, and I am right, as this *must* be IO. I won't consider any alternative." -- That's closed-minded
03:21:08<solidsnack>Peaker: No, I am not saying that.
03:21:11<Peaker>p_l: Well, you could say Python is pretty similar to CL? I've got extensive Python experience
03:21:21<solidsnack>Peaker: I am saying, that's something about which I have real misgivings.
03:21:31<solidsnack>Peaker: What you said is, basically, I don't have them.
03:21:41<conal>solidsnack: it's my approach. i get it that it's not yours, and it doesn't appeal to. so i wouldn't try to persuade you.
03:21:43<solidsnack>In other words, you have decided to blow me off.
03:22:06<Peaker>solidsnack: if you have doubts about *how* it can be abstracted in different ways than IO, then say those. What you said is not that you have doubts, but that it couldn't be done, it must be IO
03:22:24<conal>solidsnack: that's a rather loaded way to put it. you don't have to take it personally.
03:22:24<p_l>Peaker: Not really, though it helps that it's interactive interpreter is nearly fully capable... but it doesn't have the same "image" model, I guess
03:22:32<p_l>Peaker: And well, it uses duck-typing :P
03:22:54<Peaker>p_l: Doesn't Lisp also use duck-typing? At least with CLOS?
03:23:05<conal>Peaker: yeah. that's my take also.
03:23:09<p_l>Peaker: No. And double NO for CLOS
03:23:40<solidsnack>conal: Thank you for your advice.
03:23:52<solidsnack>conal: Would you care to say, what made you think I took it personally.
03:23:53<p_l>If what CLOS does was duck typing, then Haskell would be duck-typed too
03:23:53<solidsnack>?
03:23:57<Peaker>p_l: well, I see untyped+duck-typing as nicer than untyped without duck typing, as at least you can get something like type-classes that way..
03:23:58<conal>solidsnack: because i interpret you as certain (non-curious), i don't invest much time in trying to convey my ideas to you. you could call that "blowing you off". i call it investing wisely.
03:24:14<solidsnack>conal: Oh, I was responding to Peaker.
03:24:26<conal>solidsnack: sure. using the loaded phrase "blow me off".
03:24:39<conal>solidsnack: instead of a neutral/objective phrase.
03:24:58<p_l>Peaker: CL is implicitly typed, Scheme is less strict
03:25:11<solidsnack>conal: Well, you might have criticized my language instead of my state of mind.
03:25:22<Peaker>p_l: CL is typed at all? Do expressions/terms/variables have types?
03:25:38<dons>heya conal
03:25:44<p_l>Peaker: yes, they have. It's just that by default it will try inferring types, but you can define them
03:25:51<conal>dons: hi there.
03:26:00<Peaker>dons: hey -- we were having trouble figuring out where the quickcheck Utils module stuff disappeared to in Quickcheck 2, do you have any idea?
03:26:06<dons>Utils?
03:26:07<p_l>Peaker: That's how CLOs does its method matching, after all
03:26:09<dons>never used it.
03:26:18<solidsnack>conal: Should you be inclined to present a model of something, which I could consider in light of my interest in networked systems, I would of course be very interested.
03:26:19<dons>probably it got merged, or ditched
03:26:31<Peaker>dons: Test.QuickCheck.Utils existed in qc<2 and had some interesting functions (iirc e.g testAssocativeBy)
03:26:40<lolo>can someone tell me why the line: code2 :: Parser gives me "Illegal type in type expression"
03:26:42<solidsnack>conal: I fear that things are not that definite in your work, at present.
03:27:08<dons>solidsnack: (reading the scrollback) this might be a good time to let it go?
03:27:09<mauke>lolo: what is Parser?
03:27:10<solidsnack>conal: If you are measure interest by investment, however, then I have expressed interest.
03:27:25<solidsnack>dons: Sure, I will set the matter aside.
03:27:26<lolo>ParseLib i belive
03:27:29<dons>thanks.
03:27:44<Peaker>dons: who maintains quickcheck on hackage?
03:27:52<dons>btw, in case people didn't see it: US-based hackathon coming up: http://www.haskell.org/haskellwiki/Hac_φ
03:27:57<p_l>Peaker: (type-of "test") => (SIMPLE-ARRAY CHARACTER (4)) (car (type-of "test"))=>SIMPLE-ARRAY
03:27:57<Peaker>(#haskell persona, that is)
03:27:58<dons>i'm kinda excited to have a 'local' hackathon!
03:28:11<dons>Peaker: koen claessen
03:28:17<Peaker>p_l: that's as much typed as Python is?
03:28:52<p_l>Peaker: More - Python doesn't check types, it checks if there's an entry in objects dictionary with apriopriate name and calls it
03:29:14<p_l>Peaker: typing in Python afaik doesn't get outside primitive types
03:29:32<lolo>newtype Parser a = P (String -> [(a,String)])
03:29:50<mauke>lolo: yeah, then Parser is not a type
03:29:53<p_l>if an object has, I think it was "__call__" entry, you can do obj() and it will call method defined as obj.__call__()
03:30:17<Peaker>p_l: can you come to #haskell-blah ?
03:30:24<p_l>sure
03:30:26<Peaker>dons: not in #haskell ?
03:30:31<lolo>how would i go about fixing this?
03:30:35<lolo>im very new
03:30:54<dons>Peaker: nope. sadly.
03:31:04<mauke>lolo: supply the missing type argument
03:31:14<dons>lolo: i think we'll need to see a paste (e.g. hpaste.org)
03:31:38<SamB_XP>Paste: http://moonpatio.com ?
03:31:55<lolo>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5111#a5111
03:32:40<mauke>lolo: Parser String
03:33:04<mauke>what's with the nested 'do's?
03:33:09<lolo>idk
03:33:27<lolo>its a game im trying to solve
03:33:32<lolo>you see any more mistakes?
03:34:39<mauke>not mistakes per se, but there are a few unused variables
03:35:27<lolo>so were it says codex :: parser it needs to be codex :: Parser String?
03:36:53<mauke>yes
03:38:18<lolo>how does line 58 look?
03:38:38<lolo>opps i mean 111
03:39:09<mauke>hmm... wrong :-)
03:39:19<mauke>what is it supposed to do?
03:39:29<lolo>what needs to be done there
03:39:46<mauke>what is it supposed to do?
03:39:50<lolo>it takes in a huge list of strings and finds one that matches the critera in the code
03:40:22<mauke>...
03:41:24<jimmyjazz14>lambdabot: help
03:43:07<roconnor>@help
03:43:08<lambdabot>help <command>. Ask for help for <command>. Try 'list' for all commands
03:44:49<jimmyjazz14>how does one convert a Int type to a Integer type?
03:45:07<copumpkin>fromIntegral
03:45:09<Peaker>@hoogle Int -> Integer
03:45:09<lambdabot>Prelude toEnum :: Enum a => Int -> a
03:45:09<lambdabot>Data.Bits bit :: Bits a => Int -> a
03:45:09<lambdabot>Prelude toInteger :: Integral a => a -> Integer
03:45:37<jimmyjazz14>cool!
03:45:39<lolo>mauke: still looking at it?
03:45:51<mauke>no, why?
03:46:13<lolo>just wondering thanks for the help. really want to get this lol
03:46:16<copumpkin>lolo: you basically told him "here's my input and it does what the code says it does"
03:48:21<lolo>It does not do what the code says it does (right now) becouse it wont run :( it is supposed to take in a list of strings and print success along with the correct string when it is done (i think)
04:01:18<RyanT5000>has anyone here thought about simulation datastructures in Haskell?
04:01:33<RyanT5000>i'm writing a video game, and i'm trying to figure out how to model the simulation state
04:01:48<wli>Priority queue?
04:02:00<RyanT5000>i don't quite follow
04:02:05<roconnor>State ?
04:02:12<RyanT5000>roconnor: the state of the world
04:02:19<roconnor>@hoogle State
04:02:20<lambdabot>module Control.Monad.State
04:02:20<lambdabot>Test.HUnit.Base data State
04:02:20<lambdabot>Test.HUnit.Base State :: Path -> Counts -> State
04:02:28<RyanT5000>i.e.: "the hero's over here, there's some stuff over there"
04:02:35<roconnor>Control.Monad.State
04:02:43<roconnor>oh
04:02:51<roconnor>you mean the state structure itself?
04:02:55<RyanT5000>roconnor: i understand the State monad, but i'm referring to the states it represents
04:02:56<RyanT5000>yeah
04:03:02<roconnor>ah
04:03:10<roconnor>I was thinking about it.
04:03:11<hatds>mutable references in IO or ST ;-)
04:03:20<RyanT5000>hatds: haha good joke
04:03:23<RyanT5000>:P
04:03:32<roconnor>the issues of identity were difficult.
04:03:42<RyanT5000>roconnor: yeah, that's what i'm thinking about right now
04:04:01<RyanT5000>right now i'm thinking that the general principle will be something like
04:04:15<RyanT5000>getObjectState :: ID a -> StateDomain -> Maybe a
04:04:18<RyanT5000>kinda like a Map
04:04:20<roconnor>I was trying to think if two ships in identical conditions at the same place were interchangable.
04:04:33<roconnor>and if so, how would I target one of them but not the other.
04:04:52<hatds>I'm suspect of any Id type thing
04:04:54<RyanT5000>roconnor: well, i think some explicit concept of identity is necessary
04:05:03<RyanT5000>hatds: me too :-/
04:05:15<roconnor>me too
04:05:15<RyanT5000>but i can't figure out a different way to do it
04:05:33<hatds>Once I was about to write a function GenEq :: a -> b -> Bool (i.e. false if they have different types, otherwise true) before I learned the error of my ways
04:05:42<hatds>*er otherwise using (==)
04:05:52<RyanT5000>yeah
04:06:26<hatds>what do you mean by 'simulation state'? Is it the state of the game world or is this a meta simulation an AI is running or something?
04:06:29<RyanT5000>but here we're talking about an explicit identity system, which is not really any different from a Map whose RHS types are not all the same
04:06:39<RyanT5000>it's the state of the game simulation at a particular point in time
04:06:49<RyanT5000>the simulation being the logical world
04:06:56<RyanT5000>(as opposed to the rendering engine, or whatever)
04:06:59<hatds>I think mutable references are a proper solution
04:07:06<hatds>but you could use the State Monad
04:07:10<mauke>hatds: I've written and actually used that
04:07:38<RyanT5000>hatds: mutable references tie me to a mutable paradigm; it would probably be easier to write in C# if i were going to do that
04:07:45<hatds>mauke: did it work well? in my situation I realized it was suboptimal but I didn't discount it completely
04:08:02<mauke>yes, it worked fine
04:08:10<mauke>@let a === b = cast a == Just b
04:08:11<lambdabot> Defined.
04:08:15<mauke>:t (===)
04:08:15<lambdabot>forall a b. (Typeable a, Typeable b, Eq b) => a -> b -> Bool
04:08:34<RyanT5000>ah, Typeable :)
04:08:44<copumpkin>eww
04:08:51<copumpkin>Eq on b?
04:08:59<mauke>> "yes" == "yes"
04:09:00<lambdabot> True
04:09:02<mauke>> "yes" === "yes"
04:09:03<lambdabot> True
04:09:09<mauke>> "yes" === 'n'
04:09:10<lambdabot> False
04:09:17<hatds>RyanT5000: mutable references don't preclude pure code from doing the heavy lifting
04:09:24<copumpkin>> "yes" === id
04:09:25<lambdabot> No instance for (Eq (a -> a))
04:09:25<lambdabot> arising from a use of `===' at <in...
04:09:34<RyanT5000>hatds: that's true, but they do preclude forking your simulation
04:09:47<RyanT5000>hatds: or saving its state to disk in any reasonable way
04:09:55<Peaker>> id === "yes"
04:09:56<lambdabot> Add a type signature
04:10:02<Peaker>> (id::a->a) === "yes"
04:10:03<lambdabot> Add a type signature
04:10:07<hatds>forking the simulation for what end?
04:10:13<RyanT5000>hatds: who knows
04:10:16<roconnor>RyanT5000: I was thinking the "identity" of something being a big list of states that the object goes through.
04:10:24<roconnor>RyanT5000: and tying one big knot
04:10:29<roconnor>for the game
04:10:36<roconnor>But I never got far enough to actually try it.
04:10:46<RyanT5000>roconnor: how do you mean? the identity would be the history of the object?
04:11:02<erikc>whats the topic, it sounds like i have an opinion on this!!
04:11:10<hatds>handling the state of a game
04:11:21<erikc>o i sure do
04:11:22<roconnor>RyanT5000: well, you want to disgrard the notion of past and present a funture
04:11:30<roconnor>RyanT5000: think space-time :)
04:11:40<RyanT5000>roconnor: hmmm
04:11:48<roconnor>the whole game is laid out at once, just existing
04:12:18<RyanT5000>roconnor: what about player input?
04:12:32<RyanT5000>suppose it's a real-time game
04:12:37<roconnor>RyanT5000: it is represented by a oracle
04:12:39<roconnor>oh
04:12:41<roconnor>real time
04:12:42<roconnor>sorry
04:12:46<RyanT5000>hm
04:12:50<roconnor>my game was turn based.
04:13:03<RyanT5000>well, you can treat any game as turn-based internally
04:13:05<RyanT5000>just with lots of turns
04:13:06<RyanT5000>so that's fine
04:13:07<roconnor>the same ideas might work but it would be harder.
04:13:17<roconnor>again, just ideas of mine
04:13:53<RyanT5000>it sounds interesting
04:13:54<roconnor>each "object" is represented by a list of states it is in (or maybe state, time pairs in your case)
04:14:09<roconnor>and the entire "game" is a set of these "objects"
04:14:11<RyanT5000>well, i was thinking that an object could be approximately a function from time to state
04:14:17<roconnor>and the game is parameterized by the input.
04:14:34<RyanT5000>(i guess that's more or less equivalent to a list of pairs)
04:14:45<roconnor>the value of various elements of the "object" depends the value of other "objects"
04:14:58<RyanT5000>right
04:15:09<RyanT5000>that sounds hard to debug, though
04:15:10<roconnor>so you just write this down
04:15:25<hatds>RyanT5000: I think the best solution is more imperative than what you are thinking
04:15:47<RyanT5000>very easy to write noncausal code or code with circular dependencies
04:16:10<roconnor>object1 = initalstate:(some_interaction allObject)
04:16:16<roconnor>er
04:16:18<roconnor>not quite that
04:16:19<roconnor>anyhow
04:16:23<roconnor>I haven't really tried it.
04:16:36<roconnor>RyanT5000: true what you say about circular dependencies
04:16:40<RyanT5000>yeah
04:16:51<roconnor>like I said, I never tried it. Just an idea.
04:16:54<roconnor>could be crap
04:17:08<RyanT5000>well, it sounds reasonable to me
04:17:11<roconnor>and probably would be easier for a turn based game.
04:17:39<RyanT5000>hatds: well, one way to make it more imperative might be to write a custom monad
04:17:46<halberd>in programming we can't symbolically differentiate a function--what we symbolically differentiate is a data structure which represents a function but is not one
04:17:47<RyanT5000>hatds: that's basically the other solution i've been thinking about
04:18:09<hatds>RyanT5000: ultimately I think any game idea is most easily expressed as State -> State
04:18:22<RyanT5000>hatds: that's true
04:18:32<RyanT5000>hatds: but i need to impose a little more structure than that
04:18:32<halberd>you can't write a higher order function that will exactly differentiate an expression like \x -> x*x + 2*x
04:18:46<hatds>RyanT5000: sure
04:19:11<copumpkin>:t deriv
04:19:12<lambdabot>forall a b. (Num b, Num a) => (Dif a -> Dif b) -> a -> b
04:19:14<mmorrow_>halberd: differentiation is a map of functions though
04:19:21<RyanT5000>hatds: in particular, the structure needs to allow independent object to be written and debugged relatively independently
04:19:24<halberd>because you don't have access to the syntax tree of that function, you can only evaluate it at a value
04:19:25<copumpkin>> deriv (\x -> x*x + 2*x) x
04:19:26<lambdabot> 1 * x + x * 1 + 2 * 1
04:19:38<RyanT5000>because i need to hire people and let them work independently
04:19:48<mmorrow_>halberd: separate of whether you want to evaluate the resulting function on any vals
04:20:21<copumpkin>you can cheat
04:20:26<mauke>> deriv sin x
04:20:27<lambdabot> 1 * cos x
04:20:41<copumpkin>halberd: it ain't pretty, but it's symbolic ;)
04:20:53<mmorrow_>(differentiation being a linear map of vector spaces (where the "vectors" are functions))
04:21:39<halberd>copumpkin: I'm unfamiliar with how deriv works, what's the hook? could you write the function deriv in haskell?
04:21:46<copumpkin>that is written in haskell :)
04:21:53<copumpkin>without even looking at the AST
04:22:02<hatds>RyanT5000: disconnected myself for a sec there :)
04:22:08<RyanT5000>hatds: np
04:22:13<halberd>could I see the source for deriv then?
04:22:15<roconnor>> reduce $ deriv sin x
04:22:16<lambdabot> 1 * cos x
04:22:17<copumpkin>> scanl1 (+) [1..5] :: [Expr]
04:22:18<lambdabot> [1,1 + 2,1 + 2 + 3,1 + 2 + 3 + 4,1 + 2 + 3 + 4 + 5]
04:22:26<copumpkin>@hackage numbers
04:22:27<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/numbers
04:22:32<RyanT5000>all i said was that i need to ensure that several people on a team can work within this object system without getting in each others' ways
04:22:52<copumpkin>http://hackage.haskell.org/packages/archive/numbers/2009.5.20.1/doc/html/src/Data-Number-Dif.html#deriv
04:23:02<mmorrow>halberd: it uses typeclass trickery, but the basic concept could be implemented separately (w/ a parser for function reps given as String)
04:23:06<erikc>is it singlethreaded?
04:23:22<mauke>http://okmij.org/ftp/Computation/Generative.html#diff-typeclass
04:24:13<halberd>but that's my point mmorrow that you have to access the representation, which is usualy not available... unles you use typeclass trickery
04:24:19<hatds>RyanT5000: I think all that is needed is an abstraction type
04:24:25<halberd>I'm reading how that works
04:24:32<RyanT5000>hatds: what do you mean by that?
04:24:43<copumpkin>halberd: it's not using anything untypical though :)
04:24:54<halberd>differentiating the _function_ \x -> x*x + 2*x is not the same as differentiating the _string_ "\x -> x*x + 2*x"
04:25:04<halberd>someone differentiating the string has an easier time
04:25:19<hatds>RyanT5000: each disparate object of type a has to provide a function a -> B. Where B is a type representing abstract game objects
04:25:19<copumpkin>yeah, and that package isn't touching the string
04:25:27<halberd>yes I know, it's doing something funny
04:25:29<mmorrow>halberd: well without being able to view what you're working with, it would have to be magic?
04:25:46<mmorrow>oh, i see how you mean
04:25:50<hatds>RyanT5000: the abstractions could be hierarchical as well
04:26:20<mmorrow>halberd: sure, given the haskell lang (as implem by ghc) you need typeclass hackery or a QuasiQuoter
04:26:23<RyanT5000>hatds: yeah, that's true
04:26:35<RyanT5000>hatds: but i think we need some way of figuring out how objects will interact
04:26:37<mmorrow>(if you don't want to just give the rep a a String that is)
04:26:43<mmorrow>*..as a ..
04:26:51<roconnor>RyanT5000: be sure to check out data.accessor
04:27:01<hatds>RyanT5000: that is specified by the type B
04:27:33<erikc>RyanT5000: the approach i've taken (in C and Lua) is single-threaded message passing concurrency between actors (win32-style), the game state is stored relationally, separately from the actor code
04:27:59<RyanT5000>erikc: what sorts of things were actors?
04:28:08<RyanT5000>roconnor: that looks really useful
04:28:12<erikc>after the messages for a frame have been dispatched, bulk updating (physics, collisions, etc) and rendering runs in parallel using the frozen data
04:28:26<erikc>those systems generate messages on lockless queues that feed back to the actors
04:28:31<roconnor>RyanT5000: it is so useful, it should be part of the Haskell Platform! :)
04:28:40<RyanT5000>roconnor: perhaps :)
04:28:47<hatds>I think the interaction between actors will be dependent on what game it is
04:28:48<mmorrow>but i think the particulars (wrt how it's accomplished in whatever language) of any given implem of symbolic differentiation is a separate topic than what you're really doing
04:29:03<roconnor>RyanT5000: the State Monad stuff is exactly what you want.
04:29:05<hatds>interaction in an RTS would be much different than a 2D sidescroller
04:29:13<copumpkin>@let loeb x = fmap ($ loeb x) x
04:29:15<lambdabot> Defined.
04:29:17<copumpkin>:t loeb
04:29:19<lambdabot>forall (f :: * -> *) b. (Functor f) => f (f b -> b) -> f b
04:29:49<copumpkin>> loeb [ (!!5), const 3, liftM2 (+) (!!0) (!!1), (*2) . (!!2), length, const 17]
04:29:51<lambdabot> [17,3,20,40,6,17]
04:30:03<erikc>RyanT5000: characters, enemies, props, cameras, grenades, rockets, dropped weapons
04:30:12<RyanT5000>erikc: ah, i see
04:30:20<RyanT5000>erikc: and what sorts of things were considered "state"?
04:30:41<roconnor>copumpkin: who was that comment for?
04:30:45<erikc>the rule of thumb is anything that we want scripters/designers to be able to create/manipulate is done in actor land
04:30:48<copumpkin>no one
04:30:58<copumpkin>myself/anyone?
04:30:59<erikc>once we have a feature figured out, we can always move it to the backend for perf
04:31:03<RyanT5000>erikc: ah, makes sense
04:31:13<erikc>the tough part is you want it dynamic early on to experiment with the gameplay
04:31:15<RyanT5000>erikc: did you do this in Haskell?
04:31:18<mmorrow>@pl fix (\k a -> fmap ($ k a) a)
04:31:19<lambdabot>fix (fmap . flip id =<<)
04:31:27<mmorrow>@type fix (fmap . flip id =<<)
04:31:29<lambdabot>forall (f :: * -> *) c. (Functor f) => f (f c -> c) -> f c
04:31:35<copumpkin>lol
04:31:42<mmorrow>weee
04:31:45<copumpkin>it definitely fels like a fixworthy function
04:31:52<erikc>implemented a poor man's erlang in C++ and then message pumps run in either C++ or Lua
04:32:27<RyanT5000>erikc: ah, right, i remember you telling me about that the other day
04:33:07<RyanT5000>erikc: so the way you prevented cyclic references was by means of a delay in message passing?
04:33:22<erikc>the actors are stateless, all the data is stored separately so it can be serialized/snapshotted
04:33:39<erikc>data hiding is a headache in games cause there's a tendency to come up with game rules that throw the data hiding out the window anyway
04:33:54<erikc>you want to be able to crawl all over the data
04:33:59<RyanT5000>erikc: hm, yeah
04:34:08<erikc>yea, frame delay for cyclic dependencies
04:35:18<RyanT5000>erikc: the data hiding thing is an interesting problem
04:35:30<roconnor>ACTION not sure I understand what erikc is describing, but it sounds cool.
04:35:46<wy>aloha
04:35:51<erikc>im also storing the data relationally so that data that is operated on together is packed together in memory
04:36:04<erikc>so i can dma it to the spus/gpu
04:36:05<RyanT5000>erikc: right, that seems good for performance
04:36:36<wy>Is there a reason the patterns in function definitions are not lazy?
04:37:09<hatds>essentially, the haskell core has two constructions: let (lazy) and case (strict)
04:37:29<erikc>game logic shouldnt affect performance much and is hopelessly intractable to parallelize (short of STM, but then you lose deterniminism)
04:37:59<RyanT5000>erikc: what about parallel Haskell?
04:38:14<wy>@users
04:38:15<lambdabot>Maximum users seen in #haskell: 658, currently: 581 (88.3%), active: 14 (2.4%)
04:38:18<RyanT5000>erikc: i guess spark creation costs could outstrip their value
04:38:21<erikc>you mean software transactional memory?
04:38:30<hatds>wy: function definitions are considered part of case expressions, you can use "~" to make a pattern lazy and irrefutable
04:38:32<copumpkin>or DPH?
04:38:32<erikc>or data parallelism?
04:38:44<RyanT5000>erikc: data parallelism
04:39:00<erikc>you definitely want data parallelism on the engine backend for the number crunching
04:39:23<wy>hatds: but why haven't them an implicit "~" prepended?
04:39:25<RyanT5000>http://www.macs.hw.ac.uk/~dsg/gph/
04:39:34<RyanT5000>erikc: i'm talking about that; par and seq
04:39:40<hatds>are game algorithms outside of GPU stuff really suitable for data parallelism?
04:39:53<RyanT5000>i'm not sure; i haven't really looked into it
04:40:13<erikc>hatds: yup, physics, fluid simulation ai pathfinding
04:40:29<copumpkin>RyanT5000: that's all built into GHC now
04:40:38<xmonader>I'm facing this http://pastebin.com/d64840d0a while installing hs-twitter any help ?
04:40:44<erikc>generating potential fields for crowd pathfinding (though thats more wavefront parallelism)
04:40:45<RyanT5000>copumpkin: that's cool
04:40:57<copumpkin>RyanT5000: Control.Parallel(.Strategies)
04:41:03<hatds>wy: ~ also makes the pattern irrefutable, so f ~[x] = ... will result in a error if the input was actually [] *and* f tries to use the value x
04:41:50<copumpkin>just need to compile with the threaded RTS and run your program with +RTS -N x where x is the number of native threads you want to run (assuming you aren't running the latest development GHC, which can detect automatically)
04:41:55<hatds>wy: there was discussion in the creation of haskell whether to make patterns like tuples strict or lazy, since pattern matching on a tuple type cannot every fail in a well typed program (it can only succeed or diverge)
04:42:04<RyanT5000>erikc: so, if we're only concerned with usability and maintainability, how would it be to have public and private state for objects?
04:42:51<RyanT5000>erikc: if data needed to be looked through, it would need to be explicitly publicized
04:42:55<erikc>right
04:43:23<erikc>that works, you'll need a way to get at all the objects of particular classes
04:43:42<RyanT5000>erikc: we could potentially have index actors, which are basically actors who can access other actors' state
04:43:55<RyanT5000>erikc: the index dependency graph would have to be acyclic
04:44:09<RyanT5000>erikc: which would allow indices to be updated in the same frame as their constituents are changed
04:44:28<halberd>okay
04:44:44<wy>> let [x] = [] in x
04:44:46<lambdabot> * Exception: /tmp/8222069046277313235:71:36-43: Irrefutable pattern failed ...
04:44:48<RyanT5000>erikc: and, of course, actors would have access to *all* actors' states from the previous frame
04:44:56<halberd>so the deriv implementation is amazing, but it still doesn't exactly take the derivative of a function
04:44:57<erikc>right
04:45:05<RyanT5000>public state, that is
04:45:10<halberd>well, not of a function from real numbers to real numbers
04:45:14<RyanT5000>is a messaging system still needed?
04:45:20<copumpkin>halberd: why not?
04:45:26<RyanT5000>might be convenient, i suppose
04:45:44<copumpkin>halberd: http://conal.net/blog/posts/what-is-automatic-differentiation-and-why-does-it-work/
04:45:46<Ycros>RyanT5000: I'm interested in what you come up with
04:45:51<copumpkin>http://en.wikipedia.org/wiki/Automatic_differentiation
04:45:58<erikc>i went with messaging cause a major goal is to add gameplay behaviors/entities at runtime
04:46:02<halberd>it takes the derivative of a function (Num a, Num b) => Dif a -> Dif b, not of a function (Num a, Num b) => a -> b
04:46:10<RyanT5000>Ycros: cool; i'm sure i'll be in this chatroom asking questions frequently
04:46:26<halberd>it only appears to do the latter, because of the operator overloading
04:46:40<RyanT5000>erikc: ah, that makes sense
04:46:49<halberd>so you get fooled into thinking the function is a -> b, when it's really Dif a -> Dif b
04:46:54<copumpkin>halberd: sure, but you can lift a function into Dif easily
04:46:55<RyanT5000>erikc: erlang is on the very-short-list of languages i need to learn
04:47:13<mauke>halberd: Dif a is a number
04:47:19<copumpkin>any function
04:47:22<wy>have you heard of a lecture topic "Lambda the Ultimate Calculus"?
04:47:23<copumpkin>involving nubmers :)
04:47:35<copumpkin>halberd: check out conal's blog post I linked to
04:47:55<gwern>> 1130 - 434
04:47:56<lambdabot> 696
04:48:06<roconnor>copumpkin: you can't lift any function in any meaningful way
04:48:13<erikc>RyanT5000: i view a game engine as the operating system and actors as the processes
04:48:28<halberd>copumpkin you could write a function converttoDif (Num a, Num b) => (a -> b) -> Dif a -> Dif b?
04:48:38<RyanT5000>erikc: yeah, that sounds about right
04:48:40<copumpkin>roconnor: well, any function of one numerical parameter to the same numerical type, I guess
04:48:45<copumpkin>or is that not true either?
04:48:48<roconnor>no
04:49:02<roconnor>you can only properly lift it by providing the derivative as well
04:49:17<mauke>halberd: that looks like id
04:49:18<roconnor>you can improperly lift it, and get a function with a meaningless deriviatve
04:49:36<erikc>if i had the freedom to use any language, i'd likely combine C for numerical kernels, Haskell for the engine and Factor for the gameplay level code
04:49:50<roconnor>halberd: no such function exists that does what you would want it to do.
04:50:00<roconnor>for converttoDif
04:50:17<mauke>oh yeah, wrong rank
04:50:23<wy>hatds: got it. So case is the place we do branching, so we actually need the values there
04:50:26<copumpkin>what kind of meaninglessness would the derivative be?
04:50:34<RyanT5000>erikc: how do you deal with things like collision detection, which create mutual restrictions on actors' behavior?
04:50:37<hatds>wy: yea
04:50:40<roconnor>copumpkin: always 0 or always 1, or really anything you want.
04:50:48<copumpkin>ah
04:51:16<hatds>collision detection has well studied algorithms
04:51:16<copumpkin>I guess I can definitely think of functions that wouldn't work
04:51:19<halberd>so even though converttoDif is a function that doesn't do anything clearly uncomputable, it can't be written in Haskell
04:51:27<wy>hatds: What's the other places where we need to force the values?
04:51:43<hatds>you just need to specify what you want to do when certain collisions are found
04:51:45<copumpkin>halberd: well, a -> b might not be continuous, for example
04:51:52<roconnor>halberd: um, what would you expect if you give it a function that is differentiable nowhere?
04:52:05<roconnor>halberd: does that count as uncomputable?
04:52:34<halberd>well you could probably extend Dif to deal with that case with Nan
04:52:40<copumpkin>it's not just NaN
04:53:03<copumpkin>just a curve with a kink in it, for example
04:53:12<hatds>wy: I'm not familiar with the fine differences between haskell core and regular haskell, but I think case expressions are where either all or most evaluation happens
04:53:24<hatds>maybe someone else knows for sure?
04:53:30<mauke>> deriv tan x
04:53:32<lambdabot> 1 * cos x * recip (cos x) + sin x * negate (1 * negate (sin x) * recip (cos...
04:53:34<halberd>the derivative could still be reported as NaN in that case, or Undefined if you prefer
04:54:02<halberd>that would be acceptable... but even with that you still couldn't write converttoDif
04:54:04<roconnor>ACTION tries to think of a case where the derivative is uncomputable.
04:54:08<wy>halberd: So I guess lazy patterns can be only used in definitions with only one pattern?
04:54:09<roconnor>I can probably make one up
04:54:29<hatds>not necessarily
04:54:34<erikc>RyanT5000: we use the rigid body step in the backend (we use havok) to solve collisions
04:54:41<hatds>the first pattern could be non-lazy
04:54:56<hatds>and to make things more complicated you can have a lazy pattern inside a non-lazy one
04:55:13<Saizan>but then the costructor will be forced (assuming we're not talking about nested patterns)
04:55:22<halberd>that's a point roconnor
04:55:50<erikc>RyanT5000: for things like actors making choices based on nearby items, (or say, oncoming objects), we have a hidden physics volume that detects intersections on the physics step and pipes messages back to the actors
04:56:06<copumpkin>http://pirate.shu.edu/projects/reals/cont/fp_weier.html
04:56:10<RyanT5000>erikc: ah, interesting
04:56:25<RyanT5000>erikc: so, i take it the physics system is more or less independent of the actors
04:56:40<halberd>nowhere differentiable != derivative is uncomputable... there are functions whose derivative is uncomputable though
04:56:41<RyanT5000>erikc: "of the actor system", i should say
04:56:53<erikc>yep, totally separate
04:57:29<copumpkin>halberd: well, functions that are computable but their derivatives aren't?
04:58:04<halberd>I don't know about that copumpkin but if a function is uncomputable yet differentiable, its derivative is uncomputable
04:58:08<mgsloan>the derivative of id is 1!
04:58:18<RyanT5000>erikc: that's good; have you ever worked with Unity? it's the only engine i've ever had the 'pleasure' of dealing with
04:58:42<sjanssen>hmm, hackathon in Philadelphia, eh?
04:58:45<sjanssen>ACTION google maps it
04:59:08<erikc>i've played with it, but not enough to comment, i bet it demos well to C-level executives though with the lovely gui :)
04:59:24<erikc>their use of Mono is smart
04:59:34<hatds>I'll be there, anyone else going?
04:59:38<copumpkin>I'd stay away, don't wanna catch that shit
04:59:46<wy>got it
04:59:48<RyanT5000>erikc: it demos *quite* well to C-levels
05:00:00<halberd>Properties of Functions are in general uncomputable
05:00:13<wy>still haven't figured out why strict flag can be only used on data constructors and not functions
05:00:42<halberd>i.e. there is no function which can take the source code listing for another function f, and determine whether or not f is a differentiable function with derivative f'(x)=2x
05:01:00<copumpkin>well yeah
05:01:02<halberd>as long as f is written in a Turing-complete language
05:01:04<RyanT5000>erikc: (one of) the problem(s) is, Unity conflates actors with physics objects
05:01:08<sjanssen>hatds: I'm considering it, depends on whether I want to travel halfway across the country
05:01:11<hatds>wy: perhaps you want bang patterns? http://www.haskell.org/ghc/docs/latest/html/users_guide/bang-patterns.html
05:03:05<RyanT5000>erikc: i really like this idea of conceiving of the game engine as an OS; i've put a lot of thought into OS design before, so it's a really useful analogy
05:03:10<wy>yes.
05:03:45<wy>It looks good and makes the things more uniform. Just hope we never need to write those bang flags
05:03:49<RyanT5000>erikc: what makes Factor a particularly good language for level scripting?
05:04:10<wy>Can the strict flags all be inserted by strictness analysis?
05:04:20<twb>Zow, someone's recommending Factor?
05:04:50<gwern>wy: well, someone wrote a GA program for inserting bangs and seeing whether performance was helped...
05:05:35<erikc>RyanT5000: runtime code replacement with jitting, incremental generational gc, image-based (save/restoring the gc heap, including closures), code-as-data/data-as-code dualism (your 'data files' can just be scripts, no need for data file parsers, use the language)
05:06:07<twb>I suppose it depends what your "primary" language is.
05:06:16<hatds>imho problems with strictness are problems with not understand your code, and it is always worth it to understand it clearly and have very few annotations than to use scatter shot annotations.
05:06:19<RyanT5000>erikc: ah, the image-based part is something i've been wanting for quite some time
05:07:00<erikc>RyanT5000: naughty dog games uses plt scheme for their scripting and state machine descriptions in uncharted, they had a good gdc presentation this year
05:07:45<twb>Naught Dog used an in-houes CL dialect called something like "GOAL" for a while...
05:07:50<conal>halberd: if you do check out & like my auto-diff posts, you might also like my upcoming icfp paper, "beautiful differentiation"
05:08:12<erikc>twb: yep, till sony bought them and 'asked' them to build more tech in c++ to share with other studios
05:08:26<twb>erikc: ah, is that how it went?
05:08:45<twb>erikc: I heard that the one guy who understood how the GOAL compiler worked, quit/died/something
05:08:46<erikc>yea, their data build pipeline is still largely lisp
05:09:01<QtPlaty[HireMe]>IndentParser doesn't seem to be compatable with the current parsec
05:09:14<erikc>he left as well, yes (Andy Gavin), he went and made a webapp and sold it so fox interactive for 100 mil :)
05:09:16<halberd>conal: I got the idea of how it works
05:09:50<halberd>I did check out your posts and also the source code for the module
05:10:08<RyanT5000>are there any other languages that let you serialize closures?
05:10:20<wy>gwern: does GA mean genetic algorithm?
05:10:26<erikc>image-based ones, the lisps, smalltalks
05:10:36<RyanT5000>i'm specifically interested in serializing closures *without* serializing an image of the entire program
05:11:31<halberd>python does it ryan
05:12:06<hatds>I don't think the question makes sense with first class closures
05:12:08<RyanT5000>halberd: interesting; how would i search for that? pickling?
05:12:16<RyanT5000>hatds: really?
05:12:33<hatds>you could always have an abstract function type that is serializable
05:12:58<halberd>oh wait
05:13:02<halberd>maybe Python doesn't do it
05:13:04<erikc>you'd have to investigate but if you can serialize the image, you can probably serialize a portion of the object graph, provided the roots, it's the same problem
05:13:18<RyanT5000>erikc: that's what i was thinking
05:13:33<RyanT5000>erikc: but i've yet to see a language that does it
05:13:55<hatds>probably because doing so isn't getting you very much benefit
05:14:19<halberd>yeah python only does it for named functions
05:14:57<RyanT5000>hatds: i think there might be some benefits
05:15:13<RyanT5000>hatds: at the very least, it means that you can make *every* value in your language serializable
05:15:31<RyanT5000>hatds: which means that the programmer no longer has to worry about whether a particular datastructure is serializable or not
05:15:42<hatds>RyanT5000: I doubt it would be suitable for game saves
05:15:48<hatds>RyanT5000: in a game you really want your serialization to be aware of what it is serializing
05:15:59<RyanT5000>hatds: why's that? versioning?
05:16:27<wy>maybe using a "deriving Serializable" ?
05:16:30<hatds>RyanT5000: I just mean for efficiency
05:16:47<wy>otherwise roll you own ...
05:17:00<erikc>RyanT5000: factor has the serialize vocabulary which works on everything except continuations
05:17:02<RyanT5000>wy: but that means all the datastructures you *use* also need to derive it
05:17:31<RyanT5000>hatds: yeah, although i think it could be made reasonably efficient
05:17:33<wy>RyanT5000: As long as they have the method serialize ?
05:18:04<RyanT5000>wy: right, but i want something lower-level than that, so that we can guarantee, upfront, that *everything* is serializable in the whole language
05:18:12<Saizan>ocaml can serialize continuations, iirc
05:18:55<wy>RyanT5000: You could ask the compiler to add Serializable to every data type
05:19:09<RyanT5000>wy: how?
05:19:17<wy>then override it only for efficiency purposes
05:19:27<RyanT5000>Saizan: very interesting
05:19:46<wy>RyanT5000: use metaprogramming probably
05:19:57<Saizan>wy: yes, the point is finding a compiler/runtime system that supports it for everything, like functions etc.
05:19:59<erikc>but yea, where i work we just manually serialize a subset of the relations (and since the relations are packed in memory, it is quite fast)
05:20:36<RyanT5000>erikc: yeah, that makes sense; i'm not at the stage of worrying about efficiency yet, though
05:20:53<RyanT5000>erikc: right now, i'm trying to figure out what my ideal semantic model would be
05:20:57<wy>Saizan: even for monadic ones ?
05:20:58<erikc>yea
05:21:04<RyanT5000>later, i'll make concessions for efficiency purposes
05:21:16<Saizan>wy: yeah
05:21:27<RyanT5000>(your approach does sound like a good one, though)
05:21:43<Peaker>Its weird that a game developer (Sweenie) is a theory guy. In my mind, they're all C++-heads :)
05:21:46<Saizan>wy: i guess some things like file handles are not serializable by principle, however
05:21:54<wy>Saizan: good idea
05:22:25<wy>Saizan: why aren't they?
05:22:41<RyanT5000>Peaker: well, i'm a theory guy becoming a game guy :)
05:23:01<RyanT5000>really, very few people bridge the theory/practice gap
05:23:12<Peaker>RyanT5000: he's not just an ordinary game guy, he supposedly wrote Unreal Tournament
05:23:16<Saizan>wy: an Handle is a bit like a pointer to a resource, and that resource might not be there or be in the same state when you deserialize
05:23:21<erikc>Peaker: christer ericcson (tech director on god of war) is also a big theory guy (he has a big 'please game devs learn some other languages' rant) http://realtimecollisiondetection.net/blog/
05:23:22<Jedai>Didn't Clean allows to serialize closures ?
05:23:24<twb>academic vs. pragmatic?
05:23:57<wy>Saizan: we could force them to be in the same state
05:24:06<IntergalacticOwl>i'm a game kid becoming a theory kid
05:24:57<wy>Saizan: Once the object with the reference to the resource is sent, we must establish the channel over the network to synchronize the state
05:25:08<Jedai>wy: To do that we could need a copy of the file itself though...
05:25:30<Jedai>In case it changed or something
05:25:47<Saizan>wy: suppose the Handle comes from a Socket, how do you restore that if the other machine is down?
05:25:47<wy>Jedai: you just need to send the changes
05:26:12<Saizan>wy: or if it was a Socket initiated by the other machine (i.e. we're the server)
05:26:43<Jedai>wy: I'm not following you, how do you serialize changes that aren't there when you do the serializing ?
05:27:01<wy>Saizan: it can't be absolutely safe. Just let's pray for the best ;)
05:27:30<Saizan>yeah, just don't serialize Handle's :)
05:27:35<erikc>RyanT5000: the os analogy is good cause it separates the engineers (engine) from the creatives (game), the engine is a fairly known quantity, the game is going to change a lot, so theres a static/dynamic fight there
05:27:37<Peaker>erikc: cool
05:27:43<Saizan>at best you can serialize a FilePath, or an URI
05:27:51<erikc>a coworker of mine is a big propodent of gradual typing cause of that
05:28:08<erikc>as the game settles, you want to type it and push it down into higher perf land
05:28:23<RyanT5000>erikc: yeah, that makes a lot of sense
05:28:28<Jedai>Saizan: eventually with a position in the file and a signature for coherence purpose
05:28:37<RyanT5000>erikc: i don't think there's any language out there whose type system supports such a thing very well
05:29:36<mmorrow>Saizan: with pointers though, you can just map them to unique ids you create as you serialize (i'm assuming you are slurping the targets of all pointers here too)
05:30:07<Saizan>mmorrow: "pointer" was only an analogy
05:30:09<mmorrow>Saizan: with handles/scokets it's a whole different story, since you don't have access (probably) to the other side
05:30:23<Saizan>the problem is internal vs. external resource
05:30:33<mmorrow>that's a good way to say it
05:32:42<xmonader>I'm facing this http://pastebin.com/d64840d0a while installing hs-twitter any help ?
05:34:11<wy>The implementation of IO monad is a little weird, why are there two other things beside the value? GHC.Prim.State# and GHC.Prim.RealWorld?
05:34:50<hatds>I only care to understand it from the high level
05:34:54<Peaker>erikc: I disagree with his rant (and tone!) about patterns for example..
05:35:19<Peaker>Some patterns are language-specific, some are almost as "eternal" as data structures/algorithms
05:35:45<hatds>the implementation as I understand it is basically a trick to project sequencing (in the sense of time and effects) into a data dependency
05:36:08<Peaker>(The "Strategy" pattern, of passing dictionaries/functions around to higher-order functions, where the passed functions represent what you want to do. This "pattern" is implemented by type-classes or function records in Haskell, but its the same pattern from the group of four (?) book
05:36:30<Saizan>xmonader: it probably depends on an older version of json without specifying it in the .cabal file
05:37:00<Peaker>what's gradual typing?
05:37:14<erikc>http://www.google.ca/url?sa=t&source=web&ct=res&cd=3&url=http%3A%2F%2Fwww.cs.colorado.edu%2F~siek%2Fpubs%2Fpubs%2F2006%2Fsiek06%3A_gradual.pdf&ei=QzgWSrWPAov8swPhtOHZCA&usg=AFQjCNF2DrY06Kdj0CMQYstzgygzkhrLSw&sig2=1ZZQN68JBkkL67oy3GVTBw
05:37:19<erikc>err
05:37:22<mmorrow>Jedai: yeah, clean's rts supports both serializing and reading back in polymorphically typed data
05:37:31<erikc>google 'gradual typing' there are some papers
05:37:43<xmonader>Saizan, sounds so ''build-depends: base, HTTP >= 4000.0.1, network, utf8-string, json, mime, old-locale, old-time, random
05:38:22<wy>Peaker: the only way to learn the patterns is to forget them :)
05:38:35<Peaker>wli: what do you mean?
05:39:51<Jedai>wy: It seems to me that GHC.Prim.State# is the primitive type constructor behind both IO and ST and GHC.Prim.RealWorld is the state type for IO
05:40:35<Peaker>I remember reading luqui's realization a few months ago -- "why not put partiality in a monad?" or something like that. I see now that it was in Sweene's slides that I saw so long ago (but did not have enough background to understand): "Why not go one step further and define partiality as an effect, ..."
05:40:50<Jedai>mmorrow: Thanks, I vaguely remembered that that was one of the real advantage of Clean over Haskell
05:41:35<mmorrow>Jedai: this can totally be done in haskell too.. it's one thing i want to do actually
05:42:12<Saizan>xmonader: use --constraint="json < 4", as it appears JSRational constructor changed in version 0.4.1
05:42:14<mmorrow>you just just serialize closures directly like vacuum does, and then going the other way you'd need to write some rts C code
05:42:19<Jedai>mmorrow: Well theoretically, but Clean had a clean implementation integrated with its compuler
05:42:28<mmorrow>Jedai: http://moonpatio.com/repos/MISC/Clean/dynamic/dynamics/
05:42:30<PetRat>What's the precedence of the double colon operator relative to $? at gchi typing :info :: gives an error?
05:42:32<wy>Peaker: were you reading some blog post? I don't know the context
05:42:41<mmorrow>Jedai: a lot of it is hand-coded asm
05:42:42<PetRat>:info ::
05:43:08<hatds>:: extends as far as possible iirc
05:43:14<xmonader>Saizan, many thanks i'll try it and get back to you
05:43:28<Peaker>wy: reading www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/sweeny.pdf
05:43:30<PetRat>hatds: I don't understand what you mean
05:43:39<Peaker>hmm -- what's "lenient evaluation"?
05:44:05<PetRat>let me give an example: can I write "fromSql $ head $ head $ rows :: Int" ?
05:44:11<Peaker>erikc: can you describe gradual typing in a sentence? :)
05:44:21<mmorrow>Jedai: err, well i should have said that clean has _dynamics_ where you can put in and recover polymorphically-typed data
05:44:25<Peaker>PetRat: fromSql . head . head $ rows
05:44:37<mmorrow>you can probably serialize that too i'd guess
05:44:47<Jedai>Peaker: wasn't it some kind of speculative evaluation ?
05:44:49<Cale>PetRat: More toward your question, :: gobbles up as much as it can
05:45:04<wy>:info ($!)
05:45:20<Cale>That is, it scopes over the largest possible preceding subexpression.
05:45:37<mmorrow>(i'm more interested in serializing/reifying which retains all sharing, and so can serialize "infinite data" which is just some tiny graph that's only infinite if you consider it to be a tree)
05:45:45<PetRat>Cale: I think my expression was fine then, in terms of getting the right type out of fromSql.
05:45:49<Cale>yeah
05:45:58<mmorrow>, vaccum (fix (\x -> 0 : x)) {- my favorite -}
05:46:00<lunabot> luna: Not in scope: `vaccum'
05:46:05<mmorrow>, vacuum (fix (\x -> 0 : x)) {- my favorite -}
05:46:08<lunabot> [(0,[1,0]),(1,[])]
05:46:18<Cale>(though take Peaker's advice and try to get in the habit of using composition instead of repeated $)
05:46:59<mmorrow>and also, the serialization function can be (forall a. a -> ByteString)
05:47:06<Cale>The current associativity of $ is a bit of a mistake, and there are benefits to using composition instead.
05:47:28<xmonader>Saizan, http://pastebin.com/d4c53c5b4
05:47:38<PetRat>Cale: OK
05:47:38<Jedai>mmorrow: That would be awesome to have anyway :)
05:47:43<mmorrow>(deserialization though is more limited since haskell doesn't have dependent types or a polymorphic typeable)
05:47:47<erikc>Peaker: basically, dynamic by default, and then allow type annotations / infer types as much as possible
05:47:51<mmorrow>Jedai: totally!
05:48:20<erikc>and where there are type annotations, provide type checking
05:48:31<Peaker>erikc: ah, limited type inference, I hate that..
05:49:09<Cale>PetRat: Since f . (g . h) = (f . g) . h, expressions written with composition are easier to take apart and transform, and it tends to help one's thought process to be thinking of functions being stuck end to end.
05:49:26<RyanT5000>Peaker: just think of it like a type system that doesn't finish its work until runtime :P
05:49:48<wy>Peaker: haven't found anything to do with strategy pattern
05:49:48<erikc>it is ideal for situations where you dont know what you want to make, but when you figure it out, you clamp it down by adding type annotations (and get the associated safety/perf benefits)
05:49:49<Jedai>RyanT5000: You mean a dynamic type system...
05:49:51<Cale>(whereas if you have something like f $ g $ h $ x, the substrings like g $ h probably aren't even well-typed)
05:49:52<Peaker>RyanT5000: its still untyped, afaic
05:50:03<RyanT5000>Jedai: no, it *starts* its work at compile-time :P
05:50:06<Peaker>wy: no no, that was from the rant of this other dude
05:50:25<erikc>which describes game dev in a nutshell, since 'a fun program' is a nebulous requirement :)
05:50:32<Peaker>erikc: its weird to me -- I think its easier to specify the type of what you want to make, than the implementaiton
05:50:54<RyanT5000>well, there's a lot of info in the type system that isn't necessary
05:51:24<wy>Peaker: I'd like to see the rant
05:51:25<RyanT5000>for example, i frequently know that i want a datatype that associates keys with values
05:51:45<RyanT5000>but i don't always know whether i want it to be a function, a list of pairs, a Map, or an array
05:52:02<Peaker>wy: http://realtimecollisiondetection.net/blog/?p=81
05:52:03<Jedai>RyanT5000: You could use the typeclasses from Edison
05:52:28<RyanT5000>Jedai: i have; they're pretty good, but they're nowhere near pervasive enough to deal with this problem in general
05:52:37<RyanT5000>(nor comprehensive enough)
05:52:41<Peaker>RyanT5000: there are semantic differences between those types
05:52:51<Peaker>RyanT5000: if you don't know what semantics you want - how can you implement anything?
05:53:15<erikc>Peaker: and thats why game dev is such a mess :)
05:53:17<RyanT5000>Peaker: that's true; i chose a bad example
05:53:49<RyanT5000>Peaker: suppose i add a default response to the last 3 of them
05:54:07<RyanT5000>Peaker: (used for not-present or out-of-bounds inputs)
05:54:32<Peaker>ACTION has to go
05:54:42<mmorrow>mempty?
05:54:47<RyanT5000>alright; good luck on the presentation
05:55:13<RyanT5000>mmorrow: sure, the point is that i have 4 ways of representing the same idea
05:55:26<RyanT5000>mmorrow: and i have no way to tell the compiler that i don't care which of those it is
05:55:46<RyanT5000>mmorrow: (except in certain very limited circumstances like if i use Edison pervasively)
05:55:51<mmorrow>but why not rep write code that work with the general concept, that you can use regardless of implem?
05:56:03<mmorrow>(oh, i'm not talking about edison in particular)
05:56:27<wy>Peaker: I used to have list of all the design patterns and their corresponding terms in functional programming
05:56:32<RyanT5000>is there a general way to do that?
05:56:36<mmorrow>yeah, not having control over typeclass instance selection is a pain when there's more than one instance possible
05:57:20<RyanT5000>mmorrow: exactly
05:57:26<mmorrow>RyanT5000: if only we had ML structures/signatures/(recursive)-functors/etc
05:58:12<RyanT5000>mmorrow: especially if you have, e.g.: f :: C c => a -> c ; g :: C c => c -> b ; g (f x)
05:58:28<wy>My conclusion is that most "novel" design patterns arise from the lack of first-class functions. The others are old and used by people for decades. They just didn't have a name
05:58:31<RyanT5000>if i don't care at all which implementation of C gets used for c, i still have to pick one
05:59:04<RyanT5000>and since i'm virtually certain to never look at that code again, whatever i pick randomly the first time through will be there forever
05:59:31<PetRat>Suppose I'm mapping a function with > 2 arguments, and the argument to be supplied by the list is somewhere in the middle. is there something more idiomatic than map (\a -> g arg1 arg2 a arg3 arg4) xs ?
05:59:32<mmorrow>RyanT5000: yeah, i think that typeclasses are good for what they're good for, but suck as a substitute for signatures/functors
05:59:52<RyanT5000>mmorrow: yeah; what i really want in that particular example is for the compiler to just pick an instance for me
05:59:52<wy>Just like the way JUnit works. People have been using this kind of thing for decades, but some guy gave it a name and made fame from it...
06:00:13<RyanT5000>mmorrow: although that requires that classes can completely specify program behavior...
06:00:25<RyanT5000>(or at least specify it arbitrarily well)
06:00:40<mmorrow>RyanT5000: the signatures only specify abstract units
06:00:46<mmorrow>Map
06:00:50<mmorrow>Queue
06:00:55<mmorrow>Scheduler
06:00:57<mmorrow>etc
06:01:00<RyanT5000>yeah
06:01:24<RyanT5000>ideally, i'd like the programmer to usually not need to get below that level of abstraction
06:03:11<PetRat>bump Suppose I'm mapping a function with > 2 arguments, and the argument to be supplied by the list is somewhere in the middle. is there something more idiomatic than map (\a -> g arg1 arg2 a arg3 arg4) xs ?
06:05:06<dibblego>is the Test.QuickCheck module installed by default with most GHC distributions?
06:05:46<mib_t968yv>> pl (\l i k -> take (k-i+1) $ drop (i-1) l)
06:05:48<lambdabot> Not in scope: `pl'
06:06:07<mib_t968yv>...d'oh ><
06:06:45<mmorrow>RyanT5000: totally, you could code whole programs as a bunch of (ML) functors, then stick in any structures with correct signatures later
06:08:13<erikc>PetRat: none i know of
06:08:26<RyanT5000>mmorrow: or better yet, have the compiler stick them in for you, and you only change them if you need to to improve efficiency
06:08:44<RyanT5000>mmorrow: i'm going to have to learn ML now :P
06:08:52<mmorrow>RyanT5000: well sure, assuming that all the structures you need are in the stdlib
06:08:52<PetRat>erikc: thanks
06:09:05<RyanT5000>(i've used it in some classes, but not seriously)
06:09:20<mmorrow>(structure in the ML sense)
06:09:40<mib_t968yv>@pl \l i k -> take (k-i+1) $ drop (i-1) l
06:09:40<lambdabot>ap (flip . (take .) . flip flip 1 . ((+) .) . subtract) . flip (drop . subtract 1)
06:09:45<RyanT5000>mmorrow: it seems like that could be made extensible relatively easily
06:10:03<RyanT5000>mmorrow: obviously you'd have to tell the compiler which structures you trust to implement a given interface
06:10:20<RyanT5000>(especially if a library has one good structure and another that's not so good)
06:10:38<sjanssen>this seems related to defaulting
06:10:42<mmorrow>RyanT5000: exactly, you then write code that hand-picks what structures you want
06:11:07<mmorrow>(and you can swap a choice out for another easily)
06:11:08<RyanT5000>yup
06:11:31<RyanT5000>i think that would eliminate a *huge* class of decisions from the average programmer's day
06:11:56<mmorrow>me too
06:12:12<sjanssen>perhaps some sort of extension to defaulting is in order: default(Integral Integer, MapClass Data.Map.Map)
06:12:51<RyanT5000>sjanssen: i think it would take some serious changes to haskell's class system to make such a thing workable
06:13:03<RyanT5000>sjanssen: at the very least, transitive mandatory inclusion of instances would need to be dealt with
06:13:10<sjanssen>RyanT5000: I'm not sure, defaulting already exists
06:13:15<sjanssen>RyanT5000: that issues seems orthogonal
06:14:00<RyanT5000>sjanssen: well, i suppose if the default were specified with the class, that would be fine enough
06:14:20<sjanssen>RyanT5000: hmm, is that really what we want to do?
06:14:26<sjanssen>seems like defaults should be module local
06:14:48<RyanT5000>sjanssen: they need to be importable, otherwise we're adding a ton of module overhead
06:15:00<RyanT5000>sjanssen: they could be imported from non-modules though, i guess
06:15:07<sjanssen>RyanT5000: yeah, importable would be good
06:15:09<RyanT5000>C preprocessor? :P
06:15:34<erikc>RyanT5000: logic programming with a good metalanguage for the logical->physical mapping would fit well too
06:16:02<RyanT5000>erikc: i'm confused as to what you're talking about
06:16:04<erikc>there is some interesting work here http://www.cs.cornell.edu/bigreddata/games/ in that area, applying relational algebra to game scripting
06:16:17<RyanT5000>ah, i see
06:16:32<RyanT5000>"Computer games are becoming the next frontier for social interaction between humans."
06:16:41<RyanT5000>a scary - and dubious - statement :P
06:16:42<erikc>grant-speak
06:16:48<erikc>:P
06:17:35<twb>I bet dijkstra would have something scathing to say about that
06:17:40<RyanT5000>yeah... i got plenty of that kind of crap in law school :P
06:18:13<RyanT5000>(lawyers don't reserve that kind of language for court - or even for work :P)
06:18:36<erikc>twb: about the 'computer games are ...' ?
06:18:59<RyanT5000>"computer gaming is" might be a more grammatical choice :P
06:18:59<twb>erikc: about grant-speak being about a reality that doesn't exactly match the real world.
06:19:09<erikc>ah hehe
06:19:16<RyanT5000>lol
06:20:03<twb>I recently read an essay (read: rant) of his about the lack of, as it were, plain speaking in papers.
06:21:01<twb>http://www.cs.utexas.edu/users/EWD/transcriptions/EWD04xx/EWD498.html This one?
06:21:44<twb>No, not that one.
06:25:11<RyanT5000>thanks for all the input on the game engine stuff, everyone
06:25:23<RyanT5000>i'm out
06:33:04<twb>Ah, here it is
06:33:05<twb>http://www.cs.utexas.edu/users/EWD/transcriptions/EWD13xx/EWD1300.html
06:33:41<twb>Not really as relevant as I remembered.
06:33:43<dibblego>when did GHC discontinue splitting into core and extra-libs (I'm going to give a presentation and I want all users to have Test.QuickCheck available)
06:40:09<wy>weilawei|away: hi
06:47:36<xmonader>Saizan, i tried your note but still not working
06:49:56<mykelyk>how can i call f :: Value -> [Value] -> IO (State Stack Value)
06:50:38<mykelyk>with a :: IO (State Stack Value)
06:50:54<mykelyk>and b :: IO (State Stack [Value]) ?
06:52:11<mmorrow>@type \f a b -> do sv <- a; svs <- b; return (do v <- sv; vs <- svs; f v vs)
06:52:13<lambdabot>forall (t :: * -> *) (t1 :: * -> *) t2 t3 t4. (Monad t, Monad t1) => (t2 -> t3 -> t1 t4) -> t (t1 t2) -> t (t1 t3) -> t (t1 t4)
06:52:30<mmorrow>although that seems like it's not what you want. where did you get those types from?
06:52:59<mykelyk>an intepreter
06:53:36<mmorrow>@type \f a b -> do sv <- a; svs <- b; return (do v <- sv; vs <- svs; f v vs) :: (a -> [a] -> IO (State s a)) -> IO (State s a) -> IO (State s [a]) -> IO (State s a)
06:53:39<lambdabot> Inferred type is less polymorphic than expected
06:53:39<lambdabot> Quantified type variable `s' is mentioned in the environment:
06:53:39<lambdabot> svs :: IO (State s a) -> t1 (bound at <interactive>:1:22)
06:53:54<mmorrow>@type (\f a b -> do sv <- a; svs <- b; return (do v <- sv; vs <- svs; f v vs)) :: forall s. (a -> [a] -> IO (State s a)) -> IO (State s a) -> IO (State s [a]) -> IO (State s a)
06:53:56<lambdabot>Not in scope: type variable `a'
06:53:56<lambdabot>Not in scope: type variable `a'
06:53:56<lambdabot>Not in scope: type variable `a'
06:54:02<mmorrow>@type (\f a b -> do sv <- a; svs <- b; return (do v <- sv; vs <- svs; f v vs)) :: forall s a. (a -> [a] -> IO (State s a)) -> IO (State s a) -> IO (State s [a]) -> IO (State s a)
06:54:04<lambdabot> Couldn't match expected type `State s a'
06:54:04<lambdabot> against inferred type `IO (State s a)'
06:54:04<lambdabot> In the expression: f v vs
06:54:47<mmorrow>hmm
06:55:15<mykelyk>any idea?
06:55:31<mmorrow>so you need to get the IO out of the State, run the State, and put the IO back (or something)
06:56:52<mmorrow>(\f a b -> do sv <- a; svs <- b; return (do v <- sv; vs <- svs; unsafePerformIO (f v vs))) :: forall s a. (a -> [a] -> IO (State s a)) -> IO (State s a) -> IO (State s [a]) -> IO (State s a)
06:56:57<mmorrow>is what i'd do
06:57:19<mykelyk>unsafePerformIO ?
06:57:40<mmorrow>are you sure that calling f on these inputs makes sense though? because if so then it's a design error on the part of the interpreter
06:58:28<mmorrow>mykelyk: you're putting it back into IO though, so it's fine here (in fact, it's really you're only choice to do what you want to do here)
06:58:40<mmorrow>s/you're/your/
06:59:06<Jedai>mykelyk: Are you sure the type of f is correct ? Rather than IO (State...) an interpreter should rather produce something like StateT Stack IO a
06:59:12<mmorrow>yeah
06:59:58<mykelyk>probably you're right
07:15:03<mmorrow>@type \ios -> do State f <- liftIO ios; StateT (return . f)
07:15:05<lambdabot>forall t t1 (m :: * -> *). (MonadIO m) => IO (State t t1) -> StateT t m t1
07:15:48<mmorrow>mykelyk: if the code for that interp isn't at-hand, you could do that to convert stuff
07:16:57<mmorrow>(so unsafePerformIO isn't actually the only way after-all, but the fact that this is equivalent to unsafePerformIO'ing that stuff above shows that that use of unsafePerformIO was "safe")
07:17:18<mmorrow>unsafePerformIO (return 42) == 42
07:17:47<mykelyk>works like a charms thanks!!!
07:17:47<mmorrow>liftM2 (==) (return (unsafePerformIO (return 42))) (return 42)
07:17:54<mmorrow>mykelyk: cool :)
07:36:39<dancor>how do you decide between (a, b) and State a b
07:39:48<Cale>dancor: How do you mean?
07:40:06<Cale>dancor: You mean between using the state monad, and parameter passing?
07:41:12<dibblego>does anyone happen to know when GHC discontinued splitting into core and extra-libs?
07:41:51<Cale>dibblego: hmm... well, there's the Haskell Platform thing now, yeah?
07:42:01<dibblego>yeah
07:42:16<dibblego>I'm just going to give a tutoral to about 20 people and I want to make sure they all have QC
07:43:14<Cale>If they install it from Debian/Ubuntu, they'll have almost nothing, because the Debian guys split everything up on their own.
07:43:26<dibblego>bugger
07:45:20<Cale>Hmm, actually even the source for 6.10.3 comes in two packages.
07:45:42<Cale>But the binaries provided seem to be the big package.
07:46:06<Cale>Myself, I just install the binaries from the GHC website.
07:48:16<twb>Actually just ghc6 in Debian is like 100MB of stuff
07:48:34<Cale>hmm
07:48:57<twb>Uncompressed Size: 130M
07:49:19<twb>Make that 148 for 6.10.3
07:49:39<twb>This is why I don't install GHC on my laptop; it only has 4GiB of storage.
07:50:06<bnijk>how do i access system beep in haskell
07:50:18<twb>bnijk: you could try echoing ^G to standard output
07:50:22<Cale>hmm, it seems my current /usr/local/lib/ghc-6.10.3 is 347M
07:50:25<bnijk>how do i do that :O
07:50:32<bnijk>wait no
07:50:39<bnijk>it needs to actually control the hz and duration
07:50:41<Cale>and I only install packages as user
07:50:52<bnijk>i already wrote a bash script to do this, to play a major scale and a chromatic scale on the system beep
07:51:11<Cale>So that's all stuff which came with GHC for me.
07:51:25<Cale>bnijk: hmm
07:51:31<mmorrow>[m@monire ~]$ du -h /usr/local/ghc/ghc-6.10.1 | tail -1
07:51:32<mmorrow>981M /usr/local/ghc/ghc-6.10.1
07:51:33<mmorrow>:o
07:51:39<dmwit>bnijk: Call out to your bash script. ;-)
07:51:56<bnijk>that seems wasteful
07:52:01<Cale>bnijk: What does the bash script do, I wonder?
07:52:12<bnijk>well there's an accompanying c program
07:52:19<bnijk>which does beep (hz) (duration)
07:52:38<mmorrow>bnijk: i think it's a sysctl or something
07:52:41<dmwit>bnijk: If I were you, I'd call the same functions in Haskell as I did in C.
07:52:55<bnijk>let's see here
07:53:00<mmorrow>there's a program that plays songs my messing with the sysbeep, maybe that'll help
07:53:00<twb>mmorrow: -c (or -s? I forget).
07:53:05<Cale>I don't know of an existing Haskell API for that, but you can FFI import any C library calls you used.
07:53:11<mmorrow>twb: i can't remember
07:53:19<bnijk>int main(int argc, char *argv[]) {
07:53:20<bnijk> int fd = open("/dev/tty10", O_RDONLY);
07:53:20<bnijk> if (fd == -1 || argc != 3) return -1;
07:53:20<bnijk> return ioctl(fd, KDMKTONE, (atoi(argv[2])<<16)+(1193180/atoi(argv[1])));
07:53:20<twb>I always use -sch, but it prints two lines
07:53:22<bnijk>}
07:53:25<bnijk>=-o
07:53:27<bnijk>how do i do that in haskell
07:53:53<dmwit>bnijk: Same way, call ioctl.
07:54:04<bnijk>there's some strange monadic way of doing that i assume
07:54:07<dmwit>?where FFI
07:54:07<lambdabot>http://www.cse.unsw.edu.au/~chak/haskell/ffi/
07:55:03<xmonader>while installing hs-twitter i get this message http://pastebin.com/d222fb15a i tried to set json package to < 4 as Saizan said but still no good
07:55:37<Cale>bnijk: Unless you mean the IO monad, no. (The fact that IO is a monad is irrelevant to this.)
07:56:44<bnijk>haskell is hard
07:57:07<twb>bnijk: if you try to write procedures in it, sure.
07:57:08<dmwit>I still don't understand why you're not just calling out to that C program.
07:57:08<Cale>... I was just thinking that comprehending the meaning of that C program is pretty hard.
07:57:09<xmonader>bnijk, not true it's simply different
07:57:25<dmwit>It's the same thing you did with bash, why not do it with Haskell?
07:57:48<dmwit>And yeah, I'm with Cale here. That C doesn't look particularly easy to me.
07:58:17<dmwit>(Did you write the C code, or grab it from somewhere else?)
07:58:22<bnijk>(i grabbed it)
07:58:29<twb>Cale: looks like it converts the first command-line argument into a very stange number, then sends an ioctl to /dev/tty10 with that number as the argument to the call "KDMKTONE".
07:58:38<Cale>Why tty10?
07:58:38<bnijk>hell if i know how to do things like that
07:58:48<twb>Presumably because it's not allocated by default
07:59:12<dmwit>bnijk: So, what you're saying is, it's hard to do something in Haskell that you don't understand how to do in any other language, either.
07:59:28<dmwit>Forgive me if I'm not convinced of Haskell's shortcomings from that. =)
07:59:30<bnijk>lol
07:59:35<bnijk>i understand the c
07:59:41<bnijk>i just really don't know how to do it in haskell
07:59:47<twb>bnijk: then what is the purpose of the right shifting?
07:59:53<twb>Sorry, left shifting
07:59:55<bnijk>what?
08:00:08<bnijk>> map (\x->440*2**(x/12)) [0..12]
08:00:08<twb>bnijk: what is the purpose of the left shift used in that C code?
08:00:09<lambdabot> [440.0,466.1637615180899,493.8833012561241,523.2511306011972,554.3652619537...
08:00:16<Cale>atoi(argv[2])<<16 -- why shift left by 16 bits?
08:00:43<twb>bnijk: if you understand the C code, you should be able to explain it to us.
08:00:52<Cale>(1193180/atoi(argv[1])) -- and wtf is this?
08:00:54<bnijk>ah
08:01:05<bnijk>well the second part isj ust translating the hz
08:01:11<twb>Cale: I assume 11938180 is a frequency in Hz
08:01:14<mmorrow>twb: http://www.frank-buss.de/beep/index.html
08:01:15<bnijk>to what the beeping thing recognizes
08:01:21<twb>Bleh, too many beers
08:01:22<bnijk>whatever you call it
08:01:29<Cale>mm...
08:01:34<bnijk>and the first part...
08:01:41<bnijk>well
08:01:48<twb>mmorrow: yes, ^G is character 07 in ASCII
08:01:50<bnijk>that i don't get
08:01:53<yowgi>“KDMKTONE Generate tone of specified length. The lower 16 bits of argp specify the period in clock cycles, and the upper 16 bits give the duration in msec.”
08:02:05<bnijk>ah
08:02:07<twb>O dpm
08:02:15<twb>I don't think tty10 is special
08:02:26<twb>Other than being in /etc/securetty.
08:02:32<yowgi>1193180 = CLOCK_TICK_RATE
08:02:36<dmwit>Ah, so the code is actually wrong.
08:02:47<mmorrow>nice, http://tldp.org/LDP/lpg/node83.html
08:02:57<twb>Runtime.getRuntime().exec("beep.exe 440 1000");
08:02:58<dmwit>Although I suppose for something like this, sanitizing input is pretty low priority.
08:02:58<twb>Ahahahaha
08:03:07<bnijk>yes dmwit ;)
08:03:20<mmorrow>ACTION wraps messing with the pc speaker with the ffi
08:03:26<twb>yowgi: surely the tick rate depends on the architecture and the kernel version?
08:03:34<dmwit>Anyway, maybe we should be asking why you're not just using a real sound library.
08:03:45<yowgi>twb, probably, yes.
08:03:46<bnijk>dmwit: i wanted to do it with the system beep, of course
08:03:48<twb>dmwit: because this is "easier" man!
08:03:53<bnijk>anybody can write a PCM
08:04:12<dmwit>ACTION blinks
08:04:20<dmwit>And not anybody can copy and paste code from the web?
08:04:35<twb>Description: beep does what you'd expect: it beeps. But unlike printf "\a" beep allows you to control pitch, duration, and repetitions. Its job is to live inside shell/perl scripts and allow more granularity than one has otherwise. It is controlled completely through command line options. It's not supposed to be complex, and it isn't - but it makes system monitoring (or whatever else it gets hacked into) much more
08:04:35<twb>Homepage: http://johnath.com/beep/
08:04:36<bnijk>that code only does the beeping itself
08:04:44<bnijk>how do i explain
08:05:15<twb>Package: cw
08:05:15<twb>Description: This package contains a simple command line client called cw, which sounds characters as Morse code on the console speaker. The included cwgen binary can generate groups of random characters for Morse code practice.[...]
08:05:27<bnijk>i don'tw ant to manipulate timbre
08:05:38<bnijk>if i wanted to do that i'd open up a whole wave to do it
08:05:43<bnijk>just wanted the tones
08:06:58<bnijk>speaking of which - how do i work in hex in haskell
08:07:07<twb>I actually looked into using cw for a headless server SOE, so it could report panics to untrained end users
08:07:15<dmwit>> 0x20 -- the usual way
08:07:17<lambdabot> 32
08:07:19<bnijk>k
08:07:39<bnijk>so let's see here
08:07:40<twb>dmwit: what, no DEFAULT-READ-BASE ? ;-)
08:08:16<bnijk>a wav header would be formatted like...
08:08:16<twb>(SETQ DEFAULT-WRITE-BASE 2 DEFAULT-READ-BASE 36) (PRINC aaz3) ;-)
08:08:35<twb>...not bothering to check CLHS, because I'm lazy.
08:09:28<p_l>twb: why setq and not setf?
08:09:33<dmwit>:t readIntAtBase
08:09:34<lambdabot>Not in scope: `readIntAtBase'
08:09:35<twb>p_l: haha
08:09:40<dmwit>:t readInt
08:09:40<lambdabot>forall a. (Num a) => a -> (Char -> Bool) -> (Char -> Int) -> String -> [(a, String)]
08:10:17<bnijk>> 0x524946462408000057415645666d74201000000001000200 ++ sampleRate ++ byteRate ++ 0x0400 ++ bps ++ firstSubchunk ++ 0x000800000000 ++ wav
08:10:18<lambdabot> Not in scope: `sampleRate'Not in scope: `byteRate'Not in scope: `bps'Not in...
08:10:24<bnijk>you're not in scope~!
08:10:27<bnijk>ACTION slaps lambdabot
08:10:28<dmwit>:t index
08:10:29<lambdabot>forall a. (Ix a) => (a, a) -> a -> Int
08:10:35<dmwit>:t findIndex
08:10:36<lambdabot>forall a. (a -> Bool) -> [a] -> Maybe Int
08:10:49<bnijk>although the > will turn it to int i assume
08:11:21<bnijk>bah
08:11:45<dmwit>> readInt 36 (const True) (\c -> fromJust $ lookup c (zip (['0'..'9'] ++ ['a'..'z']) [0..])) "aaz3"
08:11:47<lambdabot> [(480783,"")]
08:12:14<bnijk>back to LYAH
08:12:40<dmwit>bnijk: uh... (++) operates on String
08:12:47<bnijk>meh
08:12:49<bnijk>make those :'s
08:13:01<bnijk>and then mush it all together
08:13:19<bnijk>i don't remember
08:13:31<dmwit>You have a bit to learn, yet, it seems. =)
08:13:40<bnijk>i would imagine
08:13:53<bnijk>so tell me then, how do i just mash together data
08:14:10<dmwit>Also, what the hell am I thinking? (++) works on [a] for any a, not just Char.
08:14:20<dmwit>bnijk: You don't just mash together data.
08:14:25<dmwit>That's the beauty of Haskell.
08:14:33<Cale>Well, I wrote a program which I imagine does the same thing as your C code, but I have no idea how to test it.
08:14:36<mmorrow>heh http://www.scylla-charybdis.com/tool.php/kdmktone
08:14:46<mmorrow>for a in 1 2 3; do ./kdmktone 1000 1500 2000 0; done
08:15:12<bnijk>what do you mean
08:15:17<bnijk>@dmwit
08:15:18<lambdabot>Unknown command, try @list
08:15:52<Cale>actually it does seem to work.
08:16:13<Cale>ACTION goes to hpaste
08:16:23<bnijk>if i'm trying to make a pcm wav, dmwit, they have to be aligned in that order
08:16:34<bnijk>how else do you propose to do that
08:16:40<Cale>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5112#a5112
08:16:49<Cale>bnijk: ^^
08:17:08<bnijk>nifty
08:17:16<dmwit>bnijk: We have Data.Word for that, but your first guy there will almost certainly overflow a Word.
08:17:21<bnijk>so cale
08:17:23<Cale>It doesn't work without root permissions on my machine.
08:17:34<bnijk>plug in map (\x->440*2**(x/12)) [0..12] into that
08:17:40<bnijk>and you have a chromatic scale :)
08:18:01<Cale>Well, modulo the numeric conversion.
08:18:10<bnijk>ah, yes
08:18:15<bnijk>...modulo?
08:18:21<bnijk>0.0
08:18:33<Cale>I just mean, ignoring that
08:18:54<bnijk>which part of your program is the frequency
08:19:05<Cale>I just stole the two parameters from your program
08:19:23<bnijk>ACTION looks again
08:19:24<bnijk>ok
08:19:29<Cale>I think a is the frequency
08:19:35<Cale>That's less convenient :)
08:19:54<Cale>ACTION swaps them
08:19:57<danra>any recommendations for a package to translate a tree of strings into an image of tree of strings?
08:20:16<dmwit>How about Data.Tree.showTree?
08:20:19<Cale>ah, it actually does beep, so it should probably just be called beep
08:20:20<dmwit>Or whatever that thing is called.
08:20:20<bnijk>ACTION frowns
08:20:37<dmwit>drawTree
08:20:56<danra>thanks dmwit, will look at that
08:21:03<bnijk>dmwit: i wrote a program once in quasi-functional php+postgres that just compiled little bits of text people wrote
08:21:06<bnijk>into a huge tree
08:21:13<bnijk>the things that came out of the project
08:21:17<bnijk>mmnph
08:22:20<bnijk>i want a big poster of that...
08:22:24<bnijk>ACTION fiddles some more
08:24:02<bnijk>cale you still there?
08:24:19<Cale>yeah
08:24:36<Cale>hmm, it doesn't seem to block until the beep is finished
08:24:56<bnijk>can you explain this 'foreign...' line to me
08:25:44<bnijk>or should i just look up these functions
08:25:46<Cale>sure
08:25:53<Cale>It's mostly special syntax.
08:26:29<dmwit>foreign isn't a function, actually.
08:26:46<bnijk>what is it then, a keyword
08:26:52<dmwit>A foreign import provides a bridge from Haskell to other languages.
08:26:56<Cale>yes
08:27:06<dmwit>Yep, "foreign", "import", and "ccall" are all keywords there.
08:27:14<bnijk>and these types
08:27:16<Cale>ccall is the calling convention
08:27:20<bnijk>Fd and CInt
08:27:20<twb>dmwit: language*s*? Other than C, what are they?
08:27:40<dmwit>twb: I believe there's a spec for Java, at least, though I doubt anyone implements it.
08:27:43<dmwit>?where ffi
08:27:43<lambdabot>http://www.cse.unsw.edu.au/~chak/haskell/ffi/
08:27:46<twb>Or are we talking about Haskell rather than GHC now?
08:28:01<dmwit>yep
08:28:08<dmwit>err: yep, Haskell, not GHC
08:28:11<twb>Righto
08:28:14<Cale>and then "sys/ioctl.h ioctl" describes that the function we want is described in the header <sys/ioctl.h> and is called ioctl
08:28:23<twb>I tend to conflate the two in implied contexts.
08:28:30<Cale>Then it's followed by the name of the Haskell function to import it as
08:28:49<Cale>and the Haskell type at which we want to import it... there has to be some agreement between this type and the C type
08:28:58<Cale>(but there's a bit of flexibility)
08:29:00<dmwit>twb: I guess "stdcall" is the only other required calling convention.
08:29:11<quicksilver>twb: other than C, any other language which supports the C ABI :)
08:29:15<dmwit>twb: (For win32 api calls.)
08:29:31<bnijk>hmph
08:29:35<bnijk>yours isn't in /usr/share?
08:29:44<Cale>what?
08:29:46<bnijk>er, /usr/include/sys/
08:29:50<bnijk>ioctl.h
08:29:51<Cale>It is.
08:30:31<bnijk>ok so that reads in #define _SYS_IOCTL_H
08:30:40<Cale>hmm?
08:30:45<bnijk>in ioctl.h
08:30:55<bnijk>or #ifndef
08:31:01<Cale>Well, it reads the declaration of the ioctl function from there
08:31:20<bnijk>how did you know what type ioctl had O.O
08:31:31<Cale>I gave it by hand.
08:31:43<Cale>(I looked it up in the manpage and looked at what you wrote)
08:31:47<dmwit>From man ioctl
08:32:11<Cale>ioctl normally takes an arbitrary number of parameters, so I imported it at one specific type
08:32:44<bnijk>ACTION nods
08:33:07<Cale>The first parameter is a file descriptor, and the unix package for Haskell already has stuff for working with those
08:33:21<Cale>So I imported System.Posix.Types and System.Posix.IO
08:33:29<Cale>and used the Fd type defined there
08:33:41<Cale>CInt as you'd imagine is just a C int
08:33:59<bnijk>so those types are for the arguments passed to kdmktone
08:34:10<Cale>to ioctl rather
08:34:15<bnijk>er, yeah
08:34:23<Cale>kdmktone is a particular CInt constant
08:34:24<danra>any recommendations for a package to translate a tree of strings into an *pretty* image of tree of strings? (*not* Data.Tree.drawTree :-)
08:34:47<bnijk>danra: GIMP
08:34:48<dmwit>danra: As in, a non-text image?
08:34:53<danra>yup
08:34:53<Cale>by the way: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5112#a5113
08:34:58<dmwit>danra: If so, you might be interested in the GraphViz library.
08:35:19<danra>dmwit: Thanks again, will look at that
08:35:19<bnijk>oo
08:35:28<dmwit>Have you ever used GraphViz?
08:35:31<danra>no
08:35:33<Cale>oh, you also need to import Control.Concurent
08:35:38<Cale>Concurrent*
08:35:51<Cale>(for threadDelay)
08:35:59<bnijk>wait what are the imports for the second one
08:36:07<mmorrow>ACTION just destroyed his eardrums with high pitched pure sinewaves of death
08:36:13<Cale>I'll add a revision with the whole file :)
08:36:19<dmwit>danra: Okay, well, there's lots of information on the web about it, anyway.
08:36:33<dmwit>danra: The GraphViz library just produces input for the various graphviz executables.
08:36:55<bnijk>and just out of curiosity (looking at haskell wiki) is there a haskell word processor?
08:37:04<bnijk>or just IDEs and text editors
08:37:14<dmwit>There's no word processor that I know of.
08:37:23<dmwit>Are you going to make one?
08:37:35<bnijk>i'm more eager about making my game, dmwit
08:37:42<bnijk>but haskell + opengl is a goddamn nightmare
08:37:52<dmwit>huh
08:38:08<Cale>http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5112#a5114
08:38:08<bnijk>imagine marcel duchamp + escape velocity
08:38:21<bnijk>ah, ok
08:38:31<Cale>bnijk: I even added a function to play the scale for you :)
08:38:42<bnijk>ACTION compiles
08:38:52<Cale>I needed to run it as root.
08:39:02<bnijk>yeah
08:39:22<Cale>Oh, it doesn't have a main.
08:39:38<Cale>main = playScale 300 440
08:39:41<Cale>will do
08:40:04<bnijk>how do you compile
08:40:06<bnijk>ghc -S?
08:40:15<bnijk>mmnn ok
08:40:26<Cale>ghc --make beep
08:40:27<bnijk>nope
08:40:53<bnijk>nifty
08:41:02<bnijk>now to make it play "three blind mice"...
08:42:01<bnijk>wow that did not work quite right
08:42:06<bnijk>forgot to use whole steps
08:42:22<bnijk>screw this, it's gonna play 'smoke on the water'
08:42:26<mmorrow>here's my Beep module http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5115#a5115
08:43:22<mmorrow>gotta figure out now how to encode (Hz,Seconds) -> (?,?) that (ioctl_l 1 kDMKTONE) uses... then can make music
08:44:14<bnijk>cale: [floor (root * 2 ** (k/12)) | k <- [0,3,5,0,3,6,5,0,3,5,3,0]]
08:44:14<Cale>It doesn't need any permissions if you use /dev/tty, but then it only works for me in a real linux terminal, and not in gnome-terminal. :)
08:44:26<mmorrow>(warning: "toggle n", where n > ~70 or 80 is painful if the volume's up enough)
08:44:39<bnijk>:D
08:45:02<mmorrow>ah yeah, i had to switch to a no-X screen
08:45:04<bnijk>i've been thinking a lot over the past few months of what you can do with haskell and pcm
08:45:16<bnijk>i've been making music with granular synth for the past few years - but this has gotta be even better
08:45:18<mmorrow>bnijk: probably cool stuff
08:45:40<mmorrow>ooh, cool. yeah i bet haskell would be perfect
08:47:24<mmorrow>Cale: ooh, awesome just saw your paste
08:47:40<bnijk>oo even better
08:47:41<bnijk>floor (root * 2 ** (k/12)) | k <- [0,2,4,0,0,2,4,0,4,5,7,4,5,7,7,9,7,5,4,0,7,9,7,5,4,0,0,-5,0,0,-5,0]]
08:47:54<Cale>mmorrow: I just translated his C code
08:48:23<mmorrow>Cale: what C code?
08:48:26<mmorrow>oh, hah
08:48:35<mmorrow>i should've looked more closely
08:49:10<dmwit>Heh, I was wondering why I couldn't beep my speaker here, and then I remembered: I disabled those kernel modules. ^_^
08:49:17<mmorrow>err, i think the timeval is supposed to be a CLong
08:49:25<bnijk>holy crap look at all the midi programs in the AUR
08:49:48<Cale>mmorrow: Quite possibly. I didn't think too hard about it.
08:50:06<mmorrow>Cale: wouldn't that mess with the bit shifting though?
08:50:10<mmorrow>ACTION is confused
08:50:32<Cale>Well, the shift is only 16 bits.
08:51:02<Cale>So the resulting constant is only 32 bits anyway.
08:52:24<Cale>mmorrow: How do I get your beep to work?
08:52:29<mmorrow>Cale: ahhh. i just realized why my version was crushing my ears..
08:52:42<mmorrow>Cale: i didn't get that far :)
08:52:54<mmorrow>(although "toggle 50" e.g. works)
08:53:06<mmorrow>(don't go above 70 !!@)
08:53:44<bnijk>http://gimp.org/unix/howtos/gimp-midi.html :O :O :O
08:53:53<bnijk>and people tell me photoshop is better
08:54:03<mmorrow>Cale: oh, also it's outputing to stdout, so you need to be on a real tty
08:54:10<Cale>mmorrow: Ah...
08:54:49<dmwit>bnijk: Sounds... useful.
08:55:48<bnijk>it's clearly not
08:55:51<bnijk>what's important is that it's possible
08:55:55<Cale>bnijk: More than midi, it would be fun to have something to control the brush parameters in realtime using, say, the average amplitude and pitch of whatever's coming in on the microphone :)
08:56:10<bnijk>automatic livepainting cale :O
08:56:33<bnijk>although i suppose there's already visualization programs
08:56:43<bnijk>ACTION leaves to go make eggs
08:56:45<dmwit>There's tablets...
08:56:55<bnijk>that's not the point dmwit ;)
08:57:04<dmwit>ACTION is always missing the point
08:57:25<Cale>You could combine it with a tablet too :)
08:57:58<Cale>Hehe, have the pitch mapped to hue, with an octave producing the same colour. :)
08:58:07<Cale>(but maybe brighter? :)
08:58:14<bnijk>that reminds me
08:58:19<bnijk>i have to install that program...
08:58:20<bnijk>max
08:58:20<bnijk>!
08:59:57<bnijk>or something like that - video + audio programming
09:01:19<bnijk>as technology advances - imagine even thinking of this stuff a century ago
09:02:09<xmonader>anyone got hs-twitter installed ?
09:02:19<Axman6>ChilliX: you around?
09:02:46<Cale>xmonader: Not me...
09:02:56<xmonader>Cale :(
09:03:18<xmonader>i reinstalled json, installed < 4 and still :@
09:07:29<Axman6>ACTION thinks ChilliX should come down to canberra and give his data parallel haskell talk at ANU
09:09:27<Cale>眠いんで、お休み、みんな!
09:11:30<xmonader>Cale, :S
09:23:31<jn>does anyone have a more concise way of doing the following? http://paste.lisp.org/display/80642
09:25:58<skorpan>jn: i don't know, but shouldn't maxBound for Hours be "Hours 23"?
09:26:08<bnijk>yeah..and 0..59
09:26:29<bnijk>while you're at it
09:26:38<bnijk>ACTION coughs
09:26:41<jn>no.
09:26:49<bnijk>lol
09:27:24<jn>it's an inclusive/exclusive range
09:27:37<quicksilver>jn: well, instead of "ranged 0 24 Hours" you could do "ranged minBound maxBound Hours"
09:28:03<jn>aye, that removes the duplication, but it's still horribly long
09:28:18<quicksilver>then you can give 'ranged minBound maxBound' a name
09:28:36<jn>that's true
09:29:09<quicksilver>you'd need to change stuff slightly - maxBound would be (Hours 24) not just 24.
09:29:42<LeCamarade>What does it mean when a GHC program says "thread blocked indefinitely"?
09:29:47<jn>yeah. just would've thought there'd be some more concise way of making a bounded integral type.
09:30:16<skorpan>@hoogle a -> [a] -> [a]
09:30:17<lambdabot>Data.List intersperse :: a -> [a] -> [a]
09:30:17<lambdabot>Data.List insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a]
09:30:17<lambdabot>Data.List deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a]
09:30:21<LeCamarade>I only use MVar, SampleVars, and Chan from Control.Concurrent
09:31:35<quicksilver>LeCamarade: it means you have a deadlock.
09:31:51<quicksilver>LeCamarade: no thread can proceed because they are all waiting on another thread
09:33:27<LeCamarade>Hmm.
09:33:58<LeCamarade>I thought I had architected it to prevent that. But threads make quantum mechanics look all too deterministic.
09:43:16<ChilliX>Axman6: Hey
09:43:16<lambdabot>ChilliX: You have 1 new message. '/msg lambdabot @messages' to read it.
09:51:08<jn>http://paste.lisp.org/display/80643 think that's the best i can do
09:53:19<ivanm>What's the difference between isNumber and isDigit
09:53:20<ivanm>?
09:53:29<Beelsebob>@type isNumber
09:53:31<lambdabot>Char -> Bool
09:53:38<ivanm>they have the same type ;-)
09:53:41<Beelsebob>> isNumber '.'
09:53:42<lambdabot> False
09:54:00<Beelsebob>> isNumber '-'
09:54:02<lambdabot> False
09:54:03<Beelsebob>no idea
09:54:07<ivanm>duh, I should probably have a look at the docs rather than trying to get lambdabot to work it out for me...
09:54:17<Beelsebob>what is the diff?
09:54:48<ivanm>isNumber: "Selects Unicode numeric characters, including digits from various scripts, Roman numerals, etc. "
09:54:52<ivanm>isDigit is for 0..9
09:55:05<Beelsebob>oh, neat
09:55:20<RayNbow>> isNumber 'V'
09:55:22<lambdabot> False
09:55:41<ivanm>RayNbow: must be special unicode chars
09:55:48<RayNbow>yeah, I figured :p
09:56:04<Beelsebob>> isNumber '➁'
09:56:05<trofi^w>> isNumber "a number"
09:56:07<lambdabot> True
09:56:07<lambdabot> Couldn't match expected type `Char' against inferred type `[Char]'
09:56:22<Beelsebob>> isNumber '¾'
09:56:23<lambdabot> True
09:59:16<ivanm>Beelsebob: heh
09:59:39<dobblego>what is a good property for a beginner to automated testing to demonstrate ==> ?
09:59:45<ivanm>Beelsebob: what char is the first one you tried (before trofi^w's attempt)?
10:00:12<trofi^w>twho in a circle
10:00:19<ivanm>ahhh
10:01:07<lilac>> isNumber '²'
10:01:09<lambdabot> True
10:03:02<lilac>> isNumber '⁰'
10:03:04<lambdabot> True
10:03:28<lilac>> all isNumber "¹²³⁴⁵⁶⁷⁸⁹⁰"
10:03:30<lambdabot> True
10:05:18<lilac>@hoogle isNumber
10:05:19<lambdabot>Data.Char isNumber :: Char -> Bool
10:05:20<lilac>@hoogle whichNumberIsItThough
10:05:21<lambdabot>No results found
10:08:30<Axman6>> filter isNumber [chr 0 ..]
10:08:32<lambdabot> "0123456789\178\179\185\188\189\190\1632\1633\1634\1635\1636\1637\1638\1639...
10:08:52<Axman6>> text . drop 10 . filter isNumber $ [chr 0 ..]
10:08:53<lambdabot> ²³¹¼½¾٠١٢٣٤٥٦٧٨٩۰۱۲۳۴۵۶۷۸۹०१२३४५६à¥...
10:09:30<RayNbow>that doesn't look quite right :p
10:09:37<Axman6>no...
10:09:42<Axman6>> text . drop 30 . filter isNumber $ [chr 0 ..]
10:09:44<lambdabot> ۴۵۶۷۸۹०१२३४५६७८९০১২৩৪৫৬৭৮৯৴...
10:10:05<Axman6>> text . drop 20 . filter isNumber $ [chr 0 ..]
10:10:07<lambdabot> ٤٥٦٧٨٩۰۱۲۳۴۵۶۷۸۹०१२३४५६७८९০১২৩à...
10:12:03<int-e>> isNumber '¾'
10:12:06<lambdabot> True
10:15:19<ivanm>int-e: Beelsebob beat you to it ;-)
10:15:50<ivanm>Axman6: what does text do? display unicode chars?
10:15:54<ivanm>@type text
10:15:56<lambdabot>String -> Doc
10:16:00<ivanm>ahhh
10:16:49<skorpan>@pl (\x y -> x == 3)
10:16:50<lambdabot>const . (3 ==)
10:17:13<skorpan>isn't there any combinator for doing the same thing?
10:18:15<Botje>:t curry (first (==3))
10:18:16<lambdabot>forall a b. (Num a) => a -> b -> (Bool, b)
10:18:23<skorpan>:t first
10:18:25<lambdabot>forall (a :: * -> * -> *) b c d. (Arrow a) => a b c -> a (b, d) (c, d)
10:18:29<Botje>hmm, nope
10:18:43<Botje>fst . curry . first (==3) isn't really very readable :P
10:19:20<lilac>@type curry ((==3) . fst)
10:19:22<lambdabot>forall a b. (Num a) => a -> b -> Bool
10:29:13<pao>hi all, what is the most efficient way to parse an iso format timestamp stored in a ByteString?
10:30:34<opqdonut>write a state machine
10:32:44<ivanm>if I want to span a String such that I take the first part is either numbers of '.' and at most one lower case letter on the end, what would be the best way of doing it (without regexes!)?
10:33:23<dancor>is there an easy way to make (data MyData a = MyData {info :: [String], res :: Maybe a}) have a Monad instance that acts like (type MyData a = StateT [String] Maybe a)
10:33:25<ivanm>span (\c -> isDIgit c || c == '.') str, and then check the first char of the second bit of the String to see if it's a lower case letter?
10:34:07<mauke>@unmtl StateT [String] Maybe a
10:34:08<lambdabot>[String] -> Maybe (a, [String])
10:34:39<mauke>dancor: eh?
10:34:41<dancor>hm
10:34:53<pao>opqdonut: could you elaborate? :-)
10:34:54<dancor>i guess i don't understand StateT
10:35:30<dobblego>why do I get a warning and not an error for missing coarbitrary on Test.QuickCheck.Arbitrary instance declaration?
10:35:31<dancor>my thing should be like ([String], Maybe a) and bind should just concat the Strings and fail on any Nothing
10:35:35<dancor>i guess i have to write it out
10:36:11<dancor>@mtl [String] -> Maybe (a, [String])
10:36:11<lambdabot>Maybe you meant: ft map msg pl unmtl url
10:37:07<Lemmih>?unmtl MaybeT (Writer [String]) a
10:37:07<lambdabot>(Maybe a, [String])
10:39:03<lilac>ivanm: i got a parse error on your question :)
10:39:23<mmorrow_>Cale: new and improved Beep: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5118#a5118
10:39:42<mmorrow_>it's too bad you can only play one freq at a time..
10:40:12<dancor>beepcluster
10:40:26<mmorrow_>zomg
10:40:29<ivanm>lilac: I need to parse something that is of the form [0-9]+(\.[0-9]+)* with an optional trailing lowercase letter
10:40:50<ivanm>and I want to do so without regexes :( (since I want to have no deps apart from GHC and cabal)
10:43:05<Botje>i thought Text.Regex was in base nowadays?
10:44:06<dancor>{- verify possibleFinalLetter and put into your data structure -} where (mainThing, possibleFinalLetter) = span (\ x -> isDigit x || x == '.') ?
10:44:26<dancor>ivanm seems to be way ahead of me
10:44:56<dancor>you don't want .. tho
10:45:14<dancor>anyway it's easy to split on . and then work with the resulting list
10:45:24<ivanm>recursively?
10:45:30<ivanm>Botje: it isn't, AFAICT
10:45:44<yowgi>ivanm, how about with pattern matching and Maybe?
10:45:50<ivanm>Botje: in my 6.10.3 haddock page, there's no regex listed
10:45:56<Botje>> fmap (head) $ listToMaybe (reads "12345.6789p") :: Maybe (Double, Char)
10:45:58<lambdabot> Couldn't match expected type `[a]'
10:46:03<ivanm>yowgi: pattern matching? on each individual possible lowercase letter?
10:46:12<yowgi>sorry i meant guards
10:47:00<yowgi>parse (c:cs) | isNumber c = parseSecondPart cs c
10:47:11<yowgi>parseSecondPart using the span
10:47:38<yowgi>all other non-matching cases = Nothing
10:47:47<Botje>> fmap (second (head)) $ listToMaybe $ reads "12345.6789p" :: Maybe (Double, Char)
10:47:48<lambdabot> Just (12345.6789,'p')
10:47:50<ivanm>ummmmm.... that sounds kinda dodgy
10:47:54<Botje>ivanm: ^^
10:48:15<Botje>you probaby want to do something about the head and replace it with safehead, but that's one way.
10:48:22<dancor>what about 1.1.1p
10:49:00<BONUS>?umtl WriterT w (ContT r []) a
10:49:00<lambdabot>(a -> w -> [r]) -> [r]
10:49:07<BONUS>uhh
10:49:11<BONUS>is this correct?
10:50:08<ivanm>> fmap (second (head)) $ listToMaybe $ reads "12345.6789pa" :: Maybe (Double, Char)
10:50:09<lambdabot> Just (12345.6789,'p')
10:50:18<Botje>don't ask me, Cont* is scary voodoo magic
10:50:20<ivanm>> fmap (second (head)) $ listToMaybe $ reads "12345.6789-pa" :: Maybe (Double, Char)
10:50:22<lambdabot> Just (12345.6789,'-')
10:50:32<BONUS>isnt WriterT w (ContT r []) a supposed to be ((a,w) -> [r]) -> [r]
10:51:04<ivanm>I'm already doing a case on span (can't use reads, as it might have more than one .num part)
10:51:14<mauke>@unmtl ContT r (WriterT w []) a
10:51:14<lambdabot>(a -> [(r, w)]) -> [(r, w)]
10:51:49<BONUS>that one looks ok
10:51:52<BONUS>but
10:51:59<BONUS>@umtl WriterT w (ContT r []) a
10:51:59<lambdabot>(a -> w -> [r]) -> [r]
10:52:07<BONUS>this looks kinda wrong
10:52:56<mauke>I have to agree
10:55:43<BONUS>@umtl WriterT w (ListT Maybe) a
10:55:44<lambdabot>Maybe [(a, w)]
10:56:18<BONUS>this looks ok yeah but it screws it up for WriterT w (ContT r []) a
10:57:14<BONUS>who could be notified of this bug, i wonder
10:57:31<ivanm>ACTION wonders if learning/using Text.ParserCombinators would be worth it...
10:57:54<Botje>parsec is dead easy and dead sexy
11:00:30<mxc>botje - it is sexy.
11:01:13<lilac>ivanm: you want parse :: String -> ([Int], Maybe Char) ?
11:01:37<ivanm>no, I want parse :: String -> Maybe (String, String)
11:01:54<lilac>what are the two strings?
11:01:55<ivanm>though it _could_ be using ([Int], Maybe Char) as the first STring...
11:02:01<lilac>oh, ok :)
11:02:40<ivanm>the second String is the rest of the initial String
11:03:06<ivanm>so Reads String, but replacing [] with Maybe (well, I'm still using [] at the moment, but will probably switch)
11:09:24<Baughn>@tell conal http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5121#a5121 <-- Here, have another bug. I'm going away for the weekend.
11:09:25<lambdabot>Consider it noted.
11:09:59<raji>how do we write the set of regular expression that doesn't contain 110 as substring , i know the answer as (0|10)*1* , how to derive the answer ?
11:10:47<ivanm>Baughn: how considerate of you ;-)
11:11:34<kau>hello! why join (++) $ "to" doesn't works?
11:11:56<Baughn>> join (++) "to"
11:11:56<mauke>> join (++) $ "to"
11:11:58<lambdabot> "toto"
11:11:58<lambdabot> "toto"
11:12:02<kau>says me No instance for (Monad ((->) [Char]))
11:12:10<mauke>kau: import Control.Monad.Instances
11:12:16<kau>ok thanks!
11:13:52<Baughn>ivanm: My motto is "To serve Man".
11:13:54<kau>is there a function to upper case?
11:13:59<nominolo>is there any way to wait on a file to be filled? I only get eof exceptions
11:14:02<dobblego>> toUpper 'a'
11:14:04<lambdabot> 'A'
11:14:30<mauke>nominolo: manually
11:14:32<nominolo>without polling, of course
11:14:42<nominolo>mauke: ?
11:14:44<mauke>depends on the platform
11:14:49<mauke>linux has inotify
11:14:49<Baughn>nominolo: popen "tail -f" ..
11:14:53<mauke>tail -f pools
11:14:55<mauke>er, polls
11:15:06<Baughn>Hm? That's..
11:15:22<nominolo>all i want is to open a named pipe for clients to talk to my deamon
11:15:23<mmorrow_>inotify is pretty nice
11:15:42<Baughn>So it does. Huh, I figured it'd use whatever the OS had available.
11:15:45<nominolo>(I hate Vim for not having process state)
11:15:46<mauke>oh, so this is a pipe, not a normal file
11:15:52<nominolo>mauke: right
11:16:16<nominolo>mauke: though, that shouldn't make a difference for the client, does it?
11:16:30<nominolo>(And I don't even use Vim!)
11:16:38<mauke>opening a fifo blocks until the other end is opened
11:16:41<nominolo>@seen MarcWeber
11:16:41<lambdabot>I saw MarcWeber leaving #haskell 4m 4d 2h 3s ago, and .
11:16:59<mauke>but what do you mean by "filled"?
11:17:01<Baughn>*Closing* a FIFO produces sigpipe on the other end
11:17:15<mauke>incomplete
11:17:32<nominolo>Ok, let's start with the problem I'm trying to solve:
11:17:37<mauke>closing the read end of a fifo produces SIGPIPE if someone tries to write to it
11:17:45<lilac>> map reads ["123","123.","123.4"] :: [[(Int,String)]]
11:17:47<lambdabot> [[(123,"")],[(123,".")],[]]
11:17:47<lilac>^^ WTF?
11:18:10<nominolo>I'm trying to get Vim to communicate with a Scion server (which needs to remember some state)
11:18:19<lilac>is that really the correct behaviour for Read Int?
11:18:32<nominolo>But Vim (without using Python) cannot keep a reference to a process
11:18:35<mmorrow>nominolo: could you just use a tcp socket and listen on loopback?
11:18:52<Baughn>nominolo: Or a unix domain socket
11:19:07<dobblego>@type isPrefixOf
11:19:08<nominolo>so I want to have a small script that connects to the server whenever the vim user wants to do something that needs communicating with the server
11:19:09<lambdabot>forall a. (Eq a) => [a] -> [a] -> Bool
11:19:18<lilac>> let parse xs = do (v, ys) <- reads xs; case ys of { '!':zs -> do { (vs,t,rest) <- parse zs; return (v:vs,t,rest) }; z:zs | isLower z -> return (v:[],Just z,zs); _ -> return (v:[],Nothing,ys) } in parse "123!4456lxyq" :: [([Int],Maybe Char,String)]
11:19:20<lambdabot> [([123,4456],Just 'l',"xyq")]
11:19:20<nominolo>Baughn: right, domain sockets are secure
11:19:34<nominolo>but I had some problems getting quick startup times on Windows at least
11:19:36<Baughn>nominolo: ..well, depending on the OS
11:19:41<nominolo>it should connect within milliseconds
11:19:47<Baughn>nominolo: Domain sockets are *not* secure on all operating systems
11:20:00<nominolo>Baughn: right, but BSD sockets are even less so
11:20:15<Baughn>nominolo: Option 2: ~/.vim.cookie
11:20:19<Eelis>is there a reason why top-level if-blocks aren't supported in a cabal file? i want to make an optional executable that's only built/installed if a flag was passed.
11:20:27<nominolo>Baughn: hm, what is that?
11:20:40<mmorrow>nominolo: graphviz comes with a little handy script that starts vim with the given file, and opens a viewer window, then uses inotify to wait for changes to the file, and every time it sees one it updates the view of the graph
11:20:43<Baughn>nominolo: A bunch of random data your server writes that your client has to supply to be allowed in.
11:21:08<ivanm>Baughn: lol
11:21:10<lilac>@src Read Int
11:21:10<lambdabot>Source not found. My mind is going. I can feel it.
11:21:24<nominolo>Baughn: right, yeah, something like that. some sort of shared secret
11:21:41<nominolo>mmorrow: interesting. have a link?
11:22:07<nominolo>mmorrow: oh, inotify is Linux only?
11:22:16<Baughn>ivanm: Ah, I was wondering if you understood.
11:22:25<mmorrow>nominolo: the shell script is super simple (and you probably have it if you have graphviz), but it's http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5122#a5122
11:22:30<mmorrow>"vimdot"
11:22:38<mmorrow>nominolo: yeah, linux only unfortunately
11:23:38<ivanm>Baughn: was afk for a bit
11:24:10<ivanm>mmorrow: presumably it would work in BSD if the BSD kernel had support for it...
11:25:03<nominolo>the other option is to require python support for Vim. But already MacVim doesn't include a recent enough version... :/
11:25:58<mauke>require perl support instead!!
11:27:16<nominolo>mauke: is that more widespread?
11:27:36<mauke>no (I just like perl better)
11:27:44<nominolo>mauke: I know that in general perl is more widely available than python
11:27:53<BONUS>?umtl StateT s (WriterT w []) a
11:27:53<lambdabot>s -> [(a, s, w)]
11:28:07<BONUS>isnt this also supposed to be s -> [((a,s),w)]
11:28:18<nominolo>BONUS: it's isomorphic
11:28:29<BONUS>yeah that's true
11:28:36<mmorrow>(modulo a few undefined's)
11:28:44<nominolo>mmorrow: right, as always
11:28:55<BONUS>?umtl WriterT w (ContT r []) a
11:28:56<lambdabot>(a -> w -> [r]) -> [r]
11:29:01<BONUS>but is this isomorphic?
11:29:04<mauke>yes
11:29:08<BONUS>to ((a,w) -> [r]) -> [r]
11:29:09<mauke>see uncurry
11:29:13<BONUS>ah of course
11:29:18<nominolo>BONUS: module strictness
11:29:26<nominolo>modulo*
11:29:48<Baughn>ivanm: But you caught the reference. One of the greatest works of anti-rationalist propaganda of all time..
11:30:11<ivanm>Baughn: ummm.... you were quoting something?
11:30:19<ivanm>if so, I didn't catch the reference...
11:30:24<Baughn>ivanm: The silver chair
11:30:52<ivanm>never heard of it
11:31:07<Baughn>ivanm: "To serve man" is written above the main entrance to a giant's mansion. The punchline is, of course, "for dinner".
11:31:25<ivanm>oh, right, Narnia
11:31:35<ivanm>didn't recall it being that exact phrase...
11:32:32<Baughn>I wonder how C.S. Lewis would handle being one of the most hated authors in europe?
11:32:51<sioraiocht>Baughn: self-righteously?
11:32:59<Baughn>sioraiocht: Ah. Probably.
11:36:32<Adamant>who hates C.S. Lewis?
11:36:47<ivanm>Adamant: atheists
11:36:59<Baughn>Adamant: And rationalists
11:37:01<ivanm>IIRC, the golden compass, etc. was written directly as an anti-Narnia series
11:37:09<Adamant>ivanm: lol yeah
11:37:18<Adamant>that's why I can't take it seriously
11:37:30<Adamant>nobody even reads C.S. Lewis in the first place
11:37:46<dolio>I read all but one.
11:37:49<p_l>narnia isn't that bad, I guess it's more of the hype that surrounds it... hype turning a self-fueling hate machine...
11:37:53<Adamant>to get fired up enough about his writing to make a series of crappy fantasy novels....
11:38:32<dolio>That is, all but one Narnia book. I've never bothered reading his apologetics or anything, because I hear they're terrible.
11:39:11<p_l>ACTION hears about C.S.Lewis being so hated for the first time
11:39:22<decaf>p_l: me too
11:39:31<Baughn>Adamant: I read cs lewis. I didn't realize it was propaganda at the time, though. :P
11:39:43<Adamant>Baughn: everything's propoganda
11:39:50<Baughn>Adamant: That said, the golden compass is simply a lot better - as a book, not as propaganda. I think it fails in the latter sense..
11:39:56<Adamant>people are trying to convince you of their view
11:40:12<Adamant>Baughn: I don't like Narnia but Golden Compass is even worse
11:40:22<Baughn>No. There are plenty of works of fiction that are nothing more than works of fiction, with no author tracts mixed in.
11:40:47<Adamant>Baughn: name one. they're influenced by an author's beliefs and worldview
11:40:50<p_l>ACTION liked Narnia even more when he noticed parallels with Bible, having read Revelation quite a lot due to NGE...
11:41:20<O_4>NGE?
11:41:24<p_l>Baughn: They can still function as propaganda
11:41:28<Baughn>Neon genesis evangelion
11:41:35<O_4>Ah
11:42:04<Baughn>p_l, adamant: I don't think a book like.. hm, let's say Horatio Hornblower
11:42:18<Baughn>It's written to /entertain/, that's all
11:42:19<p_l>Baughn: Oh, it works very very well as propaganda :D
11:42:20<Adamant>Baughn: lol
11:42:28<Adamant>as an American, bullshit
11:42:42<decaf>a fairy tale with satirs is christian propaganda?
11:42:43<Adamant>Horatio takes out a US ship during the War of 1812
11:42:43<Baughn>p_l: How's that, anti-oldtimes propaganda?
11:42:54<Baughn>decaf: Aslan = Jesus. Take it from there.
11:42:55<p_l>Baughn: Actually books that aren't written directly as propaganda give me that effect the most :P
11:43:12<decaf>Baughn: aslan means lion in turkish, take this one :)
11:43:12<Adamant>in one of his books and it's portrayed as a good thing
11:43:28<Baughn>decaf: That doesn't surprise me a bit
11:43:31<p_l>Adamant: Of course it is :3
11:43:36<Baughn>Adamant: He's /british/
11:43:53<Adamant>Baughn: but it doesn't help your propoganda claim
11:44:02<Adamant>in fact it reinforces min
11:44:04<Adamant>e
11:44:05<p_l>decaf: I'd say... just last book of Narnia
11:44:17<Baughn>Adamant: Perhaps it'd work as propaganda if I were british myself
11:44:53<Baughn>(But probably not. I'm.. not anti-nation, but at least rather neutral towards the concept.)
11:44:56<p_l>Baughn: What about seeing the actions of characters and thinking to yourself "now that's something I'd like to see IRL"?
11:45:24<Baughn>p_l: Then that isn't changing your ideas, it's just highlighting an existing one
11:46:00<Baughn>decaf: Oh, and the silver chair - the book explicitly states hat wishful thinking is preferable to reality.
11:46:17<p_l>Baughn: Or changing the bias... quite possibly you won't meet anything new...
11:48:35<decaf>Baughn: I'm very sorry to tell this: if that tale is a christian propaganda, that proof that christians are as 'smart' as my people (muslum turks)
11:49:14<Baughn>decaf: Mm. Hate to break it to you, but theists are equally irrational regardless of religion.
11:49:33<Baughn>Some may make it more visible, but overall.. *pout*
11:49:44<p_l>afaik narnia was written for tolkien... wasn't it some kind of wager, btw?
11:50:44<Baughn>'Tolkien disliked the first Narnia book, published in 1950, telling the author it had too many clashing elements and was pushing the Christianity "message" too far. He also apparently "hated" Lewis's allegorical fight between good and evil, with Jesus represented by Aslan the Lion.' <-- Not exactly.
11:51:17<Baughn>And yet, Tolkien was the one who converted Lewis from atheist to christian. :/
11:51:35<p_l>Baughn: Lewis writing it with Tolkien in mind doesn't clash with Tolkien not liking end result :P
11:51:36<Baughn>Converts are always the most fervent, I guess
11:56:07<Baughn>decaf: http://www.guardian.co.uk/books/2005/dec/05/cslewis.booksforchildrenandteenagers <-- Yeah, that about covers it.
11:58:06<quicksilver>Baughn: ERROR : Article too long.
11:58:06<quicksilver>:)
11:58:55<decaf>Baughn: I didn't read anything about lewis until a few minutes ago.
12:03:41<ivanm>quicksilver: you mean tl;dr ? :p
12:15:01<FalconNL>Does anyone know a way to take the log of large numbers? logBase 10 (10^308) == 308.0, but logBase 10 (10^309) == Infinity
12:15:20<Baughn>> 10^309
12:15:22<lambdabot> 100000000000000000000000000000000000000000000000000000000000000000000000000...
12:15:25<Baughn>> 10^309 :: Double
12:15:27<lambdabot> Infinity
12:15:31<mauke>> logBase 10 (10^309) :: CReal
12:15:32<lambdabot> 309.0
12:15:50<Baughn>> 10^309 :: CReal
12:15:52<lambdabot> 100000000000000000000000000000000000000000000000000000000000000000000000000...
12:16:05<Baughn>..what's going on here?
12:17:37<ivanm>Baughn: what do you mean?
12:17:45<ivanm>CReal is computable reals (by roconnor?)
12:17:50<Baughn>Well, CReal shouldn't have greater range than..
12:18:00<Baughn>Oh. So, not a Foreign.C type
12:18:05<ivanm>no
12:18:31<mauke>there is no 'real' type in C
12:18:37<ivanm>is there any sample usages or tutorials on how to use Text.ParseCombinators.ReadP?
12:23:41<augustss>CReal is based on David Lester's code.
12:27:43<FalconNL>Hm. If I call intLength (10^20000), where intLength n = succ . floor . logBase 10 $ (fromIntegral n :: CReal), it takes 1.5 seconds. Surely CReal can't be that slow?
12:27:51<ivanm>it is
12:27:53<ivanm>it's all functions
12:28:02<ivanm>rather than actually "storing" the number
12:28:24<EvilTerran>> exp (sqrt (-1) * pi) :: Complex CReal -- it is pretty cool, tho, even if it is slow
12:28:25<lambdabot> (-1.0) :+ 0.0
12:28:50<ivanm>> exp (sqrt (-1) * pi) :: Complex Double
12:28:52<lambdabot> (-1.0) :+ 1.2246467991473532e-16
12:28:54<ivanm>heh
12:29:44<FalconNL>Ok, let's try this another way then. What I'm trying to do is to determine the length of the decimal representation of a number in a faster way than length . show. Since the log-based approach doesn't seem to be working very well, does anyone know another way?
12:30:07<ivanm>any particular reason why you want to do so?
12:30:32<ivanm>and of what datatype are you finding said length?
12:30:40<FalconNL>for an algorithm to work with palindrome numbers for http://programmingpraxis.wordpress.com/2009/05/22/the-next-palindrome/
12:30:45<ivanm>(since for a CReal, you can have infinite length...)
12:30:51<ivanm>> pi :: CReal
12:30:53<lambdabot> 3.1415926535897932384626433832795028841972
12:31:01<FalconNL>Since the algorithm needs to work up to 10^1000000, probably Integers
12:31:05<ivanm>that's right... defaults to 20 decimal places or something...
12:31:33<ivanm>FalconNL: so by "decimal", you didn't mean "number of places after the decimal point"?
12:31:52<quicksilver>"decimal" means "representation in base 10" :P
12:32:05<FalconNL>no, I meant the amount of digits when shown in base 10, so 1001 -> 4, 17 -> 2, etc.
12:32:06<EvilTerran>FalconNL, binary search to find i such that 10^i <= x < 10^(i+1)?
12:32:19<ivanm>quicksilver: true, but I'm so used to having it mean "decimal places" when dealing with students, that that's what I automatically assume
12:32:26<ivanm>FalconNL: divide it by a really big number
12:32:29<ivanm>then log it
12:32:44<ivanm>something like that
12:32:51<ivanm>(Basically, you scale it down)
12:33:02<quicksilver>FalconNL: does (floor . logBase 10) for doubles not work well?
12:33:18<quicksilver>oh, 10^(10^6)
12:33:23<quicksilver>yeah that's too big for that :)
12:33:36<EvilTerran>it seems ugly to get floating point involved in a problem on integers
12:33:40<FalconNL>quicksilver: If you try it with doubles it fails at 10^309. It works fine for 10^308
12:33:59<quicksilver>EvilTerran: it is ugly, but it's sometimes faster. In this case it simply fails.
12:34:07<quicksilver>EvilTerran's binary search sounds good.
12:34:20<quicksilver>writing a fast version of length . show is another possibility.
12:36:39<EvilTerran>another possibility would be looking at the GHC internals of Integer
12:37:01<EvilTerran>you might even be able to do it O(1) that way with a bit of fudging
12:37:27<lilac>FalconNL: why not do it with a string?
12:37:35<quicksilver>lilac: he said it was too slow.
12:38:15<lilac>quicksilver: i meant do the whole problem in a String and never go to a number representation
12:38:17<FalconNL>lilac: because length $ show $ 10^1000000 takes about 800 ms
12:39:14<quicksilver>ah nod.
12:39:43<Baughn>@tell conal I've isolated the bug in my previous paste to filterE. I will now proceed to pine for my laptop all weekend.
12:39:43<lambdabot>Consider it noted.
12:50:52<byorgey>ACTION makes lambda-rhubarb muffins
12:51:04<Badger>:)
12:51:06<opqdonut>how about curry-howard muffins
12:51:18<byorgey>those are good too
12:51:21<Badger>curried howard?
12:51:36<dev31212>hi quicksilver
12:51:38<dev31212>hi all
12:51:53<byorgey>hi dev31212
12:52:01<dev31212>hy byorgey
12:52:03<dev31212>how goes it
12:52:29<byorgey>quite well, how are you?
12:52:55<Baughn>@tell conal Compare the existing definition of filterE with this: "filterE p m = justE $ (\i -> if p i then Just i else Nothing) <$> m". Neither /works/, but this one works /better/ - I suppose some odd laziness issues there, since they look identical to me.
12:52:56<lambdabot>Consider it noted.
12:52:59<dev31212>Im good thanks...I negotiated an easier work load, so I have more time to devote to my haskell web project
12:53:06<dev31212>less pay, but less stress and more time..so Im happuy
12:53:14<gio123>is here any german speakers?
12:53:23<dev31212>Im evaluating a framework called "Kibro" at the moment..
12:53:26<dev31212>know anything about it?
12:53:56<ivanm>gio123: I would say that Germany is full of German speakers
12:54:02<ivanm>here, though, is a different story ;-)
12:54:05<dev31212>hi ivanm
12:54:10<quicksilver>Baughn: I discussed an alternative implementation of filterE with conal.
12:54:10<ivanm>hey dev31212
12:54:20<dev31212>Jr parle un pue de le feancais, si-tu-plait
12:54:23<quicksilver>Baughn: it doesn't work for his implementation although it does for mine.
12:54:33<quicksilver>Baughn: might be interesting to you.
12:54:35<dev31212>je*
12:54:56<dev31212>hayoo kibro
12:55:01<dev31212>> hayoo kibro
12:55:02<lambdabot> Not in scope: `hayoo'Not in scope: `kibro'
12:55:15<frwmanners>Baughn: so, I came to the conclusion that no version of filterE could work with reactive-10.5's structure of time
12:55:27<opqdonut>@hackage kibro
12:55:28<lambdabot>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/kibro
12:55:32<frwmanners>Baughn: as in, AddBounds (Improving Stuff)
12:55:33<dev31212>Thanks :)
12:55:45<opqdonut>:)
12:55:47<dev31212>Anyone know about kibro? I cant find a web page or a tutorial for it
12:56:27<dev31212>I am trying to avoid building my own web framework...but on the other hand that might be the best way for me to learn the language..
12:56:52<dev31212>hmm
12:57:00<dev31212>I think I just made an argument for making my own framework
12:57:37<ivanm>so we get Yet Another Haskellian Web Framework?
12:57:45<dev31212>Yeah :)
12:57:51<dev31212>From a former PHP guy
12:57:57<dev31212>well current...hope to be former one day
12:58:03<mauke>ACTION runs away
12:58:05<EvilTerran>better write a monad tutorial (and library!) as well ;P
12:58:05<dev31212>lol
12:58:19<boml>mauke: what does this part do "use List::Util qw(reduce)"
12:58:41<ivanm>EvilTerran: what kind of library?
12:58:48<boml>he's gone. I'll just send it to everyone
12:58:57<boml>what does this mean? use List::Util qw(reduce)
12:59:03<quicksilver>Baughn: it's perl.
12:59:06<quicksilver>oops
12:59:08<quicksilver>boml: it's perl.
12:59:23<boml>yepp
12:59:26<ivanm>I know it's compulsory to write a monad tutorial (something I've been remiss in), but it's compulsory to write a library as well? :s
13:01:35<EvilTerran>ivanm, well, judging by the number of 'em on hackage
13:01:53<ivanm>aren't half of them by dons and mmorrow?
13:01:53<ivanm>;-)
13:02:04<EvilTerran>"... Middleware (1), Monadic Regions (1), Monads (24), Music (11) ..."
13:03:08<decaf>'google suggest' helps to type "What the hell are monads?"
13:04:02<ray>:t (>>=)
13:04:03<lambdabot>forall (m :: * -> *) a b. (Monad m) => m a -> (a -> m b) -> m b
13:04:08<ray>^^ monad tutorial
13:04:26<ivanm>@quote endofunctors
13:04:27<lambdabot>psykotic says: [monads aren't hard] they're just monoids on the category of endofunctors over some category, what's the big deal?
13:04:34<ivanm>^^ that's what monads are!
13:04:57<EvilTerran>in terms of general monad libs, there's MonadLab, monadLib, and mtl, at least; not to mention category-extras & co's shennanigans
13:04:57<ivanm>I was actually after the supposed wadler quote, but that'll do (since it's basically the same thing)
13:05:10<ivanm>does that mean that psykotic came up with that first?
13:05:18<mauke>@quote chocolate
13:05:18<lambdabot>Duqicnk says: a monad is like a train that runs backwards in time, which is made of tiny chocolate robots
13:05:37<ivanm>EvilTerran: IIRC, don't most people adovcate using monadlab or monadlib rather than mtl as they're much better libraries?
13:05:56<ivanm>and monad transformers are better defined/thought up nowadays than when mtl was written?
13:06:05<ivanm>mauke: O...K... then...
13:07:10<EvilTerran>ivanm, yeah, i think that's the case; not sure how m'lab and m'lib compare, tho
13:07:18<jonte>Hello boys and girls! I have a problem. I have a function returning (Maybe a, Splay a),it's called 'insert', and I wish to assign this return value to two variables (pattern match). I'm doing this: where; (e, t) = insert elem tree. What am I doing wrong? :) Thanks!
13:07:53<quicksilver>jonte: that's fine except for the ; after where
13:08:03<mauke>jonte: what's the error message?
13:08:42<EvilTerran>quicksilver, isn't a ; valid there if you're using explicit layout?
13:08:48<jonte>quicksilver, That'äs just for line breaking in the chat.. hmm.. The error I get is: Type error in right hand side, (Maybe c) doesn't match (a,b)
13:08:48<quicksilver>I'm not sure.
13:09:03<quicksilver>then your insert doesn't return (Maybe a,Splay a)
13:09:09<quicksilver>even though you claim it does :P
13:09:14<quicksilver>it returna (Maybe c)
13:09:24<mauke>maybe it returns Maybe (a, Splay a)
13:09:31<EvilTerran>> let { foo = bar where; bar = () } in foo
13:09:33<lambdabot> ()
13:09:35<tetha>hehe, reasons to add explicit type signatures
13:10:01<EvilTerran>^ you're allowed blank lines in layout blocks, so it makes sense that that's valid, really.
13:10:05<jonte>Hmm! I'll have to look in the library. it SHOULD return that. :)
13:10:35<jonte>Oh. Darn. You're right. :P Sorry to bother you guys. :)
13:11:05<EvilTerran>> () where {;;} -- listening to sad music in oversized headphones?
13:11:06<lambdabot> ()
13:11:38<tetha>heh
13:11:56<tetha>or cthuhlu with headphones
13:13:04<Japsu>Every time you misspell fhtagn, Cthulhu eats a cultist.
13:13:12<Japsu>Please, think about the cultists.
13:13:57<ivanm>@type where
13:13:58<lambdabot>parse error on input `where'
13:13:59<tetha>since I like him and dislike cultists, I guess misspelling is a good thing
13:14:04<ivanm>duh
13:18:28<EvilTerran>@type () where {}
13:18:29<lambdabot>parse error on input `where'
13:18:36<EvilTerran>> () where {} -- rather
13:18:38<lambdabot> ()
13:19:50<ray>> () where ()
13:19:52<lambdabot> <no location info>: parse error (possibly incorrect indentation)
13:20:02<ray>therefore, haskell sucks
13:20:07<ivanm>:o
13:20:09<ivanm>@slap ray
13:20:09<lambdabot>ACTION beats up ray
13:20:12<opqdonut>:D
13:20:23<EvilTerran>> ({-) where (-})
13:20:24<lambdabot> ()
13:20:38<ivanm>EvilTerran: heh
13:20:43<mauke>> () where () = ()
13:20:44<lambdabot> ()
13:20:48<ivanm>ACTION has no idea wtf it's meant to do though...
13:21:03<ivanm>mauke: you can set () to equal something? :o
13:21:06<ivanm>> () where () = 1
13:21:07<lambdabot> No instance for (Num ())
13:21:08<lambdabot> arising from the literal `1' at <intera...
13:21:10<mauke>> 1 where 2 = 3
13:21:10<ivanm>heh
13:21:12<lambdabot> 1
13:21:21<kpreid>ivanm: no, it's a pattern match with no variables
13:21:22<ray>making it symmetrical with comments is cheating
13:21:27<ivanm>mauke: that works because 2 isn't evaluated/defined?
13:21:28<mauke>> let 2 + 2 = 5 in 2 + 2
13:21:29<lambdabot> 5
13:21:32<ivanm>kpreid: oh, yeah
13:21:38<ivanm>mauke: :o
13:21:42<ivanm>and how does _that_ work?
13:21:51<quicksilver>it redefines (+)
13:21:52<ray>it's defining +
13:21:54<kpreid>since it's not in a case or lambda, it doesn't even care if it matches
13:21:58<quicksilver>> let 2 + 2 = 5 in 2 + 3
13:22:00<lambdabot> * Exception: /tmp/7791359399523594690:71:56-64: Non-exhaustive patterns in ...
13:22:00<kpreid>> () where False = True
13:22:01<lambdabot> ()
13:22:16<ivanm>quicksilver: you can do that? :o
13:22:18<quicksilver>it's a bug in lambdabot that it accepts 'where' on a top level expression, by the way.
13:22:22<Peaker>@type let 2+2=5 in (+)
13:22:23<ivanm>@type let 2 + 2 = 5 in 2 + 2
13:22:24<lambdabot>forall t t1 t2. (Num t2, Num t1, Num t) => t -> t1 -> t2
13:22:24<lambdabot>forall t. (Num t) => t
13:22:31<quicksilver>ivanm: you can define any operator. You can shadow any variable.
13:22:34<kpreid>> let 2 + k = succ (succ k) in 2 + 2 + 2
13:22:35<lambdabot> * Exception: /tmp/7038665918903841508:71:52-72: Non-exhaustive patterns in ...
13:22:35<quicksilver>ivanm: (+) is not magic.
13:22:41<kpreid>> let 2 + k = succ (succ k) in 2 + (2 + 2)
13:22:43<lambdabot> 6
13:22:48<ivanm>quicksilver: yes, but it's already defined for the numeric types...
13:23:08<EvilTerran>quicksilver, i thought it was a deliberate feature, tbh. it's kinda useful.
13:23:27<ray>> let id _ = error "i shadowed id" in id ()
13:23:29<lambdabot> * Exception: i shadowed id
13:23:59<ivanm>ACTION didn't know you could override/shadow top-level values/functions...
13:24:07<EvilTerran>and it would suggest a point to the "let v = ... in v" which has lead to shennanigans in the past
13:24:10<EvilTerran>@v
13:24:10<lambdabot>"\"\\\"\\\\\\\"\\\\\\"
13:24:48<quicksilver>ivanm: you can override shadow anything.
13:25:10<EvilTerran>well, apart from reserved words/symbols
13:25:36<mauke>> let pi = text "π" in pi
13:25:37<lambdabot> π
13:25:54<doserj>> let qualified = 3 in qualified
13:25:54<lambdabot> 3
13:26:00<doserj>ACTION is cheating
13:26:34<EvilTerran>ACTION notes that the newbie error of "case ... of ...; otherwise -> ..." doesn't get caught because of this very shadowing
13:26:58<ivanm>EvilTerran: because otherwise becomes a variable that matches anything?
13:27:02<ivanm>rather than an alias for True?
13:27:04<ivanm>> otherwise
13:27:06<lambdabot> True
13:27:11<Badger>> let everything = 42 in everything
13:27:13<lambdabot> 42
13:27:13<ivanm>@index otherwise
13:27:13<lambdabot>Data.Bool, Prelude
13:27:25<EvilTerran>ivanm, exactly, and then things get very odd if you try to use it in a guard within that case branch
13:27:34<ivanm>EvilTerran: heh
13:29:00<EvilTerran>?type \x -> case x of Nothing -> "foo"; otherwise | fromJust x == "bar" -> "baz" | otherwise -> "eek" -- silly contrived example
13:29:01<lambdabot> Couldn't match expected type `Bool'
13:29:01<lambdabot> against inferred type `Maybe [Char]'
13:29:01<lambdabot> In a stmt of a pattern guard for
13:30:04<cnwdup>> let braces = between (string "{") (string "}"); expr = braces expr <|> many (noneOf "{}") in parse expr "" "parse me!"
13:30:06<lambdabot> Not in scope: `between'Not in scope: `string'Not in scope: `string'Not in s...
13:30:22<cnwdup>Mh, parsec's not in scope? ):
13:30:26<quicksilver>nope.
13:30:34<cnwdup>Anyways, can anyone explain why this results in a stack overflow:
13:30:42<cnwdup>let braces = between (string "{") (string "}"); expr = braces expr <|> many (noneOf "{}") in parse expr "" "{ }"
13:30:51<cnwdup>I do not see why.
13:31:57<quicksilver>cnwdup: it yields 'Right " "' for me.
13:32:25<cnwdup>Ups. I meant parse (many expr "" "{ }".
13:32:42<mauke>many/many
13:33:06<quicksilver>(many expr)
13:33:06<quicksilver>?
13:33:07<mauke>you now have an infinite sequence of zero-length matches
13:33:13<cnwdup>Ah. Okay.
13:33:14<EvilTerran>cnwdup, well, many can match the empty string
13:33:28<EvilTerran>ACTION pokes his lag-o-meter
13:33:31<mauke>ACTION recommends Mastering Regular Expressions :-)
13:33:47<Berengal>Empty strings are evil
13:33:54<Berengal>Don't match them
13:34:32<maltem>mauke, sure, and then they're going to match expressions with matching braces
13:35:00<mauke>not a problem
13:35:44<EvilTerran>cnwdup, i would suggest braces = between (char '{') (char '}'); expr = braces expr <|> many1 (noneOf "{}")
13:35:48<EvilTerran>(i think it's called many1)
13:36:22<cnwdup>EvilTerran, yeah. I ended up with expr = braces (many1 expr) <|> many1 (noneOf "{}"). Thank you guys.
13:36:33<rubendv>is it possible to implement fromIntegral in regular Haskell?
13:36:43<mauke>many1/many1
13:36:53<EvilTerran>mauke, ?
13:36:57<mauke>infinite backtracking avoided thanks to parsec's early commit
13:36:58<doserj>@src fromIntegral
13:36:59<lambdabot>fromIntegral = fromInteger . toInteger
13:37:30<EvilTerran><mauke> many/many <mauke> many1/many1 <- IDGI
13:37:41<rubendv>how about fromInteger and toInteger then?
13:37:56<mauke>my $expr = qr/\{(?0)\}|[^{}]*/;
13:38:15<EvilTerran>rubendv, if the type you're writing an instance for is in regular haskell, yes
13:38:18<mauke>EvilTerran: "many applied to many applied to something"
13:38:24<mauke>i.e. direct nesting
13:38:41<rubendv>EvilTerran: so it is not possible for builtin types like Int
13:38:57<EvilTerran>rubendv, well, seeing as they're not "regular haskell"...
13:39:09<EvilTerran>although they could be defined as such, seeing as they're abstract
13:39:15<rubendv>I see
13:39:29<rubendv>I was just wondering about that, thank you.
13:40:33<EvilTerran>?src Bool
13:40:33<lambdabot>data Bool = False | True deriving (Eq, Ord)
13:40:39<EvilTerran>rubendv, note Bool is "regular haskell"
13:41:20<EvilTerran>so not all Prelude types are "built in" by this definition
13:41:39<ivanm>I notice here that regex-{base,posix,compat} are included in the ghc documentation: http://www.haskell.org/ghc/docs/latest/html/libraries/index.html
13:41:40<maltem>mauke, humph. ok, if you read "regular expression" as "not-so-regular regular expression", then sure, no problem
13:41:50<ivanm>is this part of extralibs or something, because on my local install they're not...
13:42:04<rubendv>So fromInteger and toInteger are functions you have to define when making an Integral instance?
13:42:12<mauke>maltem: pretty much all regexes are irregular
13:42:15<ivanm>@src Integral
13:42:15<lambdabot>class (Real a, Enum a) => Integral a where
13:42:15<lambdabot> quot, rem, div, mod :: a -> a -> a
13:42:15<lambdabot> quotRem, divMod :: a -> a -> (a,a)
13:42:15<lambdabot> toInteger :: a -> Integer
13:42:23<ivanm>rubendv: fromInteger is in Num
13:42:30<ivanm>toInteger is in INtegral
13:43:03<maltem>mauke, I hoped that if there were a place for straight terminology, it would be #haskell :))
13:43:22<rubendv>I see
13:44:05<rubendv>Makes sense :), thank you.
13:45:47<Spockz|lap>test
13:46:29<ivanm>sorry, but your test failed due to insufficient input
13:46:49<Spockz|lap>darn, sorry. I thought it would only run on the active server.
13:48:08<ivanm>heh
13:58:10<lilac>FalconNL: how fast does this palindrome thing have to be?
13:59:00<lilac>FalconNL: is 1.066s for 1000000 digits quick enough?
13:59:03<ivanm>lilac: you do realise he was asking about 1.5 hrs ago, don't you?
13:59:13<lilac>ivanm: yes, but i've been at lunch :)
13:59:17<FalconNL>lilac: there's no real requirement, but the faster the better. I'm currently reworking my algorithm a bit to make it faster
13:59:18<ivanm>lilac: IIRC, he was after 10^309 digits...
13:59:19<ivanm>heh
14:01:50<skorpan>can a logical predicate take two arguments?
14:01:57<lilac>the universe doesn't have enough space to store a number with 10^309 digits...
14:01:58<skorpan>e.g. P(x, y)
14:02:32<FalconNL>I only need 10^6 digits, which is 10^(10^6). logBase fails at 10^309
14:03:50<lilac>yep, my approach works for 10^6 digits
14:04:08<opqdonut>skorpan: yes, usually
14:04:39<skorpan>could this function be written any prettier? http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5126#a5126
14:05:03<skorpan>i tried to rewrite it using a fold, but failed
14:05:38<opqdonut>skorpan: it's pretty nice as it is
14:06:05<skorpan>i usually try to avoid helper functions like that one and it sure feels pretty foldy
14:06:05<opqdonut>you could turn the case into guards for the duplicatesBy' definition
14:06:13<FalconNL>liliac: would you mind showing your solution? Obviously you're doing something faster than I currently am
14:06:24<Twey>skorpan: duplicatesBy f = groupBy f . sortBy (comparing f)
14:06:26<opqdonut>if you wrote that as a fold, it'd have to be a fold over the tails of a list
14:06:27<Twey>No?
14:06:46<opqdonut>Twey: yeah but that needs an ordering
14:06:50<Twey>Or, wait, probably not comparing f
14:06:56<skorpan>Twey: comparing puts Ord
14:06:57<Twey>Yeah
14:06:58<skorpan>yeah
14:06:59<skorpan>:)
14:07:09<opqdonut>and it'd also need a (head . filter (\x -> length x >= 1))
14:07:35<Twey>a.k.a. (head . filter (not . null))
14:07:55<opqdonut>gah, i meant length x > 1
14:08:05<Twey>Ah
14:08:06<Twey>Yeah
14:08:13<paper_cc>well... nubBy f xs = map fst $ filter (not . uncurry f) $ zip xs (tail xs), but it fails on xs == []
14:08:15<skorpan>any other suggestions?
14:08:32<opqdonut>hmm, duplicatesBy ys = [x | (x:xs) <- tails ys, isJust $ find (p x) xs]
14:08:37<Twey>@index [a] -> [[a]]
14:08:37<lambdabot>bzzt
14:08:37<paper_cc>skorpan: ^^above
14:08:44<Twey>@hoogle [a] -> [[a]]
14:08:45<lambdabot>Data.List inits :: [a] -> [[a]]
14:08:45<lambdabot>Data.List tails :: [a] -> [[a]]
14:08:45<lambdabot>Data.List groupBy :: (a -> a -> Bool) -> [a] -> [[a]]
14:08:57<Twey>Hmm
14:09:01<skorpan>> let duplicatesBy p ys = [x | (x:xs) <- tails ys, isJust $ find (p x) xs] in duplicatesBy (==) [1,2,3,1,2]
14:09:03<lambdabot> [1,2]
14:09:08<skorpan>> let duplicatesBy p ys = [x | (x:xs) <- tails ys, isJust $ find (p x) xs] in duplicatesBy (==) [1,2,3,1,2,4,2]
14:09:10<lambdabot> [1,2,2]
14:09:18<skorpan>hm, this is not right
14:09:35<opqdonut>skorpan: same behaviour as your function
14:09:36<skorpan>my original function does the wrong thing...
14:09:42<opqdonut>multpile duplicates... yeah
14:09:54<skorpan>no, my function doesn't give multiple duplicates
14:09:55<paper_cc>@ty \f xs -> map fst $ filter (uncurry f) $ zip xs (tail xs) -- this is wrong the same way
14:09:57<lambdabot>forall a. (a -> a -> Bool) -> [a] -> [a]
14:10:02<skorpan>the problem is that i want *all* duplicates!
14:10:06<skorpan>and yours doesn't do that either :)
14:10:24<skorpan>so dupsBy (==) [1,2,3,1,2] would give me [1,2,1,2]
14:10:29<opqdonut>yeah
14:10:55<skorpan>(this is for a little verifier returning any multiple function declarations)
14:11:24<skorpan>so i need to be able to provide any predicate and have all the duplicates
14:11:38<FalconNL>lilac: would you mind showing your solution? Obviously you're doing something faster than I currently am
14:12:36<skorpan>i think another "case" does it
14:12:45<skorpan>yes, it does.
14:13:00<skorpan>updated ugly version: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5127#a5127
14:13:37<paper_cc>> inits [1..5]
14:13:39<lambdabot> [[],[1],[1,2],[1,2,3],[1,2,3,4],[1,2,3,4,5]]
14:13:40<byorgey>skorpan: doesn't that return the duplicates in reverse order?
14:13:44<byorgey>or maybe that doesn't matter
14:13:45<paper_cc>> tails [1..5]
14:13:47<lambdabot> [[1,2,3,4,5],[2,3,4,5],[3,4,5],[4,5],[5],[]]
14:14:01<skorpan>byorgey: doesn't really matter, but ideally i'd want them in the right order
14:14:06<skorpan>i guess reverse would do that
14:14:14<byorgey>yeah, just stick in a call to reverse
14:14:34<rubendv>skorpan: looks like you could use the Maybe monad
14:14:42<skorpan>rubendv: i thought so too, but can't figure out how
14:14:50<skorpan>Nothing >>= _ = Nothing
14:14:56<doserj>> let dupsBy p ys = [b | n <- [0..(length ys) -1], let (as,b:bs) = splitAt n ys, any (p b) (as++bs)] in dupsBy (==) [1,2,3,2,4,2,1]
14:14:58<lambdabot> [1,2,2,2,1]
14:15:09<rubendv>you could redefine it perhaps?
14:15:23<byorgey>off the top of my head, I don't think you can use the Maybe monad
14:15:23<skorpan>rubendv: what do you mean?
14:15:31<byorgey>because Nothing here doesn't indicate overall failure.
14:15:36<skorpan>indeed
14:15:40<rubendv>or is that something you can't do?
14:15:40<byorgey>it just means that element isn't a duplicate.
14:16:23<byorgey>rubendv: what, redefine >>= for Maybe?
14:16:30<byorgey>you can't really do that
14:16:42<paper_cc>> let splits xs = zipWith (++) (inits xs) (tail $ tails xs) in splits [1..4]
14:16:43<byorgey>you wouldn't really want to, anyway
14:16:45<lambdabot> [[2,3,4],[1,3,4],[1,2,4],[1,2,3]]
14:17:51<rubendv>and what if you define >>= for a Maybe SomeDataType?
14:18:20<skorpan>that doesn't make sense to me
14:18:46<skorpan>this function is intended to be somewhat generic
14:18:55<quicksilver>that is mplus
14:18:58<quicksilver>in the Maybe monad
14:19:03<quicksilver>> Nothing `mplus` Just 3
14:19:05<lambdabot> Just 3
14:19:08<skorpan>ah
14:19:28<doserj> > let dupsBy p ys = [b | (as,b:bs) <- init $ zip (inits ys) (tails ys), any (p b) (as++bs)] in dupsBy (==) [1,2,3,2,4,3,2,1]
14:19:30<doserj>> let dupsBy p ys = [b | (as,b:bs) <- init $ zip (inits ys) (tails ys), any (p b) (as++bs)] in dupsBy (==) [1,2,3,2,4,3,2,1]
14:19:32<lambdabot> [1,2,3,2,3,2,1]
14:19:50<davidL>does this data surprise anyone? http://web.cecs.pdx.edu/~lazard/chart.png Why would I use one over another for dumping a [Word8] to a file?
14:20:21<skorpan>> let dupsBy p ys = [b | (as,b:bs) <- init $ zip (inits ys) (tails ys), any (p b) (as++bs)] in dupsBy (==) []
14:20:22<lambdabot> []
14:20:26<skorpan>> let dupsBy p ys = [b | (as,b:bs) <- init $ zip (inits ys) (tails ys), any (p b) (as++bs)] in dupsBy (==) [1,2,1]
14:20:27<lambdabot> [1,1]
14:20:30<skorpan>interesting...
14:21:02<quicksilver>but it's not obvoious the best way to write it
14:21:14<skorpan>certainly not
14:21:21<quicksilver>since in the case that you find it as "y", you use (x:found)
14:21:23<quicksilver>not (z:found)
14:21:30<quicksilver>so the two branches don't really have the same pattern
14:21:36<skorpan>i'll try doing something with mplus...
14:22:18<skorpan>i can't seem to find the definition of Maybe's mplus
14:22:29<byorgey>@src Maybe mplus
14:22:30<lambdabot>Nothing `mplus` ys = ys
14:22:30<lambdabot>xs `mplus` ys = xs
14:22:35<opqdonut>skorpan: how about something like: dupsBy p xs = filter (\x -> count (p x) xs > 1) xs
14:22:35<skorpan>okay, found it :)
14:22:40<lilac>FalconNL: my solution is posted as a comment on that blog
14:22:50<skorpan>let dupsBy p xs = filter (\x -> count (p x) xs > 1) xs in [1,2,1]
14:22:53<skorpan>> let dupsBy p xs = filter (\x -> count (p x) xs > 1) xs in [1,2,1]
14:22:54<lambdabot> Not in scope: `count'
14:23:06<skorpan>> let dupsBy p xs = filter (\x -> (length . filter) (p x) xs > 1) xs in [1,2,1]
14:23:07<lambdabot> Couldn't match expected type `[a]'
14:23:12<skorpan>hurmm...
14:23:20<doserj>> let dupsBy p ys = [b | (as,b:bs) <- init $zip (inits ys) (tails ys), any (p b) (as++bs)] in dupsBy ((==)`on`(`mod`10)) [1,11,21,2,12,3,4,5]
14:23:21<lambdabot> [1,11,21,2,12]
14:23:34<byorgey>(length.) . filter I think
14:23:42<skorpan>> let dupsBy p xs = filter (\x -> ((length .) . filter) (p x) xs > 1) xs in [1,2,1]
14:23:44<lambdabot> [1,2,1]
14:23:50<paper_cc>let splits xs = zipWith (++) (inits xs) (tail $ tails xs); dupsBy f xs = catMaybes $ zipWith (\x other -> find (f x) other) xs (splits xs) in dupsBy (==) [1,2,3,1,2]
14:23:51<skorpan>no cigar!
14:23:54<paper_cc>oh
14:23:56<paper_cc>> let splits xs = zipWith (++) (inits xs) (tail $ tails xs); dupsBy f xs = catMaybes $ zipWith (\x other -> find (f x) other) xs (splits xs) in dupsBy (==) [1,2,3,1,2]
14:23:58<lambdabot> [1,2,1,2]
14:24:10<byorgey>skorpan: um, look carefully at what you typed there =)
14:24:13<davidL>> let dupsBy p xs = filter (\x -> length (filter p xs) > 1) xs in dupBy (==) [1,2,1]
14:24:14<lambdabot> Not in scope: `dupBy'
14:24:18<davidL>> let dupsBy p xs = filter (\x -> length (filter p xs) > 1) xs in dupsBy (==) [1,2,1]
14:24:19<lambdabot> Couldn't match expected type `Bool'
14:24:28<skorpan>oh byorgey :)
14:24:28<wicket>I'm not entirely sure what kind of results you want from [1,2,3,1,2]
14:24:30<opqdonut>davidL: (p x) ...
14:24:35<skorpan>wicket: [1,2,1,2]
14:24:46<davidL>> let dupsBy p xs = filter (\x -> length (filter (p x) xs) > 1) xs in dupsBy (==) [1,2,1]
14:24:47<lambdabot> [1,1]
14:25:00<skorpan>> let dupsBy p xs = filter (\x -> length (filter (p x) xs) > 1) xs in dupsBy (==) [1,2,3,1,2]
14:25:02<lambdabot> [1,2,1,2]
14:25:05<skorpan>this is beautiful
14:25:07<byorgey>brilliant!
14:25:13<opqdonut>thank you :)
14:25:17<skorpan>thanks davidL, mind if i use this code in yi? :)
14:25:18<byorgey>opqdonut++
14:25:23<davidL>what
14:25:24<skorpan>oh, what
14:25:27<skorpan>was that opqdonut?
14:25:33<opqdonut>sure, go ahead
14:25:44<skorpan>thanks
14:25:48<doserj>> let dupsBy p ys = [y | y <- ys, any (p y) (ys\\[y])] in dupsBy ((==)`on`(`mod`10)) [1,11,21,2,12,3,4,5] -- cheating a bit
14:25:49<lambdabot> [1,11,21,2,12]
14:26:05<opqdonut>ys\\[y], hng
14:27:22<paper_cc>ys \\ [y] requires Eq
14:27:22<byorgey>doserj: I don't think that's quite the same, is it?
14:27:33<skorpan>it's not
14:27:34<doserj>the nested filters are nice
14:27:48<doserj>I did say I cheated :)
14:27:52<byorgey>hehe
14:28:05<opqdonut>doserj: they capture the intent quite nicely, right
14:28:19<opqdonut>i find the > 1 a bit ugly though
14:28:30<byorgey>even better would be to make a function to test whether the length of a list is > 1
14:28:39<byorgey>calling length and checking if its > 1 is not lazy enough
14:28:57<mauke>not . null . drop 1
14:29:44<opqdonut>mauke: better i guess
14:29:45<gwern>@quote drug.*addict
14:29:45<lambdabot>No quotes match. Just what do you think you're doing Dave?
14:29:54<gwern>@remember seydar what's the nick of the drug addict who wrote learn you a haskell? and i mean that in the best possible way.
14:29:55<lambdabot>I will remember.
14:30:09<gwern>@quote String.*poor
14:30:10<lambdabot>No quotes match.
14:30:22<gwern>@remember roconnor String is kinda a poor data type for strings.
14:30:23<lambdabot>I will remember.
14:30:33<gwern>@quote beaten.*up
14:30:33<lambdabot>No quotes match. There are some things that I just don't know.
14:30:44<gwern>@remember kyevan I had a haskell-related dream last night. Sorta. I was beaten up by some kids because I tried to go somewhere my type didn't match, apparently.
14:30:44<lambdabot>Done.
14:30:56<gwern>@quote Windows.*98
14:30:56<lambdabot>No quotes match. Have you considered trying to match wits with a rutabaga?
14:31:05<gwern>@remember edwardk Haskell 98 is the Windows 98 of standards ;)
14:31:06<lambdabot>Okay.
14:31:12<gwern>@quote endofunctor
14:31:12<lambdabot>psykotic says: [monads aren't hard] they're just monoids on the category of endofunctors over some category, what's the big deal?
14:31:16<gwern>@quote endofunctor
14:31:16<lambdabot>PhilipWadler says: I'm delighted to learn that "a monad is a monoid in the category of endofunctors"---anyone know where I can find a good tutorial?
14:31:32<gwern>@quote play.*monads
14:31:32<lambdabot>No quotes match. Sorry about this, I know it's a bit silly.
14:31:42<gwern>@remember DavidLeimbach Don't play with your monads... eventually you'll go bind.
14:31:42<lambdabot>Okay.
14:31:45<gwern>@flush
14:32:45<weilawei>lambdabot is on the ball today ^__^
14:33:50<opqdonut>@quote
14:33:51<lambdabot>robreim says: Great, now we've got to start an IRC channel for lojban-speaking, haskell-coding anarchists
14:34:16<weilawei>@quote
14:34:17<lambdabot>SamB_XP says: oh. does A/S/L mean Age/Sex/Programming Language?
14:34:24<weilawei>xD i wish
14:36:22<gnuvince>I have a dumb question: some programming languages (Smalltalk, Clojure, Factor) provide abstract interfaces to their collection types, making it easy to switch from one to another. Haskell doesn't seem to have that, though I guess it could with a typeclass. Is the reason for that purely historic, or am I missing an important technical point?
14:37:16<opqdonut>i'd say historic
14:37:33<solrize_>foldable ?
14:37:44<byorgey>gnuvince: note this isn't about the languages themselves but about the standard libraries.
14:37:45<opqdonut>Functor :)
14:38:26<byorgey>gnuvince: I agree this is one area where the standard libraries could be improved somewhat. Although there are libraries like Edison.
14:38:29<opqdonut>gnuvince: a partial reason is that the usual kind of collection "interface" would require multi param typeclasses, fundeps and possibly associated types
14:38:31<byorgey>dunno if that's still maintained.
14:39:11<gwern>edison is maintained; just no one uses it
14:39:27<opqdonut>a shame
14:40:28<quicksilver>gnuvince: is it clear whether it's worth it?
14:40:40<quicksilver>the difference between the collection types is normally such that if you need one, you need that one.
14:40:52<quicksilver>the "lowest common denominator" of their interfaces is very small
14:41:00<FalconNL_>I don't suppose there's a faster version of read? (read $ show $ 10^1000000 :: Integer) is very slow.
14:41:15<quicksilver>whilst the corresponding upper bound contains all sorts of necessarily inefficient things.
14:41:21<opqdonut>you're not really supposed to use read for anything real
14:41:36<solrize_>???
14:41:50<FalconNL_>opqdonut: it's fast enough up to 10^10000 or so, but after that it becomes slow
14:41:58<byorgey>FalconNL_: yeah, read is rather slow
14:42:05<lilac>i wouldn't think of any situation where you have to read a million digit number as 'real' anyway...
14:42:11<Berengal>Why would you want to read such a number?
14:42:14<opqdonut>lilac: hehe
14:42:30<byorgey>if you want something faster you can roll your own with a fold over a bytestring
14:42:37<opqdonut>indeed
14:42:42<solrize_>why don't they just fix read?
14:42:49<pejo>lilac, read is slow for other things as well. D. Swierstra and some others had a paper at the haskell symposium last year on it.
14:42:51<gwern>wonder if data.binary would read just Integers faster
14:43:28<lilac>Berengal: FalconNL is attacking this: http://programmingpraxis.wordpress.com/2009/05/22/the-next-palindrome/
14:43:29<byorgey>solrize_: I think part of the problem is that read is so general. for reading any particular thing a custom solution is likely to be faster.
14:43:40<Berengal>lilac: ah
14:43:48<solrize_>i don't get it. other languages have read-like functions that are fast.
14:44:17<quicksilver>solrize_: part of the reason is the underlying slowness of String
14:44:18<quicksilver>I suspect.
14:44:20<lilac>FalconNL_: for what it's worth, i think you should consider solutions which don't involve converting your string to a number and back
14:44:22<quicksilver>I don't know how much of it.
14:45:15<byorgey>yeah, that's a fun problem
14:45:20<FalconNL_>lilac: The speed difference between your and my version is in read. My Integer -> String algorithm runs slightly faster than yours. But ideally I'd like an Integer -> Integer algorithm ,since it's cleaner
14:45:24<byorgey>I seem to recall solving it once upon a time =)
14:45:26<mauke>hah
14:45:30<quicksilver>solrize_: a 1-byte-per-character string rep is always going to be faster than a 24-byte-per-character string rep :)
14:45:31<mauke>I solved PALIN in Perl
14:45:48<byorgey>I think I solved it in C =)
14:46:00<mauke>yeah, I also have a C solution
14:46:37<pejo>quicksilver, read is sometimes exponential: http://portal.acm.org/citation.cfm?id=1411286.1411296
14:47:12<lilac>FalconNL_: I think I'd do an Integer -> Integer algorithm somewhat differently (not via String)
14:47:59<quicksilver>pejo: if you're going to paste a link, paste one that I can download from :P
14:48:31<pejo>quicksilver, ok, let me retry.
14:48:36<pejo>quicksilver, read is sometimes exponential.
14:48:45<pejo>quicksilver, :P
14:49:00<quicksilver>pejo: but, not in the case we are discussing.
14:49:26<quicksilver>pejo: only in the case of infix constructors, as far as I can tell.
14:49:30<quicksilver>so, not relevant here.
15:05:48<mmorrow>i was just looking at the jhc-generated C code for
15:05:50<mmorrow>fib :: Int -> Int -> [Int]; fib m n = m : fib n (m + n); main = (print . length) (fib 0 1)
15:06:03<mmorrow>and it's first building the entire list
15:06:11<mmorrow>then it runs over and finds the length
15:07:03<mmorrow>(and also, even though it wouldn't matter here, there's no gc)
15:08:11<mmorrow>and without something like this getting fused in some/any way, there can't be a gc
15:08:42<mmorrow>(which was why i was looking at the C code in the first place :(
15:08:49<copumpki>:o
15:11:31<DarthMeh>given an expression (test1 == test 2), if I want test1 and test2 to evaluate in parallel with par, how do I express this?
15:11:34<mmorrow>well, actually i should make sure that it doesn't magically fuse if the list is finite
15:12:24<koeien>DarthMeh: test1 `par` (test2 `pseq` (test1==test2)) iirc
15:12:38<DarthMeh>thank you, koeien
15:12:46<pumpkin>sounds like someone should define liftP2 (==) test1 test2 :P
15:13:01<koeien>yeah, could be a nice function ;)
15:13:41<pumpkin>(==) <$$> test1 <||> test2
15:14:02<pumpkin>maybe?
15:14:05<pumpkin>ACTION shrugs
15:17:56<mmorrow>it doesnt
15:18:03<pumpkin>?
15:18:06<pumpkin>oh, JHC
15:18:10<mmorrow>oh, about magically fusing
15:18:14<mmorrow>yeah
15:18:30<mmorrow>main = (print . length . maxBound) (fib 0 1) -- ;)
15:18:35<mmorrow>err
15:18:38<mmorrow>main = (print . length . take maxBound) (fib 0 1) -- ;)
15:20:33<quicksilver>mmorrow: You lost me. jhc is or isn't fusing?
15:22:28<b_jonas>hi
15:22:57<pumpkin>hi indeed!
15:23:11<b_jonas>can you use the data types a la carte thing to create a product type, say for a state so that you can read or alter any field without having to know what other fields there are?
15:23:15<zsol>yo
15:23:35<quicksilver>b_jonas: well it's not a magic solution.
15:23:44<quicksilver>you can obviously write something which is polymorphic
15:23:50<quicksilver>you could do that with a normal tuple too:
15:23:58<quicksilver>(Int,a) -> ....
15:24:05<quicksilver>^^ ignores the "other field" a.
15:24:19<quicksilver>but it remains sensitive to the orders of the fields and stuff.
15:25:08<roconnor>quicksilver: does that solution use the class system for overloading?
15:25:22<quicksilver>the solution I just sketched doesn't do any overloading.
15:25:28<roconnor>ok
15:25:34<quicksilver>to make something cleverer you would indeed have to use the class system.
15:26:07<quicksilver>haskell's data types don't support this kind of extension, and data types a la carte isn't changing haskell in any way
15:26:13<quicksilver>it's just a particular approach.
15:26:31<quicksilver>(...don't support *polymorphism* over this kind of extension...) I should say
15:26:44<quicksilver>you can hack up various kinds of extensible record stuffs with type classes
15:26:51<paper_cc>is there a GMap library done with type families? (gmap-0.1 on Hackage uses FunDeps)
15:26:51<quicksilver>some of it more clumsy looking than others.
15:27:24<b_jonas>quicksilver: thanks
15:27:35<b_jonas>I'll have to read the data types a la carte article again
15:27:45<b_jonas>because I still don't really understand how it works
15:27:55<b_jonas>I have another question though
15:28:17<b_jonas>how do the extensible exceptions in ghc work? is it magic or is there an article about it somewhere?
15:29:14<quicksilver>b_jonas: it's not magic.
15:29:34<quicksilver>b_jonas: http://www.haskell.org/~simonmar/papers/ext-exceptions.pdf
15:30:00<b_jonas>quicksilver: thanks for the link
15:31:37<mmorrow>awesome. this however jhc runs in constant memory:
15:31:48<mmorrow>fib m n x k = k x (m::Int) (\x -> fib (n::Int) (m + n) x k); gogo acc _ k = let acc' = acc + (1::Int) in acc' `seq` k acc'; main = print (fib 0 1 (0::Int) gogo :: Int)
15:32:24<mmorrow>so it looks like if you just pretend you're programming in a strict language, you're golden ;)
15:34:58<mmorrow>quicksilver: i'm gonna make a short writeup paste, because that'll be infinitely more clear than me trying to describe the particulars
15:38:46<quicksilver>mmorrow: OK :)
15:44:42<mmorrow>hmm, i take back that it's running in constant space, since there doesn't seem to be any use of free() in the entire file, and it's malling malloc 4 times per loop...
15:45:05<pumpkin>:o
15:45:16<mmorrow>(i guess the massive eat-all-4GB-of-memory-in-under-a-second with the other program was from stack)
15:46:18<FalconNL_>lilac: I've posted my solution as well
15:50:04<Elly>mmorrow: rule 1 of malloc is the same as rule 1 of air travel
15:50:16<Elly>"Attempt at all costs to keep your number of landings equal to your number of takeoffs."
15:52:28<weilawei>Elly: that's an awesome way to put it. never heard that analogy before
15:52:51<Elly>heh, thanks :)
15:53:23<pumpkin>@remember Elly Rule 1 of malloc is the same as rule 1 of air travel: "Attempt at all costs to keep your number of landings equal to your number of takeoffs."
15:53:23<lambdabot>I will remember.
15:53:27<FalconNL_>Alternatively you could say: If you don't land after taking off, you'll crash.
15:55:02<dmwit>If you land twice after takeoff... you've definitely crashed.
15:58:53<roconnor>I prefer to only let my planes take off throughout the day. Then I go home at the end of the day. In the morning, all my planes have been put back on the ground for me.
15:59:59<maltem_>As long as you're not going for intercontinental flights.
16:00:27<roconnor>I'm just running local flights on my laptop
16:03:14<Gilly>Any particular reason to why Data.Time.Calendar.Day isn't a instance of Read?
16:03:19<skorpan>i'm trying to write some sort of typechecker using the reader monad... i've only done this using the state monad before, which apparently is supposed to be more "heavyweight" than necessary. this is my question: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5128#a5128
16:04:35<roconnor>skorpan: do you want to stop when you hit an error, or carry on?
16:04:41<skorpan>roconnor: carry on
16:05:02<roconnor>skorpan: maybe use Writer and tell the errors to it?
16:05:40<skorpan>roconnor: that was the idea i had in the beginning, but friends of mine told me that Reader is more suiting for some reasons i don't remember and they're not accessible to ask right now
16:05:59<skorpan>i think they said that "local" is awesome for some reason
16:06:25<roconnor>do you need to know what the errors were as you go along?
16:06:36<skorpan>nope, i don't care about existing errors
16:07:05<quicksilver>Gilly: it is.
16:07:08<roconnor>skorpan: definitely not Reader. "local" will only add information locally. After you leave the local block it will be gone.
16:07:26<skorpan>yeah, i know! i'm glad i'm not the only one not understanding what Reader would be good for :)
16:07:29<quicksilver>Gilly: but the instance is perhaps not in one of the modules you important.
16:07:35<quicksilver>Gilly: try Data.Time.Format
16:07:35<roconnor>skorpan: local would be great if you needed the error report to carry on, but didn't want to report it in the end.
16:07:51<roconnor>skorpan: but this is exactly the opposite of what you want.
16:08:14<skorpan>i'll just go for writer and see if that makes my life difficult
16:08:17<skorpan>thanks for your input
16:08:40<roconnor>skorpan: use DList in Writer.
16:08:50<skorpan>for speed?
16:08:52<roconnor>or CPS your monad stack.
16:08:54<roconnor>ya
16:09:00<skorpan>CPS?
16:09:08<roconnor>continuation passing style
16:09:16<skorpan>ah, well, i'm not too familiar with that just yet
16:09:33<roconnor>well
16:09:37<Gilly>quicksilver: Ahh, thanks :)
16:09:42<roconnor>you probably don't have too many errors
16:09:51<roconnor>so maybe using DList isn't that important
16:09:55<roconnor>you can probably start with list.
16:10:04<roconnor>hmm
16:11:05<Jedai>skorpan: local is nice to manage the environment in a functional language interpreter for instance
16:11:37<skorpan>ah, right, one environment per block?
16:11:38<mmorrow>quicksilver: http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2462
16:11:59<mmorrow>Elly: hehe
16:12:14<Jedai>skorpan: Right, of course for your problematic I also fail to see why Reader would help, it seems a typical Writer task
16:26:29<pumpkin>shh, I'm hunting bunny wabbits
16:27:44<skorpan>if i'm using "DList a" as the "state" of my Writer, do i have to (tell . singleton) everytime?
16:30:56<quicksilver>skorpan: yes.
16:31:08<quicksilver>skorpan: you can give that a name if you like :)
16:31:14<quicksilver>sktell = tell . singleton
16:31:22<skorpan>say = tell . D.singleton
16:31:23<skorpan>:)
16:36:21<pumpkin>mmorrow: that little chunk of code you wrote for closures in c is like the adjustor in the ghc rts?
16:37:12<skorpan>@type tell . Data.DList.singleton
16:37:14<lambdabot>Couldn't find qualified module.
16:37:38<skorpan>GHC only says it's a -> m () but that's not enough
16:37:43<skorpan>i can't figure the type out!
16:38:12<lilac>@index Data.DList
16:38:12<lambdabot>bzzt
16:38:25<quicksilver>why isn't that enough?
16:38:41<quicksilver>singleton has type (a -> DList a)
16:38:56<skorpan>tell is only for MonadWriter so i have to put that constraint somehow
16:39:12<quicksilver>ghc should tell you it.
16:39:22<skorpan>but it doesn't
16:39:29<quicksilver>MonadWriter (DList a) m => a -> m ()
16:39:33<quicksilver>skorpan: I don't believe you.
16:39:45<skorpan>Warning: Definition but no type signature for `say'
16:39:45<skorpan>Inferred type: say :: a -> m ()
16:39:52<quicksilver>ask ghci.
16:40:16<skorpan>that's inconvenient as hell because i haven't installed the package i'm writing this for
16:40:20<dmwit>And file a RFE against GHC.
16:40:36<quicksilver>you don't need that package
16:40:38<quicksilver>you just need DList
16:40:43<skorpan>hm, true
16:40:43<dmwit>Wait, ghci does exactly the same things ghc does.
16:40:59<dmwit>So if ghc can see whatever it is you're using, so can ghci.
16:41:08<quicksilver>dmwit: it's only the warning message at fault.
16:41:17<quicksilver>right.
16:41:24<skorpan>ghci gives me the right result
16:41:26<quicksilver>you can always run ghci up in the same context ghc is compilng from
16:41:47<skorpan>listen i'm not *lying* so obviously something strange is going on
16:42:38<skorpan>could it be that i'm already using the definition of "say" in other functions when i cabal build, which i don't when i check the type in ghci?
16:42:59<roconnor>@hoogle say
16:43:00<lambdabot>No results found
16:43:26<roconnor>@where hayoo
16:43:26<lambdabot>http://holumbus.fh-wedel.de/hayoo/hayoo.html
16:43:36<skorpan>say = tell . Data.DList.singleton
16:44:26<mauke>I get No instance for (MonadWriter (DList a) m) for that line
16:44:55<roconnor>DList a needs to be a Monoid.
16:45:07<roconnor>if it isn't the package ought to be changed?
16:45:15<mauke>it is
16:46:40<mauke>compiles with FlexibleContexts and (MonadWriter (DList a) m) => a -> m ()
16:47:50<roconnor>huh?
16:48:09<roconnor>what about (MonadWriter [a] m) => a -> m ()
16:48:16<roconnor>does that requires FlexibleContexts?
16:48:19<mauke>oy
16:48:23<mauke>owned by MR
16:48:29<roconnor>that's what I figured
16:48:33<roconnor>I should have said
16:49:05<roconnor>monomoprhismRestriction--
16:50:12<mauke>yes, [a] also requires flexible contexts
16:50:18<koeien>too long :(
16:50:38<mauke>MR--
16:51:23<koeien>monomorphismrestriction.com is still free!
16:51:48<mauke>preflex: karma MR
16:51:49<preflex> MR: -1
16:52:11<bremner>mutability++
16:52:34<pumpkin>:o
16:52:43<roconnor>mauke: I assume that NoMonomoprhismRestriction works instead of FlexibleContexts?
16:52:52<roconnor>mauke: or eta expending the definition of say.
16:53:10<roconnor>@burnDown bremner
16:53:11<lambdabot>Unknown command, try @list
16:53:15<mauke>eta expanding works if I remove the type signature
16:53:55<Twey>koeien: Quick! Let's grab it!
16:53:58<Twey>*cough*
16:55:21<koeien>Twey: let's register it to prevent it from being used ;)
16:56:02<b_jonas>monomorphismRestriction++ I for one like iy
16:56:37<mauke>BURN HIM
16:59:39<maltem_>@remember koeien Let's register it [monomorphismrestriction.com] to prevent it from being used ;)
16:59:39<lambdabot>It is forever etched in my memory.
17:17:21<mmorrow_>pumpkin: sort of.. it is like that in the sense that it could be used to give something a view as a function pointer, but that code doesn't take any args, but if it did it'd be exactly like that (in purpose, i'm not sure how exactly the adjustor works)
17:18:23<mmorrow_>pumpkin: but on the other hand, it's pretty much exactly what a suspended function application is represented as by the rts
17:21:32<skorpan>@pl not . null
17:21:33<lambdabot>not . null
17:21:44<skorpan>just checking if there is notNull :P
17:22:34<pumpkin>@hoogle [a] -> Bool
17:22:34<lambdabot>Prelude null :: [a] -> Bool
17:22:34<lambdabot>Data.List null :: [a] -> Bool
17:22:34<lambdabot>Prelude all :: (a -> Bool) -> [a] -> Bool
17:22:42<skorpan>@pl not . elem
17:22:43<lambdabot>not . elem
17:22:49<skorpan>hm... i thought it was wiser
17:22:58<Twey>That's already pointfree
17:23:30<Twey>@pl \x y -> not (elem x y)
17:23:30<lambdabot>(not .) . elem
17:23:42<Twey>Hmn
17:24:01<Twey>@unpl not . null
17:24:01<lambdabot>(\ c -> not (null c))
17:24:06<Twey>@unpl not . elem
17:24:07<lambdabot>(\ c -> not (elem c))
17:24:18<Twey>That's not very useful
17:24:22<skorpan>nope!
17:25:40<roconnor> @pl just gets rid of lambdas
17:26:11<roconnor>hmm, maybe that isn't true
17:26:13<Elly>@pl \x -> x + x
17:26:13<lambdabot>join (+)
17:26:18<Elly>:t join
17:26:19<lambdabot>forall (m :: * -> *) a. (Monad m) => m (m a) -> m a
17:26:21<roconnor>> flip (flip id)
17:26:22<lambdabot> Overlapping instances for Show ((a -> c) -> a -> c)
17:26:22<lambdabot> arising from...
17:26:25<Twey>It does just get rid of lambdas
17:26:27<roconnor>@pl flip (flip id)
17:26:28<lambdabot>id
17:26:28<Elly>what the heck is that
17:26:30<Twey>But it has some neat tricks for doing so
17:26:38<Twey>Elly: join on the function monad
17:26:47<Elly>I didn't know there was a function monad
17:26:53<Twey>Essentially, it just repeats the argument
17:27:09<Twey>m here is (-> r)
17:27:16<roconnor>@djinn (e -> e -> a) -> (e -> a)
17:27:17<lambdabot>f a b = a b b
17:27:23<Twey>So, it's :: (a -> a -> r) -> (a -> r)
17:27:33<Elly>nice
17:27:43<JuanDaugherty>googling "haskell calculator" returns a half million hits but they all seem to be half assed. Anybody know of a decent one with an X interface?
17:27:46<Twey>Yeah, there's a function monad
17:28:06<mauke>JuanDaugherty: why an X interface?
17:28:14<mauke>I think ghci is an acceptable calculator
17:28:24<roconnor>JuanDaugherty: half-assed calculators is typically a test case for new GUI development libs.
17:28:29<Twey>> (length >>= (*2)) [1, 2, 3]
17:28:30<lambdabot> Couldn't match expected type `[a] -> b' against inferred type `Int'
17:28:32<Twey>Boo
17:28:48<Twey>I can never remember how to use it, but it exists :-P
17:28:58<roconnor>@let loeb x = fmap ($ loeb x) x
17:28:58<lambdabot> Defined.
17:29:05<Twey>> do { l <- length; return l } [1, 2, 3]
17:29:06<mauke>needs more fix
17:29:06<lambdabot> <no location info>: parse error on input `['
17:29:11<roconnor>ACTION thinks ghci is also a fine spreadsheet
17:29:17<roconnor>> loeb [ (!!5), const 3, liftM2 (+) (!!0) (!!1), (*2) . (!!2), length, const 17]
17:29:18<lambdabot> [17,3,20,40,6,17]
17:29:35<JuanDaugherty>mauke: dunno of you are asking why a gui, or why that gui platform, but um, just because.
17:29:39<JuanDaugherty>*if
17:29:41<mauke>why a gui
17:29:55<mauke>I haven't seen a calculator that was improved by having a GUI
17:30:02<JuanDaugherty>for the reason gui exists
17:30:09<Twey>I've never been able to find good information on the (-> r) monad
17:30:16<Twey>Where does it lurk?
17:30:28<roconnor>Control.Monad.Instances I beleive
17:30:37<maltem_>Twey, btw it's ((->) r)
17:30:56<Twey>roconnor: I meant the information, not the monad
17:31:15<Twey>Oh, yeah
17:31:16<roconnor>it's isomorphic to (Reader r)
17:31:18<Twey>It's (r ->)
17:31:44<Cale>Good information lurks in the minds of the people of this channel :)
17:32:02<Cale>Also, it's a good exercise to try writing the instance yourself :)
17:32:23<Cale>If you get the types to match, it is almost impossible to have the wrong thing.
17:32:24<roconnor>Cale: actually everyone is a mindless zombie automoton, other than Twey.
17:32:44<mauke>JuanDaugherty: gui exists to display graphical information and let me click on things
17:32:52<JuanDaugherty>roconnor: Acknowledged, a decent one (as opposed to a half assed one) developed for that purpose would be fine.
17:33:02<Cale>> (do x <- id; y <- reverse; z <- map toUpper; return (x,y,z)) "Hello"
17:33:03<lambdabot> ("Hello","olleH","HELLO")
17:33:04<Twey>roconnor: I always knew it :-P
17:33:13<JuanDaugherty>mauke: yeah that's the ticket, just lemme at it
17:33:16<zachk>couldnt you use a map
17:33:16<Twey>Ah, that's the way to do it, is it?
17:33:31<zachk>omfg that was like 3 days ago forget i ever said that
17:33:31<Cale>> sequence [id, (+2), (*2), (^2), (2^)] 5
17:33:33<lambdabot> [5,7,10,25,32]
17:33:39<CalJohn>is it possible to parse an integer token with attoparsec?
17:33:39<Twey>Hahaha, zachk
17:33:40<b_jonas>I may be mindless but I'm not a zombie
17:33:59<CalJohn>i'm learning parsec, but I'd like to use bytestrings
17:34:24<Twey>CalJohn: Get Parsec 3, use Text.Parsec.ByteString
17:34:33<roconnor>b_jonas: philosophical zombie, not hollywood zombie.
17:36:13<Cale>http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ChristmasTree -- what a great contrived name for a package :)
17:36:30<Twey>Hahahaha
17:36:31<Twey>Nice!
17:37:20<koeien>lol lol lol
17:37:22<koeien>very nice
17:37:27<b_jonas>yeah
17:37:38<koeien>was that the utrecht thingy?
17:37:41<koeien>sounds like it
17:37:51<CalJohn>Twey: ah, wow, did not know
17:38:05<koeien>home page is cs.uu.nl, yeah apparently :)
17:38:18<gio123>please heeeeeeeeeeelp I need file amsmath.cls
17:38:27<CalJohn>koeien: i am attending that utrecht thingy
17:38:41<mmorrow_>pumpkin: this code though lets you make a closure of a C function and a value, then gives you back a function pointer which when called with another arg will call that original function with both saved arg and the new arg http://moonpatio.com/repos/cclos.c
17:38:55<Cale>gio123: That doesn't seem like a Haskell question... isn't that a LaTeX class file?
17:39:01<b_jonas>it is
17:39:04<koeien>CalJohn: i mean, i saw a presentation on that in Eindhoven by doaitse swierstra from Utrecht university
17:39:08<mmorrow_>pumpkin: (only have x86_64 asm though for that thus far)
17:39:25<koeien>gio123: try google.
17:39:26<CalJohn>koeien: oh, i was mistaken
17:39:35<mmorrow_>pumpkin: the thing that sucks about x86 is that you can't do pc-relative references easily
17:39:35<gio123>Cale: yes
17:39:36<gio123>:)
17:39:52<Cale>gio123: I'm pretty sure that it comes with most of the popular distributions of LaTeX...
17:39:54<koeien>CalJohn: the name (at least, the unabbreviated version) reminded me of that
17:39:58<b_jonas>mmorrow_: that's not the only think that sucks about x86
17:40:06<mmorrow_>b_jonas: heh
17:40:16<b_jonas>I think I sound like a bot
17:40:27<gio123>Cale: noo, I am compiling the documents and it gives me error that that file can not fond
17:40:28<b_jonas>I make shallow comments like "yeah" and "um I don't think so" about whatever you say
17:40:43<Cale>How did you install LaTeX?
17:40:52<b_jonas>gio123: could you ask on another channel? like #haskell-blah ?
17:41:14<gio123>Cale: pm
17:41:18<b_jonas>(I must sound like that again)
17:41:38<b_jonas>anyway, I decided the magic isn't in extendible exceptions but in Typeable that is uses
17:41:46<b_jonas>so now I'll have to read how Typeable works
17:42:06<skorpan>@pl \x y -> not (null x) && not (null y)
17:42:08<lambdabot>(. (not . null)) . (&&) . not . null
17:42:12<skorpan>...right...
17:42:37<mauke>:t (&&) `on` (not . null)
17:42:37<kyagrd>Is there a (development) version of TH that can parse GADT declerations?
17:42:38<lambdabot>forall a. [a] -> [a] -> Bool
17:43:07<mauke>:t join (liftM2 (&&)) (not . null)
17:43:08<lambdabot>forall a. [a] -> Bool
17:43:12<mauke>d'oh
17:43:42<mmorrow_>pumpkin: (and the best part of that cclos.c code is that it creates a new copy of the code for each closure, so you can have arbitrarily many of them and they won't interfere, no global vars used)
17:52:14<mmorrow_>kyagrd: unfortunately no
17:56:12<mxc>(a -> b -> c)
17:56:14<mxc>oops
17:56:18<mxc>oops
17:59:29<lilac>mmorrow_: am i right in thinking that they added rip-relative addressing in x86_64?
18:00:16<mmorrow_>lilac: yes, it's awesome
18:00:31<lilac>i imagine it's especially awesome for the authors of virii and trojans
18:00:38<mmorrow_> label(%rip)
18:01:06<lilac>what does the r stand for, anyway? ridiculously-big?
18:01:13<mmorrow_>lilac: exactly!
18:01:20<mmorrow_>i dunno
18:01:22<mauke>VIRII IS NOT A WORD
18:01:49<mmorrow_>is cactuses a word?
18:02:02<mauke>it is acceptable
18:02:15<lilac>> words "virii and trojans"
18:02:16<lambdabot> ["virii","and","trojans"]
18:02:22<lilac>lambdabot disagrees
18:02:22<deech>Hi all,
18:02:30<mauke>lilac: no, I disagree!
18:02:43<lilac>mauke: lambdabot says it's a word, though!
18:02:47<lilac>> words "virii"
18:02:48<lambdabot> ["virii"]
18:03:02<mauke>> words "`__)"
18:03:03<lambdabot> ["`__)"]
18:03:10<mmorrow_>mauke: heh, i actually just had to lookup the plural of cactus and it's "cacti" with only one i (or cactuses)
18:03:11<inimino>@faq can Haskell solve disputes over English?
18:03:11<lambdabot>The answer is: Yes! Haskell can do that.
18:03:38<inimino>good to know
18:03:39<mauke>there is no "-ii" suffix in latin
18:03:41<mmorrow_>mauke: so i guess it's different a thing altogether
18:03:44<mmorrow_>oh
18:03:51<mmorrow_>is there an -i ?
18:03:57<mauke>yes, several
18:04:03<lilac>@faq Can Haskell pose a polynomial-time-checkable problem so hard even Haskell cannot solve it in polynomial time?
18:04:03<lambdabot>The answer is: Yes! Haskell can do that.
18:04:08<deech>I'm trying to use Network.HTTP to browse a web address, but I want to handle the case when the network isn't available. I am currently getting a GHCI error in my handler function. The code is at http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5129#a5129. Appreciate your input.
18:04:14<lilac>wow. P != NP. you heard it here first.
18:04:24<mauke>"sons" is filii because a single son is filius
18:05:11<lilac>mauke: i envy how much you care about this :)
18:05:34<mauke>guess what I have in my highlight list
18:05:46<inimino>*ii ?
18:05:51<mmorrow_>hahah
18:05:54<mauke>no, "virii"
18:06:12<mauke>but don't worry, it's not an automatic /kick
18:06:16<mauke>(yet)
18:06:29<lilac>mauke: was this whole response merely a script in your IRC client playing itself out?
18:06:31<da-x>@faq Can Haskell explain what happens on Lost?
18:06:31<lambdabot>The answer is: Yes! Haskell can do that.
18:06:38<inimino>ACTION is glad mauke is on the case
18:06:40<inimino>some one has to defend Latin or it might die out!
18:06:41<mauke>lilac: haha, no :-)
18:07:22<lilac>inimino: latin is clearly actively maintained. iso latin15 didn't come out that long ago
18:08:16<mmorrow_>i wonder if there's a -fii-suffixii-allowed flag
18:08:33<lilac>sufficii, surely? ;-)
18:08:47<mauke>suffixen
18:09:40<lilac>mauke: hold on, you have virii in your highlight list? you're actively /hunting/ people who are wrong on the internets?
18:09:43<inimino>ACTION waits for someone to write Haskelligata, translating the entire type system into suffixes
18:09:59<mauke>lilac: precisely
18:10:17<lilac>ACTION waits for someone to paste an xkcd link
18:10:37<mauke>god help you if I catch you using "could care less"
18:11:29<mmorrow_>ha
18:11:35<Twey>‘Virii’ is a word — it means ‘males’
18:11:45<Twey>mauke: *shudder*
18:11:45<lilac>mauke: i'm with you on that
18:11:51<mauke>Twey: no, that's viri
18:11:58<lilac>virii is the plural of virium
18:11:59<mauke>men
18:12:00<Twey>mauke: It's virī
18:12:09<lilac>which is a word i made up
18:12:13<mauke>lilac: no, that would be viria
18:12:20<JuanDaugherty>ACTION concludes that the character set socalled "ISO-LATIN-15" has little or nothing to do with the Latin language (besides the obvious)
18:12:24<lilac>mauke: virius?
18:12:27<mauke>visum -> visa, etc
18:12:32<mauke>lilac: yes
18:12:35<Twey>The double-for-long-vowel convention was created by Accius
18:13:09<Twey>JuanDaugherty: Yeah — it has weird characters in it like ‘U’ and ‘W’
18:13:57<mauke>I thought it was called ISO 8859-15
18:14:21<lilac>mauke: Virius was a Roman first name. When referring to multiple people with this first name, is 'Virii' not appropriate?
18:14:21<JuanDaugherty>a "real" Latin set might have for example have had Claudius' characters
18:14:51<mauke>lilac: do you have a reference for that?
18:15:30<b_jonas>JuanDaugherty: is that the half H and turned C thing?
18:15:36<JuanDaugherty>y
18:15:51<centrinia>Which declension does "Virius" fall under?
18:16:00<mauke>tee hee
18:16:06<b_jonas>what I don't get is, why did they bother with introducing G as a variant form of C when they already had K and Q as extra letter Cs
18:16:07<mauke>Viriūs
18:16:49<b_jonas>I mean, the greeks used to have two letters for K as well, why do they have to repeat their mistake?
18:17:09<mauke>what was the other greek K?
18:17:27<b_jonas>English spelling still sucks because of the Latin's bad decisions
18:17:53<centrinia>varkappa?
18:18:24<b_jonas>no, Qoppa
18:18:43<b_jonas>it fell into disuse because the greeks did realize it was redundant
18:18:49<centrinia>That looks more like a 'Q'
18:19:08<mauke>ACTION faintly remembers things called "koppa" and "stigma"
18:19:58<Twey>centrinia: ‘Virius’ looks 2m
18:20:31<centrinia>Second declension masculine?
18:20:42<abbe>http://xkcd.com/587/
18:21:56<Twey>centrinia: Yeah
18:22:50<centrinia>That would look like Viriī
18:23:14<b_jonas>if we could get people to use a writing that corresponds to phonetic once, then maybe phonetics wouldn't change much after that and then we wouldn't have all the historical accidents that caused us to use writings deviating from phonetics in first place
18:23:37<b_jonas>especially now in the age of global communication
18:23:43<mauke>and next week: "i.e." vs. "e.g."
18:24:11<b_jonas>because I can sort of understand how the geographic distances could have caused the problems in the ancient times
18:27:32<Twey>centrinia: The Romans rarely marked long vowels
18:29:15<centrinia>If zombies can only eat two brains and turn their victims into zombies; and you start out with one zombie, then shouldn't the n-th generation of brain eating victims have F_n members?
18:30:44<b_jonas>no
18:31:04<centrinia>Why not?
18:31:13<lilac>mauke: virius lupus was some famous roman dude
18:31:14<b_jonas>there'd be 2^n
18:31:21<Cale>2^n - 1
18:31:59<b_jonas>Cale: no, "the n-th generation of brain eating victims" doesn't include earlier ones I think
18:32:15<Cale>oh, if that's the case, then yes
18:32:28<tromp>:t showOct
18:32:30<lambdabot>forall a. (Integral a) => a -> String -> String
18:32:31<b_jonas>well, either can be a plausible interpretation
18:32:37<b_jonas>after all, zombies don't die
18:32:44<b_jonas>they can only be destroyed
18:32:48<tromp>> showOct 797 ""
18:32:49<lambdabot> "1435"
18:32:50<Cale>I thought it was talking about the total zombie population :)
18:33:02<centrinia>What if the zombie can only eat one brain during one generation?
18:33:26<b_jonas>centrinia: that would be a strange definition of "generation"
18:33:28<Cale>centrinia: But they keep earing?
18:33:32<Cale>eat*
18:33:46<centrinia>They go back to the grave after eating two brains.
18:34:08<lizrail>Hi, can anybody explain, what's the reason for this error in ghci: Loading package HTTP-4000.0.6 ... linking ... <interactive>: /usr/lib64/http-4000.0.6/ghc-6.10.1/HSHTTP-4000.0.6.o: unknown symbol `networkzm2zi2zi1_NetworkziURI_uri_closure'
18:34:08<lizrail>ghc: unable to load package `HTTP-4000.0.6'
18:34:51<voker57_>version mismatch in network
18:35:06<mauke>preflex: zdec networkzm2zi2zi1_NetworkziURI_uri_closure
18:35:06<preflex> network-2.2.1_Network.URI_uri_closure
18:35:07<Cale>lizrail: hmm, my first thought was "you're not compiling with --make" but since you got it in GHCi, it's probably a version mismatch like voker57_ says :)
18:35:33<lizrail>mismatch between what and what? I tried rebuild network and http
18:35:54<Cale>lizrail: hmm...
18:36:00<centrinia>So zombie a_{0,0} eats the brain of zombie a_{1,0}; zombie a_{0,0} and zombie a_{1,0} eat the brains of zombies a_{2,0} and a_{2,1}; zombie a_{1,0}, zombie a_{2,0}, and zombie a_{2,1} eat the brains of zombie a_{3,0}, a_{3,1}, and a_{3,2}
18:37:18<tromp>> showOct 410 ""
18:37:20<lambdabot> "632"
18:37:48<lizrail>Cale, I get this when trying to compile: http://pastebin.com/m165ce497
18:37:53<tromp>> showOct 1024 ""
18:37:55<lambdabot> "2000"
18:38:51<Cale>lizrail: Yeah, it's got to be something strange with either network or http... I'm not sure what though, I've never run into that before.
18:40:11<skorpan>@type when
18:40:12<lambdabot>forall (m :: * -> *). (Monad m) => Bool -> m () -> m ()
18:40:19<Cale>centrinia: The number of freshly bitten zombies on a given turn is the sum of the freshly bitten zombies from the previous two generations. So that's Fibonacci-ish...
18:41:10<lizrail>Cale, what can be done to investigate the problem?
18:41:31<tetha>mm, I remember that there is a simulator of a zombie outbreak in a building somewhere
18:43:29<Cale>lizrail: Let's start with ghc-pkg list network
18:44:02<Cale>Is there more than one entry? You should have a network package that came with your ghc installation most likely.
18:44:13<Cale>But there might also be a locally installed one?
18:44:34<Cale>I'm running 6.10.3 at the moment, so I'm not sure what version is appropriate.
18:44:40<lizrail>Cale, http://pastebin.com/d460e5836
18:45:07<Cale>Oh, interesting, so there are two of them which are the same...
18:46:01<Cale>Maybe try uninstalling that local version of network: ghc-pkg --user unregister network
18:46:02<lizrail>Cale, I believe it because at first I built one as user with cabal and later second was installed from haskell overlay
18:46:40<lizrail>Cale, all fixed!
18:46:47<lizrail>thanks
18:46:57<Cale>Ah, that solved it? Nice :)
18:47:45<lizrail>still I'm puzzled how to prevent similar issues in the future..
18:48:11<lizrail>by not using --user with cabal?
18:48:13<Cale>Well, a good rule of thumb is not to use cabal to install packages that normally come with ghc. It's not ideal...
18:48:35<lizrail>Cale, but what if I want to update them?
18:48:57<lizrail>or some other package wants more recent version?
18:49:19<Cale>Usually if a package wants a newer version of one of those, it's meant to be built with a newer GHC anyway.
18:49:46<lizrail>)
18:49:50<Cale>I think that normally it's okay to have multiple versions of a package installed though
18:50:06<Cale>I think it may have got confused by the fact that they were the same version.
18:50:52<Cale>dcoutts would know more about this than I do
18:51:23<Cale>(He wrote much of Cabal and is really familiar with the package system)
18:51:35<eivuokko>It should be possible to link package with same name, but different versions, currently.
18:51:37<lizrail>yes, though I remember I runned into troubles in the past then two versions of package was used by two different packages in one program
18:52:03<eivuokko>The types between the different versions are never compatible in type system.
18:52:34<Cale>We have some annoying dependency problems like that in some of the packages on Hackage. Particularly stupid issues like packages demanding different versions of QuickCheck.
18:52:42<Cale>(Even though they only use it for testing)
18:53:10<eivuokko>I think that is also related to how cabal tries to optimise the dependencies?
18:53:29<Cale>Possibly. I seem to recall that installing them one by one separately helps.
18:54:11<eivuokko>Yeah, basically Cabal optimises dependencies on general case (not ghc), which means you can't have Qc<2.0 and Qc>=2.0 at one time in dependency solver.
18:54:22<eivuokko>Or did last I read it, but that's a while ago.
18:55:18<lizrail>deleting .cabal and rebuilding nessesary packages helped me one time
18:55:25<Cale>I've also had the dependency solver make bad decisions about which version to install, like it would inexplicably pick a really old version of something to download and install.
18:55:46<Cale>But if you asked for the deps separately, it was fine.
18:55:53<eivuokko>Hmmm.
18:56:02<eivuokko>That sounds like a bug in SAT solver thingy...
18:56:17<mreh>conal: is your webiste good material to read for game programing?
18:56:28<mreh>"Simply efficiennt functional reactivity"
18:56:58<Cale>mreh: Yes, but only if you're prepared to write your game in a new and somewhat experimental way :)
18:57:27<Cale>mreh: After playing around with Reactive, I'm pretty convinced that something like it is the future of game programming.
18:57:37<conal>mreh: i agree with Cale, though he may be being too generous.
18:57:37<lambdabot>conal: You have 4 new messages. '/msg lambdabot @messages' to read them.
18:57:52<conal>Cale: :) !
18:57:57<Cale>mreh: But the current implementation still has some bugs which make it a bit hard to use practically...
18:58:15<conal>mreh: games definitely fit into what i want Reactive to support well.
18:58:31<lizrail>Cale, please, give a link )
18:58:32<conal>yeah. what Cale said.
18:58:50<conal>the programming model needs work, also.
19:00:02<conal>so far, FRP doesn't handle input in a composable way.
19:00:03<skorpan>if i have a bunch of type constructors for the same type, e.g. data A t = A t t | B t t t | C t, and i want to be able to access the first parameter for each constructor, is there any generic way of doing this? i don't mind e.g. TH?
19:00:06<Cale>lizrail: To conal's blog? http://conal.net/blog/
19:00:26<FunctorSalad>skorpan: gmapQi
19:00:28<Cale>lizrail: The best introductory articles are quite a ways back now though...
19:00:44<skorpan>FunctorSalad: i for index?
19:00:46<conal>the paper "genuinely functional user interfaces" set a direction for FRP with composable input, but it wasn't very much pursued. yampa got to a bit of it.
19:00:49<mreh>conal: i'll skip it
19:00:59<mreh>but I am looking for interesting projects
19:01:19<conal>mreh: sure. it'll give you more enlightenment than anything at this point.
19:01:25<FunctorSalad>skorpan: yes. head/gmapQ is fine too of course
19:01:57<lizrail>Cale, thanks, lots of promising titles. I must go now. Bye.
19:01:59<skorpan>i'd like some head...
19:02:16<FunctorSalad>skorpan: although I'm not sure syb can deal with this kind of polymorphism :(
19:02:18<mreh>im doing machine learning next year, FP should make it a whole lot easier
19:02:40<FunctorSalad>you can make "A" an instance of Typeable1
19:02:50<skorpan>this should be fairly easy with TH though, right?
19:03:04<FunctorSalad>(but I'm not sure what the predicate to gmapQ should look like)
19:03:09<skorpan>sad thing is i know virtually no TH myself
19:03:09<FunctorSalad>skorpan: yeah, use "reify"
19:03:23<FunctorSalad>then extract the constructors from the info
19:03:54<skorpan>could you help me with that? :/ sorry if i'm asking too much of you!
19:05:07<mreh>I like conals
19:05:13<mreh>'s website
19:05:25<mreh>"The goal of my new research agenda is to give artists access to the expressive power of computers"
19:06:07<conal>mreh: thx. i better re-read that sentence regularly so i don't forget!
19:06:33<conal>i still get regularly wrapped up in type theory, denotational semantics, etc.
19:08:16<Cale>Did you ever figure out what was going on with the integral equation problem?
19:08:28<solrize_>i really like .lhs. i write much more heavily commented code just from not having to type "--" on every line.
19:09:44<mreh>what dat?
19:10:26<Cale>mreh: hm?
19:10:31<Cale>lhs?
19:10:35<b_jonas>{- haskell has long comments -}
19:10:38<b_jonas>Cale: literal hs
19:10:44<wli>What kind of integral equation?
19:10:48<b_jonas>it has that file extension
19:10:55<Cale>b_jonas: I know, I was asking what mreh was asking about.
19:10:57<glguy>its a great way to fill your source code with pages of outdated comments :)
19:11:06<mreh>Cale: I was asking what .lhs is
19:11:17<b_jonas>oh
19:11:24<solrize_>b_jonas yeah, but that still feels like writing comments that are interspersed into code. .lhs feels like writing text with code interspersed into it.
19:11:39<solrize_>and i want to start using lhs2latex
19:11:39<glguy>mreh: instead of surrounding your comments with delimiters, you surround your code with them
19:11:45<glguy>> code goes here
19:11:46<lambdabot> Not in scope: `code'Not in scope: `goes'Not in scope: `here'
19:11:49<b_jonas>well I don't really like literate programming
19:12:01<b_jonas>I don't write many comments either
19:12:07<FunctorSalad>skorpan: rough outline... http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5130#a5130
19:12:09<b_jonas>sometimes I do write some comments of course
19:12:21<burp_>wtf, > in front of each code line?
19:12:25<burp_>how mad is that
19:12:26<Cale>mreh: It's Literate Haskell. It makes commenting the default, and there are two styles of it. The first requires that each code line begins with "> " and the second puts code in between \begin{code} and \end{code}
19:12:31<Vq^>burp_: thats the idea
19:12:45<Cale>It's quite nice actually.
19:13:05<FunctorSalad>skorpan: reference for the abstract syntax tree..... http://hackage.haskell.org/packages/archive/template-haskell/2.3.0.1/doc/html/Language-Haskell-TH-Syntax.html
19:13:12<Cale>wli: Anything recursive.
19:13:25<FunctorSalad>(there are lower-case versions of all these constructors, which operate on values in the Q monad)
19:13:25<Vq^>burp_: consider the situation when you have a lot more documentation than actual sourcecode
19:13:46<burp_>ok
19:13:49<MyCatVerbs>The bird notation ("> " at the start of every line) is used on a lot of Haskell blogs so that one can just copy and paste their posts into a file, stick .lhs on the end of it and compile.
19:13:56<Cale>wli: But in my case, it was the integral equations for describing the position of an object in terms of its acceleration and velocity, when it had a drag acceleration dependent on the velocity.