четверг, 8 января 2009 г.

Haskell pt.2

MacQueen, and only on alternating weeks.
02:26:24 I will never forget.
02:26:30 the looks better
02:26:42 ksf: indeed, there are really simple template idioms i'd like
to use that are socially unacceptable because of the verbosity that occurs
without inferencing (c++0x's auto will help that somewhat)
02:26:46 @flush
02:26:55 @remember JonathanShapiro Later we would come to feel that
monads do not scale to large programs well.
02:26:55 Done.
02:27:00 @quote scale
02:27:00 JonathanShapiro says: Later we would come to feel that
monads do not scale to large programs well.
02:27:33 @flush
02:27:52 ' The problems with module systems in stateful languages are
all about global variable initialization order. Java ducks this by eliminating
both non-trivial and mutable global variables. Which works, but it is one of the
reasons that Java isn't terribly well suited to systems programming. One thing
does seem clear: using things before you define them is problematic in a safe
programming language.
02:28:11 (Yes, I suppose using undefined things can be problematic)
02:28:46 java isn't suited for systems programming because it's without a
j2se runtime
02:29:01 insert a "a pain to use" there.
02:29:13 i know, i did games in j2me.
02:29:29 ACTION proposes hardware j2se runtime chips
02:29:48 ACTION proposes software j2se compile-time chips
02:29:55 you've got the speed of an interpreted language and the
inflexibility of a compiled one.
02:30:32 ksf, how dare you say such blasphemy to a compiled channel!
02:31:13 ghc-api ftw.
02:31:23 @faq Can Haskell be as flexible as an interpreted language?
02:31:23 The answer is: Yes! Haskell can do that.
02:31:30 'From the programming language community, we are often informed
that we didn't fully understand the I/O monad, or we are asked whether state is
truly necessary. To some degree this question is a matter of theology, but state
is unquestionably awkward from a verification standpoint. '
02:31:47 TH ftw.
02:32:57 gwern, this is from the recent LtU paper?
02:32:58 'The real reason we stuck with the LISP-ish syntax is that we
didn't want to be fiddling with the parser while designing the language, and (to
a lesser degree) because we didn't want to encourage programmers until we
thought the language was ready. We are now preparing a more sensible surface
syntax, whereupon we will receive rotten egg and tomato complaints from the LISP
community. You can't please everyone.'
02:33:09 luqui: I don't think so, the page is marked a draft/unfinished
02:33:10 gwern: heh, "So in summary, why did we create BitC? It seems
that we did so because of a failure to understand functional programming idioms."
02:33:23 (not a real quote)
02:33:24 heh
02:33:47 Yes, it's the LtU paper.
02:33:50 @remember JonathanShapiro We are now preparing a more sensible
surface syntax, whereupon we will receive rotten egg and tomato complaints from
the LISP community.
02:33:50 I will never forget.
02:33:55 @quote rotten
02:33:56 JonathanShapiro says: We are now preparing a more sensible
surface syntax, whereupon we will receive rotten egg and tomato complaints from
the LISP community.
02:34:37 starting out with lisp syntax is actually a very sensible idea.
02:34:49 ksf: Indeed it is.
02:34:51 Cale, that does seem a pretty common reason (with various
substitutions for "functional programming") to create a language
02:34:52 'It is noteworthy that none of this effort was deemed fundable
by the National Science Foundation (which is to say: by the academic programming
languages community). The work is clearly innovative, and it is somewhat unusual
to find a project of this sort that is accompanied by a validating experiment. '
<-- sour much?
02:35:07 ksf: lisp no-syntax
02:35:14 gwern, got a link?
02:35:22 ?seen mbeddoe
02:35:22 Last time I saw mbeddoe was when I left #debian-es, #dreamlinux-es,
#friendly-coders, #gentoo-uy, #haskell, #haskell-hac07, #haskell.de, #haskell.dut,
#haskell.es, #haskell.fi, #haskell.fr, #haskell.
02:35:22 hr, #haskell.it, #haskell.jp, #haskell.no, #haskell.ru, #haskell.se,
#haskell_ru and #thunks 2m 17d 21h 10m 27s ago.
02:35:23 luqui: looks like it might be post-LtU: 'We have received
comments, encouragement, and assistance from the many members of the bitc-lang
mailing list and the Lambda the Ultimate blog. '
02:35:35 dibblego: I posted it earlier: http://www.bitc-lang.org/docs/bitc/bitc-origins.html
02:35:36 Title: The Origins of the BitC Programming Language
02:35:57 'This sort of ``let's do a conservative, evaluable experiment''
approach makes project funding nearly impossible to obtain in academic circles,
which may help to explain why computer scientists tend to step on each other's
toes rather than standing on each other's shoulders. '
02:35:58 LISP has syntax. After all, lisp programs are not infinite...
02:36:31 @remember JonathanShapiro This sort of "let's do a conservative,
evaluable experiment" approach makes project funding nearly impossible to obtain
in academic circles, which may help to explain why computer scientists tend to
step on each other's toes rather than standing on each other's shoulders.
02:36:32 Okay.
02:36:37 @quote shoulders
02:36:38 JonathanShapiro says: This sort of "let's do a conservative,
evaluable experiment" approach makes project funding nearly impossible to obtain
in academic circles, which may help to explain why
02:36:38 computer scientists tend to step on each other's toes
rather than standing on each other's shoulders.
02:37:18 ACTION notes quietly that there's a tense disagreement there -
'tend to step' doesn't parallel 'standing'
02:38:09 minor type error
02:38:35 classical confusion of cause and effect there.
02:38:37 isn't it really awesome that creating your own operators in
Haskell is much more elegant and completely non-brittle?
02:38:52 well, it's not perfect
02:38:55 I mean, most language I know that let you do this result in very
brittle code.
02:39:11 I still find '-4' to be strange, and I wonder why precedences
are ints
02:39:29 what else should they be?
02:39:35 gwern: isn't the alternative a partial ordering?
02:39:37 dcoutts: little experiment, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/statistics-fusion-0.1
(reimplementing hstats using uvector fusion)
02:39:38 Title: HackageDB: statistics-fusion-0.1, http://tinyurl.com/667zvf
02:39:45 fynn, dependencies.
02:39:50 fynn: well, reals. or an approximation
02:39:56 gwern: strings
02:40:02 like * > +
02:40:08 hey, awesome, haddock generates uvector's docs now.
02:40:15 possibly the reason for them being integers and discrete is to
avoid confusing people too much.
02:40:22 fynn: if '+' is 8, and '*' is 9, one should be able to insert
something between '+' and '*' if that's semantically appropriate
02:40:25 it's hard to remember precedence rules as it is.
02:40:45 8.5 would work. and suppose you want to add another betwene the
new one and *? make it 8.75 and so on
02:40:58 Stuff like * > + means you have to worry about cycles and such.
02:41:05 * > # > + still holds.
02:41:11 gwern: still, isn't Haskell the language with the best (maybe "only
usable") implementation of "define your own operators"?
02:41:16 mauke: how would strings work?
02:41:17 well cycles are obviously errors.
02:41:32 ?users
02:41:32 Maximum users seen in #haskell: 559, currently: 492 (88.0%),
active: 23 (4.7%)
02:41:34 fynn: I suspect the lispers would disagree. haskell is
certainly better than your average bear I do admit
02:41:54 gwern: I don't know, but the idea was mentioned in the perl6
design :-)
02:42:04 gwern: you think lispers would argue that non-hygienic macros
are not brittle?
02:42:09 mauke: of course, I suppose
02:42:18 dons: I'm interested what you think is gained from hitting
mean etc with the INLINE hammer :-)
02:42:22 fynn: I dunno. go ask some common lispers and see what they say
02:42:25 dcoutts: it is required.
02:42:28 mauke, only briefly.
02:42:32 dcoutts: otherwise no fusion happens in the user's module.
02:42:37 hmm
02:42:41 ghc 6.10
02:42:47 mauke, every day
02:42:53 dcoutts: note i had to /remove/ inline from Data.Binary.Get to
get it to inline...
02:42:54 because the bodies look too big
02:43:00 maybe, yeah.
02:43:15 gwern: I worked with Lisp a bit, and although the non-hygienic
macros are powerful, I'm pretty sure they're more brittle than defining
operators in Haskell.
02:43:33 the breakage cases are much more subtle, and problematic once
they occur.
02:43:38 dons: hmm, do you know what was going on with get? phasing
things? inlining too early?
02:43:46 fynn, of course, because they are not extensional
02:43:46 fynn: iirc, wouldn't a lisper hack the symbol table to define
an operator?
02:44:03 (man, am I hungry)
02:44:10 lol
02:44:32 (fullp fridge)
02:44:41 any mechanism which can distinguish between two identical
functions is going to be brittle
02:44:43 hehe
02:45:13 gwern: I thought it was 'hack the gibson' not symboltable
02:45:41 .oO( what's the equivalent of %::=() in lisp? )
02:46:06 dcoutts: it wasn't respecting our inline stuff. not sure why.
02:46:43 mauke, I have been out of perl for a while, but... that isn't
legal, is it?
02:46:45 gwern: (really not sure changing the symbol table in any way is
going to give you all the stuff you can do with Haskell's custom operators)
02:46:56 luqui: depends on your definition of "legal"
02:47:16 mauke, okay, probably it will parse, but no matter what the
context, it will always result in a runtime error
02:47:22 nope
02:47:32 % perl -wle '%::=(); print 42'
02:47:32 42
02:47:43 .oO( does stripping a lisp program of identifiers produce
interesting set-theoretic theorems? )
02:47:43 oh geez.
02:47:50 the Enterprise operator.
02:48:03 luqui: but do it in a BEGIN block to trigger a segfault
02:48:03 Perl 6 code is going to look like a Star Trek episode.
02:48:25 oh that's a real =. I was parsing "%::=" as the name of a hash
02:48:48 i see, empty the top-level symbol table
02:48:55 We call it operator NCC-1701?
02:50:01 omg my code typechecks!
02:50:08 ACTION does the typechecking dance
02:50:09 congrats
02:50:09 byorgey: yeah?
02:50:13 ship it!
02:50:20 byorgey: now, exlpain the significance
02:50:24 ACTION hits the 'ship' button
02:50:27 Is the type 'IO a' really 'World -> (a, World)'?
02:50:32 byorgey: what is your code?
02:50:35 harblcat: no
02:50:40 well, I've just finished some major refactoring
02:50:50 I basically spent the past two hours fixing type errors
02:50:50 harblcat: more like (a, World)
02:51:04 so I had to share my victory =)
02:51:14 this is my lambda-cube interpreter
02:51:30 byorgey: tell me about it...I had some sessions on the darcs
source were I'd spend a couple days making stuff type check with our GADTs :)
02:51:35 harblcat, that depends on what you mean by "really"
02:51:41 hehe, sounds fun =)
02:51:46 mauke: I've been trying to get the 'a' out..
02:51:51 where a day is defined as 12+ hoours of hacking :
02:51:52 :)
02:51:54 harblcat: why?
02:52:13 harblcat, you can't, by design. though you can use the a inside
another IO action
02:52:14 ACTION is determined but perhaps slow
02:52:15 harblcat: It's not *really* World -> (a,World)
02:52:31 mauke: So that I don't have a whole bunch of IO * functions...
02:52:38 huh?
02:52:44 Working with random numbers is hard.
02:52:55 if you use global state, yes
02:52:56 harblcat, make them functions of an infinite list of random
numbers
02:52:57 or rather, no
02:53:03 just use IO everywhere
02:53:04 harblcat: well, you see, you have an inverted view of the world
as most haskell beginners do
02:53:17 harblcat: Inside of a do-block defining an IO action, you can
write v <- x where x :: IO t, and then v :: t
02:53:22 lispy: I am a beginner, yes.
02:53:36 harblcat: That v can then be passed on to a pure function.
02:53:40 lispy: everyone knows that if you try to hack a gibson, you'll
just wind up burning the chrome
02:53:41 ACTION just defined the shurikan operator: <+>
02:53:50 Cale: But then when I return v, it's IO v, anyway
02:53:51 apropos "hacking the Gibson" that is.
02:53:51 harblcat: and the result perhaps used for output later
02:53:55 harblcat: right.
02:54:00 > randoms (mkStdGen 42)
02:54:01 [-3907187990116499535,-2519438828217931933,-8264534369199619667,86887135830...
02:54:05 harblcat: basically, you pull the value out while your in a do-block
and use all your non IO functions on that value. When you're done looking at the
value, you use 'return' to put it back into IO :)
02:54:07 > randoms (mkStdGen 42) :: [Double]
02:54:08 [0.11040701265689151,0.8453984927258916,0.30778213446209723,0.7813880826070...
02:54:16 harblcat: Do something pure with the thing you got from the IO
action, and then do some output
02:54:22 "Type mismatch: expected type A -> A, got type A -> A instead"
-- hmm... =P
02:54:28 harblcat: At least, that's the general pattern.
02:54:31 ACTION goes and watches an Alan Kay presentation at TED
02:54:38 harblcat: In the end, your 'main' is an IO action anyway.
02:54:52 byorgey: oh, better do a recall on that ship :)
02:55:00 too late! ;)
02:55:19 Ah, so the value is pure while in the do block, but once it
leaves, it's an IO value again?
02:55:19 byorgey: at least your program doesn't allow buggy programs :)
02:55:31 harblcat: yeah, in that regard IO is a wrapper
02:55:32 harblcat: the do-block as a whole is an IO action.
02:55:46 lispy: I wouldn't be willing to put money on that...
02:55:46 I see. So I've got to think differently.
02:56:00 harblcat, well.. it can only leave through the use of "return",
which has type a -> IO a, which puts it back into the IO monad
02:56:01 Think different!в„ў
02:56:07 'leave'
02:56:10 byorgey: obama won, we can do anything now. Don't be so shy ;)
02:56:16 hehe
02:56:16 I'm not clear on what 'leave' means here ;)
02:56:31 ?faq Can Haskell elect an african american president to the US?
02:56:31 The answer is: Yes! Haskell can do that.
02:56:41 Cale, me neither. I'm just trying to jump on his thought train....
02:56:44 But you might pass v to a pure function.
02:56:54 something like...
02:57:02 let w = f v
02:57:20 and then do some more actual I/O with the result of that...
02:57:23 print w
02:57:49 Ah.
02:58:18 Well, someone said before, generating a list of randoms is
not hard. I was just getting confused as to how I would use them.
02:58:24 harblcat, but if the only IO you are doing most of the time is
getting random numbers, you might like MonadRandom on hackage
02:58:47 harblcat: now that we've said all that, there is one way to
take a value out of IO but it's reserved for use by experts that understand it
will eat kittens if used incorrectly
02:59:02 ACTION eats a kitten
02:59:16 I think it's misleading to say "take a value out of IO"
02:59:19 Assuming I completely abandon operational reasoning, can I still
reason about big-O?
02:59:27 A better way to say that is "run an IO action"
02:59:33 I was making a list of numbers, basically rands n, which
would return IO [Int]... And sum doesn't work on IO [Int]
02:59:35 ksf, VERY good question.
02:59:45 harblcat: fmap sum does though.
02:59:53 :t fmap sum
02:59:54 forall a (f :: * -> *). (Functor f, Num a) => f [a] -> f a
03:00:00 ksf, I have been trying to answer it for myself for quite a
while
03:00:02 :t fmap sum :: IO Int
03:00:04 Couldn't match expected type `IO Int'
03:00:04 against inferred type `f [a] -> f a'
03:00:09 harblcat: It gives you an IO Int
03:00:23 :t fmap sum (replicateM 6 randomIO)
03:00:24 forall a. (Random a, Num a) => IO a
03:00:29 :t fmap sum :: IO [Int] -> IO Int
03:00:30 IO [Int] -> IO Int
03:00:50 (boy, Kay seems very tired in his talk. when I think about it,
he must be in his 60s by now or something)
03:00:51 harblcat: Of course, you could also write:
03:01:00 :t fmap sum
03:01:01 forall a (f :: * -> *). (Functor f, Num a) => f [a] -> f a
03:01:07 do xs <- myIOaction; return (sum xs)
03:01:29 :t do xs <- replicateM 6 randomIO; return (sum xs)
03:01:31 forall a. (Num a, Random a) => IO a
03:01:38 How to be sure that map is really O(n) and not NP-hard?
03:01:48 ksf: what?
03:02:00 Assuming I completely abandon operational reasoning, can I
still reason about big-O?
03:02:10 no, you can't.
03:02:24 that's quite a conclusion to jump to
03:02:29 If you're working in the land of denotational semantics,
functions don't take any time at all.
03:02:35 They're defined or they're not.
03:02:51 yeah. evaluation strategies alone would mess things up
03:02:55 but saying "no, you can't" I think is a shaky thing to extract
from this
03:03:05 yes, but they still have complexity.
03:03:13 What complexity?
03:03:19 we already know the answer
03:03:19 why would there not be a different semantics which captures
computational complexity as well
03:03:22 You can add time to the picture, but it's not there in the
denotational view.
03:03:31 you cannot use scott semantics, but does that mean it can't be
done?
03:03:43 luqui: Oh, of course it can be done.
03:04:04 Usually it's done via a particular operational semantics, but
you could invent something else.
03:04:12 Asking about the complexity of something given as denotational
semantics, isn't that really just the complexity to verify the answer?
03:04:15 yay, I like being able to invent things!
03:04:47 lispy: I suppose you could look at it that way too, "jumping
outside the system"
03:04:49 So I'm guessing that when someone is a haskell beginner,
there are a lot of moments like these where one has to think differently, maybe
learn something new?
03:04:54 And so if we're only considering the time to verify the answer,
that's the whole non-deterministic space right?
03:04:55 harblcat: yes.
03:05:04 harblcat: Treat it like learning to program again :)
03:05:44 harblcat: This IO that you're doing, it's for managing random
numbers?
03:06:00 harblcat: You might instead find it more convenient to work with
StdGens.
03:06:04 Let's break this down: Is there a way to tell that map _cannot_
run in less than O(n)? It certainly _can_ be NP-hard if you e.g. use a compiler
that targets malbolge.
03:06:48 ksf: I don't see a way to make that question meaningful without
introducing at least some notion of what it means to compute the result.
03:07:21 I mean map might be O(1), and in fact, in Haskell, counting the
time to reach WHNF, it is.
03:07:42 there are people that study minimum algorithmic complexity, but
those people still do so interms of operational semantics, right?
03:08:10 yes, mmx makes addition O(1/4)
03:08:21 O(1/4) = O(1)
03:08:27 Cale: StdGens?
03:08:32 harblcat: Yes.
03:08:48 harblcat: A StdGen value is essentially the state of a random
number generator.
03:08:51 not if you compare O(1/4 * n) and O(1 * n)
03:09:04 O(n/4) = O(n)
03:09:10 ksf: No, those are the same class as well.
03:09:46 harblcat: You can get a random one (based on the clock) using
newStdGen from IO
03:10:02 Cale: Well, I'm currently using gen <- getStdGen, and before
returning a value I use newStdGen...
03:10:04 well, actually I'm more interested in knowing the run-time cost
than figuring out the concrete class.
03:10:11 harblcat: You then pass that StdGen you get to whatever
otherwise-pure function needs to generate (pseudo) random values
03:10:22 Cale: newStdGen returns a StdGen?
03:10:38 Uploaded to hackage: statistics-fusion 0.1
03:10:38 harblcat: yeah. getStdGen is totally superfluous, and I'd
recommend avoiding it.
03:10:51 harblcat: newStdGen is almost always what you really want.
03:10:59 Cale: Never thought of that, thanks! One less line of code.
03:11:41 harblcat: Then you use functions like randomR to get a
pseudorandom value from that StdGen, along with another StdGen, which should be
used to get the next value.
03:12:10 Cale: I'm using randomRs, to get many at once.
03:12:18 Right, that works too. :)
03:12:45 You can also use split, to split a StdGen into two new ones (useful
if you need to recurse down two branches of a tree, for instance)
03:12:47 specifically, I'm more interested in what effects it has to my
reasoning than in doing pen+paper calculations using it.
03:13:10 s/no-grammar/grammar/
03:13:24 heh
03:14:26 Understanding the real-world cost of running a Haskell program
is probably best done using profiling and a toy model of the operational
semantics.
03:14:28 Cale: I'm guessing that splitting a StdGen is more efficient
than making two new ones?
03:14:28 or, put differently, I want you guys to beat the assembly out of
my head.
03:14:38 harblcat: Well, it's pure :)
03:14:56 harblcat: Not just more efficient (actually I'm not sure if it
is more efficient)
03:15:03 :t split
03:15:04 forall g. (RandomGen g) => g -> (g, g)
03:15:41 newStdGen calls split, I thought.
03:15:47 ksf: Okay, I think what you really want is a way to evaluate
Haskell code which gives you a real sense of how long it'll take to run.
03:15:48 :t newStdGen
03:15:49 IO StdGen
03:15:50 It only get seeded with the time at the start of the program.
03:15:55 And then splits from there.
03:16:19 dolio: Oh, okay. None of that stuff works how I think it ought
to, really.
03:16:43 Nah, actually I want to apply my haskell experience to imperative
languages more thoroughly.
03:16:51 In my mind, getStdGen shouldn't exist at all, and newStdGen
should read from the system entropy pool.
03:17:09 ksf: Okay...
03:17:19 How long do you think this will take? let divisors n = [x |
x<- [2..(n-1)], n `mod` x == 0]; isPrime n = if n < 2 then False else if (length
(divisors n)) == 0 then True else False; t = [n | n <- [1..500000000], isPrime (2*n^2
- 1)] in length t
03:17:40 keseldude: a metric minut
03:17:42 +e
03:17:49 do g <- getStdGen ; g' <- newStdGen ; return (split g, g') ==>
((1920670146 40692,1700912949 2147483398),1700912949 2147483398)
03:18:08 is X11-extras obsolete?
03:18:30 @src newStdGen
03:18:30 Source not found.
03:19:35 ksf: hmm...
03:20:06 ksf: Well, at the very least, you know how to remove unnecessary
state variables from things :)
03:20:08 juhp: yes
03:20:53 do g <- getStdGen ; g' <- newStdGen ; g'' <- getStdGen ; return
(show (split g) == show (g'', g')) ==> True
03:21:11 I find that getting better at haskell tends to make me a worse
programmer in other languages.
03:21:23 yes... there were days where i defined FP as putting as much side-effect
free functions into a statement as possible.
03:21:25 mauke: thanks - it would be nice if packages can be labelled old
or something in hackage, like "Obsoleted by: X11 >= ..."
03:21:31 keseldude: If I'm reading that correctly, I would expect the sun
to burn out first.
03:21:39 :D
03:22:14 at least it's not 2^n - 1
03:22:22 learning haskell didn't affect my perl skills, but it ruined my
ocaml
03:22:30 that would be ridiculous
03:22:41 "if (length (divisors n)) == 0 then True else False" == "(length
(divisors n)) == 0"
03:23:08 yeah, I wrote it really quickly a few minutes ago
03:23:29 I wasn't really thinking
03:23:45 keseldude: Speeding that computation up so that it's more
reasonable seems like it would involve quite a bit of number theory.
03:24:06 it's the most recent problem on Project Euler
03:24:30 keseldude: well, you'll need much more efficient algorithms
than that
03:24:51 for one, isPrime only needs to check for divisors up to sqrt n
03:24:56 yeah, I was about to ask
03:25:10 I tried to do that, but I could never quite get it to go up
to only floor(sqrt(n))
03:25:32 :t floor
03:25:32 forall a b. (Integral b, RealFrac a) => a -> b
03:25:42 :t sqrt
03:25:43 forall a. (Floating a) => a -> a
03:25:46 okay i'm youtuberfing the video of frag
03:25:54 i hate that >_<
03:25:56 snk_kid: oh?
03:25:59 > [x | x <- [1..(floor(sqrt(12))], 12 `mod` x == 0]
03:25:59 snk_kid: nice
03:26:00 : parse error on input `]'
03:26:07 Cale: earlier discussion
03:26:18 Cale: no video of frag but while?
03:26:28 i mean but why
03:27:04 I would guess because it's easier to download and play frag for
yourself than to make a screencast :P
03:27:38 having a youtube video is nice advertising though
03:27:43 Cale: not exactly on widows and not until more recently
03:27:44 and documents what frag was like in 2008
03:28:04 Is frag actually under any active development?
03:28:06 sorry about spelling, 03:27 a.m.
03:28:39 Cale: no.
03:28:53 It's a nice proof of concept, but it's somewhat hastily designed,
and it's not really much of a game that you'd sit down and play for very long.
03:29:00 its a research prototype on building 3d games with reactive
programming.
03:29:12 It looks like some of Conal's recent work is headed in that
direction.
03:29:25 s/some/almost all of/
03:29:32 Cale: is there something better to show?
03:29:41 snk_kid: Not as a video.
03:29:55 monadius?
03:30:00 some of the other games on hackage?
03:30:06 snk_kid: But Conal has the core of a nice FRP 3D library in
place.
03:30:29 IMO, frag should be on youtube
03:30:38 There are soooo many video game videos on there. Why not?
03:31:04 dons: monadius is already up there
03:31:11 snk_kid: Of course, some of the Japanese guys have been knocking
out retro games with Haskell, which are pretty cool, but they're not 3D.
03:31:28 Cale: i know, i was the one who linked to super nario ;)
03:31:35 :)
03:32:11 anyways it's to late you can't stop me now!
03:32:14 hooray, upgrading cabal was a lot easier than expected
03:32:16 hehe
03:32:27 I'm not arguing against putting a video up :)
03:32:46 You asked why there wasn't already one there, and I tried to
provide an explanation as to why that might be :)
03:33:31 is there a function does this? f [id,(+1),(*2)] 2 = [2,3,4] ?
03:33:42 > sequence [id,(+1),(*2)] 2
03:33:43 [2,3,4]
03:34:00 :t sequence
03:34:01 forall (m :: * -> *) a. (Monad m) => [m a] -> m [a]
03:34:02 luite: That requires Control.Monad.Instances
03:34:11 Here, m = e ->
03:34:13 ah, thanks, I thought it would be ap, but that didn't work
03:34:20 @type ap
03:34:22 forall (m :: * -> *) a b. (Monad m) => m (a -> b) -> m a ->
m b
03:34:33 well...
03:34:36 > ap [id,(+1),(*2)] [2]
03:34:37 [2,3,4]
03:34:39 yes
03:34:55 yes I already found that out :)
03:34:58 So (ap .) . return
03:35:04 er...
03:35:28 points-free fail
03:35:31 I guess the sequence example uses the (->r) monad, while the ap
example uses the list monad
03:35:45 yeah
03:35:49 ((->) r)
03:35:54 Or (r ->)
03:35:58 er, yeah, that one
03:36:11 monadius actually looks pretty cool
03:36:14 I kinda wish we could actually write (r ->)
03:37:49 hey, monadius devs, not everyone uses qwerty!
03:37:51 is it possible to write a pointfree id function?
03:38:03 myid = id
03:38:08 ;)
03:38:20 I = SKK
03:38:26 with id only on the left side ;)
03:38:33 :t ap const const
03:38:34 forall a. a -> a
03:38:50 :t fmap fix return
03:38:51 forall a. a -> a
03:39:18 :t head . (: [])
03:39:18 forall a. a -> a
03:39:55 > (fmap fix return) 2
03:39:56 2
03:41:56 Haskell for C Programmers: http://www.youtube.com/watch?v=PoPyMcD9lSE
03:42:01 Title: YouTube - Haskell for C Programmers Video Supplement
(Part I)
03:42:09 Except the narrator calls it Haskall
03:42:38 i pronouce it like pascal but with with a h
03:44:00 It doesn't sound like Pascal.
03:44:07 not pascal
03:44:17 Pascal with a H :P
03:44:29 That's still wrong. :)
03:44:53 It's like Haskle.
03:45:12 silly speakers of english
03:45:14 If you take SPJ as a reference, at least.
03:45:34 we can has skull?
03:45:36 yeah i think i'm saying it the same way anyways
03:45:38 rhymes with rascal
03:45:46 geezusfreeek: can has skull?
03:46:41 uh, gwern
03:46:42 I've heard that SML's module system is more 'powerful' than
Haskell98's modules + type classes. Do type families close the gap?
03:46:44 sorry geezusfreeek
03:47:30 what the hell youtube >.<
03:47:49 Hehe, the guy playing Super Nario Bros tries to get the hidden 1up,
but clearly it's not there :)
03:49:08 mwc: http://www.haskell.org/pipermail/haskell/2004-August/014463.html
03:49:14 Cale: yeah, I thought that was cute too
03:49:27 Title: [Haskell] Applicative translucent functors in
Haskell
03:49:46 dolio: thanks, been away from haskell for a few months
03:51:07 heheh, this video about 'lambda list', the narrator says 'skim'
instead of 'scheme'...I didn't realize these languges had such vague
pronouncation rules :)
03:52:38 http://uk.youtube.com/watch?v=0jYdu2u8gAU
03:52:39 Title: YouTube - Frag - 3D FPS game written in Haskell
03:55:11 snk_kid: hey, is that the standard map?
03:55:20 snk_kid: too bad the video framerate doesn't keep up with
the game
03:55:46 sorry i couldn't find a decent capture software, if you got
any recommendations
03:55:58 snk_kid: well, at worst it will make people download it
03:56:17 snk_kid: in order to see it at 60fps ;-)
03:56:46 Maybe what I want is to stop reasoning about every part of a
problem in a touring-complete way. That is, capture the minimal complexity of
the system that is needed to evaluate each part.
03:56:55 snk_kid: what did you use?
03:57:16 Cale: yeah, i noticed it's from OpenArena so i'll download it
tomorrow maybe and rip out some maps
03:57:25 lispy: Camtasia
03:57:45 you could probably just modify the game to dump the frames to
an avi
03:57:49 What I _definitely_ should do is continuing reading A New kind of
Science.
03:58:04 s/reading/rereading/
03:58:16 I think jeffz is write
03:58:18 right*
03:58:18 jeffz: not at 04:00 a.m. i'm not :)
03:58:23 heh
03:59:31 jeffz: afterall, is there a FragMonad or what ? lol
03:59:42 It's an Arrow.
04:00:18 There are question-mark fnords all over " That is, capture the
minimal complexity of the system that is needed to evaluate each part."
04:00:35 look at the first comment lol
04:00:45 wow that video is terrible
04:02:19 snk_kid: much better than nothing
04:07:24 grr i can't remember how to take in an arguement string
04:07:47 take it like a man
04:07:54 :t getArgs
04:07:55 Not in scope: `getArgs'
04:08:00 ah.
04:08:04 @type System.getArgs
04:08:04 no System.IO
04:08:05 IO [String]
04:08:08 System.getArgs
04:08:23 :t System.Environment.getArgs
04:08:24 IO [String]
04:15:06 hehe thanks for all the replies
04:16:48 snk_kid: good work on the video.
04:17:26 snk_kid: but also, not worth engaging with comments on youtube :)
04:19:27 :)
04:19:59 time to sleep, good night/morning/afternoon
04:20:26 is this valid? "main = do x <- getArgs" and then nextline:
"putStrLn x"
04:20:37 nofeardjb: no
04:20:51 x :: [String], putStrLn :: String -> IO ()
04:20:58 mauke: i can't remember how i was doing this yesterday lol
04:21:14 aaaaaaah
04:21:48 :/aa2/aa3/aa;/aa9/aa1/aa5/h
04:22:22 :O
04:22:24 I'm imagining a dialect of haskell that is mostly not touring-complete,
but requires usage of a special monad to do such evil and hard-to-reason-about
things.
04:22:27 mauke: nice
04:22:33 For now, it seems to work quite well.
04:22:35 nofeardjb: what are you trying to do?
04:23:25 I figured that you mostly don't need it, so you shouldn't care
about it.
04:23:28 mauke: one second
04:25:14 mauke: heh, well from my assignment i can't tell if this is
supposed to be a stand alone executable of haskell or if he's going to test via
hugs interpreter O_o so maybe i don't need to worry about I/O
04:27:08 well it's always nice to have something like (infile:outfile:[])
<- getArgs and then do all the stuff instead of relaying on interact or such.
04:28:14 ksf: ya, i'm having a hard time learning the IO syntax for
Haskell
04:28:44 i think i'll finish the nuts and bolts of the program and
then see if i can write some sort of IO at the end, since i don't think its
required for this assignment
04:28:44 nofeardjb: there is no IO syntax :-)
04:28:48 all you need is (>>=) and return
04:29:01 mauke: i'm not so good with words xD
04:30:15 I hereby hypothesise that Big-O can be defined for denotational
semantics that describe non-touring complete systems.
04:30:51 Turing
04:30:59 my bad.
04:31:14 it's associated with "tour" and "round-trip" in my head.
04:31:33 o_O
04:33:20 Shortcutting the proof by abstract nonsense, I'd say that
analysis becomes possible non-operationally 'cos I just defined away the halting
problem.
04:34:28 ksf: wait, what's bad about 'interact'?
04:34:34 when it's usable, I love interact
04:34:45 the shell redirection.
04:34:49 I just don't like it.
04:35:10 shouldn't be the only way to use a program.
04:35:16 yes, it should
04:36:08 ghc --make < Main.hs?
04:36:28 that's different; you can actually pass multiple files to ghc
04:38:12 well, taste cast aside, there are times when you don't have a
shell to do all the handle bending for you.
04:39:46 wow the ackermann equation is fun recursion :)
04:39:51 yeah
04:39:52 er, algorithm
04:39:53 it's crazy
04:41:08 Conjecture: If you can't tell how many beers you've had without
looking at the near-empty six pack, you're also going to drink the rest of it.
04:41:21 ....lol
04:43:29 random ackermann reference: http://xkcd.com/207/
04:43:30 Title: xkcd - A Webcomic - What xkcd Means
04:44:14 anyone met Jon Harrop?
04:44:52 Why is this guy such an ubertroll? I mean hardly an
attitude that works in a community of people with strong logic skills. is he a
real doctor btw?
04:45:10 askentasken, he is a fraud, ignore him
04:45:44 askentasken: why? money
04:46:01 Where are you that he's trolling?
04:46:27 let's not go down that rabbit hole.
04:46:47 sweet: ack 4 1 "ERROR - Control stack overflow"
04:47:09 is that hugs?
04:47:13 ya
04:47:17 nofeardjb: dude, gotta get yourself a real haskell :)
04:47:26 *==>* haskell.org/ghc
04:47:26 dons: oh i know
04:47:41 dons: we're required to use hugs for our work in this class,
don't ask me why
04:47:46 Is a malloc needed for each new bytestring created?
04:47:47 life must suck using hugs. not a strictness analsysis to be had.
04:47:56 nofeardjb: you could do it all in ghci / ghc , then port it back
i guess.
04:48:05 sw17ch, Mu.
04:48:07 but you should talk to the lecturer about using a modern haskell
system.
04:48:16 sw17ch: nope.
04:48:22 sw17ch: it allocates on the haskell heap
04:48:24 dons: the whole class has suggested it lol
04:48:36 dons: great! i was worried about that
04:48:42 i'd just use ghc anyway. unless he's trying ot make the language
seem like a toy.. :/
04:48:53 its like using an interpreter for C in a C class ...
04:49:23 lol
04:49:24 Has there been work on porting more of the windows API to
Haskell?
04:49:35 or are the parts not ported stupidly hard to implement?
04:49:55 doubt it. just not enough windows devs.
04:50:04 bugs are generally not haskell-compatible.
04:50:07 dons: i'm having issues porting Scurry to windows
04:50:15 and i'm being forced to be non-elegant
04:50:26 ksf :: a -> SCNR a
04:50:36 hi.
04:50:41 hey andrewsw
04:50:47 and if just a tad bit more of the Windows API was present...
it would be easier... oh well
04:50:47 hey dons.
04:51:17 if map applies a function to a list, how do I apply a list
of functions to a value returning the list of results?
04:51:30 sequence
04:51:43 >:t sequence
04:51:49 :t sequence
04:51:49 forall (m :: * -> *) a. (Monad m) => [m a] -> m [a]
04:52:02 sequence [(+1),(+2)] 5
04:52:06 > sequence [(+1),(+2)] 5
04:52:07 [6,7]
04:52:13 ah, perfect!
04:52:16 =)
04:52:47 > map ($ 5) [(+1), (+2)] -- Prelude only
04:52:48 [6,7]
04:53:04 hmmm... okay.
04:53:16 I was thinking I'd need a lambda
04:53:21 sw17ch's example requires an instance that is found in
Control.Monad.Instances
04:53:29 andrewsw: sure, you could use a lambda
04:53:43 > map (id 5) [(+1), (+2)]
04:53:44 No instance for (Num ((a -> a) -> b))
04:53:44 arising from the literal `...
04:53:52 > map (\f -> f 5) [(+1), (+2)]
04:53:53 [6,7]
04:53:57 dons: Are the new ByteStrings allocated on the haskell heap
capable of reusing old strings of the same size?
04:54:01 without intervention?
04:54:08 @pl \f -> f 5
04:54:09 ($ 5)
04:54:09 sjanssen: that's more up my alley
04:54:14 sw17ch: reusing?
04:54:32 as in, if you create a new string "foo" it'll be transparently
not allocated, and instead point to a previous one?
04:54:44 dons: I have a TChan of ByteStrings (packets) that are going
to be approximately 1500 bytes each.
04:54:50 Object reuse is all i'm going for
04:54:54 not that it matters if it's raw
04:54:56 and just bytes
04:54:58 you want to reuse the buffer?
04:55:38 you can reuse and copy buffers if you like. but i don't quite
understand what you want to be reused.
04:55:41 dons: well, i can't reuse the buffer, but is GHC capable of
seeing something of the same size on it's heap that's marked for GC and is the
same size/shape as what it's currently trying to allocate?
04:55:52 sw17ch: umm, doesn't the garbage collector do this?
04:55:57 oh. just leave it to the GC
04:55:58 sjanssen, that's wahti was getting at
04:56:01 its smart and efficient.
04:56:06 sw17ch: why is it imperative to use the exact same buffers?
04:56:09 Excellent, i didn't quite know how to ask that question
04:56:21 sjanssen: well, it won't even come up if he's using the GC
anyway.
04:56:32 sjanssen, it's not, but i'm going ot have millions of little
allocations which are immediately freed
04:56:53 and if the GC is smart about it, it'll be much faster, and i
don't have to worry about optimizing it myself
04:57:05 sw17ch: GHC's garbage collector is good at that
04:57:06 (since no more than a few of these will exist together at the
same time)
04:57:10 marvelous
04:58:03 it'll be interesting to see how you go.
04:58:21 dons: as soon as the windows port is working, i want to do a
release on hackage
04:58:30 there are cheaper options than bytestrings (e.g. uvector-like
strings), but for most scenarios i can think of ,bytestrings are perfect.
04:58:48 but wait for a problem before worrying about them.
04:58:58 well, i just had to move my read/write functions to C, so all
i'm really doing is passing CString's around
04:59:09 you had to move your read/write to C?
04:59:10 the bytestrings with a few unsafe usages will be great for my
purpose
04:59:25 yup. if you're using C, that's the only option really.
04:59:33 dons: yeah... the TUN/TAP driver in windows can't be used as a
file descriptor
04:59:39 as far as i can tell
04:59:52 so, i need to use the CreateFile and their awful Read/Write
functions
04:59:57 ah i see.
05:00:06 or find some goofy way to abstract out the HANDLE/Handle/Fd/FD
differences...
05:00:25 I have about 2 lines in linux which exploded to about 30 in
windows
05:00:30 mm. Handle is the abstraction :)
05:00:34 but yeah, if you're monkeying around
05:00:42 but i need descriptors :)
05:00:46 yup
05:00:49 actually, that's not true
05:00:53 what i'm given is a descriptor (by linux)
05:00:58 and i'm given a handle by windows
05:01:00 but it's a windows handle
05:01:12 and i'm not aware of a way to turn a HANDLE (win) to a Handle
(Haskell)
05:01:29 well, ghc does it somehow.
05:01:34 if you dig around the bottom of the base library
05:01:38 dons: i've been trying to figure out how... :(
05:01:50 I discovered GHC.Handle.fdToHandle (which isn't documented)
05:02:01 which was *almost* what i wanted
05:03:45 ACTION wonders if any one knows for sure whether or not
windows devices can be used as files
05:03:55 with _read/_write?
05:04:33 sw17ch: possibly, there are some device names you can enumerate
and access, can't remember much about it though
05:05:18 I've been rooting around in the code for qemu/openvpn/tinc to
figure out how they implement the windows read/write functionality for the TAP
device... they all do it slightly differently and it's convoluted
05:05:56 ah, I thought you might have only meant filesystems
05:06:11 jeffz: no :( i'm doing weird things
05:25:25 @seen conal
05:25:25 conal is in #haskell and #ghc. I don't know when conal last
spoke.
05:27:04 \msg conal I humbly suggest replacing Graphics.FieldTrip.Color
with my lib to get gamma-correct compositing: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/colour
05:27:09 Title: HackageDB: colour-1.0.0
05:27:14 @msg conal I humbly suggest replacing Graphics.FieldTrip.Color
with my lib to get gamma-correct compositing: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/colour
05:27:15 Not enough privileges
05:27:26 oh?
05:28:25 @tell ?
05:28:26 Consider it noted.
05:28:45 oh right
05:28:49 @tell conal I humbly suggest replacing Graphics.FieldTrip.Color
with my lib to get gamma-correct compositing: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/colour
05:28:50 Consider it noted.
05:28:54 dons++
05:29:00 What is the appropriate definition of a "Finalizer" and is it
documented any where?
05:29:53 well, i'm giving up for the night. good night all.
05:30:07 sw17ch: System.Mem.Weak describes them a little
05:30:26 thanks jeffz
05:38:47 oh, I didn't know hackage builds on ghc 6.8 and 6.10
05:38:49 is there any operator (i guess it would be a type operator)
with signature *->(*->*) ? that is, you give it a type and a function comes out
05:38:50 cool.
05:39:14 @type ReaderT
05:39:16 forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
05:39:28 @kind ReaderT
05:39:29 * -> (* -> *) -> * -> *
05:39:43 hmm
05:39:53 wait, * -> (* -> *) is the same as * -> * -> *
05:40:06 solrize_: you are trying to trick us :)
05:40:07 Either ;)
05:40:17 yeah, its just parameterized, right?
05:40:19 doesn't seem right
05:40:20 @kind Eitehr
05:40:21 Not in scope: type constructor or class `Eitehr'
05:40:22 @kind Either
05:40:24 * -> * -> *
05:40:30 Or (->)
05:40:32 Or (,)
05:40:34 i'm thinking more in terms of a generic function
05:40:35 @kind (,)
05:40:36 * -> * -> *
05:40:45 Except (->) has a much more insidious kind.
05:41:03 (In GHC)
05:41:11 :kind (->)
05:41:19 Not that insidious, it's just that if you account for unboxed
stuff, it gets slightly more complicated.
05:41:31 :k (->)
05:41:31 ?? -> ? -> *
05:41:44 :k (+)
05:41:45 Not in scope: type variable `+'
05:41:53 :k State
05:41:54 * -> * -> *
05:42:01 (+) doesn't have a kind, but its type has kind *
05:42:06 right
05:43:00 i want something like a generic function constructor, e.g. "showfunc
Integer" gives back the show function for integers
05:43:14 "showfunc (Maybe Int)" similarly
05:43:38 You mean, specialisation?
05:43:51 :t show :: Integer -> String
05:43:53 Integer -> String
05:43:53 or more precisely i'm trying to figure out if this is a
reasonable way to describe the difference between genericity and polymorphism
05:44:31 :t show `asTypeOf` (undefined :: Integer -> String)
05:44:32 i think not just specializing, but the ability to do
something like "deriving Show", which reflects on the structure of the type
being defined
05:44:32 Integer -> String
05:45:20 Oh, so your showFunc would actually construct the function from
the structure of the type?
05:45:25 yeah
05:45:45 and that's always done with external packages like drift,
syb, etc
05:45:59 so that capability is not directly in the language
05:46:03 Well, you could write it directly in Generic Haskell.
05:46:22 syb is a library written in Haskell with a few extensions...
05:46:26 but my first question was whether there was anything at all
with that signature, and the answer is yes, it's the same as *->*->* which is a
vanilla type constructor
05:46:40 syb isn't a preprocessor or anything.
05:47:16 syb uses a compiler hack that allows reflection on types,
right?
05:47:32 It uses automatic deriving for the Data and Typeable
typeclasses.
05:47:32 Uh, not really.
05:47:36 hmm
05:47:44 That's the only compiler addition.
05:48:19 ic
05:48:28 In order to be sound, those typeclasses really should *only* be
derivable... at least Typeable.
05:48:43 :t gshow
05:48:44 forall a. (Data a) => a -> String
05:48:53 the wikipedia article about generics is really a mess and i
don't see a way to capture the concept
05:49:00 There's the generalised version of show which you wanted ;)
05:49:14 hmm
05:49:14 gshow [1..10]
05:49:16 > gshow [1..10]
05:49:17 /tmp/3097833299487768762:70:44: Not in scope: `gshow'
05:49:23 oh, not in scope
05:49:51 @type gfoldl
05:49:52 forall (c :: * -> *) a. (Data a) => (forall a1 b. (Data a1)
=> c (a1 -> b) -> a1 -> c b) -> (forall g. g -> c g) -> a -> c a
05:49:52 "((:) (1) ((:) (2) ((:) (3) ((:) (4) ((:) (5) ((:) (6) ((:) (7)
((:) (8) ((:) (9) ((:) (10) ([])))))))))))"
05:49:54 there's something hacking about syb that i haven't wrapped
my head around
05:50:07 dolio: it also uses higher ranked types
05:50:08 is the result... a little suboptimal, but what are you going to
do? :)
05:50:16 Ah, yeah, true.
05:50:48 hacking->hackish
05:51:10 Well, it definitely has its problems.
05:51:13 <_roconnor> solrize_: syb is a big hack
05:51:14 I tend to think of the approach taken by Generic Haskell as
being a lot prettier.
05:51:51 But I'm not really an expert on this stuff, and it's not clear
to me what the differences with regard to expressiveness are.
05:52:13 the whole point of the paradise benchmark seems to be to
escape the type system and turn haskell into lisp
05:52:26 so if generic haskell can do the same thing, it has the same
disease
05:52:29 unless i'm missing something
05:53:00 Paradise benchmark?
05:53:02 Well, no, it's giving an appropriate type to functions which act
on all algebraic types.
05:53:53 dolio, the paradise benchmark is the one that recursively
crawls a datatype for the org chart of a corporation, finds all the people in it,
and gives them all a raise
05:54:08 Ah.
05:54:11 described in the syb paper
05:54:25 http://www.cs.uu.nl/research/projects/generic-haskell/jandewit.pdf
05:54:28 Heh, I guess it's been a while since I read that. :)
05:54:35 Title: A technical overview of Generic H A SKELL, http://tinyurl.com/5rwlm8
05:55:44 solrize_: If you want, typeclasses are "more hackish" in this
regard, as definitions for various types can in principle be completely
unrelated.
05:55:46 why not use traversable?
05:55:57 or map even
05:56:47 roconnor: Presumably, the org chart is an opaque algebraic
datatype, not some parameterized type that would work with traversable, etc.
05:56:52 Cale: not completely. They have the sameish typesignature.
05:56:56 roconnor: The idea is that you have some complicated bunch of
nested datatypes, which we don't want to assume too much about, and you want to
find all the Person-typed values in those, and map a function over them
05:57:31 Cale: that's a dumb idea :)
05:57:48 I still say use map
05:57:49 roconnor: Well, it's a common sort of problem.
05:58:01 roconnor: The type might not even be a functor.
05:58:29 ok
05:58:31 It might be an unparametrised datatype.
05:58:51 and the idea is that we want to recurse over the structure of
the type
05:59:11 It might be an unparametrised datatype.
05:59:13 there's your problem
05:59:24 I should stop commenting
05:59:39 and reread data types a la carte
05:59:49 roconnor: Well, another example is provided by Read and Show
06:00:02 We have machinery in the compiler for deriving instances of
those.
06:00:18 it's true. We need more generic deriving stuff
06:00:20 Mainly because we cannot write the appropriate generic functions
once and for all.
06:01:13 is that really the case, or is it because we use '|' and ' '
in our ADTs instead of "Either" and "(,)"?
06:01:21 another good one to read (which I think provides a cleaner view
of generic programming) is the paper I linked to
06:01:59 solrize_: Generally, I'd say a generic function works for many
types by inspecting the particular type it's used on, and tailoring what it does
to that type somehow, whereas a (parametric) polymorphic function works on many
types by not needing any information whatsoever about those types.
06:02:09 At least, in an ad-hoc, hand-wavey kind of way.
06:02:10 there was nice paper this year that compared different
generic libs
06:02:30 dolio, yeah, that's what i would say too
06:02:46 i'm sarah palin!!!!!!!!!!!!!
06:03:03 @ops
06:03:04 Maybe you meant: docs oeis pl
06:05:17 I'm parah salin?
06:05:39 why does adding instance declarations to my program slow it
down even if I don't use the instances? (GHC 6.8.2)
06:07:41 yeah i may have seen that paper
06:09:42 nofeardjb: I'm Ron Burgundy
06:10:38 Uploaded to hackage: utf8-prelude 0.1.5
06:10:38 Uploaded to hackage: ehaskell 0.5
06:13:28 Adamant: you forgot the question mark
06:13:40 nofeardjb: so I did
06:13:40 Adamant: I'm Ron Burgundy?
06:13:50 Adamant: :)
06:14:00 hi Ron!
06:14:10 :)~
07:08:17 @bot
07:08:17 :)
07:10:39 Uploaded to hackage: hake 0.9.5
07:10:59 @hackage hake
07:10:59 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hake
07:17:24 > sum [4 / fromInteger n * if (n + 1) `mod` 4 == 0 then -1
else 1 | n <- [1,3..99999]]
07:17:26 3.1415726535897814
07:18:23 o.O
07:18:33 anyone know when we can expect a version of hxt that works with
6.10?
07:18:49 ivanm: what is broken?
07:18:56 ivanm: if it's just exceptions, you can use base3
07:19:07 ivanm: if it's GADTs, its more work but there are rules
07:19:21 the Arrow syntax
07:19:30 and I forgot about base 3...
07:19:42 how do you specifically require base-3 support again?
07:20:50 > 355/113
07:20:52 3.1415929203539825
07:21:24 > pi
07:21:24 3.141592653589793
07:21:27 Betterer
07:21:39 > showCReal 200 pi
07:21:40 "3.141592653589793238462643383279502884197169399375105820974944592307816406...
07:21:45 bestest
07:23:50 Axman6: no it isn't
07:23:54 > showCReal 201 pi
07:23:56 Ambiguous occurrence `pi'
07:23:56 It could refer to either `Prelude.pi', i...
07:24:10 > showCReal 202 pi -- bestestest
07:24:11 Ambiguous occurrence `pi'
07:24:11 It could refer to either `Prelude.pi', i...
07:24:11 :o how come lambdabot didn't complain to you? :o
07:24:18 > showCReal 200 pi
07:24:19 Ambiguous occurrence `pi'
07:24:19 It could refer to either `Prelude.pi', i...
07:24:27 hmmm..... what just happened there?
07:24:33 eh?
07:24:34 @hoogle pi
07:24:35 Prelude pi :: Floating a => a
07:24:35 Data.Fixed type Pico = Fixed E12
07:24:35 Data.Time.Clock picosecondsToDiffTime :: Integer ->
DiffTime
07:24:48 @undefine
07:24:49 > showCReal 202 CReal.pi -- bestestest
07:24:50 Failed to load interface for `CReal':
07:24:50 Use -v to see a list of th...
07:24:55 Axman6: I tried repeating what you did above, and lambdabot
doesn't seem to work anymore :s
07:25:00 > showCReal 202 Data.Numeric.CReal.pi -- bestestest
07:25:01 Failed to load interface for `Data.Numeric.CReal':
07:25:01 Use -v to see...
07:25:07 heh
07:25:07 > showCReal 202 pi
07:25:08 "3.141592653589793238462643383279502884197169399375105820974944592307816406...
07:25:24 > showCReal 202 (pi :: CReal) -- bestestest
07:25:25 dolio: what, someone did @let pi = ?
07:25:25 "3.141592653589793238462643383279502884197169399375105820974944592307816406...
07:25:31 I guess.
07:25:36 ha
07:25:42 Axman6: you can always use more digits...
07:25:53 interesting, so @lets are cross channel?
07:26:09 @let (+) = (-)
07:26:10 Defined.
07:26:11 static bot ;-)
07:26:14 @slap Axman6
07:26:15 ACTION places her fist firmly on Axman6's jaw
07:26:16 > 1 + 3
07:26:17 Ambiguous occurrence `+'
07:26:17 It could refer to either `Prelude.+', imp...
07:26:17 Sorry, guys :)
07:26:20 dang
07:26:22 heh
07:26:24 @undefine
07:26:26 I had to
07:26:27 > 1 + 3
07:26:29 4
07:26:42 vegai: did you _really_ have to? or did you just _want_ to?
07:27:00 > pi :: CReal
07:27:01 3.1415926535897932384626433832795028841972
07:29:12 nominolo: ping
07:29:21 http://www.physics.uq.edu.au/people/gilmore/humour/the-pi-song/
07:29:23 Title: Joel Gilmore’s Home » The Pi Song
07:29:28 ivanm: it seems my free will is limited
07:29:38 heh
07:32:58 CReal?
07:36:53 is it expected behaviour for GHC (or a known bug) that instance
declarations cause slowdowns even if the instances aren't used?
07:37:49 @hackage numbers
07:37:49 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/numbers
07:38:15 lispy: an arbitrary precision number
07:38:39 Taejo: slow downs in the produced code? Seems strange
07:38:55 sjanssen: indeed it does
07:39:43 Taejo: are you sure the instances aren't used? Perhaps you're
working with overlapping instances?
07:40:48 did it warn orphan?
07:40:59 lispy: no warnings
07:41:48 sjanssen: I didn't allow overlapping instances
07:42:20 Taejo: are you absolutely certain this is what is happening?
07:42:21 http://hpaste.org/11909
07:42:55 sjanssen: that code runs in 1.660 seconds
07:43:28 if I comment out the instances it takes 1.212s
07:44:21 and if I comment out the Applicative but leave the Functor
instance, it runs in 1.292s
07:44:28 Taejo: which flags are you using to compile?
07:44:39 -funbox-strict-fields -O2
07:45:06 -funbox-strict-fields won't do anything on this code, but
that's no problem
07:46:24 Taejo: I can't reproduce that here
07:46:37 sjanssen: are you using GHC 6.10?
07:46:47 6.8
07:46:54 ok, I'm using 6.8.2
07:47:05 same here
07:47:21 I bet you forgot to uncomment "(/) <$> sumF <*> (fromIntegral
<$> lengthF)" in the instances version
07:48:08 sjanssen: it's commented out in both -- that's the point
07:48:33 if the instance was *used* I could understand (though it
shouldn't use a dictionary anyway)
07:48:35 hmm, strange
07:48:41 I'm actually seeing it now
07:48:48 sjanssen: havent' you wanted to upgrade yet?
07:48:56 ivanm: I don't really care
07:49:08 heh
07:49:52 the instances version allocates 1,402,757,012 bytes; without
the instances, only 880,892,088 bytes
07:50:04 Taejo: I think the optimizer gets a certain amount of "time"
per module, your instances (and other code) must be complicated enough to hit
that limit
07:50:22 hmm, interesting
07:50:52 yeah, try sticking in undefined stubs for each class
function
07:52:04 sjanssen: that brings it down to the same time and allocation
as the no-instances version
07:52:05 oh, actually I bet it is inlining
07:52:48 yep
07:53:12 sjanssen: is there an option to allow the optimizer more time/passes?
07:53:13 Taejo: stick INLINE pragmas on both and after
07:53:26 Taejo: I was wrong about the passes thing
07:54:05 sjanssen: is it just {-# INLINE #-} ?
07:54:12 {-# INLINE both #-}
07:55:20 > head [x | a <-[1..9], b <-[0..9], c <-[0..9], d <-[0..9],
let x = (1000*a + 100*b + 10*c + d), x*4 == (1000*d + 100*c + 10*b + a)]
07:55:21 2178
07:56:11 sjanssen: that seems to fix it
07:56:55 Taejo: note that <*> uses 'both', as does 'bothWith', which
is indirectly used by main
07:57:31 yeah
07:57:48 when there is only one use of both, GHC inlines it. When
there are two uses of both, GHC doesn't
07:58:02 sjanssen: aah
08:03:57 noZone: project euler?
08:04:44 Taejo: what is the purpose of the third parameter to F?
08:05:31 I actually don't remember where I found that one... just
poking around after digging up stuff on combinadics.
08:06:11 sjanssen: it is the "post-processor" -- we need it to combine
different folds (and it seems essential for to make Fold a a functor)
08:08:36 Taejo: it doesn't seem clean
08:09:06 sjanssen: how do you combine two folds into one if you don't
allow a combining function?
08:09:46 Taejo: data Fold b a = forall a. F !(a -> b -> a) !a --
seems better to me
08:10:02 >[x | a <-[1..9], b <-[0..9], c <-[0..9], d <-[0..9], let x =
(1000*a + 100*b + 10*c + d), x*4 == (1000*d + 100*c + 10*b + a)]
08:10:10 then combine :: Fold b a -> F

Комментариев нет:

Отправить комментарий