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:02:32 | <Gracenotes> | > let leng xxs = let (x:xs) = xxs in 1+leng xs in leng [1,2,3] -- from the mailing list... why? >_> |
| 00:02:34 | <lambdabot> | * Exception: stack overflow |
| 00:03:42 | <Gracenotes> | on the other hand, something like 'let (x:xs) = xxs in x+mysum xs' fails predictably |
| 00:04:31 | <Jedai> | Gracenotes: what's the question ? |
| 00:04:53 | <Gracenotes> | 'why? >_>' does it stack overflow |
| 00:04:57 | <Jedai> | Gracenotes: pattern matching in let is always lazy/irrefutable |
| 00:05:18 | <Gracenotes> | yes, I'm aware -- but this seems counterintuitive. What's overflowing? |
| 00:05:32 | <Jedai> | Gracenotes: because it put an infinite number of (+) on the stack |
| 00:06:07 | <Jedai> | Gracenotes: it never evaluates x or xs (not really) so it never stops putting (+) on the stack ==> stack overflow |
| 00:06:22 | <Gracenotes> | right, so it recurses too much; so it never breaks down on the constructor? |
| 00:06:32 | <Jedai> | Gracenotes: the sum version though evaluates x so it stops as soon as it goes over the end of the list |
| 00:06:34 | <Gracenotes> | too much laziness. I see, I think. |
| 00:06:52 | <pumpkin_> | you could fix that in that case with using head and tail explicitly I think |
| 00:06:54 | <aavogt> | ok, so it will be a while before cabal will regularly be used for finding source repos |
| 00:06:55 | <Gracenotes> | that's interesting... it recurses beyond what it can pattern match |
| 00:06:58 | <Jedai> | pumpkin_: no |
| 00:07:17 | <Gracenotes> | oh, mak sanse |
| 00:07:32 | <Jedai> | > let leng xxs = 1+leng (tail xxs) in leng [1,2,3] |
| 00:07:34 | <lambdabot> | * Exception: stack overflow |
| 00:07:54 | <Berengal> | Gracenotes: Try 'leng undefined' in your head, see what happens |
| 00:08:02 | <Gracenotes> | Berengal: yes. I did that |
| 00:08:11 | <Jedai> | pumpkin_: as you see it doesn't fix anything (which is logical since the irrefutable pattern is more or less equivalent to use head or tail directly) |
| 00:08:17 | <Gracenotes> | the ultimate laziness test! :o |
| 00:08:21 | <pumpkin_> | hmm, interesting |
| 00:08:29 | <aavogt> | > fix (1+) -- same? |
| 00:08:34 | <lambdabot> | mueval-core: Prelude.read: no parse |
| 00:08:34 | <lambdabot> | mueval: ExitFailure 1 |
| 00:08:51 | <Jedai> | aavogt: exactly, leng _ == fix (1+) |
| 00:09:08 | <aavogt> | hmm, but different failure |
| 00:09:13 | <aavogt> | in this case |
| 00:09:13 | <amckinley> | hey, could somebody help me out with a small piece of a parsec parser that im working on? |
| 00:09:20 | <Jedai> | > fix (1+) |
| 00:09:26 | <lambdabot> | mueval-core: Prelude.read: no parse |
| 00:09:26 | <lambdabot> | mueval: ExitFailure 1 |
| 00:09:37 | <Gracenotes> | Jedai: not to mention, it might not be overflowing on the (+), but rather on the "tail" in your version |
| 00:09:47 | <Gracenotes> | or both at the same time |
| 00:11:32 | <Jedai> | Gracenotes: no, I don't think so |
| 00:11:41 | <Jedai> | Gracenotes: the tail is in a thunk in the heap |
| 00:11:56 | <Gracenotes> | oic |
| 00:12:04 | <Jedai> | Gracenotes: it's _never_ called on the stack (which is precisely the problem) |
| 00:12:51 | <Jedai> | Gracenotes: but on the other hand I don't really understand why fix (1+) don't fail with the same error... |
| 00:14:36 | <Gracenotes> | fixPlusOne = let x = 1+x in x... |
| 00:14:57 | <Gracenotes> | hm |
| 00:15:19 | <Gracenotes> | oh, I see |
| 00:15:54 | <Gracenotes> | fix (1+) is a stack overflow on my ghci |
| 00:15:58 | <Gracenotes> | fix (+1) hangs forever |
| 00:16:20 | <Gracenotes> | ...and I might possibly be more confused than before |
| 00:16:26 | <Jedai> | Gracenotes: it's like instead of putting a new (+) call on the stack it use the circularity of the graph to reuse the same call (and presumably keep a count of the number of time it was reused I guess) |
| 00:17:59 | <aavogt> | Gracenotes: ghci 6.10.3 hangs forever with 0 cpu (seems to catch that the expression is _|_) on both variations here |
| 00:18:15 | <Jedai> | aavogt: 6.10.2 too |
| 00:18:58 | <Gracenotes> | 6.8 here |
| 00:19:04 | <Jedai> | aavogt: but normally when GHC detects this kind of thing it create an exception "blackhole" or whatever |
| 00:19:10 | <Gracenotes> | graph reduction is an interesting thing |
| 00:20:02 | <kpreid> | <joke about "graph oxidation"> |
| 00:24:09 | <johnnnowa> | hello all. Data.Time.Calendar.Day claims it has a read instance but I seem to be unable to actually use it (read "1984-09-08" :: Data.Time.Calendar.Day). am I doing something silly? |
| 00:25:00 | <kpreid> | johnnnowa: try seeing what syntax its show instance produced |
| 00:25:10 | <dancor> | graph + h = graphh |
| 00:26:04 | <johnnnowa> | kpreid: the same format i'm using. in either case, it's claiming no instance for (Read Day) |
| 00:26:29 | <kpreid> | Point out the evidence that it has a read instance? |
| 00:26:43 | <johnnnowa> | http://hackage.haskell.org/packages/archive/time/1.1.2.1/doc/html/Data-Time-Calendar.html#t%3ADay |
| 00:27:15 | <kpreid> | Is that documenting the same version you're working with? |
| 00:27:17 | <Gracenotes> | hm. |
| 00:27:39 | <johnnnowa> | kpreid: don't know. how can I check? |
| 00:29:02 | <kpreid> | I don't know. |
| 00:29:17 | <enolan> | johnnnowa, ghc-pkg describe time |
| 00:29:24 | <enolan> | will tell you the version |
| 00:29:35 | <Gracenotes> | johnnnowa: try importing Data.Time.Format |
| 00:29:43 | <johnnnowa> | the documentation is for 1.1.2.1, i'm using 1.1.2.2 |
| 00:29:45 | <Gracenotes> | that in turns imports the private module Data.Time.Format.Parse |
| 00:29:49 | <Gracenotes> | which has an instance for Read Day |
| 00:29:54 | <johnnnowa> | egh |
| 00:30:05 | <johnnnowa> | yeah, that works |
| 00:30:13 | <johnnnowa> | how can i tell that from the documentation? |
| 00:30:20 | <Gracenotes> | I think the documentation may be lacking :/ |
| 00:30:32 | <kpreid> | hm...you can't, and I think that's haddock's fault |
| 00:30:47 | <Gracenotes> | I just grepped the source for "instance Read Day" and then for "import Data.Time.Format.Parse" |
| 00:32:02 | <aavogt> | Jedai: yeah, I've come across some mention of blackholes either in the ghc docs or maybe in a quick look over the IFL book |
| 00:34:01 | <Jedai> | johnnnowa: I would suggest avoiding this Read instance to be honest and using directly the facility in Data.Time.Format |
| 00:34:21 | <johnnnowa> | Jedai: aye, was just trying to get some script to work quickly |
| 00:34:59 | <Jedai> | johnnnowa: that would let you specify exactly the format of your date and document it and with a standard date format description |
| 00:35:15 | <Jedai> | johnnnowa: In this case of course ^^ |
| 00:42:29 | <bos> | faster pidgits writeup: http://bit.ly/nLyYB |
| 00:47:28 | <dons> | that's a title for the intertubes |
| 00:49:05 | <bos> | it sure is |
| 00:53:05 | <wli> | ACTION peeks. |
| 00:54:10 | <wli> | bos: Tried shiftL for multiplying by powers of 2? |
| 00:55:25 | <fracture> | if I used mplus with Maybe, and the lhs is not nothing, will it evaluate the rhs? |
| 00:56:02 | <glguy> | > Just 1 `mplus` undefined |
| 00:56:04 | <lambdabot> | Just 1 |
| 00:56:05 | <glguy> | no |
| 00:56:22 | <fracture> | ah thanks |
| 00:57:31 | <Gracenotes> | there's Last and First for that |
| 00:57:41 | <glguy> | wli, judging by http://hackage.haskell.org/packages/archive/base/4.1.0.0/doc/html/src/Data-Bits.html#Bits , Integer's Bits instance just uses: x * 2^i |
| 00:57:50 | <Gracenotes> | > undefined `mappend` Last (Just 1) `mappend` Last Nothing |
| 00:57:51 | <lambdabot> | Last {getLast = Just 1} |
| 00:57:59 | <wli> | glguy: ugh |
| 00:58:02 | <Gracenotes> | > undefined `mappend` First (Just 1) `mappend` First Nothing |
| 00:58:04 | <lambdabot> | First {getFirst = * Exception: Prelude.undefined |
| 00:59:05 | <bos> | wli: the shiftL implementation for Integer sucks :-( |
| 01:07:05 | <dancor> | is there any existing template haskell that makes a Traversable instance |
| 01:08:07 | <Jedai> | dancor: there's derive |
| 01:08:13 | <wli> | You might be better off writing your own arbitrary-precision integer arithmetic at that rate. |
| 01:08:30 | <Jedai> | it has all sort of Template Haskell to derive most common class |
| 01:08:42 | <dancor> | oh nice |
| 01:09:02 | <Jedai> | dancor: also in 6.12 GHC will know how to derive Functor, Foldable and Traversable |
| 01:09:21 | <Jedai> | dancor: the HEAD already contains the patch |
| 01:40:41 | <dancor> | i am a template haskell noob. how do i go from Language.Haskell.TH.Data.DataDef |
| 01:40:46 | <dancor> | to Language.Haskell.TH.Syntax.Name |
| 01:40:58 | <dancor> | is there a good TH tutorial |
| 01:41:33 | <gwern> | no |
| 01:41:55 | <gwern> | but the congealed tears and wails of your suffering as you figure it out - that might be a good tutorial |
| 01:42:46 | <SamB> | @hoogle DataDef -> Name |
| 01:42:47 | <lambdabot> | Warning: Unknown type DataDef |
| 01:42:47 | <lambdabot> | Distribution.Simple.Command optionName :: OptionField a -> Name |
| 01:42:47 | <lambdabot> | Distribution.Text display :: Text a => a -> String |
| 01:43:01 | <SamB> | @hoogle Data -> Name |
| 01:43:01 | <lambdabot> | Did you mean: Data a -> Name /count=20 |
| 01:43:01 | <lambdabot> | Distribution.Simple.Command optionName :: OptionField a -> Name |
| 01:43:01 | <lambdabot> | Distribution.Text display :: Text a => a -> String |
| 01:43:09 | <SamB> | @hoogle a -> Name |
| 01:43:09 | <lambdabot> | Distribution.Simple.Command optionName :: OptionField a -> Name |
| 01:43:09 | <lambdabot> | Prelude repeat :: a -> [a] |
| 01:43:09 | <lambdabot> | Data.List repeat :: a -> [a] |
| 01:43:18 | <dancor> | well ''Lol seems to create a Syntax.Name. |
| 01:43:21 | <SamB> | hmm :-( |
| 01:45:19 | <dancor> | i think DataDef is the whole data statement, not just a constructor |
| 02:00:04 | <bos> | what would people think about merging the network-bytestring and network packages? http://trac.haskell.org/network/ticket/15 |
| 02:01:41 | <amckinley> | hey, is there any way to consecutively apply a list of arguments to a partially-applied function? |
| 02:01:43 | <centrinia> | I would rather have a merge-network package. |
| 02:01:53 | <c2racer> | I'm new to IRC. Is this the place to come to for discussions on haskell ? |
| 02:01:58 | <dibblego> | amckinley, f a b c |
| 02:02:00 | <centrinia> | c2racer: Yes. |
| 02:02:32 | <amckinley> | dibblego: right, im asking if its possible to achieve that effect if i have [a,b,c] |
| 02:02:46 | <centrinia> | amckinley: Do you want to compute f (head $ x) (head . tail $ x) (head . tain $ x) Z |
| 02:02:48 | <gwern> | dibblego: but b c isn't a list! |
| 02:03:00 | <c2racer> | OK - looking for some guidance on a program design for a domain-specific language in haskell |
| 02:03:01 | <dibblego> | oh an actual list |
| 02:03:12 | <dibblego> | amckinley, map or mapM perhaps? |
| 02:03:26 | <centrinia> | @pl f (head $ x) (head . tail $ x) (head . tail . tail $ x) |
| 02:03:26 | <lambdabot> | f (head x) (head (tail x)) (head (tail (tail x))) |
| 02:03:42 | <centrinia> | @pl \x -> f (head $ x) (head . tail $ x) (head . tail . tail $ x) |
| 02:03:42 | <lambdabot> | ap (liftM2 f head (head . tail)) (head . tail . tail) |
| 02:03:51 | <amckinley> | dibblego: i was thinking fold, but the problem is that the type of the partially applied function would change after every application |
| 02:04:01 | <centrinia> | @pl \f x -> f (head $ x) (head . tail $ x) (head . tail . tail $ x) (head . tail . tail . tail $ x) |
| 02:04:02 | <lambdabot> | (`ap` (head . tail . tail . tail)) . (`ap` (head . tail . tail)) . (`ap` (head . tail)) . (. head) |
| 02:04:02 | <dibblego> | amckinley, how could it? it's a list |
| 02:04:25 | <hatds> | amckinley: you cannot go from [a,b,c] to f a b c except by pattern matching on the first list and writing out "f a b c" |
| 02:04:32 | <TomMD> | bos: Its a good idea. |
| 02:04:45 | <Haudrex> | Sounds like amckinley wants to fold composition over an hlist. |
| 02:05:01 | <amckinley> | hatds: bummer |
| 02:05:09 | <amckinley> | Haudrex: tell me more :) |
| 02:05:17 | <TomMD> | bos: Also, the network API should be reworked entirely. There is value of having a direct FFI, but it shouldn't be the main API for most Haskell applications. In other words - I think we can do better. |
| 02:05:39 | <Haudrex> | @go haskell heterogeneous list |
| 02:05:41 | <lambdabot> | http://en.wikibooks.org/wiki/Haskell/Existentially_quantified_types |
| 02:05:41 | <lambdabot> | Title: Haskell/Existentially quantified types - Wikibooks, collection of open-content t ... |
| 02:05:44 | <centrinia> | amckinley: You could have extrapolated the output that lambdabot gave somehow. |
| 02:05:55 | <TomMD> | A trivial example is "inet_ntoa :: String -> IO HostAddress" |
| 02:06:07 | <hatds> | amckinley: I think hlist will only lead you astray, personally |
| 02:06:25 | <hatds> | amckinley: what you are asking for could be a sign that you need to rethink your program design |
| 02:06:55 | <Haudrex> | http://okmij.org/ftp/Haskell/types.html#HList |
| 02:06:58 | <^Someone^> | Tada |
| 02:07:21 | <djahandarie> | ^Someone^, oh hey there. :P |
| 02:07:28 | <^Someone^> | Hello ^^ |
| 02:07:37 | <amckinley> | hatds: you're probably right |
| 02:08:28 | <tompledger> | Re using the first few elements of a list as function arguments: http://www.mail-archive.com/haskell-cafe@haskell.org/msg00142.html |
| 02:08:53 | <amckinley> | tompledger: thanks! |
| 02:09:02 | <amckinley> | hatds: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5326#a5326 |
| 02:09:17 | <amckinley> | im writing a parsec parser for dns zone files |
| 02:09:39 | <amckinley> | this is my first project in haskell, so you may want to shield your eyes :) |
| 02:10:07 | <Twey> | You probably shouldn't be using list elements as arguments, though. |
| 02:10:11 | <Twey> | You can always pattern-match. |
| 02:10:50 | <centrinia> | amckinley: Where is the argument list-using function? |
| 02:10:53 | <amckinley> | anyways, im trying to deal with this corner case in the syntax: at any point in a record declaration, you can use parens to circumvent the normal line-based record processing |
| 02:11:18 | <amckinley> | heres an example: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5327#a5327 |
| 02:11:19 | <Twey> | > foldr id (+) [1, 2] |
| 02:11:20 | <lambdabot> | Overlapping instances for GHC.Show.Show (a -> a -> a) |
| 02:11:20 | <lambdabot> | arising from a use... |
| 02:11:38 | <centrinia> | :t foldr id (+) [1,2] |
| 02:11:40 | <lambdabot> | forall a. (Num a, Num ((a -> a -> a) -> a -> a -> a)) => a -> a -> a |
| 02:11:40 | <Twey> | Hm, that's not right... |
| 02:11:49 | <amckinley> | centrinia: the constructors for the various record types |
| 02:11:50 | <Twey> | What happened there? |
| 02:11:57 | <bos> | TomMD: yes, the network API is a bit hopeless |
| 02:12:07 | <amckinley> | in pr :: Parsec String (Maybe String) DnsRecord |
| 02:13:29 | <amckinley> | i was in the middle of thinking about how to rewrite that part |
| 02:14:28 | <JusticeFries> | Hi! I'm trying to figure out advantages between picking up Erlang and Haskell...being both functional languages, is there much of a difference? |
| 02:14:53 | <centrinia> | amckinley: Instead of having a single parseRdata, try having functions parseARecord, parsePTRRecord, etc. |
| 02:15:24 | <bos> | JusticeFries: see http://www.erlang-factory.com/conference/SFBayAreaErlangFactory2009/speakers/BryanOSullivan |
| 02:15:27 | <Cale> | JusticeFries: Lots of differences |
| 02:16:09 | <centrinia> | JusticeFries: Try both of them and find the differences yourself. |
| 02:16:10 | <JusticeFries> | ah, thanks! |
| 02:16:12 | <Cale> | JusticeFries: Haskell *might* be more challenging a change in mindset. |
| 02:16:37 | <amckinley> | centrinia: i still end up needing a generic way to parse the record data |
| 02:16:43 | <Cale> | Because it's more insistent on purity, perhaps |
| 02:16:51 | <centrinia> | amckinley: Why must it be generic? |
| 02:16:52 | <JusticeFries> | I'd like to try both, but then I'm sure I'd get deeply interested in both, and of course I have general time constraints. |
| 02:17:06 | <bos> | Haskell's definitely more challenging than Erlang. |
| 02:17:23 | <bos> | Erlang is a bit of a pig's ear of a language, saved by its runtime system. |
| 02:17:32 | <inimino> | indeed |
| 02:17:37 | <amckinley> | centrinia: because the hard part (at least as im seeing it) is the handling of this paren case, which means i cant blindly use lexeme parsers |
| 02:17:50 | <gwern> | it's an odd bastardization of prolog, I got the impression from the erlang retrospective |
| 02:18:10 | <Cale> | I think Haskell is also probably more fun than Erlang in the end, but I shouldn't really say that, given that I've only played around with Erlang a tiny bit. |
| 02:18:54 | <JusticeFries> | From what I got, either one works great for parallel servers. |
| 02:18:56 | <sjanssen> | JusticeFries: Haskell will have more new and interesting concepts than Erlang. Erlang has concurrency, Haskell has purity, parametric polymorphism, type classes, laziness, monads, etc. |
| 02:19:14 | <JusticeFries> | Hmm. Okay. |
| 02:19:15 | <Cale> | (and concurrency :) |
| 02:19:22 | <JusticeFries> | well. |
| 02:19:29 | <JusticeFries> | concurrency you can easily get in haskell from what I briefly read - par. |
| 02:19:30 | <sjanssen> | (and multiple interesting approaches to concurrency) |
| 02:19:36 | <amckinley> | centrinia: its just becoming very miserable to deal with a grammar that requires me to handle whitespace in complicated ways |
| 02:19:37 | <Cale> | JusticeFries: That's parallelism. |
| 02:19:47 | <JusticeFries> | ooh. |
| 02:19:50 | <Cale> | JusticeFries: We also have concurrency, and lots of fun libraries related to that. |
| 02:20:30 | <Cale> | Parallelism is computing a result faster because you have more processors to compute it on, concurrency is doing lots of things at once (regardless of the number of processors) |
| 02:20:34 | <aavogt> | haskell doesn't have widely used ways to replace code at runtime though? |
| 02:20:47 | <gwern> | JusticeFries: well, what erlang really gets is parallelism over multiple computers - this is not something haskell does well |
| 02:20:55 | <Cale> | That is, lots of different things, which may interact nondeterministically. |
| 02:21:00 | <TomMD> | bos: You might be interested in my hopes of building what I'd call a 'network2' package. Currently I've uploaded 'network-data' which inplements what should have been part of network: IPv4 header, pretty printing, binary instances, IPv6/UDP/TCP headers, checksums (untested). |
| 02:21:03 | <JusticeFries> | i see. |
| 02:21:07 | <sjanssen> | aavogt: that's true |
| 02:21:14 | <centrinia> | amckinley: In the cases where typ is either "MX" or "SOA", the presence of the read function should indicate that you should write a specific parser function. |
| 02:21:17 | <TomMD> | bos: Eventually I intend to design/build/release network-api |
| 02:21:24 | <gwern> | JusticeFries: but if your program is on just computer, then haskell is as good as erlang |
| 02:21:31 | <bos> | TomMD: Binary instances? hm. |
| 02:21:38 | <JusticeFries> | well |
| 02:21:41 | <JusticeFries> | i guess i'll just check out both. |
| 02:21:42 | <bos> | TomMD: i don't like the binary API much |
| 02:21:50 | <JusticeFries> | and make my foray into functional programming :3 |
| 02:21:53 | <TomMD> | bos: yes, for the headers - incase you build sockets and specify the header is included. |
| 02:21:54 | <amckinley> | centrinia: how about a polymorphic return type in parseRdata? |
| 02:21:57 | <centrinia> | amckinley: How do you handle parse failures? |
| 02:22:03 | <pumpkin_> | RyanT5000: know anything about GHC on ARM? :o |
| 02:22:03 | <Cale> | JusticeFries: Yeah, I'd even go so far as to say that as long as you're not doing distributed computation, Haskell currently beats Erlang at concurrency :) |
| 02:22:04 | <TomMD> | bos: But you need not care about the binary instances for most cases. |
| 02:22:25 | <amckinley> | id like to say parseData :: (Int, String, Int, Whatever) and get back a tuple that looks like that |
| 02:22:40 | <amckinley> | centrinia: im not :P |
| 02:22:41 | <bos> | TomMD: the problem is that binary doesn't let a parse fail |
| 02:23:01 | <Cale> | But we have very little answer for how to do distributed stuff. |
| 02:23:01 | <RyanT5000> | pumpkin_: i might know a bit sometime soon |
| 02:23:15 | <pumpkin_> | :o |
| 02:23:17 | <TomMD> | bos: This is true (and annoyed the heck out of me in past projects). Still, it is useful to have a representation of headers that you can send/recv over a wire. |
| 02:23:33 | <amckinley> | centrinia: if you're wondering, parseRdata takes an Int because i was rewriting it so i could restrict the amount of parsing it attempts |
| 02:23:42 | <TomMD> | bos: A 'fail-safe' serialization of headers would be welcome instances in the network-data package |
| 02:24:03 | <amckinley> | so i could say parseRdata 5 and get back a list with 5 elements, or a parse failure |
| 02:24:13 | <JusticeFries> | well |
| 02:24:19 | <JusticeFries> | between erlang, haskell, and scala, it should be a fun summer. |
| 02:24:21 | <TomMD> | bos: Aside from 'bytestring-strict' do you know of such a class for serialization? |
| 02:24:39 | <centrinia> | amckinley: Try removing rdata <- parseRdata2; also try to modify the cases so that they look like: "MX" | length rdata == 2 -> parseMXrecord |
| 02:25:26 | <bos> | TomMD: what's bytestring-strict? |
| 02:25:27 | <amckinley> | centrinia: yes, i could rewrite it like that, but im still stuck on needing this generic parser for handling the record data |
| 02:25:56 | <bos> | TomMD: i have a binary derivative that i picked up from, um, adam langley, which can do failed and partial parses |
| 02:26:04 | <TomMD> | bos: I ment binary-strict |
| 02:26:12 | <amckinley> | centrinia: unless you can show me a really easy way to handle the paren case |
| 02:26:18 | <TomMD> | @hackage binary-strict -- I think |
| 02:26:19 | <lambdabot> | http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict -- I think |
| 02:26:25 | <bos> | TomMD: my library is a continuation of binary-strict |
| 02:26:33 | <TomMD> | ok |
| 02:26:49 | <bos> | TomMD: but i don't recall whether i published it |
| 02:29:02 | <centrinia> | amckinley: It looks like that the parentheses are extraneous and you can ignore them while parsing. |
| 02:29:42 | <amckinley> | centrinia: no, i cant. otherwise i cant determine the end of the record data |
| 02:30:14 | <centrinia> | You already determined them. For the MX records, it is 2, for the SOA records, it is 7. |
| 02:30:17 | <amckinley> | well actually... |
| 02:30:23 | <amckinley> | yes, you're right |
| 02:30:41 | <amckinley> | let me try that |
| 02:30:52 | <centrinia> | Okay. |
| 02:31:18 | <iop> | haskell is more challenging and more rewarding and imho a beter language. erlang is probabl easier to pick up though and if you have to deal specifically with distributed or concurrent stuff then it has a aholw platform for it |
| 02:32:30 | <amckinley> | centrinia: id like to avoid repeating myself in the individual record parsers, since they only differ in the data they're expecting |
| 02:32:59 | <centrinia> | That's the price you pay. :( |
| 02:33:11 | <centrinia> | The benefit is that you can have better error messages. |
| 02:33:32 | <amckinley> | centrinia: i guess i could pass the stuff thats already been parsed as arguments to the individual record parsers |
| 02:33:40 | <centrinia> | The entire program will not abort if, say, a SOA record has 6 parts. |
| 02:33:49 | <Kali_> | hey, has anyone here worked with declarative representations of 3D scenes? |
| 02:34:27 | <centrinia> | amckinley: Try creating a DNS zone file with a MX record with one part. :) |
| 02:35:45 | <amckinley> | centrinia: the real issue is that by using all these lexeme parsers, its easy to roll past the end of the newline that officially marks the end of the record and consume the next hostname, say, as the final element of a previous record |
| 02:35:59 | <adu> | Kali_: I've dealt with X3D and PovRay |
| 02:38:05 | <amckinley> | centrinia: which would then cause the parser to fail because the fields dont line up, but the error message wouldnt be very intuitive and it doesnt really reflect what actually happened |
| 02:39:50 | <adu> | Kali_? |
| 02:40:32 | <Kali_> | how do you think those would translate to haskell? |
| 02:40:35 | <hatds> | Concurrency question: I have two IO actions A and B and I want to perform action B repeatedly until at least n seconds elapses, then perform A once and start over. I don't, however, want to pre-empt a B action still in progress when I decide to switch to A. What's the most elegant way to do this? |
| 02:43:01 | <adu> | Kali_: ooo good question |
| 02:44:01 | <amckinley> | centrinia: the grammar is fundamentally line-oriented, so i feel like my parser should be as well |
| 02:48:00 | <hackagebot> | hs-twitter 0.2.8 |
| 02:49:03 | <adu> | Kali_: I would imagine there would be at least two schools .... functionalization of X3D, and verbatim Haskellization of X3D (via OOHaskell perhaps) |
| 02:49:29 | <amckinley> | centrinia: ive got to run; thanks for your help |
| 02:50:20 | <adu> | Kali_: the first school of tought would likely start with the FieldTrip project, and make extensions to it maybe |
| 02:50:52 | <Kali_> | adu: cool thanks, the first one is what I'd be more interested in so I'll look into that :) |
| 02:50:57 | <pumpkin_> | people should really check the code they send out on haskell-cafe |
| 02:51:31 | <hatds> | hehe |
| 02:51:44 | <hatds> | or else you'll get a torrent of corrections? |
| 02:52:32 | <pumpkin_> | just that it makes no sense |
| 02:52:51 | <pumpkin_> | the whole f :: (Int a) => a -> [b] |
| 02:53:21 | <centrinia> | Maybe someone is hiding Prelude and defined a class Int. |
| 02:53:42 | <pumpkin_> | even so, the type doesn't make sense :) |
| 02:54:04 | <hatds> | f a = take (fromIntegral a) $ repeat undefined |
| 02:54:23 | <pumpkin_> | replicate a undefined ? :P |
| 02:54:30 | <pumpkin_> | still not what I consider a sensical funciton |
| 02:54:33 | <pumpkin_> | function |
| 02:54:40 | <hatds> | yep |
| 02:54:48 | <centrinia> | pumpkin_, f = const [] |
| 02:54:53 | <hatds> | the only useful result of the function is you can count it's length |
| 02:54:54 | <travisbrady> | anyone have any recommended reading for someone looking to understand type systems and what can be done with types? and maybe a little of "what's the big deal about types?" |
| 02:54:59 | <centrinia> | :t const [] |
| 02:55:00 | <pumpkin_> | centrinia: again, not what I consider a sensical function :P |
| 02:55:01 | <lambdabot> | forall a b. b -> [a] |
| 02:55:14 | <pumpkin_> | travisbrady: TAPL? |
| 02:55:19 | <pumpkin_> | @where tapl |
| 02:55:19 | <lambdabot> | http://www.cis.upenn.edu/~bcpierce/tapl/ |
| 02:56:27 | <hatds> | seconding TAPL |
| 02:57:00 | <travisbrady> | pumpkin_, hatds: thank you |
| 03:09:12 | <Cale> | http://xkcd.com/589/ hahaha |
| 03:09:20 | <dancor> | reify means to make concrete but in TH it means to make into an abstract syntax tree? |
| 03:10:29 | <Gracenotes> | or, to expose the concrete implementation of something |
| 03:12:32 | <Cale> | You give it a name and it gives you information about that name |
| 03:13:04 | <monochrom> | Is 589 today's? |
| 03:13:25 | <Cale> | seems to be the newest |
| 03:14:01 | <monochrom> | OK I like its finishing touch i.e. "goat" and "wolf" can't be in the same car. :) |
| 03:15:06 | <hackagebot> | delicious 0.3.3 |
| 03:18:08 | <Cale> | monochrom: yeah, that's the part I liked too :) |
| 03:18:09 | <vininim> | @tell marcot yes, basicaly parsec with bytestrings |
| 03:18:09 | <lambdabot> | Consider it noted. |
| 03:18:33 | <vininim> | except it's not cute like parsec :/ |
| 03:21:51 | <jimmyjazz14> | question about pattern matching with the record syntax, shouldn't ' let a (MyType { a = n }) = n+1 ' work |
| 03:23:05 | <Berengal> | jimmyjazz14: I don't think so, but even if it does it looks highly questionable |
| 03:29:59 | <bos> | jimmyjazz14: depends on what you want it to do. |
| 03:30:48 | <hatds> | hmm.. I don't use records but it looks legals. http://www.haskell.org/onlinereport/exps.html Semantics of Case Expressions n) and m). Might just be easier to test it out |
| 03:30:52 | <hatds> | *lega |
| 03:30:57 | <hatds> | ahem, *legal |
| 03:30:59 | <bos> | it's legal. |
| 03:31:02 | <bos> | but it's weird. |
| 03:31:26 | <hatds> | makes sense, but records are weird to begin with |
| 03:33:45 | <monochrom> | You can haz "case x of Maybe{} -> ..." it's the same as "case x of Maybe _ -> ..." |
| 03:34:19 | <monochrom> | oops. s/Maybe/Just/ |
| 03:34:34 | <monochrom> | "case x of Just{} -> ..." it's the same as "case x of Just _ -> ..." |
| 03:34:37 | <bos> | monochrom: but the rules are really weird: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5331#a5331 |
| 03:35:00 | <bos> | monochrom: i can't explain why the types of those definitions are different, for instance :-( |
| 03:35:27 | <hatds> | x is not a value of type Int, it is a globally visibile function of type Foo -> Int |
| 03:35:52 | <monochrom> | x :: Foo -> Int is what hatds says. Available because of the record declaration. |
| 03:36:19 | <monochrom> | b is equivalent to: b _ = x |
| 03:36:26 | <bos> | yeah, but it's really lexically confusing. |
| 03:36:51 | <monochrom> | But now you can explain it. |
| 03:37:05 | <monochrom> | It's all science and math, no magic. |
| 03:37:16 | <hatds> | imho, don't try to look for structs in haskell, there don't exist (at least not elegantly) |
| 03:37:23 | <hatds> | there=they |
| 03:37:43 | <monochrom> | Name clashes are of course always evil, as usual. |
| 03:38:04 | <monochrom> | f :: (Monad int) => io -> int io ha ha ha |
| 03:39:39 | <monochrom> | In fact, is this allowed? data Monad a = ... whatever you want here...; instance Monad Monad where .... |
| 03:40:13 | <hatds> | if Monad isn't imported unqualified you could say "data Monad.." |
| 03:40:43 | <hatds> | but not in general |
| 03:40:46 | <dancor> | i can't figure out DeriveTraversal: http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=2513#a2513 |
| 03:42:30 | <monochrom> | "data Monad a = Monad a" alone is allowed. Only ambiguity is when you start using it. |
| 03:42:54 | <monochrom> | (For example when you say "instance Monad Monad where") |
| 03:43:08 | <Twey> | Then you have a Monad class, a Monad type, and a Monad constructor |
| 03:43:20 | <Twey> | Perfectly unambiguous to Haskell, but maddening to everyone else |
| 03:43:33 | <monochrom> | (Or when you say "f :: Monad a -> Monad ()") |
| 03:44:00 | <Twey> | What's wrong with that? |
| 03:44:09 | <hatds> | yea, isn't it clear it has to be the type? |
| 03:44:10 | <Twey> | Oh, you mean the -> might be mistaken for a =>? |
| 03:44:21 | <monochrom> | No. |
| 03:44:58 | <Twey> | Why not? It couldn't be anything else there |
| 03:45:26 | <hatds> | It is hard enough to distinguish between typeclasses and types at times, we don't need to make it harder ;) |
| 03:45:34 | <monochrom> | Ambiguous occurrence `Monad' / It could refer to either `Main.Monad' ... or `Prelude.Monad' |
| 03:46:01 | <djahandarie> | Twey, yet again you confuse me by being in different channels that I'm in. |
| 03:46:03 | <djahandarie> | monochrom, you too |
| 03:46:05 | <monochrom> | The name resolver doesn't care "it's a type name" vs "it's a class name" at this point. |
| 03:46:25 | <Twey> | Oh, right, that ambiguity. |
| 03:46:34 | <jimmyjazz14> | is there a way to have multiple types using the record syntax that use the same name, like ' data Mt = Mt {name :: String } ; data Ml = Ml {name :: String} |
| 03:46:34 | <Twey> | Wait |
| 03:46:38 | <Twey> | That's an ambiguity? |
| 03:46:52 | <monochrom> | I don't know. It is a reproducible experiment. |
| 03:47:06 | <Twey> | How odd |
| 03:47:14 | <Twey> | jimmyjazz14: Yes — put them in separate modules |
| 03:47:30 | <hatds> | jimmjazz14: not without using module scoping to hide them, but you can do this data Mt = Con1 {name :: String, age :: Int} | Con2 {name :: String, height :: Int} |
| 03:47:41 | <monochrom> | I am too lazy to check into the Haskell98 report on this issue now. :) |
| 03:47:43 | <hatds> | jimmjazz14: but records are ugly, I wouldn't recommend it |
| 03:48:14 | <hatds> | records with alternation seem like they would be especially confusing |
| 03:48:42 | <jimmyjazz14> | I see |
| 03:48:44 | <Twey> | Modules are for namespacing, and in modules we should trust |
| 03:49:25 | <hatds> | I think using modules for interfaces is a little grungy, if that is what you mean |
| 03:49:33 | <Twey> | Why? |
| 03:49:43 | <hatds> | I'm not sure actually |
| 03:49:44 | <Twey> | That's their purpose |
| 03:49:55 | <hatds> | well, I'm talking about just this specifically: |
| 03:49:59 | <Twey> | In fact it's the entirety of their purpose |
| 03:50:15 | <hatds> | Data.Applicative.length or somesuch |
| 03:50:36 | <Twey> | And that's why we have qualified imports |
| 03:50:42 | <Twey> | A.length is so much nicer :) |
| 03:50:54 | <hatds> | yea, that's what I would do too |
| 03:51:06 | <jimmyjazz14> | any good alternative to record sytax that will keep my large type declarations readable? |
| 03:51:19 | <Twey> | jimmyjazz14: Um, that's what record syntax is for |
| 03:51:32 | <Twey> | What's your issue with it? |
| 03:51:40 | <hatds> | but I don't think it is a good idea to design your module to conform to an existing interface. i.e. if you are going to use 'length' as your identifier do so because it is a good name, not because you want to be compatible with Data.List interface |
| 03:52:09 | <dancor> | so is there no simple way to generate Dec, given that [d|...|] makes [Dec]? |
| 03:52:22 | <hatds> | there really ought to be a typeclass if you want a universal interface |
| 03:52:35 | <Twey> | hatds: Well, in one sense, that's so |
| 03:52:52 | <Twey> | I guess |
| 03:52:54 | <hatds> | that's so what? |
| 03:53:07 | <jimmyjazz14> | actually creating modules makes sense now that I think about it |
| 03:53:08 | <Twey> | MultiContainer or something |
| 03:54:11 | <hatds> | jimmyjazz14: you can use type synonyms, like this type A1 = .., type A2 = .., ... then finally say data Foo = Foo (A1 A2 A3 ..) You should also think about breaking up your big data type into smaller ones, if possible |
| 03:55:26 | <hatds> | I think most people use records specifically to handle large datatypes though, I just haven't ever been compelled enough |
| 03:58:03 | <Cale> | ACTION tries to sort out exactly what the cml library code is doing and make it easier to read. |
| 03:59:33 | <bos> | cml? |
| 04:00:10 | <Cale> | http://hackage.haskell.org/packages/archive/cml/0.1.1/doc/html/Control-Concurrent-CML.html |
| 04:00:58 | <Cale> | It's an interesting library, but the code style is unfortunate. |
| 04:01:58 | <Cale> | http://hackage.haskell.org/packages/archive/cml/0.1.1/doc/html/src/Control-Concurrent-CML.html#atsync |
| 04:02:16 | <bos> | oh, trippy. |
| 04:02:27 | <hatds> | oh dear |
| 04:03:51 | <Cale> | Also it's strange that they didn't notice that Event seems to have easy Functor, Applicative and Monad instances. |
| 04:04:06 | <bos> | if it had one coding style, that would be something. but it looks like it was written by several people who didn't like to talk to each other. |
| 04:04:29 | <bos> | probably not very longstanding haskell hackers. |
| 04:04:54 | <hatds> | look at 'atchan' |
| 04:05:02 | <hatds> | si, ei, ko |
| 04:05:55 | <hatds> | this is a good reminder that you should indicate somewhere why your short identifiers are named what they are |
| 04:05:56 | <Cale> | Looking at the paper, at least those names could be elaborated |
| 04:06:38 | <Cale> | Though, it's funny that it doesn't exactly follow the paper's code... |
| 04:07:17 | <hatds> | (atpointO r t o y x) (\s -> do ... |
| 04:07:21 | <hatds> | hmm ;) |
| 04:07:32 | <bos> | i don't mind short local variable names. |
| 04:07:54 | <Cale> | yeah, it doesn't matter if their meaning is clear |
| 04:08:10 | <hatds> | yea, but is it? |
| 04:08:15 | <wahjava> | hi everyone |
| 04:08:20 | <Cale> | hi |
| 04:08:25 | <hatds> | I guess I shouldn't comment since I'm not seriously trying to follow the code |
| 04:09:02 | <te> | Alex McLean is my hero |
| 04:09:24 | <te> | That Haskell hack video he made is friggen cool |
| 04:09:35 | <Cale> | I've at least managed to reindent it all. |
| 04:10:03 | <te> | For those who don't know: http://yaxu.org/haskell-hack/ |
| 04:10:29 | <centrinia> | Who is coa? |
| 04:10:58 | <coCocoa> | centrinia: The dual of 'a', of course. ;p |
| 04:12:46 | <centrinia> | When did this dual meme start? |
| 04:13:43 | <Adamant> | it's all copumpkin's fault |
| 04:13:44 | <Adamant> | :P |
| 04:13:54 | <monochrom> | Ever since we studied category theory and dualized everything. |
| 04:15:15 | <Pseudonym> | ACTION writes more de |
| 04:16:45 | <clug> | Evertime I try to code i can't get it to work because of "syntax errors", is there a language that doesn't have syntax errors? |
| 04:17:01 | <monochrom> | hahahahaha are you trolling? |
| 04:17:06 | <centrinia> | clug: Yes! |
| 04:17:07 | <hatds> | machine code? |
| 04:17:10 | <Pseudonym> | A/PL? |
| 04:17:17 | <Pseudonym> | TECO! |
| 04:17:18 | <centrinia> | Halt. |
| 04:17:23 | <monochrom> | Gödel numbering has no syntax error. |
| 04:17:35 | <centrinia> | It just ignores everything you write. :) |
| 04:17:49 | <centrinia> | It is the simplest language actually. |
| 04:17:50 | <Pseudonym> | monochrom: I don't think that's true. Gödel numberig has no requirement to be surjective. |
| 04:18:31 | <monochrom> | I know. We hack it by mapping the unused numbers to a default. |
| 04:18:41 | <Pseudonym> | Well, strange you should mention that. |
| 04:18:57 | <Pseudonym> | You can construct a bijection if the source language is Turing-hard. |
| 04:19:22 | <Pseudonym> | The proof of the Cantor-Bernstein-Schroeder theorem is constructive,. |
| 04:19:28 | <hatds> | remember that Halloween episode of the Simpsons where every test answer Bart gave became correct by default? Now imagine the same thing with syntax of your favorite language |
| 04:20:10 | <centrinia> | Ping pong proof. :) |
| 04:20:17 | <Pseudonym> | Yeah, exactly. |
| 04:20:44 | <Pseudonym> | If you can ensure that the sequence isn't doubly infinite (which is usually easy to guarantee if you're picking it), then it's even computable. |
| 04:21:03 | <monochrom> | If a bijection can be constructed, so that we don't have to use the defaulting hack, all the better. |
| 04:21:33 | <Pseudonym> | Implementing a marshalling/demarshalling framework based on the Cantor-Bernstein-Schroeder theorem is left as an exercise. |
| 04:21:49 | <monochrom> | I want to drive home the point that a language without syntax/type/semantics/logic errors is harder to use, not easier to use. Maximum surprise, etc. |
| 04:22:31 | <monochrom> | The easiest-to-use language is one that makes you write full specifications and prove all implementations correct. Principle of least surprise. |
| 04:22:41 | <Pseudonym> | @let f x = (x :: Integer, y :: Integer) |
| 04:22:43 | <lambdabot> | Couldn't match expected type `Integer' against inferred type `Expr' |
| 04:22:49 | <Pseudonym> | @let f x = (x :: Integer, x :: Integer) |
| 04:22:51 | <lambdabot> | Defined. |
| 04:23:07 | <Pseudonym> | @let f_inv (x,y) = if x == y then Just x else Nothing |
| 04:23:08 | <lambdabot> | Defined. |
| 04:23:19 | <Pseudonym> | @let g (x,y) = 2^x * 3^y :: Integer |
| 04:23:21 | <lambdabot> | Defined. |
| 04:24:23 | <semicoln> | People awake in here? |
| 04:25:15 | <monochrom> | No, we sleep here. |
| 04:25:38 | <Pseudonym> | @let g_inv n = let g' n (f2,f3) = case (n `divMod` 2,n `divMod` 3) of { ((0,r),_) -> g' r (f2+1,f3); (_,(0,r)) -> g' r (f2,f3+1}; _ -> if n == 1 then Just (f2,f3) else Nothing } |
| 04:25:38 | <lambdabot> | Parse error |
| 04:25:40 | <monochrom> | It's like "people awake in ICU?" The point of ICU is people are in coma. |
| 04:25:43 | <Pseudonym> | @let g_inv n = let g' n (f2,f3) = case (n `divMod` 2,n `divMod` 3) of { ((0,r),_) -> g' r (f2+1,f3); (_,(0,r)) -> g' r (f2,f3+1}; _ -> if n == 1 then Just (f2,f3) else Nothing } in g' n (0,0) |
| 04:25:44 | <lambdabot> | Parse error |
| 04:25:52 | <Pseudonym> | @let g_inv n = let g' n (f2,f3) = case (n `divMod` 2,n `divMod` 3) of { ((0,r),_) -> g' r (f2+1,f3); (_,(0,r)) -> g' r (f2,f3+1); _ -> if n == 1 then Just (f2,f3) else Nothing } in g' n (0,0) |
| 04:25:54 | <lambdabot> | Defined. |
| 04:26:05 | <Pseudonym> | So far, so good. |
| 04:26:10 | <monochrom> | Hehehe this channel is the ICU for programmers! |
| 04:26:18 | <semicoln> | Lol monochrom |
| 04:26:24 | <Pseudonym> | :-) |
| 04:27:11 | <ray> | so whenever i build a package with ghc 6.10, ld uses absolutely enormous amounts of memory |
| 04:27:15 | <ray> | is this normal? |
| 04:27:42 | <Cale> | ray: maybe, if there are a lot of dependencies |
| 04:28:18 | <semicoln> | ray: what platform? |
| 04:28:42 | <ray> | lunix (debian lenny) |
| 04:28:45 | <wahjava> | ACTION has pasted httpd.hs at http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5332#a5332 |
| 04:28:59 | <ray> | i was using OS packages before, but i stopped |
| 04:29:02 | <wahjava> | i'm having an issue with a network server program in haskell. |
| 04:29:25 | <wahjava> | i think it is not cleaning up properly, but i'm unable to figure out what I'm missing. |
| 04:29:42 | <wahjava> | hi sbahra |
| 04:30:38 | <Pseudonym> | @check \x -> Just x == f_inv (f x) |
| 04:30:40 | <lambdabot> | Not in scope: `f_inv' |
| 04:30:47 | <Pseudonym> | @check \x -> Just x == L.f_inv (L.f x) |
| 04:30:48 | <lambdabot> | Not in scope: `L.f_inv'Not in scope: `L.f' |
| 04:30:52 | <Pseudonym> | Damn. |
| 04:30:56 | <wahjava> | any ideas anyone ? |
| 04:32:00 | <bos> | wahjava: that's extremely non-descriptive. |
| 04:32:18 | <wahjava> | bos, sorry about that, i've pasted the output in the footer of that paste. |
| 04:32:21 | <bos> | wahjava: sh. |
| 04:32:43 | <dmead> | ?seen dons |
| 04:32:44 | <lambdabot> | dons is in #haskell-in-depth, #concatenative, #arch-haskell, #darcs, #yi, #xmonad, #ghc and #haskell. I last heard dons speak 3h 45m 15s ago. |
| 04:32:48 | <bos> | wahjava: oh, that's normal. |
| 04:33:20 | <bos> | wahjava: you want to specify ReuseAddr |
| 04:33:24 | <wahjava> | bos, normal with all network servers or just the servers written in Haskell ? |
| 04:33:36 | <bos> | wahjava: in all network servers. |
| 04:33:58 | <wahjava> | bos, but I don't think I ever specified that in any of the server code I written in C. |
| 04:35:23 | <bos> | wahjava: nevertheless, it's needed. |
| 04:35:27 | <bos> | even in C. |
| 04:35:30 | <wahjava> | I'm not sure, but I think lazy evaluation of haskell is responsible somewhere. |
| 04:36:13 | <semicoln> | not lazy socket programmer? |
| 04:37:02 | <bos> | wahjava: you are mistaken. |
| 04:37:30 | <wahjava> | okay. let me verify it. |
| 04:39:22 | <bos> | wahjava: google for SO_REUSEADDR |
| 04:39:36 | <wahjava> | bos, I know about that socket option. |
| 04:39:55 | <wahjava> | but it is just that I never felt the need to use it in my tiny server programs. |
| 04:51:44 | <wahjava> | bos, http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5333#a5333 -- srv.c, the c program which does something *similar* but isn't behaving same as haskell code. |
| 04:54:18 | <bos> | wahjava: afaict, you connected to your haskell server before you killed it. |
| 04:54:26 | <bos> | wahjava: did you do the same with your C program? |
| 04:55:18 | <bos> | wahjava: from the netstat output that you showed in your first paste, you had a connected socket in TIME_WAIT state |
| 04:55:19 | <wahjava> | bos, well, i executed 'srv' in one xterm and in another xterm, i did: curl http://localhost:8080/ , which connected to my server and server exited after echoing. |
| 04:55:45 | <wahjava> | bos, yes, it seems 'hClose h' at line 89 of haskell code is not effective. |
| 04:56:34 | <wahjava> | preventing socket shutdown process from completion |
| 04:57:23 | <bos> | are you sure that line was actually executed? |
| 05:00:12 | <wahjava> | bos, well it should get executed as nothing in the program is preventing it from executing. |
| 05:00:13 | <wahjava> | bos, but i'm not sure if it executing or not. |
| 05:01:10 | <bos> | wahjava: that probably doesn't matter anyway. it's normal for a connection to go into TIME_WAIT state when you close it. |
| 05:01:49 | <bos> | so you need SO_REUSEADDR to ensure that the kernel will allow the server port to be reused if there's a connection in TIME_WAIT state. |
| 05:03:06 | <bos> | ACTION <*> bed |
| 05:04:32 | <wahjava> | bos, I got it |
| 05:04:36 | <wahjava> | bos, :-) |
| 05:05:47 | <wahjava> | bos, when I used curl with 'srv' (the c code), curl after seeing that the first line is not valid HTTP response, initated the close. |
| 05:07:03 | <wahjava> | bos, but when I used telnet to connect to srv, srv is the one to initiate close, and as srv quits, it reaches into the TIME_WAIT state and I get the same behavior :). |
| 05:07:06 | <wahjava> | thanks bos. |
| 05:11:04 | <Gilly> | I'm doing a software with GUI and DB but I'm ending up with most of the code running in IO and there's not really much separation between DB and GUI management. Any ideas how to design this? |
| 05:13:37 | <cads> | hey, what's a good introductory paper on HM's type system as implemented in haskell? something that'll actually talk a little theory and proof, but not over the top? |
| 05:14:43 | <cads> | really I just want to learn more about the inference algorithm and type representation |
| 05:15:12 | <Gilly> | In my program data is pretty much flowing from GUI to DB and back, but this way I won't have a lot of pure code :P |
| 05:15:32 | <cads> | aren't there functional db wrappers? |
| 05:21:07 | <inimino> | cads: the Wikipedia page on H-M explains the inference algorithm, with references |
| 05:24:20 | <cads> | I really need to give that wiki thing more credit |
| 05:26:41 | <cads> | one day they'll have cool, data carrying holographic tatoos. Then, I can get wikipedia or trillions of pi digits tatooed. |
| 05:28:20 | <Adamant> | cads: just plug it into your datajack like normal people |
| 05:28:26 | <Adamant> | :P |
| 05:37:34 | <cads> | Adamant: I hate how that's been one generation away for two generations now |
| 05:38:06 | <Adamant> | cads: count on it not happening until we understand the human brain |
| 05:38:12 | <cads> | I want a fucking brain chip, even if it's only 1.44 mb in all its glory |
| 05:38:40 | <Adamant> | cads: it could be worse, practical fusion power was invisaged in the 1920's :P |
| 05:38:59 | <cads> | I'm gonna pine for fusion till I die :( |
| 05:39:22 | <cads> | of famine. |
| 05:39:24 | <Ralith> | I'm sure we'll have fusion within 40 years. |
| 05:40:49 | <TomMD> | @remember Ralith I'm sure we'll have fusion within 40 years. |
| 05:40:49 | <lambdabot> | I will never forget. |
| 05:40:54 | <TomMD> | @flush |
| 05:40:55 | <lambdabot> | Not enough privileges |
| 05:40:58 | <TomMD> | @damn |
| 05:40:59 | <lambdabot> | Unknown command, try @list |
| 05:41:47 | <Ralith> | TomMD: it's a reference :P |
| 05:46:09 | <Berengal> | We don't need computers that can interface with brains, we need brains that can interface with computers |
| 06:12:21 | <mxc> | ?seen byogey |
| 06:12:21 | <lambdabot> | I haven't seen byogey. |
| 06:12:27 | <mxc> | ?seen byorgey |
| 06:12:28 | <lambdabot> | byorgey is in #haskell-overflow, #haskell-in-depth, #haskell-blah, #xmonad and #haskell. I last heard byorgey speak 8h 25m 56s ago. |
| 06:35:38 | <cads> | I hate how asking "what's a good code generator for C" in the actual C channel gets a bunch of huffy responses and no informative answers |
| 06:36:32 | <cads> | if I ask what's a good code generator for haskell here, I learn about someone's experience with template haskell or some other very cool thing |
| 06:37:15 | <trofi^w> | @where harpy |
| 06:37:15 | <lambdabot> | http://uebb.cs.tu-berlin.de/harpy/ |
| 06:37:54 | <cads> | requirements: template haskell :D |
| 06:38:32 | <cads> | see, there's all sorts of that kind of stuff in lots of languages except apparently in C |
| 06:40:05 | <trofi^w> | @google libvex |
| 06:40:06 | <lambdabot> | No Result Found. |
| 06:40:13 | <trofi^w> | @google VEX |
| 06:40:14 | <lambdabot> | http://www.vexrobotics.com/ |
| 06:40:14 | <lambdabot> | Title: VEX Robotics Design System |
| 06:40:20 | <trofi^w> | cache miss |
| 06:41:06 | <Twey> | @hoogle (a -> Bool) -> [a] -> [[a]] |
| 06:41:07 | <lambdabot> | Distribution.Simple.Utils breaks :: (a -> Bool) -> [a] -> [[a]] |
| 06:41:07 | <lambdabot> | Prelude dropWhile :: (a -> Bool) -> [a] -> [a] |
| 06:41:07 | <lambdabot> | Prelude filter :: (a -> Bool) -> [a] -> [a] |
| 06:41:52 | <trofi^w> | @where split |
| 06:41:53 | <lambdabot> | I know nothing about split. |
| 06:42:13 | <Twey> | Split does only one instance |
| 06:42:14 | <Twey> | :t split |
| 06:42:15 | <lambdabot> | forall g. (RandomGen g) => g -> (g, g) |
| 06:42:16 | <Twey> | :t break |
| 06:42:18 | <lambdabot> | forall a. (a -> Bool) -> [a] -> ([a], [a]) |
| 06:42:23 | <Twey> | Wrong split *frowns* |
| 06:42:28 | <Twey> | :t Data.List.splitAt |
| 06:42:29 | <lambdabot> | forall a. Int -> [a] -> ([a], [a]) |
| 06:42:31 | <Twey> | :t Data.List.split |
| 06:42:32 | <lambdabot> | Not in scope: `Data.List.split' |
| 06:42:38 | <Twey> | Hm, maybe it doesn't exist. |
| 06:47:11 | <elbar> | :t Data.List.Split |
| 06:47:12 | <lambdabot> | Not in scope: data constructor `Data.List.Split' |
| 06:47:56 | <elbar> | :t shouldnt work too good on modules i guess ;) |
| 06:47:58 | <lambdabot> | parse error on input `;' |
| 06:48:58 | <elbar> | split :: Splitter a -> [a] -> [[a]] |
| 06:49:06 | <elbar> | looking for something like this? |
| 06:49:48 | <TomMD> | My view of the XML libraries is that they aren't very integrated with the rest of Hackage. For example, I don't see any XML package that has Binary instances. |
| 06:50:39 | <TomMD> | Does anyone have a bandaid solution or am I doomed to writing Binary instances and sending it to a maintainer? (I'd probably go with the 'xml' package on Hackage) |
| 06:53:58 | <Twey> | You could make them separate packages |
| 06:54:19 | <Twey> | ACTION wants instance scoping |
| 06:54:25 | <TomMD> | Twey: Sure, but I'd rather not do anything at all if there already exists a solution. I just don't think there is one. |
| 06:55:15 | <Twey> | I don't think there is one, either. |
| 06:55:40 | <Twey> | I don't think Data.Binary can automatically derive instances, and I don't think it would help much if it could. |
| 06:56:04 | <TomMD> | Twey: It can, but it wouldn't help seeing as I need a particular (XML) format. |
| 06:56:20 | <Twey> | Hm |
| 06:57:08 | <TomMD> | Oh well - I hacked a simple KML -> ByteString method into my current code so I'll use that for the forseeable future. |
| 06:58:09 | <TomMD> | The hope was that I'd have a painless path to do a Coordinates -> KML -> ByteString for some useful intermediate representation of KML. Currently its actually just KML = [Coordinate] |
| 06:59:34 | <TomMD> | ACTION falls asleep |
| 07:22:08 | <hackagebot> | linear-maps 0.6 |
| 07:34:47 | <osfameron> | ACTION was thinking about lenses last night. it seems like there are plenty of very sensible transformations which can't be expressed as a lens |
| 07:35:04 | <aconbere> | hey, so I'm struggling with Random and using that within the context of HOpenGL |
| 07:35:17 | <aconbere> | basically one of the state variables I want to be randomly generated |
| 07:35:27 | <aconbere> | intially you create a newIORef |
| 07:35:40 | <aconbere> | and this works fine coming from the IO wrapped random data |
| 07:35:48 | <aconbere> | but when I try to mutate it |
| 07:35:58 | <aconbere> | myVar $= randomVar |
| 07:36:07 | <aconbere> | it yells at me about the type |
| 07:36:13 | <aconbere> | ACTION shrugs! |
| 07:36:29 | <Zao> | writeIORef? |
| 07:36:37 | <Zao> | I thought $= was just for opengl state? |
| 07:37:05 | <aconbere> | right, this is an openGL state var |
| 07:37:43 | <Zao> | So readIORef and throw the result at myVar $=? |
| 07:39:33 | <Zao> | aconbere: ($=) :: s a -> a -> IO () |
| 07:40:49 | <Zao> | aconbere: Take shadeModel for example. |
| 07:41:11 | <Zao> | You have shadeModel :: StateVar ShadingModel |
| 07:42:01 | <aconbere> | ACTION tries to find this in the api docs |
| 07:42:04 | <Zao> | (shadeModel $=) would have the type ShadingModel -> IO (), which is an function taking a ShadingModel returning an IO action. |
| 07:42:14 | <Zao> | http://hackage.haskell.org/packages/archive/OpenGL/2.2.3.0/doc/html/Graphics-Rendering-OpenGL-GL-StateVar.html#v%3A%24%3D |
| 07:43:19 | <Zao> | Where your expression has the type StateVar ShadingModel -> (IORef ShadingModel) -> IO () |
| 07:43:31 | <Zao> | Which doesn't match the signature for ($=) |
| 07:44:18 | <aconbere> | so a lot of what you're saying is over my head still |
| 07:44:38 | <aconbere> | but I think the gist of my problem comes down to how you manipulate random data from tools like MonadRandom |
| 07:44:44 | <aconbere> | once I get that IO data type |
| 07:44:51 | <aconbere> | I feel like I can't do anything with it |
| 07:45:15 | <Zao> | @type readIORef |
| 07:45:17 | <lambdabot> | Not in scope: `readIORef' |
| 07:45:25 | <aconbere> | so I tried |
| 07:45:33 | <Zao> | @type Data.IORef.readIORef |
| 07:45:35 | <lambdabot> | forall a. GHC.IOBase.IORef a -> IO a |
| 07:45:39 | <aconbere> | myVar $= readIORef myRandomVar |
| 07:45:52 | <aconbere> | but got a type error that readIORef expects and IORef |
| 07:45:55 | <aconbere> | not IO |
| 07:46:03 | <Zao> | What type is myRandomVar? |
| 07:46:07 | <aconbere> | IO |
| 07:46:12 | <aconbere> | since that's what random returns |
| 07:46:32 | <Zao> | Not the whole truth. |
| 07:47:00 | <Zao> | IO what? One usually doesn't refer to the monad with just the name. |
| 07:47:46 | <Zao> | Could you hpaste relevant bits of your code? |
| 07:48:54 | <Zao> | Long story short, if you want to get the contents of an IORef t, you use x <- readIORef r |
| 07:49:16 | <Zao> | If you want to use randomIO to get a random value from the global pool, you use x <- randomIO |
| 07:49:29 | <aconbere> | yeah I'm working on it, slightly weird dev environment here |
| 07:50:44 | <Zao> | You can't use something with type (IO a) anywhere that expects an a. |
| 07:51:09 | <Zao> | You need to sequence it and get hold of the contents using <- or >>= or suchlike. |
| 07:51:49 | <aconbere> | right, so I've been kind of shooting in the dark with this stuff I can't ever really quite figure out how that stuff works |
| 07:51:53 | <aconbere> | but it's okay I'm learning :) |
| 07:51:54 | <Zao> | A value of type (IO t) represents a function in the IO monad, that when actually run yields the value inside. |
| 07:51:56 | <aconbere> | http://paste.pocoo.org/show/119531/ |
| 07:52:26 | <aconbere> | so that's the bit that makes the random data structure |
| 07:53:18 | <aconbere> | http://paste.pocoo.org/show/119532/ |
| 07:53:28 | <aconbere> | that's where it's instantiated in the openGL main loop |
| 07:55:15 | <Zao> | So what's the type of the expression newIORef $ randomFood? |
| 07:55:34 | <aconbere> | http://paste.pocoo.org/show/119534/ |
| 07:56:01 | <aconbere> | one sec let me look at newIORef again :) |
| 07:56:33 | <aconbere> | I'd expect it to be something crazy like |
| 07:56:44 | <aconbere> | IO (IORef (IO a)) |
| 07:57:25 | <Zao> | So in the end, food has what type? |
| 07:59:30 | <Zao> | In do notation, <- binds the name to the left to the result of the (m a) expression to the right. |
| 08:00:02 | <aconbere> | I'm not sure I understand ($=) :: s a -> a -> IO () |
| 08:00:13 | <aconbere> | but the type that food ends up as is bound up in that |
| 08:00:47 | <aconbere> | as far as <- goes I get taht it's binding a variable from (m a) |
| 08:00:59 | <aconbere> | I just don't find that it quite works the way I expect in practice |
| 08:01:01 | <Zao> | ($=) is a function in the IO monad, taking something matching (s a), a value of type a, returning unit. |
| 08:01:16 | <Zao> | $= only works on OpenGL state variables. |
| 08:01:32 | <Zao> | (and other things conformant to the HasSetter class) |
| 08:02:06 | <Zao> | food has type :: IORef (IO f) |
| 08:02:31 | <Zao> | That is, an IORef pointing at a IO function to give you a new random food. |
| 08:02:49 | <Zao> | Is that the intended result? |
| 08:03:17 | <aconbere> | the problem with "intended" in this regard is that I have not internalized haskell completely |
| 08:03:26 | <aconbere> | so often times "intended" just isn't how to do it :) |
| 08:03:28 | <aconbere> | for instance |
| 08:03:43 | <aconbere> | my intention is to simply create a new random food evertime it gets eaten |
| 08:04:07 | <aconbere> | the problem is in my approach :) |
| 08:04:24 | <te> | I'm so excited for my haskell book to get here tomorrow |
| 08:04:29 | <Zao> | I assume the intended functionality would be analogous to the following C++: *currentFood = randomFood(); ? |
| 08:04:42 | <Zao> | Or more explicitly, Food f = randomFood(); *currentFood = f; |
| 08:05:14 | <Zao> | As I assume that the food IORef in main is supposed to contain a piece of food, not a function to generate more. |
| 08:06:29 | <Zao> | Ignore what I said above about ($=) not being usable on IORefs. Apparently there's an instance around for that. |
| 08:08:50 | <aconbere> | Zao: that's pretty much right |
| 08:09:01 | <aconbere> | or in most dynamic languages it would be analagous to |
| 08:09:09 | <aconbere> | food = RandomFood() |
| 08:09:25 | <aconbere> | which is kind of how I've been envisioning this whole $= bit |
| 08:09:31 | <aconbere> | since that seems to be mostly how it works |
| 08:09:40 | <aconbere> | but Random has been givine me a headache :) |
| 08:10:24 | <Zao> | Let's address the issue in main first. |
| 08:10:46 | <Zao> | You're initializing the food IORef with an IO function, while you just want an initial value. |
| 08:10:46 | <aconbere> | roger! |
| 08:10:53 | <aconbere> | totally |
| 08:11:08 | <Baughn> | @index fix |
| 08:11:09 | <lambdabot> | Control.Monad.Fix, Control.Monad.Reader, Control.Monad.Writer, Control.Monad.State, Control.Monad.RWS, Control.Monad.Identity, Control.Monad.Error |
| 08:11:10 | <aconbere> | so should I have first binding that value to a variable? |
| 08:11:21 | <aconbere> | wow |
| 08:11:24 | <Zao> | That's one way. |
| 08:11:24 | <aconbere> | that's barely english |
| 08:11:52 | <Baughn> | @instances-importing Control.Monad.Fix MonadFix |
| 08:11:53 | <lambdabot> | ((->) r), Either e, ErrorT e m, IO, Maybe, RWS r w s, RWST r w s m, Reader r, ReaderT r m, ST s, State s, StateT s m, Writer w, WriterT w m, [] |
| 08:12:46 | <Zao> | do { initialFood <- randomFood; food <- newIORef initialFood } |
| 08:12:50 | <Zao> | That's the more explicit variant. |
| 08:13:31 | <aconbere> | totally |
| 08:13:35 | <aconbere> | okay I'll start there |
| 08:13:38 | <aconbere> | ACTION pokes around |
| 08:14:32 | <Zao> | @type >>= |
| 08:14:34 | <lambdabot> | parse error on input `>>=' |
| 08:14:37 | <Zao> | @type (>>=) |
| 08:14:39 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => m a -> (a -> m b) -> m b |
| 08:15:11 | <Zao> | For future reference, food <- randomFood >>= newIORef would do too. |
| 08:15:19 | <Zao> | But that relies on understanding >>= |
| 08:15:26 | <aconbere> | yeah |
| 08:15:28 | <Zao> | Anyway, I'm late for work already. Have fun. |
| 08:15:31 | <aconbere> | let's not go there quite yet :) |
| 08:15:36 | <aconbere> | thanks! |
| 08:16:15 | <Zao> | Duct taping actions together like that tends to cut down on the avalanche of temporary variables. |
| 08:17:02 | <Zao> | When control flows through an IO function, there needs to be a single clear order (sequence) of IO actions to perform. |
| 08:17:17 | <Zao> | >>= allows you to compose larger actions from smaller ones. |
| 08:17:37 | <Zao> | `do' blocks actually desugars to >>, >>= and a whole pile of lambdas. |
| 08:18:58 | <Zao> | It tends to take a good while before things start to click :) |
| 08:19:46 | <Lemmih> | @seen augustss |
| 08:19:46 | <lambdabot> | augustss is in #haskell-in-depth, #ghc and #haskell. I don't know when augustss last spoke. |
| 08:49:35 | <Baughn> | @type msum |
| 08:49:37 | <lambdabot> | forall (m :: * -> *) a. (MonadPlus m) => [m a] -> m a |
| 08:50:11 | <mib_83y9w7go> | hey guys |
| 08:50:21 | <mib_83y9w7go> | could anyone tell me whats wrong with this |
| 08:50:23 | <mib_83y9w7go> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5334#a5334 |
| 08:51:04 | <mebbel> | exactly what it says |
| 08:51:22 | <mebbel> | you're calling fanCount films |
| 08:51:36 | <mebbel> | fanCount takes a Film; films is a list of Films |
| 08:51:50 | <mib_83y9w7go> | ahh |
| 08:52:43 | <T-Cell> | HELP PLEASE: Expected kind `?', but `Request' has kind `* -> *' ...I need to support '*' uri in OPTIONS request. How is this done? (relevant source: http://hackage.haskell.org/packages/archive/HTTP/3001.1.5/doc/html/src/Network-HTTP.html#RequestMethod ) |
| 08:54:09 | <Lemmih> | T-Cell: More information required. |
| 08:54:12 | <mebbel> | Request has kind * -> *? not according to the url you pasted |
| 08:57:17 | <T-Cell> | specifically, in data Request, rqURI has :: URI and I need this to support '*' see the link above |
| 08:57:37 | <mebbel> | ok? |
| 08:57:54 | <T-Cell> | I'm not sure how this is done |
| 08:58:00 | <Lemmih> | T-Cell: You haven't really asked anything. |
| 08:58:14 | <mebbel> | and how is this related to the kind error? |
| 09:00:08 | <T-Cell> | How can I support '*' in uri OPTIONS request? OPTIONS is defined in rqMethodMap which is in the link above. |
| 09:00:13 | <quicksilver> | I have no idea what the kind error is about, but the comments in that source suggest that you can't. |
| 09:00:19 | <quicksilver> | -- ^ might need changing in future |
| 09:00:26 | <quicksilver> | -- 1) to support '*' uri in OPTIONS request |
| 09:00:30 | <T-Cell> | yes |
| 09:00:45 | <mebbel> | so you can do it by patching Network.HTTP |
| 09:01:15 | <Lemmih> | ACTION has a nagging feeling that T-Cell is asking us to do his work for him. |
| 09:03:36 | <T-Cell> | no, I just don't know a lot about Network.HTTP. I really just need a function to work which unfortunately depends on this. |
| 09:04:24 | <T-Cell> | it's ok. I appreciate the help though. |
| 09:10:16 | <mib_83y9w7go> | any idea how to fix this? http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5334#a5334 |
| 09:10:26 | <mib_83y9w7go> | im lost |
| 09:10:46 | <quicksilver> | as you were told 20 minutes ago |
| 09:10:48 | <mib_83y9w7go> | trying to sort list by amount of fans |
| 09:10:58 | <quicksilver> | fanCount takes a single film |
| 09:11:06 | <quicksilver> | and you're giving it 'films' which is a list. |
| 09:11:25 | <quicksilver> | I think you misunderstand sortBy, too :) |
| 09:11:29 | <quicksilver> | :t sortBy |
| 09:11:31 | <lambdabot> | forall a. (a -> a -> Ordering) -> [a] -> [a] |
| 09:11:56 | <mib_83y9w7go> | seems i have a lot of work |
| 09:12:00 | <mib_83y9w7go> | :S |
| 09:12:03 | <quicksilver> | what you want is sortBy (comparing fanCount) films |
| 09:12:16 | <quicksilver> | it would probably be good if you tried to work out why, though. |
| 09:12:22 | <quicksilver> | :t comparing |
| 09:12:23 | <lambdabot> | forall b a. (Ord a) => (b -> a) -> b -> b -> Ordering |
| 09:12:24 | <Zao> | Almost sounds like english, this fancy language of yours :) |
| 09:12:53 | <mib_83y9w7go> | lol |
| 09:13:08 | <Cale> | Zao: That was the point when I first defined comparing :) |
| 09:19:41 | <McManiaC> | @src getLine |
| 09:19:42 | <lambdabot> | getLine = hGetLine stdin |
| 09:33:50 | <mib_83y9w7go> | hey is there a generic function to flip a list? |
| 09:34:00 | <Cale> | reverse? |
| 09:34:03 | <Cale> | > reverse [1,2,3] |
| 09:34:05 | <lambdabot> | [3,2,1] |
| 09:34:09 | <mib_83y9w7go> | cool |
| 09:37:19 | <cads> | hey, what's the cleverest O(1) algorithm known to man? |
| 09:37:44 | <cads> | makes a better candidate for a joke than a question |
| 09:39:09 | <dmwit> | There's not really a lot of choices. |
| 09:39:12 | <dmwit> | Array indexing, maybe. |
| 09:39:25 | <quicksilver> | reading a haiku |
| 09:39:28 | <cads> | i guess any algorithm that does a fixed number of things with at most a fixed number of elements of the input would qualify |
| 09:39:55 | <dmwit> | Radix sort on lists of length at most 10^30. ;-) |
| 09:40:22 | <cads> | well technically that O(1), no? |
| 09:40:57 | <cads> | hehe, not locally |
| 09:41:18 | <dmwit> | cads: Yes, it's O(1), exactly. =) |
| 09:41:41 | <WorkyBob> | cads: no, I don't think so – to be O(1) its time complexity must be constant varying *with the size of its input* |
| 09:41:57 | <WorkyBob> | you can't just say "yes, but its input is this size" and declare it constant time |
| 09:42:10 | <dmwit> | Sure you can. |
| 09:42:16 | <cads> | but bob, if the first part of the algorithm just truncates the input if too large, the rest of it will run in constant time |
| 09:42:37 | <WorkyBob> | cads: ah, now that's a different matter - that does sound like a constant time algorithm |
| 09:42:41 | <WorkyBob> | not a very interesting one though |
| 09:42:58 | <WorkyBob> | well, I guess head does that and is fairly interesting |
| 09:43:13 | <dmwit> | This is one of the pitfalls of O-notation: people mostly don't understand it as well as they think they do. |
| 09:43:16 | <cads> | getting head )is( interesting |
| 09:43:22 | <WorkyBob> | heh |
| 09:44:16 | <opqdonut> | dmwit: most people who get all smart-ass about O(1) don't remember that the problem/algorithm needs to be extended to inputs of arbitary length |
| 09:44:19 | <WorkyBob> | dmwit: is this function: f 6 = 3 constant? |
| 09:44:42 | <hackagebot> | delimited-text 0.1.1 |
| 09:45:07 | <Zao> | @type const 3 |
| 09:45:09 | <lambdabot> | forall t b. (Num t) => b -> t |
| 09:45:13 | <opqdonut> | cads: but as for real O(1) algorithms, there are local graph algorithms (i.e. collect data from only a constant radius) that attain good approximations of classic problems |
| 09:45:17 | <ivanm> | opqdonut: I just came in to this conversation and so I don't know what you're talking about, but isn't array access O(1) no matter what size the array (well, maybe not after you've updated your immutable array a few times...) |
| 09:45:19 | <ivanm> | ? |
| 09:45:20 | <opqdonut> | cads: let me throw you a link |
| 09:45:33 | <cads> | dmwit: yeah, plateuing any function's runtime after a certain size input makes it O(1) but render the O notation useless for thinking about the function... or rather, we;d want to think about the part of the function that grows like a different O, which will be hard in general |
| 09:45:35 | <opqdonut> | ivanm: yeah, array access is really (ideally) O(1) |
| 09:45:39 | <WorkyBob> | ivanm: indeed |
| 09:46:02 | <Saizan> | well, with unbounded memory it isn't |
| 09:46:09 | <ivanm> | though immutable arrays make that kind of argument tricky ;-) |
| 09:46:12 | <ivanm> | Saizan: *nod* |
| 09:46:21 | <dmwit> | WorkyBob: ...yes? |
| 09:46:22 | <WorkyBob> | Saizan: with an unbounded integer unit it is again though :D |
| 09:46:22 | <Saizan> | but it all depends on what operations you're counting |
| 09:46:23 | <opqdonut> | cads: the link: http://arxiv.org/pdf/0810.2175 |
| 09:46:34 | <dmwit> | cads: Right, I understand that. |
| 09:46:36 | <WorkyBob> | dmwit: so how come I get different results for f 5 and f 6? |
| 09:46:46 | <cads> | in clojure we get a vector where subvectors and reversal are O(1) |
| 09:46:51 | <dmwit> | WorkyBob: I thought you were talking about constant-time. |
| 09:46:57 | <dmwit> | i.e. O(1) |
| 09:47:04 | <dmwit> | Naturally it's not the constant function. |
| 09:47:21 | <opqdonut> | cads: the haskell Data.Sequence type is quite efficient for splicing, indexing and catenating |
| 09:47:23 | <WorkyBob> | dmwit: I am - but my point is that you saying "if you restrict it to only inputs of a set length it's constant time" is equivalent to saying that f 6 = 3 is a constant function |
| 09:47:39 | <WorkyBob> | ... if it's input is of length 6, it'll always take 3 seconds |
| 09:47:51 | <Saizan> | more interestingly, how to prove that the fold for Data.Tree.Tree runs in linear time if the folded function runs in constant time? |
| 09:47:53 | <cads> | oo, consing is O(1) |
| 09:48:07 | <dmwit> | Ah, yes, I understand what you're saying. I was slightly imprecise in my statement. |
| 09:49:08 | <cads> | yeah, we're not fixing the input |
| 09:51:49 | <cads> | lets see, "f ~ O g" means that a function g is bound from above by some scalar factor of some function, right? |
| 09:52:03 | <cads> | O(g) * |
| 09:52:15 | <cads> | ah crud |
| 09:52:27 | <cads> | bound above by a scalar factor of g* |
| 09:52:46 | <cads> | shit I really need to just go to bed |
| 09:53:19 | <dmwit> | It means f is bound above by a scalar factor of g, yes. |
| 09:53:49 | <cads> | it's actually a useful notion places other than algorithms |
| 09:53:51 | <Saizan> | after some point |
| 09:53:57 | <mapreduce> | cads: Consing is O(1)? So if you cons n items it happens in constant time? |
| 09:54:05 | <WorkyBob> | mapreduce: absolutely |
| 09:54:06 | <dmwit> | For sufficiently large inputs. =) |
| 09:54:07 | <opqdonut> | cads: yeah, stuff like O(1/n) |
| 09:54:19 | <WorkyBob> | (1:long list) does not traverse the whole long list |
| 09:54:27 | <mapreduce> | WorkyBob: That's not what I said. |
| 09:54:33 | <WorkyBob> | oh, neither it is |
| 09:54:35 | <Saizan> | if you cons n items you pay O(n) |
| 09:54:37 | <dmwit> | mapreduce: If you cons n items, it happens in O(n) time. =) |
| 09:54:38 | <WorkyBob> | but he said consing is constant time |
| 09:54:45 | <WorkyBob> | not multiple conses are constant time |
| 09:55:01 | <WorkyBob> | if you do n O(1) operations, you get an O(n) algorithm, big surprise |
| 09:55:02 | <mapreduce> | Ok. |
| 09:55:53 | <cads> | mapreduce: consing an item onto a list of n items will take O(1) time |
| 09:56:30 | <cads> | wait, you guys covered that |
| 09:57:07 | <cads> | I'm going to slep |
| 09:57:10 | <cads> | night all |
| 09:57:33 | <cads> | I think tail wins as most interesting O(1) algorith, yaaaaay! |
| 09:58:04 | <Berengal> | tail is barely an algorithm at all... |
| 09:58:05 | <cads> | though the fixed radius subgraph was neat if true |
| 09:58:59 | <cads> | man, tail can take an infinite number of elements, serve you up with another infinite elements, all in one operation? shoooot |
| 09:59:16 | <yowgi> | are walking and taking the bus both O(n)? ;) |
| 10:00:16 | <cads> | ACTION would settle for O(log(log(x))) transportation |
| 10:02:18 | <yowgi> | although one could say that travelling at c is both O(n) and O(1). or even O(0)? |
| 10:03:27 | <Berengal> | Well, it's not O(0) since getting from one place to another still takes time, whatever that may be at that speed |
| 10:04:07 | <doserj> | it doesn't in your frame of reference |
| 10:04:40 | <lilac> | big-O notation only makes sense if you have a pre-agreed objective definition of what it is you're bounding |
| 10:04:59 | <lilac> | "time, as measured by, well, someone (we don't know who)" doesn't count ;-) |
| 10:05:57 | <Berengal> | What's the time complexity for counting the number of list elements in a tree of lists? |
| 10:06:30 | <quicksilver> | O(elements) I believe. |
| 10:06:53 | <quicksilver> | traversing a tree should be O(nodes) |
| 10:07:30 | <Berengal> | Yeah, that's what I thought as well. O((elements/nodes)nodes) = O(elements) |
| 10:08:04 | <Berengal> | Could you also say it's O(elements + nodes)? |
| 10:08:50 | <quicksilver> | but nodes itself is O(elements) |
| 10:08:54 | <quicksilver> | so there is no point saying that. |
| 10:09:06 | <quicksilver> | unless some of your lists are empty! |
| 10:09:13 | <quicksilver> | in which case, yes, O(nodes + elements) is better :) |
| 10:09:38 | <Berengal> | O(nodes + elements) take care of both the (combined) size of the lists and the size of the tree |
| 10:10:02 | <Berengal> | O(elements) assumes a tree of a given size |
| 10:10:21 | <quicksilver> | well I was just assuming the lists are non empty |
| 10:10:40 | <quicksilver> | at which point nodes is certainly O(elements) |
| 10:10:47 | <quicksilver> | and you can coalesce |
| 10:11:34 | <Berengal> | Tree traversal doesn't depend on the contents of the tree |
| 10:12:06 | <Berengal> | It's O(nodes) anyway |
| 10:12:44 | <Berengal> | The length of a list is O(elements) |
| 10:13:31 | <Berengal> | I should be heading off to work instead of doing this :/ |
| 10:13:41 | <ivanm> | work? what's that? |
| 10:13:42 | <ivanm> | :p |
| 10:14:07 | <Berengal> | Well, it's my last day tomorrow |
| 10:14:09 | <Berengal> | ish |
| 10:14:17 | <Berengal> | Moving to a new department |
| 10:14:23 | <ivanm> | ahhh |
| 10:14:29 | <ivanm> | promotion? or transfer? |
| 10:14:35 | <Alpounet> | yay |
| 10:14:35 | <Berengal> | Transfer |
| 10:14:56 | <Berengal> | But promotion from intern in the department I'm transfering to |
| 10:15:05 | <ivanm> | heh |
| 10:15:16 | <ivanm> | so I'd say that's in a sense a promotion ;-) |
| 10:15:41 | <Berengal> | Yes. Also, change in title. I'll now be a "programmer" instead of a "junior consultant" |
| 10:15:52 | <ivanm> | they call interns "junior consultants"? |
| 10:15:58 | <ivanm> | that sounds better than "programmer"... |
| 10:16:16 | <Berengal> | No, they call interns interns. Junior consultants are just regular clerks |
| 10:16:25 | <ivanm> | ahhh |
| 10:16:46 | <Berengal> | And also, small raise :) |
| 10:16:51 | <ivanm> | \o/ |
| 10:17:01 | <ivanm> | but only a _small_ one? from intern -> programmer? |
| 10:17:18 | <Berengal> | I worked as an intern for free |
| 10:17:35 | <Berengal> | But I also had a regular job at the same company |
| 10:17:39 | <ivanm> | ahhhhh |
| 10:18:30 | <Berengal> | Anyway, more hours + more pay = good |
| 10:18:40 | <ivanm> | no, less hours + more pay = good |
| 10:18:40 | <ivanm> | ;-) |
| 10:19:09 | <Berengal> | To be honest, 30% of full time isn't enough :/ |
| 10:19:33 | <Berengal> | Now I've got 10 weeks of 100% |
| 10:19:42 | <ivanm> | if they pay you for full time but you only work 30%, that leaves you with 70% for other things! |
| 10:19:47 | <ivanm> | Berengal: only a short term contract? |
| 10:20:10 | <Berengal> | Yeah, I've been on a short-term contract since last summer... |
| 10:20:22 | <Berengal> | Though as a student that fits me okay |
| 10:20:42 | <ivanm> | well, you better get going to work so that they'll renew your contract again when this one is up! |
| 10:20:43 | <ivanm> | ;-) |
| 10:20:55 | <Berengal> | Yeah, indeed |
| 10:20:57 | <Berengal> | I'm off |
| 10:21:26 | <ivanm> | then maybe you should be kept in the fridge rather than left outside? :p |
| 10:34:12 | <Baughn> | @tell conal I did eventually get makeEvent working, though getting finalizers to work right is crazily hard. http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5335 has the code for that; you'll want to consider changing types such as :--> and :+->, though. (Right now I'm just not using them) |
| 10:34:13 | <lambdabot> | Consider it noted. |
| 10:36:01 | <WorkyBob> | Baughn: ohh, does that mean that reactive actually makes progress correctly now, or is this a different bug? |
| 10:40:10 | <Baughn> | WorkyBob: I'm working on it |
| 10:40:42 | <WorkyBob> | sweet :D |
| 10:40:47 | <Baughn> | WorkyBob: The bug I'm /currently/ working on is to have a makeEvent-created event /end/ when the sink gets GC'd |
| 10:40:55 | <Baughn> | WorkyBob: ..and the other way around |
| 10:41:02 | <WorkyBob> | ah, yeh |
| 10:41:16 | <WorkyBob> | that makes sense, so it actually gets the infinite future added? |
| 10:41:16 | <Baughn> | WorkyBob: QUite a lot of stuff started working when I fixed unamb a while back, but that code hasn't been released yet |
| 10:41:19 | <Baughn> | Yes |
| 10:41:33 | <WorkyBob> | is that possible with Haskell finalizers? |
| 10:41:37 | <WorkyBob> | I thought they weren't guarenteed to run |
| 10:41:38 | <Baughn> | Yes |
| 10:41:42 | <WorkyBob> | only C ones |
| 10:41:42 | <Baughn> | Oh, they aren't |
| 10:41:50 | <Baughn> | In practice they get run, though. |
| 10:41:53 | <WorkyBob> | ah, k |
| 10:42:09 | <Baughn> | In particular, they get run before the GC decides a thread is deadlocked. |
| 10:42:38 | <quicksilver> | Baughn: it would be nice to hear a bit about what you're doing/fixing on the reactive list |
| 10:42:39 | <WorkyBob> | hmm, doesn't sound overly reliable to me |
| 10:42:58 | <Baughn> | So that means you might end up blocking on reading the event for a while (=until the next major gc, possibly), but you won't actually get a deadlock exception |
| 10:43:07 | <WorkyBob> | yeh, I'd love to hear what progress you're making in more detail – some of the bugs in reactive really enlightened me about how the whole thing works |
| 10:43:23 | <WorkyBob> | ahhh, okay |
| 10:43:28 | <Baughn> | WorkyBob: I'm also adding a call that'll let you cap the Event manually, which is safer. The finalizer's just to ensure it never goes /too/ wrong. |
| 10:43:55 | <Baughn> | ..if I can figure out why my code isn't working now |
| 10:44:06 | <WorkyBob> | ah, ok |
| 10:44:11 | <Baughn> | quicksilver: I'm not even subscribed. :/ |
| 10:45:11 | <WorkyBob> | what I'm slightly confused by is that a while ago I fixed recursive integrals |
| 10:45:17 | <WorkyBob> | and I'm sure it went into the darcs copy |
| 10:45:23 | <quicksilver> | Baughn: well my suggestion is it would be nice if you were :) |
| 10:45:27 | <WorkyBob> | but the most recent one doesn't seem to do it right |
| 10:45:43 | <quicksilver> | Baughn: for a while, the list was quite lively but then people got blocked on some bugs, and busy. |
| 10:45:47 | <Baughn> | WorkyBob: A lot of things fail to work due to a malfunctioning Unamb. Hang on.. |
| 10:45:53 | <quicksilver> | Baughn: they don't even even know you're fixing them :) |
| 10:45:58 | <WorkyBob> | isn't unamb fixed now though? |
| 10:46:09 | <WorkyBob> | I thought that was due to it not restarting the computation if it was demanded again |
| 10:46:11 | <Baughn> | Yes, but the code hasn't been released |
| 10:46:15 | <Baughn> | WorkyBob: Oh, it was |
| 10:46:20 | <Baughn> | WorkyBob: The fix for that didn't work. |
| 10:46:24 | <WorkyBob> | oh, okay |
| 10:46:28 | <Baughn> | ..testing's nice. |
| 10:46:34 | <Baughn> | WorkyBob: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5337#a5337 <-- This one does. |
| 10:46:56 | <hackagebot> | Chart 0.11 |
| 10:47:39 | <quicksilver> | Baughn: so your fix is for the same thing? it's just a fix which works? |
| 10:47:56 | <Baughn> | quicksilver: Yes |
| 10:47:58 | <WorkyBob> | Baughn: ohhh, that's a neat one |
| 10:48:13 | <WorkyBob> | it's a shame unamb is such a hard bugger to implement right |
| 10:48:22 | <WorkyBob> | it's got some really nasty gotchas |
| 10:48:57 | <WorkyBob> | oh, also, neat - that one produces a "fast" bottom, doesn't it |
| 10:49:05 | <Baughn> | It does, if it works. :) |
| 10:49:06 | <WorkyBob> | i.e. if both are bottom, it terminates as bottom |
| 10:49:11 | <WorkyBob> | rather than non-terminating |
| 10:49:23 | <quicksilver> | ACTION should carve out some time to poke at his implementation again. |
| 10:49:25 | <Baughn> | Oh. Yes, but so did the last one. |
| 10:49:31 | <WorkyBob> | hmm? |
| 10:49:44 | <WorkyBob> | in the last one, if a thread threw an exception, the mvars never got written |
| 10:49:46 | <WorkyBob> | and it just got blocked |
| 10:49:50 | <Baughn> | Hm |
| 10:50:12 | <Baughn> | I didn't realize. Seemed like the obvious thing to do.. |
| 10:50:30 | <Baughn> | WorkyBob: It also has an optimization-in-potentia in isEvaluated, I just don't quite dare to turn it on yet |
| 10:50:37 | <WorkyBob> | hehe |
| 10:50:39 | <WorkyBob> | yes |
| 10:50:47 | <WorkyBob> | when did isEvaluated get added btw? |
| 10:50:51 | <Baughn> | Yesterday |
| 10:50:54 | <WorkyBob> | in amongst all the Vaccum fun? |
| 10:51:21 | <Baughn> | I originally wrote it independently of vacuum, but using vacuum lets me get away with /not/ including all of GHC in the executable. :3 |
| 10:51:31 | <WorkyBob> | nice :) |
| 10:52:56 | <Baughn> | ..oh, this is insane |
| 10:53:18 | <Baughn> | I've got a thread blocked on writeChan /at the same time/ as another thread is blocked on readChan |
| 10:53:21 | <Baughn> | For the same Chan |
| 10:53:26 | <WorkyBob> | o.O |
| 10:53:48 | <Baughn> | GHC just doesn't want to let me make makeEvent work. >_< |
| 11:01:43 | <Baughn> | @tell conal ..also, it doesn't work. I appear to have two threads deadlocked on the same chan, reading and writing it respectively. No, no idea how. *groan* |
| 11:01:44 | <lambdabot> | Consider it noted. |
| 11:04:18 | <mib_13lje4t4> | hey guys im using get line to get a year value |
| 11:04:47 | <mib_13lje4t4> | but it comes up as the return value for getLine is [char] |
| 11:05:09 | <mib_13lje4t4> | and i need an Int |
| 11:05:13 | <mib_13lje4t4> | any ideas? |
| 11:05:18 | <ivanm> | mib_13lje4t4: read it |
| 11:05:20 | <Axman6> | you want readLn |
| 11:05:23 | <ivanm> | > read "1234" |
| 11:05:25 | <lambdabot> | * Exception: Prelude.read: no parse |
| 11:05:31 | <ivanm> | @type readLn |
| 11:05:33 | <lambdabot> | forall a. (Read a) => IO a |
| 11:05:40 | <ivanm> | hmmmm, didn't know about readLn |
| 11:05:43 | <Axman6> | @src readLn |
| 11:05:43 | <lambdabot> | readLn = do l <- getLine; r <- readIO l; return r |
| 11:05:55 | <Gracenotes> | @type readIO |
| 11:05:56 | <lambdabot> | forall a. (Read a) => String -> IO a |
| 11:06:07 | <Axman6> | @src readIO |
| 11:06:07 | <lambdabot> | Source not found. Just try something else. |
| 11:06:17 | <ivanm> | why is it IO? |
| 11:06:22 | <ivanm> | @src readIO |
| 11:06:23 | <lambdabot> | Source not found. It can only be attributed to human error. |
| 11:06:25 | <Axman6> | no idea |
| 11:06:26 | <Gracenotes> | r <- readIO l; return r? A bit redundant? :P |
| 11:06:43 | <ivanm> | Gracenotes: yeah |
| 11:07:05 | <WorkyBob> | o.O |
| 11:07:20 | <ivanm> | but AFAICT, readIO = liftM read |
| 11:07:21 | <ivanm> | :s |
| 11:07:28 | <ivanm> | take it back, it isn't |
| 11:07:36 | <ivanm> | readIO str = return (read str) |
| 11:07:46 | <doserj> | readIO throws an IOException instead of error |
| 11:08:04 | <ivanm> | doserj: if read fails? that makes sense then |
| 11:08:07 | <Gracenotes> | oh, I see. |
| 11:08:22 | <doserj> | ivanm: yes |
| 11:08:48 | <Gracenotes> | here |
| 11:08:50 | <ivanm> | since it's easier to catch IOException rather than an error? |
| 11:08:50 | <Gracenotes> | readIO s = case (do { (x,t) <- reads s; ("","") <- lex t; return x }) of { [x] -> return x; [] -> ioError (userError "Prelude.readIO: no parse"); _ -> ioError (userError "Prelude.readIO: ambiguous parse") } |
| 11:09:08 | <Gracenotes> | from System.IO |
| 11:09:13 | <ivanm> | hmmm.... |
| 11:09:15 | <ivanm> | @type lex |
| 11:09:17 | <ivanm> | @src lex |
| 11:09:17 | <lambdabot> | String -> [(String, String)] |
| 11:09:18 | <lambdabot> | Source not found. I feel much better now. |
| 11:09:38 | <ivanm> | what's lex? |
| 11:09:45 | <ivanm> | > lex "1234" |
| 11:09:46 | <doserj> | ivanm: yes. you can't catch error in Haskell98 |
| 11:09:47 | <lambdabot> | [("1234","")] |
| 11:09:50 | <Gracenotes> | ivanm: catching of native errors always occurs in the IO monad. So may as well throw in the IO monad |
| 11:09:56 | <Gracenotes> | me guesses |
| 11:09:58 | <ivanm> | > lex "Maybe 1234" |
| 11:10:00 | <lambdabot> | [("Maybe"," 1234")] |
| 11:10:06 | <ivanm> | >_> |
| 11:10:12 | <Gracenotes> | ooooh... that's an interesting function |
| 11:10:21 | <Gracenotes> | > lex "Maybe!" |
| 11:10:22 | <lambdabot> | [("Maybe","!")] |
| 11:10:32 | <Gracenotes> | so that's how reading occurs like that |
| 11:10:38 | <ivanm> | but what does it actually _do_? |
| 11:11:14 | <ivanm> | since it isn't class based, how does it know which constructor to read? |
| 11:11:25 | <ivanm> | or does it split symbols from letters? |
| 11:11:33 | <ivanm> | > lex "1234Maybe" |
| 11:11:36 | <lambdabot> | [("1234","Maybe")] |
| 11:11:44 | <ivanm> | @index lex |
| 11:11:45 | <lambdabot> | Text.Read, Prelude, Text.Read.Lex |
| 11:12:22 | <doserj> | ivanm: it splits the input text into tokens, approximating Haskell syntax rules |
| 11:12:24 | <Baughn> | quicksilver: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5338#a5338 <-- While you're around, any idea how this code can (when running the finalizer for chan1w) get to state "croak", while the reader is at "wannaread", and the program then /deadlocks and exits/? |
| 11:12:35 | <Gracenotes> | ivanm: let is defined precisely in the prelude |
| 11:12:37 | <Gracenotes> | http://www.haskell.org/onlinereport/standard-prelude.html#sect8.2 |
| 11:12:38 | <ivanm> | doserj: *nod* |
| 11:12:42 | <ivanm> | Gracenotes: you mean lex? |
| 11:12:44 | <Gracenotes> | it's Haskell 98. that's how srs it is |
| 11:12:52 | <Baughn> | quicksilver: I mean, I've then got one thread doing a write to the Chan while another is reading, and somehow it deadlocks. |
| 11:12:52 | <ivanm> | "srs"? |
| 11:12:59 | <Gracenotes> | lex, right. Check out the link for the exact algorithm |
| 11:13:02 | <Gracenotes> | serious |
| 11:13:10 | <quicksilver> | Baughn: threaded or non-threaded rts? |
| 11:13:33 | <Baughn> | quicksilver: Both |
| 11:14:39 | <nopsled_X> | Newbie question: how would i use the function >> bind f' (gx,gs) = let (fx,fs) = f' gx in (fx,gs++fs) << ? |
| 11:15:11 | <nopsled_X> | exploring monads .. |
| 11:15:22 | <ivanm> | @hoogle bind |
| 11:15:23 | <lambdabot> | Distribution.Simple.InstallDirs bindir :: InstallDirs dir -> dir |
| 11:15:23 | <lambdabot> | Distribution.Simple.InstallDirs BindirVar :: PathTemplateVariable |
| 11:15:23 | <lambdabot> | Language.Haskell.TH.Syntax bindQ :: Q a -> (a -> Q b) -> Q b |
| 11:15:24 | <Gracenotes> | looks like bind for the Writer monad .. for lists |
| 11:16:01 | <nopsled_X> | Its from the article "you-could-have-invented-monads-and.html" |
| 11:16:34 | <Gracenotes> | to get the most out of the Writer monad, you need the "tell" function |
| 11:16:50 | <Gracenotes> | ..hm |
| 11:17:09 | <nopsled_X> | idea was from let (y,s) = g' x |
| 11:17:10 | <nopsled_X> | (z,t) = f' y in (z,s++t) |
| 11:17:17 | <nopsled_X> | define bind.. |
| 11:17:32 | <quicksilver> | Baughn: are you sure the main thread isn't just running out? what is keeping the main thread alive? just tryning to eliminate possibilities here |
| 11:18:24 | <Baughn> | quicksilver: I suppose.. here's the code for the main thread, so as you can see I'm pretty sure. http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5338#a5339 |
| 11:18:47 | <Gracenotes> | nopsled_X: the Writer monad lets you do normal operations with "gx" and "fx" |
| 11:19:16 | <nopsled_X> | Gracenotes: ok |
| 11:19:22 | <Baughn> | quicksilver: And just to make extra sure, I just switched it for print $ eFutures ev. That ought to finish by printing a ], not "test: thread blocked indefinitely". |
| 11:19:26 | <Gracenotes> | however, it has an extra parameter for a monoid |
| 11:19:28 | <Gracenotes> | in your case, a list |
| 11:19:41 | <quicksilver> | Baughn: I don't think addFinaliser works the way you think it does. |
| 11:19:48 | <Baughn> | quicksilver: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5338#a5340 <-- Here's the actual output |
| 11:19:50 | <Gracenotes> | so it's like you're working on two values at the same time: a normal value, and something else that accumulates |
| 11:20:24 | <Baughn> | quicksilver: I know it doesn't necessarily get called immediately, but as the output shows it /does/ get called. The finalizer is working, it's the finally code that isn't. |
| 11:20:26 | <nopsled_X> | haskells notion of state.. ? |
| 11:20:38 | <quicksilver> | Baughn: the finaliser is being called too early. |
| 11:20:44 | <quicksilver> | Baughn: which is always a risk with addFinaliser. |
| 11:20:52 | <quicksilver> | Baughn: that kills the thread. |
| 11:21:01 | <Gracenotes> | nopsled_X: sort of. The Writer monad is meant to extend the state -- aka write-only -- not necessarily read it |
| 11:21:02 | <quicksilver> | is my guess. |
| 11:21:20 | <Gracenotes> | or to modify it. (although these operations are supported, they're not commonly used) |
| 11:21:29 | <Gracenotes> | there is an actual State monad that is intended for this |
| 11:21:38 | <Baughn> | quicksilver: The finalizer is being called at exactly the right time, once the sink-calling thread exits |
| 11:21:57 | <Baughn> | quicksilver: Also, if it did get called too early the effect of the would be occurences going missing, not a deadlock |
| 11:22:00 | <EvilTerran> | nopsled_X, Writer is for things such as producing a log alongside the evaluation |
| 11:22:19 | <Gracenotes> | nopsled_X: I think http://book.realworldhaskell.org/read/monads.html#id640791 explains the Writer monad better |
| 11:22:33 | <Gracenotes> | It's actually a specific version of Writer -- for lists |
| 11:22:38 | <Gracenotes> | like you have there |
| 11:23:32 | <Gracenotes> | er. actually it's introduced in http://book.realworldhaskell.org/read/monads.html#monads.logger , but the implementation is in the first link |
| 11:23:43 | <Baughn> | quicksilver: Still. You can probably see what I'm trying to do here; if you have any better suggestions, I'm all ears. I've gone through about six revisions that all either called the finalizers too early or not at all. This one calls them correctly, but they then fail to work. : |
| 11:23:48 | <Baughn> | :/ |
| 11:24:00 | <quicksilver> | Baughn: My theory was, a finaliser being called too early would kill a blocked thread which then causes deadlock as there is nothing left to break it |
| 11:24:22 | <nopsled_X> | Gracenotes: thanks :-) |
| 11:24:38 | <Baughn> | quicksilver: The Chan programmers were smarter than that. It uses withMVar, etc. - things that carefully unlock the Chan if it gets aborted. |
| 11:25:07 | <quicksilver> | Baughn: yes, but that's not the point. |
| 11:25:09 | <Baughn> | quicksilver: Wait.. you may have something there |
| 11:25:12 | <quicksilver> | Baughn: if I kill the last possible reader |
| 11:25:18 | <quicksilver> | than any remaining writer is in deadlock |
| 11:25:21 | <quicksilver> | or vice-versa |
| 11:25:28 | <Baughn> | Oh, sure. The reader isn't killed |
| 11:25:48 | <Gracenotes> | nopsled_X: no problem. There are lots of resources out there :) If you need to look at the implementations for some common monads see Part II here http://www.haskell.org/all_about_monads/html/index.html |
| 11:26:13 | <osfameron> | don't most censorship regimes burn books rather than killing readers? |
| 11:26:22 | <nopsled_X> | Gracenotes: thanks :-) |
| 11:26:47 | <whoppix> | osfameron, yes, killing all the readers is somewhat impractical |
| 11:26:51 | <quicksilver> | Baughn: well in this specific case, a finaliser running early kills the last remaning writer to chan2 |
| 11:26:59 | <QtPlaty[HireMe]> | s |
| 11:27:11 | <quicksilver> | Baughn: which means the reads on chan2 are deadlock (i.e. the next time you look for an event occurence) |
| 11:27:32 | <Baughn> | quicksilver: Yes, that's what the finally clause is for |
| 11:27:47 | <Baughn> | quicksilver: The writer is supposed to put Nothing in the chan, which will make the reader bail out and stop reading |
| 11:28:42 | <quicksilver> | Baughn: I think you should put a print in the other finaliser too. |
| 11:30:05 | <quicksilver> | maybe the thread is getting killed twice |
| 11:30:12 | <quicksilver> | second kill arriving in the finally |
| 11:30:40 | <Baughn> | quicksilver: Exceptions are blocked in exception handlers. But if the reader gets killed.. |
| 11:31:04 | <quicksilver> | Baughn: not if the handler contains an unblock they aren't. |
| 11:31:10 | <quicksilver> | Baughn: and chan2w contains an unblock. |
| 11:31:16 | <Baughn> | ..the write |
| 11:33:40 | <Baughn> | quicksilver: You're right, the chan2r finalizer does get run. But why, when readOccurences is in the middle of calling it? |
| 11:34:06 | <quicksilver> | because addFinaliser doesn't mean what you think it means. |
| 11:34:28 | <quicksilver> | it adds a finaliser to what, for lack of a better word, I'll call a "box" |
| 11:34:46 | <quicksilver> | but you have no guarantee that all uses of chan2r actually use the "chan2r box" that the finaliser is attached to. |
| 11:34:59 | <quicksilver> | other uses of chan2r may happily have inlined some or all of that box. |
| 11:35:10 | <Baughn> | That is, admittedly, true |
| 11:35:22 | <Baughn> | But I don't see how I'm going to pull this off without finalizers |
| 11:35:23 | <quicksilver> | I'm pretty sure in your example all uses of chan2r will definitely be inlined |
| 11:35:33 | <quicksilver> | so I'd expect that finaliser to be eligible for running immediately |
| 11:35:34 | <Baughn> | Um.. let me explain in #ghc |
| 11:35:38 | <quicksilver> | (and, in practice, get run at the next GC) |
| 11:46:42 | <mib_13lje4t4> | hey what does this error mean "Instance of Num [Char] required for definition of mainMenu"? |
| 11:47:04 | <Zao> | mib_13lje4t4: Depends on what mainMenu is and how you were using it. |
| 11:47:14 | <mib_13lje4t4> | ok |
| 11:47:18 | <mib_13lje4t4> | ill hpaste |
| 11:48:25 | <Gracenotes> | mib_13lje4t4: it probably means that a [Char] was expected, but that a Num was inferred |
| 11:48:36 | <Gracenotes> | (Num being a typeclass makes the error a bit more cryptic) |
| 11:49:09 | <Gracenotes> | or it could mean the other way around, wrt expected/inferred... |
| 11:49:15 | <mib_13lje4t4> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5341#a5341 |
| 11:49:54 | <Gracenotes> | x is a string, and you're comparing it to 1 |
| 11:49:56 | <EvilTerran> | mib_13lje4t4, that error tends to mean that you're trying to use a number as a string, or vice-versa |
| 11:49:59 | <mib_13lje4t4> | ERROR file:.\FilmV3.hs:128 - Instance of Num [Char] required for definition of mainMenu |
| 11:50:08 | <Gracenotes> | that's a no-no >_> |
| 11:50:32 | <EvilTerran> | mib_13lje4t4, "Instance of Num [Char] required" means "I need [Char] to be a numeric type, but it isn't!" |
| 11:50:39 | <EvilTerran> | and [Char] = String |
| 11:50:46 | <Gracenotes> | actually, this was brought up earlier :) try readLn |
| 11:50:49 | <mib_13lje4t4> | ah ok |
| 11:50:49 | <Zao> | Isn't the else too far outdented? |
| 11:50:50 | <Gracenotes> | @type readLn |
| 11:50:52 | <lambdabot> | forall a. (Read a) => IO a |
| 11:51:02 | <mib_13lje4t4> | easier if i just call them A B C .... |
| 11:51:07 | <Gracenotes> | x <- readLn |
| 11:51:15 | <Gracenotes> | although you might need to specify the type of x |
| 11:51:52 | <mib_13lje4t4> | readLn sorted it |
| 11:51:55 | <mib_13lje4t4> | :) |
| 11:55:41 | <Baughn> | @type (>=>) |
| 11:55:42 | <lambdabot> | forall a (m :: * -> *) b c. (Monad m) => (a -> m b) -> (b -> m c) -> a -> m c |
| 11:56:29 | <Baughn> | @index (>=>) |
| 11:56:30 | <lambdabot> | bzzt |
| 11:56:40 | <Baughn> | @hoogle (>=>) |
| 11:56:40 | <lambdabot> | Control.Monad (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c |
| 12:02:58 | <EvilTerran> | mib_13lje4t4, the other possibility would be continuing to use getLine, and replacing the x == 1 with x == "1" |
| 12:07:14 | <ski> | > read " 1" :: Int |
| 12:07:16 | <lambdabot> | 1 |
| 12:10:39 | <Baughn> | ..now it's just taunting me. |
| 12:14:52 | <dancor_> | what would you do if you sent takusen a question and later answered it with a patch and neither maintainer ever responded |
| 12:15:05 | <dancor_> | forkusen? |
| 12:15:54 | <pejo> | Pingusen? |
| 12:16:18 | <dancor_> | mm |
| 12:16:40 | <povman> | Good Morning Everyone! |
| 12:17:50 | <lilac> | good early afternoon, povman |
| 12:17:51 | <dancor_> | gm |
| 12:18:09 | <ivanm> | povman: g'evening |
| 12:19:16 | <povman> | If I compile a program with GHC, can i call its 'main' from a c program without the FFI? |
| 12:19:18 | <quicksilver> | dancor_: haskel-cafusen |
| 12:19:32 | <dancor_> | what is the scope of haskell-cafe |
| 12:19:42 | <quicksilver> | stuff about haskell. |
| 12:19:47 | <EvilTerran> | ACTION is confusen |
| 12:19:49 | <dancor_> | is it a forum for revenge on maintainers |
| 12:19:55 | <quicksilver> | sure, among other things. |
| 12:20:07 | <quicksilver> | there are was of saying things, though. |
| 12:20:28 | <ivanm> | dancor_: maintainers of what? |
| 12:20:29 | <quicksilver> | You can say something like "here is a patch I find useful with takusen, here is a place you can download it from, does anybody have any comments" ? |
| 12:21:44 | <mib_13lje4t4> | hey is there a function that outputs a list rather than a string? |
| 12:22:23 | <povman> | mib_13lje4t4: That is a very vague question, but here's one: f = [] |
| 12:22:24 | <EvilTerran> | mib_13lje4t4, er, a string is a list |
| 12:22:30 | <EvilTerran> | ?src String |
| 12:22:31 | <lambdabot> | type String = [Char] |
| 12:23:01 | <b_jonas> | > ['s','t','r','i','n','g'] |
| 12:23:02 | <lambdabot> | "string" |
| 12:23:19 | <mib_13lje4t4> | im trying to out put a list of tuples though |
| 12:23:22 | <b_jonas> | (unlike in standard ml where a string is an iarray of chars) |
| 12:23:29 | <EvilTerran> | > map toUpper "abracadabra" |
| 12:23:30 | <lambdabot> | "ABRACADABRA" |
| 12:24:04 | <ivanm> | b_jonas: after all, if C does it then it _must_ be a good idea! :p |
| 12:24:50 | <quicksilver> | mib_13lje4t4: you can "show" most combinations of built in types. |
| 12:25:02 | <quicksilver> | > show [(1,3),(3,4)] |
| 12:25:04 | <lambdabot> | "[(1,3),(3,4)]" |
| 12:25:13 | <EvilTerran> | ?type print |
| 12:25:15 | <quicksilver> | mib_13lje4t4: so you can show it and then putStrLn it |
| 12:25:15 | <lambdabot> | forall a. (Show a) => a -> IO () |
| 12:25:21 | <EvilTerran> | ?src print |
| 12:25:22 | <lambdabot> | print x = putStrLn (show x) |
| 12:25:58 | <povman> | If I compile a program with GHC, can i call its 'main' from a c program without the FFI? |
| 12:26:32 | <EvilTerran> | fork() and exec()? |
| 12:26:52 | <povman> | I mean a direct function call |
| 12:27:06 | <quicksilver> | no. |
| 12:27:28 | <quicksilver> | You'll need to set up the haskell RTS and stuff. |
| 12:27:29 | <mib_13lje4t4> | quicksilver would deriving (Show) be put in the function that is returning the list? |
| 12:27:36 | <quicksilver> | mib_13lje4t4: no. |
| 12:27:54 | <quicksilver> | mib_13lje4t4: most built in types and combinations of them are already instances of Show, in fact. |
| 12:28:02 | <b_jonas> | povman: do you mean http://www.haskell.org/ghc/docs/latest/html/users_guide/ffi-ghc.html ? |
| 12:28:12 | <povman> | If i have main(){hs_init(...); CALL_HS_MAIN(); hs_exit(); return 0;} |
| 12:28:38 | <mib_13lje4t4> | sooo... putStrLn show [a]? |
| 12:28:42 | <povman> | b_jonas: I want a C program that runs a haskell program without the haskell author needing to know |
| 12:29:05 | <b_jonas> | povman: I think you need to export functions with ffi |
| 12:29:29 | <povman> | There isn't a consistent symbol for main? |
| 12:29:36 | <Cale> | povman: Wrap hs_init and hs_exit in something and tell the person writing the C program to call that :) |
| 12:30:25 | <povman> | Cale: I'm writing the C program, I want it to call hs main as a function, without hs main being ffi exported |
| 12:31:00 | <Cale> | povman: Oh, I see what you mean. |
| 12:31:10 | <b_jonas> | povman: what if you write a haskell function in another module that just calls main, and export that? |
| 12:31:13 | <povman> | I was hoping there'd be a single entry point which i could point at |
| 12:31:43 | <povman> | b_jonas: That requires the 'other module' to know what the main module is :( |
| 12:31:55 | <povman> | i'm so bad at linker |
| 12:34:19 | <lilac> | povman: you could possibly dlopen the haskell binary and use dlsym to find the GHC RTS entry point |
| 12:35:01 | <povman> | lilac: Curious.. |
| 12:36:03 | <lilac> | why can't you just fork and exec? |
| 12:38:15 | <povman> | lilac: I fear that might not work. I'm fixing the SDL binding |
| 12:41:09 | <codebliss> | Hello. I'm working on a ripoff of the Maybe monad for practice. Here's my code, I have an error. More information in the pastebin =D http://pastebin.com/m5a48adf1 |
| 12:41:27 | <codebliss> | I'm still trying to get used to this type mania |
| 12:41:49 | <povman> | Your names are totally rad, dude |
| 12:42:16 | <codebliss> | hahahaha XD |
| 12:42:25 | <mux> | codebliss: you need a "| otherwise = ..." in the second case |
| 12:42:29 | <mux> | since you're using pattern guards |
| 12:42:31 | <codebliss> | Okay |
| 12:42:42 | <codebliss> | >liftM2 (+) (Totally 5) (Totally 29) |
| 12:42:44 | <codebliss> | Totally 34 |
| 12:42:48 | <codebliss> | hahaha XD |
| 12:42:53 | <ski> | Totally x >>= f = f x |
| 12:42:54 | <povman> | I'm being completely weirded out by the (//) - why parentheses? |
| 12:42:59 | <ski> | a // b | b == 0 = Null |
| 12:43:04 | <codebliss> | Oh ya, you don't need it there |
| 12:43:11 | <ski> | Totally a // Totally b = Totally (a / b) |
| 12:43:11 | <codebliss> | *facepalm* |
| 12:43:16 | <mux> | povman: those seem weird indeed, parenthesis are used around operators to use them in prefix form |
| 12:43:30 | <codebliss> | Understood, I have no idea why I did that |
| 12:43:33 | <lilac> | codebliss: the | b == 0 is wrong too |
| 12:43:42 | <povman> | Yes, i read that as (//) a pattern argument of (Totally a) |
| 12:43:47 | <lilac> | codebliss: since b is a Possibly t for some t |
| 12:44:00 | <mux> | right |
| 12:44:04 | <lilac> | (and not a Num instance) |
| 12:44:11 | <lilac> | (and not an Eq instance either) |
| 12:44:19 | <mux> | missed that one; should be a // (Totally b) | b == 0 = ... |
| 12:44:21 | <codebliss> | _ // (Totally b) | b == 0 = Null |
| 12:44:26 | <codebliss> | Got it |
| 12:44:32 | <codebliss> | Understood thank you =D |
| 12:44:45 | <ski> | no brackets needed around `Totally b' |
| 12:44:45 | <doserj> | you can just write _ // (Totally 0) = Null |
| 12:44:53 | <lilac> | codebliss: you'll also need a // Null case |
| 12:45:09 | <codebliss> | Roger, thank you very much all of you |
| 12:45:19 | <codebliss> | That...is a very good idea |
| 12:45:30 | <lilac> | codebliss: you might want to consider adding Eq to your deriving clause |
| 12:45:37 | <byorgey> | codebliss: what type do you want // to have? I would have thought something like Double -> Double -> Possibly Double |
| 12:45:39 | <lilac> | then you can say 'a // b | b = Totally 0 = Null' |
| 12:45:53 | <byorgey> | but looks like you have Possibly Double -> Possibly Double -> Possibly Double |
| 12:46:05 | <lilac> | s/b =/b ==/ |
| 12:46:06 | <codebliss> | OH |
| 12:46:08 | <codebliss> | I gotcha |
| 12:46:12 | <codebliss> | byorgey: Thanks |
| 12:46:32 | <codebliss> | I just wanted Num a => a -> a -> Possibly a |
| 12:46:36 | <byorgey> | right |
| 12:46:58 | <byorgey> | well, Num won't work, but Fractional will |
| 12:47:00 | <codebliss> | I need to wake up, lol. Thanks again all |
| 12:47:07 | <codebliss> | *refacepalm* |
| 12:47:17 | <byorgey> | hehe |
| 12:49:05 | <lilac> | you could also make a Num a => Num (Possibly a) instance... |
| 12:49:11 | <codebliss> | *Main> 5 // 0 |
| 12:49:11 | <codebliss> | Null |
| 12:49:11 | <codebliss> | *Main> 5 // 3 |
| 12:49:11 | <codebliss> | Totally 1.6666666666666667 |
| 12:49:12 | <codebliss> | Thank you |
| 12:49:22 | <lilac> | depending on whether you want to work in the monadic style or the numeric style |
| 12:49:33 | <povman> | I think in this case, facepalming is good for you |
| 12:49:48 | <codebliss> | Facepalming helps the blood in my brain =P |
| 12:49:59 | <lilac> | don't worry if your head hurts, it's just your brain getting bigger |
| 12:50:09 | <lilac> | ;-D |
| 12:50:13 | <codebliss> | =D. Damn haskell making me think, it's addicting! |
| 12:50:34 | <codebliss> | I still laugh at (,) being a function. That's just too awesome |
| 12:51:25 | <codebliss> | Okay not literally, but I love pure fprogramming |
| 12:52:13 | <povman> | Ok, i've got my wrapper down to a single foreign export ccall "hs_main" main :: IO () |
| 12:53:25 | <quicksilver> | it's sometimes bad for your keyboard. |
| 12:57:00 | <McManiaC> | what do i need to use "foreign import ..." ? i always get "parse error on import" |
| 12:57:39 | <EvilTerran> | {-# LANGUAGE ForeignFunctionInterface #-} |
| 12:57:40 | <EvilTerran> | iirc |
| 12:57:54 | <povman> | that is correct |
| 12:58:40 | <McManiaC> | ok thx! |
| 13:08:25 | <povman> | YESSSSS!!!!! VICTOLY! I feel so dirty, yet so clean. |
| 13:09:06 | <povman> | It should now be possible for haskell people to write cross platform SDL programs without all this C nonsense |
| 13:09:06 | <Saizan> | ? |
| 13:09:14 | <byorgey> | ACTION high-fives povman |
| 13:09:22 | <povman> | it's disgusting |
| 13:09:33 | <povman> | I'd better make sure it's portable |
| 13:09:41 | <byorgey> | povman: how did you get around the external-main thing? |
| 13:09:47 | <liyang> | povman: BIKUTORI, shurely. |
| 13:10:34 | <povman> | http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2514#a2514 |
| 13:12:02 | <Baughn> | povman: It would be easier if SDL didn't do so many disgusting hacks |
| 13:12:12 | <povman> | Baughn: so true. |
| 13:12:26 | <povman> | They want their C interface to be the same everywhere though, which is reasonable |
| 13:12:47 | <Baughn> | povman: They could do it some other way |
| 13:13:34 | <povman> | well. Maybe. The #sdl people didn't much like my suggestion to delete the #define main SDL_main |
| 13:14:46 | <povman> | this is making me wet |
| 13:15:59 | <povman> | I think i'm going to cry of happiness |
| 13:22:18 | <cnwdup> | @seen dons |
| 13:22:18 | <lambdabot> | dons is in #haskell-in-depth, #concatenative, #arch-haskell, #darcs, #yi, #xmonad, #ghc and #haskell. I last heard dons speak 12h 34m 49s ago. |
| 13:24:59 | <povman> | @seen Lemmih |
| 13:25:00 | <lambdabot> | Lemmih is in #haskell. I last heard Lemmih speak 4h 23m 44s ago. |
| 13:33:43 | <fasta> | Is there some file API which replaces ~ by the home dir? Preferably something which also works on $PLATFORM. |
| 13:34:47 | <quicksilver> | I doubt it. |
| 13:35:40 | <earthy> | not that I know of |
| 13:35:43 | <Absolute0> | Do I need to use monads to change a state of some object? |
| 13:36:28 | <Absolute0> | Say I have a map and I want to change the key of that map |
| 13:36:37 | <Absolute0> | doing that in function results in nothing |
| 13:36:45 | <kpreid> | Absolute0: It depends on what you mean by change, really :-) |
| 13:36:49 | <Absolute0> | *key of an item in the map |
| 13:36:50 | <doserj> | there are no objects in haskell, and you don't change state in haskell :) |
| 13:36:55 | <fasta> | Absolute0: you cannot actually change anything, but you can use monads to achieve something similar. |
| 13:37:01 | <kpreid> | Absolute0: You have two options ... |
| 13:37:17 | <Saizan> | Absolute0: you usually just return a updated map and use that from then on |
| 13:37:17 | <Absolute0> | in ghci you just call the functions and it does the job |
| 13:37:19 | <kpreid> | You can write a routine to take a value and return a modified value |
| 13:37:21 | <earthy> | fasta: however, there is System.Directory.getHomeDirectory |
| 13:37:38 | <kpreid> | Or you can use some monad with references such as ST, STM or, if you must, IO |
| 13:37:41 | <earthy> | and System.Directory.getUserDocumentsDirectory |
| 13:37:47 | <fasta> | earthy: yes, I already wrote my own version based on that. |
| 13:37:58 | <Absolute0> | let me play with it some more |
| 13:38:02 | <kpreid> | It is generally better to use the 'return modified' approach as it is more flexible |
| 13:38:16 | <Absolute0> | is there a concept of pass by value/reference in haskell? |
| 13:38:26 | <earthy> | yes. |
| 13:38:31 | <kpreid> | No. You always pass values by reference... |
| 13:38:32 | <earthy> | everything is passed by valuw |
| 13:38:36 | <earthy> | value |
| 13:38:42 | <Axman6> | heh |
| 13:38:51 | <fasta> | Absolute0: everything is pass by value, ST/IO can be used for references. |
| 13:38:52 | <earthy> | even references are passed by value. :) |
| 13:39:01 | <kpreid> | Er, right, I got that backwards |
| 13:39:11 | <b_jonas> | fasta: try http://erxz.com/pb/17862 |
| 13:39:13 | <kpreid> | If you have one thing which a complex program wants to modify repeatedly, consider using the State monad (which is just a decorative wrapper around passing the value) |
| 13:39:17 | <quicksilver> | well, at the level of implementation, everything is indeed passed by reference. |
| 13:39:18 | <Absolute0> | and things are accessed by pointers like in java? |
| 13:39:23 | <Absolute0> | ie references |
| 13:39:26 | <quicksilver> | (so you can assuming that no copying takes place - passing is fast) |
| 13:39:31 | <opqdonut> | value and reference are really the same in a referentially transparent language :) |
| 13:39:32 | <Absolute0> | right |
| 13:39:33 | <kpreid> | Absolute0: That distinction doesn't make sense in Haskell. |
| 13:39:37 | <opqdonut> | indeed |
| 13:39:40 | <quicksilver> | however at the level of semantics everything is passed by value |
| 13:39:40 | <earthy> | ACTION nods |
| 13:39:50 | <quicksilver> | if you can't modify a reference, it doesn't matter :) |
| 13:39:51 | <fasta> | b_jonas: I wrote something similar, but based on getHomeDirectory. I will just keep it that way. |
| 13:39:55 | <kpreid> | Absolute0: Since there is no mutation (outside of the reified stuff in IO/ST/...) there is no difference between pass-by-* |
| 13:39:59 | <Absolute0> | quicksilver: copying large objects is slow.. |
| 13:40:01 | <lilac> | fasta: there's something in libtcl which does ~-expansion, and libtcl is probably available on $PLATFORM... |
| 13:40:06 | <kpreid> | Absolute0: so you don't copy |
| 13:40:06 | <quicksilver> | Absolute0: indeed. and they are not copied. |
| 13:40:13 | <lilac> | fasta: admittedly that's probably not a very helpful answer, but... |
| 13:40:17 | <quicksilver> | Absolute0: since everything is immutable there is no need to copy. |
| 13:40:20 | <WorkyBob> | Absolute0: clever implementations don't copy things ;) |
| 13:40:26 | <earthy> | unless you generate a new value out of the old value... |
| 13:40:29 | <earthy> | reusing parts of it |
| 13:40:38 | <kpreid> | > let x = [1,2,3] in (0:tail x) -- I did not copy x, but I produced a modified version of it |
| 13:40:40 | <earthy> | then those parts *may* get copied... |
| 13:40:42 | <lambdabot> | [0,2,3] |
| 13:40:43 | <fasta> | WorkyBob: too bad there are no smart implementations :) |
| 13:40:58 | <earthy> | ofcourse, there's also the copying garbage collector which copies things regularly anyway |
| 13:41:06 | <earthy> | but that's another matter entirely ;) |
| 13:41:17 | <Absolute0> | let me just see what Data.Map.insert returns :) that will solve all my problems |
| 13:41:23 | <lilac> | b_jonas: that doesn't work for ~foo/... :-/ |
| 13:41:25 | <kpreid> | :t Data.Map.insert |
| 13:41:28 | <lambdabot> | forall k a. (Ord k) => k -> a -> M.Map k a -> M.Map k a |
| 13:41:46 | <Absolute0> | it returns the modified map.. |
| 13:41:47 | <Absolute0> | ok |
| 13:41:53 | <fasta> | lilac: it should not work for that input. |
| 13:41:58 | <kpreid> | > M.insert "a" "b" (M.empty) |
| 13:41:59 | <lambdabot> | fromList [("a","b")] |
| 13:42:04 | <b_jonas> | lilac: yup |
| 13:42:10 | <lilac> | fasta: ~foo/ should mean foo's home dir |
| 13:42:12 | <b_jonas> | lilac: also not for ~+ and ~- and ~1 and stuff |
| 13:42:23 | <lilac> | b_jonas: what do those do? :) |
| 13:42:48 | <fasta> | lilac: oh, I didn't know that. |
| 13:42:57 | <fasta> | lilac: what's the point of doing that? |
| 13:43:07 | <quicksilver> | historically, ~-expansion is a feature of the shell not, for example, the filesystem or the c library |
| 13:43:07 | <b_jonas> | lilac: ~+ is bashism for the current directory, ~- is the OLDPWD env-var which cd sets to the old directory when you change, ~1 and ~2 and ~+1 etc are the directory stack (dirs, pushd, popd) thing |
| 13:43:08 | <lilac> | fasta: it's mandated by POSIX iirc |
| 13:43:10 | <Absolute0> | also what is the best way for parsing/tokenizing strings in haskell? |
| 13:43:12 | <quicksilver> | thus is varies from shell to shell |
| 13:43:14 | <b_jonas> | they're useful in the shell line often |
| 13:43:29 | <WorkyBob> | Absolute0: depends on how complex the parsing you want to do is |
| 13:43:52 | <WorkyBob> | one of happy/parsec/manually writing a parser usually though |
| 13:44:10 | <Absolute0> | I have a string "(a,1) -> (b,2)" and i need to convert them to the tuples: ('a', 1) and ('b',2) |
| 13:44:19 | <WorkyBob> | oh, manually then |
| 13:44:29 | <yowgi> | i find that with happy there can be a lot of repetitions between types and the grammar |
| 13:44:41 | <WorkyBob> | read . takeWhile (/= ' ') -- first tuple |
| 13:44:47 | <Absolute0> | happy is a library? |
| 13:44:58 | <earthy> | happy is a parser generator |
| 13:44:59 | <thoughtpolice> | Absolute0: happy is a parser generator, like gnu bison |
| 13:45:02 | <WorkyBob> | read . dropWhile (/='(') . tail -- second tuple |
| 13:45:07 | <earthy> | (or antlr) |
| 13:45:19 | <earthy> | parsec in applicative style is quite nice though as well |
| 13:46:06 | <Absolute0> | WorkyBob: the tuple should be (Char, Int) not just another string. |
| 13:46:11 | <Absolute0> | ok i can play with it.. |
| 13:46:16 | <WorkyBob> | Absolute0: that's what read does |
| 13:46:19 | <WorkyBob> | @type read |
| 13:46:21 | <lambdabot> | forall a. (Read a) => String -> a |
| 13:46:21 | <Absolute0> | ah |
| 13:46:27 | <Absolute0> | cool |
| 13:46:28 | <Absolute0> | :) |
| 13:46:31 | <WorkyBob> | > read "(5, \"jam\")" |
| 13:46:33 | <lambdabot> | * Exception: Prelude.read: no parse |
| 13:46:42 | <WorkyBob> | > read "(5, \"jam\")" :: (Int, String) |
| 13:46:43 | <lambdabot> | (5,"jam") |
| 13:46:58 | <earthy> | does require quotes though |
| 13:47:08 | <earthy> | > read "(5, a)" :: (Int,Char) |
| 13:47:10 | <lambdabot> | * Exception: Prelude.read: no parse |
| 13:47:35 | <WorkyBob> | oh okay then, you want a little custom character reading function then |
| 13:47:45 | <kpreid> | > read "(5, a)" :: (Int,Expr) -- probably not what you want |
| 13:47:46 | <lambdabot> | No instance for (GHC.Read.Read SimpleReflect.Expr) |
| 13:47:46 | <lambdabot> | arising from a use of... |
| 13:47:50 | <kpreid> | (even if it worked) |
| 13:48:10 | <Absolute0> | read "('a',5)"::(Char, Int) |
| 13:48:11 | <Absolute0> | ('a',5) |
| 13:48:12 | <Absolute0> | :) |
| 13:48:15 | <WorkyBob> | > read "(5, 'a')" :: (Int, Char) |
| 13:48:16 | <lambdabot> | (5,'a') |
| 13:48:16 | <Absolute0> | works just fine |
| 13:48:26 | <WorkyBob> | Absolute0: sure, but not if you don't include the quotes |
| 13:48:27 | <earthy> | as I said, requires quotes :) |
| 13:49:16 | <Absolute0> | oh sorry I missed the quotes in my question. |
| 13:49:23 | <Absolute0> | I can make the user enter them in. :-P |
| 13:49:27 | <WorkyBob> | :) |
| 13:49:32 | <Absolute0> | I'll probably be the only user anyways |
| 13:49:36 | <Absolute0> | i can take it |
| 13:50:05 | <WorkyBob> | if you want to do something more permissive that lets you include spaces in the tuple etc, you'll need a little bit more preprocessing than I did, but *shrug* |
| 13:50:12 | <lilac> | b_jonas: interesting. so "cd -" is really just shorthand for "cd ~-" then? :) |
| 13:50:21 | <WorkyBob> | takeWhile (/=')') and append the close paren might work nicely |
| 13:50:28 | <b_jonas> | lilac: yes, they're the same |
| 13:50:37 | <b_jonas> | mostly |
| 13:51:43 | <hackagebot> | linear-maps 0.6.1 |
| 13:52:55 | <Absolute0> | doesn't Data.Map.delete violate the haskell philosophy? |
| 13:53:01 | <Absolute0> | or insert |
| 13:53:02 | <WorkyBob> | nope |
| 13:53:06 | <WorkyBob> | you get a new map back |
| 13:53:08 | <Absolute0> | the result is different each time |
| 13:53:09 | <WorkyBob> | with the value deleted |
| 13:53:15 | <WorkyBob> | hmm? show me an input |
| 13:53:21 | <WorkyBob> | for which I can call it multiple times |
| 13:53:24 | <Zao> | Absolute0: Given a certain input, it gives the same output. |
| 13:53:24 | <WorkyBob> | and get different results |
| 13:53:25 | <EvilTerran> | the old map stays the same |
| 13:53:31 | <Absolute0> | oh :) |
| 13:53:32 | <Absolute0> | ok |
| 13:53:39 | <opqdonut> | of course those operations are implemented efficiently so the input and the output share as much as possible |
| 13:53:41 | <Absolute0> | still getting used to it.. |
| 13:53:53 | <fasta> | Absolute0: also, it is not a Haskell philosophy. All this stuff comes from the 70's and was in fact more advanced back then. |
| 13:54:14 | <fasta> | Absolute0: this just had a different name for these kind of structures. |
| 13:54:20 | <WorkyBob> | fasta: sure it is |
| 13:54:28 | <opqdonut> | yeah, persistent data structures |
| 13:54:29 | <WorkyBob> | just like "give the user access to the machine" is the C philosophy |
| 13:54:33 | <fasta> | opqdonut: right |
| 13:54:42 | <opqdonut> | some really good papers back there |
| 13:54:45 | <WorkyBob> | it having been done before doesn't make it any less the haskell philosophy |
| 13:55:11 | <opqdonut> | the haskell philosophy is "support abstraction with types", not "purity" :) |
| 13:55:12 | <opqdonut> | imo |
| 13:55:21 | <WorkyBob> | depends who you ask |
| 13:55:22 | <Absolute0> | It's cool how the Data.Map doc's print the actuall order complexity. |
| 13:55:27 | <WorkyBob> | perhaps that's the great thing about Haskell |
| 13:55:34 | <WorkyBob> | different people can get totally different things from it |
| 13:55:34 | <Absolute0> | haskell duded care about effeciency. |
| 13:55:40 | <Absolute0> | dudes |
| 13:55:51 | <b_jonas> | well, the Data.Map is written in pure haskell with no unsafe functions or anything like that, so its functions must be safe |
| 13:56:32 | <lilac> | where "safe" == referentially transparent |
| 13:56:41 | <fasta> | Absolute0: some do, but not all. |
| 13:56:53 | <WorkyBob> | most care about complexity |
| 13:57:03 | <WorkyBob> | few care about number-of-machine-operations type efficiency |
| 13:57:10 | <Axman6> | ACTION cares |
| 13:57:15 | <mercury^> | Unfortunately. :( |
| 13:57:39 | <lilac> | most care about complexity, but not always computational complexity. sometimes code complexity is more important ;-) |
| 13:57:46 | <WorkyBob> | indeed |
| 13:58:16 | <lilac> | fwiw, i sometimes care about number-of-machine-operations type efficiency, and number-of-bytes-of-memory efficiency... |
| 13:58:28 | <opqdonut> | type-efficiency ;) |
| 13:58:37 | <lilac> | heh |
| 13:58:58 | <opqdonut> | "this code type-checks in under 30 unifications!" |
| 13:59:00 | <WorkyBob> | I care that my entire program is efficient... meaning that GHC's already run it in the type system when I compile it |
| 13:59:01 | <WorkyBob> | >.< |
| 13:59:24 | <lilac> | WorkyBob: doesn't that make your development process less efficient? :) |
| 13:59:28 | <WorkyBob> | hehe |
| 13:59:44 | <fasta> | The whole of CS is about number-of-machine operations in some way. If it isn't, then CS has no right to exist anymore. |
| 14:00:01 | <opqdonut> | CS is about computability |
| 14:00:42 | <opqdonut> | efficiency of computation is just a subfield |
| 14:00:46 | <fasta> | opqdonut: ok, maybe I meant the algorithmic part of CS> |
| 14:01:43 | <fasta> | And, the next interesting thing someone might say about computability will have to be someone with a degree in physics. |
| 14:02:40 | <opqdonut> | are you referring to quantum computers? their theoretical properties are pretty well known |
| 14:02:41 | <opqdonut> | BQP and all |
| 14:02:49 | <fasta> | opqdonut: no, I was not referring to quantum computers. |
| 14:02:57 | <opqdonut> | ok |
| 14:03:10 | <fasta> | opqdonut: I was referring to something which might invalidate the Church-Turing thesis. |
| 14:03:25 | <opqdonut> | that'd be cool |
| 14:03:44 | <fasta> | opqdonut: there is a guy who wrote about using quantum computers to do so. |
| 14:03:54 | <opqdonut> | somehow cs is just a very convoluted branch of constructive mathematics ;) |
| 14:04:03 | <opqdonut> | fasta: do you have a link? |
| 14:04:26 | <fasta> | opqdonut: http://adsabs.harvard.edu/abs/2006cs.......10114T |
| 14:04:41 | <opqdonut> | nice periods |
| 14:05:41 | <fasta> | opqdonut: unfortunately, I was not able to follow it in detail, but that the Church-Turing thesis might not be true, is something which would not surprise me a lot. |
| 14:06:25 | <Axman6> | hmm, CS needs laws |
| 14:06:46 | <Axman6> | all good sciences have laws, and they make things easier |
| 14:07:00 | <lilac> | fasta: how do you mean, might not be true? |
| 14:07:06 | <Axman6> | V = IR etc |
| 14:07:13 | <lilac> | it doesn't apply in general, only to a certain number of proven cases, right? |
| 14:07:20 | <fasta> | Axman6: V=IR is a great simplification. |
| 14:07:39 | <lilac> | fasta: isn't it the definition of resistance? |
| 14:08:42 | <fasta> | lilac: yes, I was thinking of something else. |
| 14:09:21 | <fasta> | lilac: I mean that you can in fact compute incomputable objects. |
| 14:10:03 | <lilac> | fasta: you're right though; V=IR is a great simplification if you assume that R is constant |
| 14:10:43 | <mercury^> | What is V=IR? |
| 14:10:43 | <lilac> | in reality it's a function of temperature and a bunch of other effects, some of which will indirectly depend on V... |
| 14:10:52 | <lilac> | mercury^: Ohm's law |
| 14:11:38 | <fasta> | lilac: and of course temperature is also a model |
| 14:11:55 | <purplefistmixer> | perhaps the laws of thermodynamics would be a better one to take |
| 14:12:31 | <fasta> | "Laws" also stiffle innovation, in case they are wrong. |
| 14:13:01 | <lilac> | fasta: absolutely. how many physicists have you heard discount theories because they would allow information to travel faster than the speed of light? |
| 14:13:32 | <fasta> | lilac: a few, but I am not a physicist. |
| 14:14:08 | <jmcarthur_work> | laws in science are different from laws in mathematics |
| 14:14:11 | <ksf> | what's Mondad (->a)? eval/apply? |
| 14:14:28 | <Absolute0> | I have 2 modules that each require the other to function, how can I prevent cycle imports? |
| 14:14:32 | <lilac> | ksf: you mean Monad (->) a? |
| 14:14:34 | <jmcarthur_work> | mathematical laws are only ever really accepted if they are proven, something which you con't even begin to do in science |
| 14:14:38 | <ksf> | lilac, yes. |
| 14:14:48 | <lilac> | ksf: that's the Reader monad with no clothes on |
| 14:14:54 | <quicksilver> | jmcarthur_work: well you can prove scientific laws, based on other assumptions. |
| 14:15:04 | <quicksilver> | jmcarthur_work: that's not all that different from mathematical laws |
| 14:15:06 | <ksf> | There's no laws, unless you choose to invent them. |
| 14:15:09 | <quicksilver> | but this is pretty off-topic :) |
| 14:15:12 | <jmcarthur_work> | quicksilver, sure, but then it's only sensible to include those assumptions with the law |
| 14:15:27 | <jmcarthur_work> | which is often left out of the law as it is usually cited |
| 14:15:29 | <fasta> | jmcarthur_work: and what constitutes a proof? |
| 14:15:49 | <hackagebot> | terrahs 0.6 |
| 14:15:52 | <EvilTerran> | Absolute0, the ghc manual has a bit on dealing with circular imports |
| 14:15:57 | <ksf> | There can be no proof, only applicability of a model in a certain domain. |
| 14:16:16 | <ksf> | look at, e.g., newtonian mechanics. |
| 14:16:23 | <fasta> | jmcarthur_work: there is no ultimate truth. Everything is relative to something else and bottoms out at turtles. |
| 14:16:27 | <Absolute0> | EvilTerran: i moved the dependent part into the other modules :) |
| 14:16:35 | <Absolute0> | fixed. |
| 14:16:37 | <ksf> | to say that the next big theory is more true is merely being blindly arrogant. |
| 14:16:41 | <jmcarthur_work> | my point is that mathematical laws are generally given with their assumptions and can be verified based on those assumptions. scientific laws, not so much |
| 14:16:47 | <jmcarthur_work> | i'm not claiming absolute truth |
| 14:16:48 | <lilac> | ksf: couldn't you equally say, there are no proofs in mathematics, only applicability of a certain line of reasoning in a given model of logic with a certain set of axioms? |
| 14:17:00 | <jmcarthur_work> | math is not reality anyway |
| 14:17:03 | <Absolute0> | math/physics who cares go get a girlfriend :) |
| 14:17:05 | <ksf> | lilac, I could'nt have said it better. |
| 14:17:23 | <jmcarthur_work> | i think we are in agreement, just with different words |
| 14:17:40 | <lilac> | ksf: of course, that leads to the question of, how do you know your line of reasoning is valid? we only think that first-order logic is valid because we've not found it to be inconsistent |
| 14:17:57 | <lilac> | and that's really the same as the argument for quantum mechanics |
| 14:18:01 | <jeff_s_> | Completeness Theorem |
| 14:18:15 | <ksf> | it's valid if you get something useful done. |
| 14:18:15 | <jeff_s_> | first order logic is stronger than you're saying |
| 14:18:40 | <lilac> | jeff_s_: all that proves is that it's at least as consistent as some other system in which you're showing it to be consistent |
| 14:19:00 | <jmcarthur_work> | that's all that math is |
| 14:19:01 | <ksf> | consistency is nice, but not a total requirement... you can use a program for ages and make millions before it segfaults for the first time. |
| 14:19:17 | <Saizan> | nah, physical laws have only passed enough iterations of QuickCheck, while mathematical "laws" (do we mean theorems?) have a proof |
| 14:19:38 | <jeff_s_> | ksf - do you know about the Completeness Theorem? |
| 14:19:43 | <Saizan> | the proof is only as good as the reviewers, though :) |
| 14:19:43 | <lilac> | Saizan: the logic on which mathematical laws are based have only passed enough iterations of QuickCheck. |
| 14:20:12 | <ksf> | jeff_s_, yes, though I don't claim to have any more than an intuitive understanding of the proof. |
| 14:20:15 | <jmcarthur_work> | lilac, i don't understand that. logic is an invention, not a natural phenomenon |
| 14:20:40 | <Saizan> | lilac: even if the logic is inconsistent the theorem is still valid |
| 14:20:54 | <lilac> | jmcarthur_work: my point is this: we want our logic to be consistent. we can't prove it is, because that would require the pre-existence of a known consistent logic. |
| 14:20:54 | <jeff_s_> | then you might want to read about it more before trying to convince people that first order logic is so weak |
| 14:21:08 | <jmcarthur_work> | lilac, that's true, but i don't think it's useful |
| 14:21:29 | <yottis> | my firends the philosophers seem to think that one can reach certainty, but i think they trust themselves a bit too much, or as usual, have redefined terms such as "reality" to better suit their needs |
| 14:21:44 | <jmcarthur_work> | logic, at least in the way i think you are using the word, is the *definition* of consistency |
| 14:21:48 | <ksf> | I'm not trying to tell people anything about fo logic... |
| 14:22:10 | <jeff_s_> | sorry I meant to talk to lilac >< |
| 14:22:33 | <lilac> | jeff_s_: when did i say first order logic was weak? |
| 14:22:45 | <ksf> | psychologically speaking, there's a wide gap between certainty and truth. |
| 14:22:52 | <lilac> | jeff_s_: i said we've not found it to be inconsistent. |
| 14:23:17 | <quicksilver> | jeff_s_: don't be patronising. |
| 14:23:25 | <lilac> | that's as strong a statement as you can make for any logic without assuming any other logic is consistent |
| 14:23:26 | <jeff_s_> | I missed the beginning of this conversation but... "we only think that first-order logic is valid because we've not found it to be inconsistent" |
| 14:23:40 | <Absolute0> | Can instances be overridden? |
| 14:23:41 | <quicksilver> | jeff_s_: the "proof" of the consistency of first order logic is itself written in some logic. |
| 14:23:54 | <quicksilver> | jeff_s_: that logic may not be consistent, so the proof may be invalid. |
| 14:23:59 | <lilac> | jeff_s_: the contrapositive being, if we found first-order logic to be inconsistent, we would think it was invalid. what's wrong with that? |
| 14:24:12 | <jmcarthur_work> | the proof is valid in that particular logic though. and that is all that matters |
| 14:24:28 | <jmcarthur_work> | it seems that the conversation is steering toward some concept of "absolute validity" |
| 14:24:42 | <ksf> | there's no truth. everything is permissible. |
| 14:24:43 | <jmcarthur_work> | different logics will have different results |
| 14:24:44 | <lilac> | jmcarthur_work: why is that all that matters? we're talking about the foundation here, not about those things built atop it. |
| 14:25:00 | <EvilTerran> | ksf, all things are true? |
| 14:25:07 | <Absolute0> | instance Show (Map.Map Position ChessPiece) where <-- Position and ChessPiece are both data definitions |
| 14:25:12 | <jmcarthur_work> | lilac, there is no foundation. if you reject the logics we use commonly then just use your own |
| 14:25:15 | <EvilTerran> | even false things? |
| 14:25:21 | <jmcarthur_work> | in math you can make things up |
| 14:25:26 | <jmcarthur_work> | that's just how it is |
| 14:25:28 | <quicksilver> | Absolute0: in normal haskell, no. |
| 14:25:38 | <Absolute0> | Illegal instance declaration for `Show (Map.Map Position ChessPiece)' |
| 14:25:43 | <quicksilver> | Absolute0: if there is a polymorphic show instance for Map (and there is), then you cannot supply a more specific one. |
| 14:25:58 | <Absolute0> | quicksilver: what would be the syntax? |
| 14:26:05 | <Absolute0> | I tried different combinations.. |
| 14:26:07 | <quicksilver> | Absolute0: actually there are some other problems with that to do with the precise forms instances are allowed to take |
| 14:26:09 | <ksf> | EvilTerran, not while I'm eating, no. |
| 14:26:14 | <EvilTerran> | Absolute0, if you don't want the behaviour that Show provides, then you probably don't actually want a Show instance |
| 14:26:18 | <quicksilver> | Absolute0: there is nothing really wrong with that syntax. |
| 14:26:27 | <jmcarthur_work> | #haskell has to be the most philosophical programming channel i've ever been in |
| 14:26:31 | <quicksilver> | Absolute0: but there are two things wrong with what you're tryign to do. |
| 14:26:38 | <EvilTerran> | Absolute0, seeing as Show instances tend to follow some fairly specific semantics |
| 14:26:52 | <Peaker> | Absolute0, you can have a newtype/data around a Map Position ChessPiece that has its own Show instance |
| 14:27:04 | <Absolute0> | oh let me try that |
| 14:27:07 | <lilac> | jmcarthur_work: i disagree. there is a common foundation (alhtough we can't prove we all use the same one), and it's important to recognise that it's empirical, rather than absolute |
| 14:27:08 | <quicksilver> | Absolute0: (1) in strict haskell98, you can't give instance declarations for types constructed out of type constructors. |
| 14:27:31 | <quicksilver> | Absolute0: (2) once you fixed that with -XFlexibleInstances, you still can't do what you want, because tehre is already a Show instance for Map |
| 14:27:38 | <quicksilver> | Absolute0: (3) you REALLY DONT WANT TO DO THIS anyway. |
| 14:27:39 | <quicksilver> | ;) |
| 14:27:41 | <lilac> | jmcarthur_work: if tomorrow we found that first-order logic proves false, then we'd need to reject it and all logics which prove it consistent. |
| 14:27:48 | <jmcarthur_work> | lilac, i don't think we disagree that it shouldn't be considered absolute |
| 14:27:57 | <jmcarthur_work> | lilac, proves false *in some other logic* you mean |
| 14:28:02 | <Absolute0> | Qualified name in binding position: Map.Map |
| 14:28:05 | <jmcarthur_work> | which, again, suffers from the same problem |
| 14:28:06 | <lilac> | jmcarthur_work: no, in itself. |
| 14:28:13 | <quicksilver> | Show is for machine-readable, haskell syntax |
| 14:28:14 | <Absolute0> | newtype GameSetup = Map.Map Position ChessPiece |
| 14:28:15 | <jeff_s_> | lilac - why are you insisting on considering that 1st order logic could be found to be wrong somehow when it's impossible? |
| 14:28:25 | <Absolute0> | quicksilver: alright i'll just implement a myShow function :) |
| 14:28:25 | <jmcarthur_work> | you can't prove a logic "false" anyway |
| 14:28:26 | <quicksilver> | never use it for pretty printing or 'smoethign which looks nicer' |
| 14:28:28 | <Absolute0> | point taken. |
| 14:28:47 | <quicksilver> | Absolute0: the newtype syntax is newtype GameSetup = GameSetup (Map.Map Position ChessPiece) |
| 14:28:50 | <quicksilver> | you need a constructor. |
| 14:28:55 | <Peaker> | jmcarthur_work, you can prove it inconsistent, though? |
| 14:28:55 | <Absolute0> | oh |
| 14:29:11 | <fasta> | Peaker: yes |
| 14:29:12 | <Absolute0> | So show should never be overridden? |
| 14:29:21 | <quicksilver> | you can write show for your own types |
| 14:29:22 | <Absolute0> | since Read cannot process it. |
| 14:29:32 | <quicksilver> | but you should always write something which Read can process |
| 14:29:33 | <EvilTerran> | jmcarthur_work, jeff_s_: i think lilac is thinking of the problem that, due to incompleteness, we can't actually disprove "forall a. a" in FOL |
| 14:29:37 | <Absolute0> | right. |
| 14:29:39 | <quicksilver> | so you might as well use 'deriving' really |
| 14:29:47 | <lilac> | jeff_s_: i think you misunderstand the Completeness Theorem. if logic A proves logic B consistent, then either B is consistent or A is not. there's no absolute notion of 'impossible' here |
| 14:29:57 | <jeff_s_> | er, "forall" isn't a concept in 1st order logic |
| 14:30:09 | <jeff_s_> | completeness doesn't hold for 2nd order logic |
| 14:30:28 | <jeff_s_> | completeness DOES hold for 1st order logic |
| 14:30:51 | <jmcarthur_work> | a logic will always be "wrong" if it is either inconsistent or incomplete? that doesn't sound useful to me either |
| 14:31:06 | <EvilTerran> | um |
| 14:31:21 | <ksf> | OMG WE NEED A HASKELL BROWSER |
| 14:31:30 | <EvilTerran> | "FOL is a system of deduction that extends propositional logic by allowing quantification over individuals of a given domain of discourse." |
| 14:32:01 | <quicksilver> | EvilTerran: however, "forall a . a" isn't FOL, since that's not quantifying over an individual, but over a proposition. |
| 14:32:08 | <EvilTerran> | ah, i see |
| 14:32:13 | <quicksilver> | still I think we should maybe take this to -overflow or -blah |
| 14:32:25 | <EvilTerran> | i meant we can't prove FOL consistent, though |
| 14:32:51 | <lilac> | -overflow seems more appropriate |
| 14:33:34 | <seliopou> | sorry to jump in here... but I believe that first-order logic is both sound and complete |
| 14:33:54 | <quicksilver> | seliopou: if you wish to jump in, please jump into #haskell-overflow :P |
| 14:34:16 | <jeff_s_> | never mind, I was mistaken. forall is in first order logic, but it's still complete |
| 14:34:51 | <jeff_s_> | oh and quicksilver is right too though - ok i'm done then :P |
| 14:35:50 | <rfmge> | > let f n = (\a b c -> [a,b,c]) <$> [1..n] <*> [1..n] <*> [1..n] in f 2 |
| 14:35:52 | <lambdabot> | [[1,1,1],[1,1,2],[1,2,1],[1,2,2],[2,1,1],[2,1,2],[2,2,1],[2,2,2]] |
| 14:36:02 | <rfmge> | is there a way to make that work for any number of lists instead of just 3? |
| 14:36:54 | <quicksilver> | > replicateM 3 [1..2] |
| 14:36:56 | <lambdabot> | [[1,1,1],[1,1,2],[1,2,1],[1,2,2],[2,1,1],[2,1,2],[2,2,1],[2,2,2]] |
| 14:37:01 | <quicksilver> | > replicateM 4 [1..2] |
| 14:37:03 | <lambdabot> | [[1,1,1,1],[1,1,1,2],[1,1,2,1],[1,1,2,2],[1,2,1,1],[1,2,1,2],[1,2,2,1],[1,2... |
| 14:37:17 | <rfmge> | awesome, thanks |
| 14:42:25 | <EvilTerran> | rfmge, but do you see how it works? |
| 14:43:46 | <rfmge> | i think so |
| 14:44:38 | <rfmge> | the list monad is concatMap, so it's building a list of [[1][1][1][1]],[[1][1][1][2]]... |
| 14:44:58 | <dev31212> | > print Nothing |
| 14:45:00 | <lambdabot> | <IO ()> |
| 14:45:13 | <dev31212> | Hi folks...question about show |
| 14:45:21 | <dev31212> | IN GHCi, "print Nothing" works fine. |
| 14:45:41 | <dev31212> | but in my simple test program, main = print Nothing, I get the following error: |
| 14:46:02 | <dev31212> | Ambiguous type variable `a' in the constraint: |
| 14:46:02 | <dev31212> | `Show a' arising from a use of `print' at functor.hs:50:1-5 |
| 14:46:02 | <dev31212> | Probable fix: add a type signature that fixes these type variable(s) |
| 14:46:17 | <dev31212> | Am I not importing something? |
| 14:46:24 | <Zao> | As Nothing is of type Maybe a, it doesn't know what a is. |
| 14:46:35 | <nibro> | ghci does some clever defaulting to pick an a for you |
| 14:46:44 | <Zao> | What about if you do print (Nothing :: Maybe ()) ? |
| 14:47:01 | <dev31212> | ahh let me try |
| 14:47:17 | <ksf> | sometimes, I have the impression that okular is the only kde program that was written by half-way capable people. |
| 14:47:22 | <nibro> | I have a question for the ssh gurus out there |
| 14:47:33 | <ksf> | as in "at least, it never crashed on me" |
| 14:47:52 | <dev31212> | ok, indeed that works Zao |
| 14:47:53 | <dev31212> | thanks |
| 14:47:58 | <dev31212> | Why does GHCi allow it? |
| 14:48:07 | <nibro> | I'm trying to set myself up on my new machine, and I want to ssh to code.haskell.org without typing my password all the time (which I've even forgotten) |
| 14:48:23 | <Zao> | dev31212: Friendliness? |
| 14:48:30 | <nibro> | I thought it would be enough to copy my .ssh from my old machine to my new one, but it doesn't seem to work |
| 14:48:31 | <Zao> | It does a lot of defaulting. |
| 14:48:33 | <ksf> | dev31212, ghc can't infer what type your Justs are, because you never use them. |
| 14:48:37 | <Zao> | nibro: Permissions right? |
| 14:48:49 | <Zao> | nibro: Throw more -vvv at ssh to see if you get more info. |
| 14:49:19 | <ksf> | dev31212, -XNoMonomorphismRestriction should "fix" things, but adding a signature is better style. |
| 14:49:27 | <dev31212> | ok gotcha |
| 14:49:29 | <dev31212> | Thanks folks |
| 14:49:36 | <dev31212> | so I guess as you said, "friendliness" |
| 14:49:39 | <lilac> | ksf: will that help? |
| 14:49:43 | <dev31212> | Well that friendlieness can be confusing for new jacks |
| 14:49:52 | <nibro> | dev31212: ghci always tries () first, if it doesn't know what the type is |
| 14:49:56 | <ksf> | lilac, nope. |
| 14:50:16 | <ksf> | ... the Maybe type doesn't escape to the top-level binding. |
| 14:52:08 | <dev31212> | ok |
| 14:52:25 | <nibro> | I checked the permissions, they were probably wrong, but I've fixed them to the same as my other machine has and it still won't work |
| 14:52:37 | <nibro> | ssh -v doesn't seem to mention anything about looking at the .ssh |
| 14:53:52 | <nibro> | http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5343#a5343 |
| 14:57:27 | <dev31212> | Anybody care to give a guy some inspiration? |
| 14:57:35 | <dev31212> | Whats the Haskell job market like? |
| 14:58:02 | <skorpan> | which haskell job market? |
| 14:58:08 | <skorpan> | or rather "what" |
| 14:58:26 | <dev31212> | Um, I dunno...general haskell programming? |
| 14:58:34 | <nibro> | "emerging" |
| 14:58:40 | <dev31212> | Entry level Haskell jobs? I am looking to transition out of Java/PHP at one point |
| 14:58:43 | <Beelsebob> | there are people with haskell jobs |
| 14:58:44 | <C-Keen> | heh |
| 14:58:49 | <Beelsebob> | they're not easy to get though |
| 14:58:54 | <dev31212> | Beelsebob, that doesnt souind encouraging |
| 14:59:02 | <dev31212> | ok |
| 14:59:06 | <jmcarthur_work> | dev31212, Beelsebob just wants the haskell jobs to himself |
| 14:59:08 | <osfameron> | "entry level haskell jobs" would be nice... |
| 14:59:16 | <Beelsebob> | jmcarthur: I already *have* a haskell job |
| 14:59:30 | <osfameron> | I think the best way to get a haskell job right now is to startup your own company developing haskell |
| 14:59:31 | <jmcarthur_work> | Beelsebob, do you have any extras to pass around? |
| 14:59:36 | <jmcarthur_work> | ;) |
| 14:59:51 | <dev31212> | Well I realize it will probably be up to a year before I could consider myself competent enough for a haskell job anyway...and I am mainly doing this for my own personal projects |
| 14:59:55 | <osfameron> | or to get a job doing nothaskell, and persuade your boss that your next project should be in haskell |
| 14:59:59 | <dev31212> | but it wouyld be nice to be in a market with such little supply |
| 15:00:12 | <dev31212> | PHP programmers are a dime a dozen..so I want to enhance my resume |
| 15:00:30 | <dev31212> | osfameron, hmmm...not a bad idea. |
| 15:01:09 | <myname> | hi, i need help: how to list files in a folder in haskell? |
| 15:01:27 | <quicksilver> | lars9: look at the functions in System.Directory |
| 15:01:44 | <lars9> | thanks, i'll check that. |
| 15:02:11 | <dev31212> | Beelsebob, let me ask you, rudely, a question |
| 15:02:26 | <quicksilver> | ACTION recommends you ask it, politely. |
| 15:02:29 | <quicksilver> | ;P |
| 15:02:30 | <dev31212> | would you say you make more than the average person, with your years of experience, doing say, Java, or .net, php, etc? |
| 15:02:36 | <mux> | lars9: the function is getDirectoryContents |
| 15:02:41 | <dev31212> | A rude question asked politley :) |
| 15:02:43 | <lars9> | quicksilver, are you replying me? i'm new to irc... |
| 15:02:53 | <jmcarthur_work> | sounds like a /msg question ;) |
| 15:02:58 | <quicksilver> | lars9: I was, yes, the first time. |
| 15:02:59 | <dev31212> | ok, my bad |
| 15:03:09 | <quicksilver> | lars9: when I said "look at the functions in System.Directory |
| 15:03:47 | <jmcarthur_work> | but i am curious if the average haskell developer makes more than the average <insert X language> developer (i find it very likely) |
| 15:03:58 | <lars9> | thanks, then i use that to count number of new mails in my maildir, for a plugin of xmobar... |
| 15:04:02 | <dev31212> | Thats what I am thinking... |
| 15:04:15 | <dev31212> | given the short supply of competent Haskell programmers..and functional programmers, in general |
| 15:04:30 | <jmcarthur_work> | well, also pretty small demand, yet |
| 15:04:37 | <dev31212> | yeah, good point. |
| 15:05:01 | <dev31212> | I was told some Swiss Bank uses Haskell for all their systems... |
| 15:05:10 | <dev31212> | And Twitter is written in Scala... |
| 15:05:28 | <lars9> | swiss bank uses haskell? cool... |
| 15:05:42 | <dev31212> | Yeah, I think centrenia told me that... |
| 15:05:49 | <nibro> | a lot of banks use haskell these days |
| 15:05:53 | <dev31212> | ahh nice |
| 15:05:56 | <nibro> | well, several anyway... |
| 15:06:02 | <mux> | facebook's chat is written in erlang |
| 15:06:11 | <nibro> | they use it for financial system modelling |
| 15:06:11 | <jeff_s_> | awesom |
| 15:06:13 | <dev31212> | nice |
| 15:06:28 | <lars9> | awesome +1 |
| 15:07:05 | <QtPlaty[HireMe]> | ACTION can't recall which bank uses Ocamel "But if you do any search for functional langs you often get there adds" |
| 15:07:16 | <dev31212> | I saw some blog article advocating using haskell to write Military munitions code |
| 15:07:22 | <dev31212> | because of less chance of screwups :) |
| 15:07:35 | <nibro> | see here: http://www.haskell.org/haskellwiki/Haskell_in_industry |
| 15:07:36 | <dev31212> | I guess that;'s why bannks like it...less chanbce of dumb dubgs |
| 15:07:36 | <fasta> | QtPlaty[HireMe]: Jane Street |
| 15:07:49 | <dev31212> | bugs* |
| 15:09:24 | <SamB> | QtPlaty[HireMe]: you also can't remember how to spell? |
| 15:09:26 | <nibro> | Zao: turns out it was a permission thing after all, thanks for the tip :) |
| 15:14:02 | <dev31212> | hi centrinia |
| 15:14:04 | <bos> | nifty, my rewrite of pidgits gets Haskell to first place on that list again: http://shootout.alioth.debian.org/u64q/benchmark.php?test=pidigits&lang=all&box=1 |
| 15:14:15 | <centrinia> | Hi dev31212. |
| 15:14:16 | <wli> | w00t |
| 15:14:20 | <nibro> | way to go bos! :) |
| 15:14:56 | <bos> | and it's the shortest of all the submissions by a fair margin, too. nice! |
| 15:16:22 | <JaffaCake> | bos: very nice, but you're allowed to use whitespace in the shootout, right? |
| 15:17:17 | <ksf> | bos, multi-threading? |
| 15:17:38 | <ksf> | that is, seperate calculation from printing? |
| 15:18:18 | <bos> | JaffaCake: i guess. |
| 15:18:23 | <bos> | :-) |
| 15:18:35 | <bos> | ksf: haven't had time to try it. i'd be somewhat astonished if it helped. |
| 15:19:06 | <jeff_s_> | bos, what is the "j#s" and "j&(n,a,d) syntax in your pidgits function? |
| 15:19:16 | <fasta> | jeff_s_: it's not syntax |
| 15:19:20 | <bos> | jeff_s_: they're just functions. |
| 15:19:26 | <bos> | # is one function, and & is another. |
| 15:19:48 | <JaffaCake> | are they still using gzip as a way to measure code length? |
| 15:19:58 | <jeff_s_> | hm, ok |
| 15:20:02 | <bos> | JaffaCake: yep |
| 15:20:11 | <JaffaCake> | this code looks like it's already been gzipped :) |
| 15:20:51 | <bos> | JaffaCake: it was a lot more readable before i golfed the living bejaysus out of it :-) |
| 15:21:04 | <jeff_s_> | huh, so in haskell you don't have to put ain infix operator in parens and use it prefix when defining it? |
| 15:21:08 | <bos> | i could have tightened it up more, but that felt silly. |
| 15:21:15 | <bos> | jeff_s_: right |
| 15:21:18 | <jeff_s_> | neat |
| 15:21:22 | <JaffaCake> | :) np, as long as we win |
| 15:23:14 | <bos> | i could actually understand the code when i first wrote it. now, er, not so much. |
| 15:23:20 | <fasta> | y=(j*2+1) |
| 15:23:28 | <fasta> | Two parens? |
| 15:23:41 | <nibro> | cpu usage 100% 0% 0% 0%? |
| 15:23:51 | <fasta> | Or is that more efficient for gzip ;) |
| 15:23:51 | <nibro> | no gains to be made at all from parallelizing? |
| 15:24:08 | <nibro> | (disclaimer: I have no idea what the problem is even :)) |
| 15:24:12 | <bos> | fasta: an artifact of refactoring in a rush |
| 15:24:24 | <bos> | nibro: almost certainly no gain from parallel evaluation |
| 15:24:38 | <fasta> | It depends on how many cores you have. |
| 15:24:48 | <ksf> | the pi generation isn't parallisable as i see it, but you could factor out printing. |
| 15:25:05 | <fasta> | If you have a gazillion cores, you can probably do things which are completely insane to do right now. |
| 15:25:24 | <jmcarthur_work> | fasta, well, also dependent on the bandwidth you have to those cores |
| 15:25:28 | <bos> | fasta: not if every digit depends on the computation of the prior digit. |
| 15:25:32 | <jeff_s_> | is anyone here subscribed to the libraries@haskell.org maillist? http://www.haskell.org/ghc/dist/current/docs/libraries/old-time/System-Time.html has a broken link |
| 15:25:46 | <fasta> | bos: but that's not the case for pi |
| 15:26:06 | <ksf> | fasta, the algorithm is given. |
| 15:26:11 | <jmcarthur_work> | fasta, the benchmark stipulates a particular algorithm, which i'm not sure is parallelisable |
| 15:26:38 | <fasta> | So, if you have to use a particular algorithm, how can you use more than one cpu? |
| 15:26:42 | <fasta> | That would change the algorithm. |
| 15:27:07 | <bos> | sometimes the algorithm can be parallelised. |
| 15:27:12 | <jeff_s_> | if Haskell has a pmap you could probably sneak it in :) |
| 15:28:34 | <McManiaC> | @src error |
| 15:28:34 | <lambdabot> | error s = throw (ErrorCall s) |
| 15:31:16 | <jmcarthur_work> | :t parMap |
| 15:31:17 | <lambdabot> | forall b a. Strategy b -> (a -> b) -> [a] -> [b] |
| 15:31:26 | <jmcarthur_work> | :t par |
| 15:31:27 | <lambdabot> | forall a b. a -> b -> b |
| 15:32:33 | <lilac> | bos: looks like the algorithm boils down to a long product of 2x2 matrices? that sounds embarassingly parallelizable |
| 15:32:49 | <lilac> | unless you're required to multiply in a certain order? |
| 15:32:50 | <ksf> | bos, http://hackage.haskell.org/packages/archive/strict-concurrency/0.2.1/doc/html/Control-Concurrent-Chan-Strict.html |
| 15:33:01 | <ksf> | I'd do it, but I have a single core. |
| 15:33:47 | <bos> | lilac: i don't believe so |
| 15:34:08 | <lilac> | which part? |
| 15:36:19 | <ksf> | what about the library rule? would using something out of the platform be allowed? |
| 15:37:30 | <Berengal> | If we're going to have multiple error-reporting modes in ghc, I want to suggest "foo :: Int -> Bool \n bar :: Double \n foo bar :: WTF o_O? |
| 15:37:48 | <Berengal> | <location>" |
| 15:37:56 | <nominolo> | Hm, I have a suspicion that Parsec 3's Stream interface is not as useful as it could be :/ |
| 15:38:13 | <ksf> | nominolo, huh? |
| 15:38:31 | <ksf> | it's basically another interface to matching on : and []] |
| 15:39:29 | <nominolo> | ksf: well, I'm trying to build a stream out of bytes I read from a socket or stdin and I get weird parse errors which shouldn't happen |
| 15:40:00 | <nominolo> | the thing is that we have no guarantee that the returned state is used linearly |
| 15:49:29 | <lars9> | hi, i need help one a small piece of code, who can help me? |
| 15:49:56 | <ksf> | nominolo, well, parsec isn't designed to work on monadic streams... it sounds to me that you want to use something in the direction of iteratees. |
| 15:50:17 | <nominolo> | ksf: right, but I want to also parse things |
| 15:50:34 | <nominolo> | and I'd like to avoid rolling (yet again) my own parser |
| 15:50:56 | <lars9> | i have the function countFiles to count the number of files in a directory. and the function has type of "String -> IO String" |
| 15:51:40 | <lars9> | how to write "countFiles d = do ..."? using functions "getDirectoryContents" and "length" |
| 15:52:00 | <Lemmih> | lars9: Why does it return a String? |
| 15:52:49 | <ksf> | :t fmap length getDirectoryContents |
| 15:52:50 | <lambdabot> | Not in scope: `getDirectoryContents' |
| 15:53:09 | <lars9> | import System.Directory |
| 15:53:16 | <ksf> | :t fmap length System.Directory.getDirectoryContents |
| 15:53:17 | <lambdabot> | Couldn't match expected type `[a]' |
| 15:53:17 | <lambdabot> | against inferred type `IO [FilePath]' |
| 15:53:17 | <lambdabot> | Expected type: FilePath -> [a] |
| 15:53:31 | <doserj> | countFiles d = length <$> getDirectoryContents d |
| 15:54:15 | <ksf> | :t \x -> fmap length System.Directory.getDirectoryContents x |
| 15:54:17 | <lambdabot> | Couldn't match expected type `[a]' |
| 15:54:17 | <lambdabot> | against inferred type `IO [FilePath]' |
| 15:54:17 | <lambdabot> | Expected type: FilePath -> [a] |
| 15:54:28 | <ksf> | :t \x -> fmap length (System.Directory.getDirectoryContents x) |
| 15:54:29 | <lambdabot> | FilePath -> IO Int |
| 15:54:43 | <ksf> | now that's an utterly cryptic error message, there. |
| 15:55:08 | <dancor_> | it's better when it gives you the part with the mismatch |
| 15:55:14 | <dancor_> | it's cut-off here |
| 15:55:40 | <doserj> | ksf: why? fmap length reguires a list as argument, getDirectoryContents isn't a list |
| 15:55:43 | <ksf> | otoh, it's the same, old, pontless fail. |
| 15:55:53 | <Lemmih> | lars9: Use two functions: one for counting the files and one for displaying the output. |
| 15:56:23 | <ksf> | :t (fmap length .) System.Directory.getDirectoryContents |
| 15:56:25 | <lambdabot> | FilePath -> IO Int |
| 15:56:43 | <dancor_> | :t length <$> System.Directory.getDirectoryContents |
| 15:56:44 | <lambdabot> | Couldn't match expected type `[a]' |
| 15:56:44 | <lambdabot> | against inferred type `IO [FilePath]' |
| 15:56:44 | <lambdabot> | Expected type: FilePath -> [a] |
| 15:56:50 | <lars9> | why mine does not work? countFiles d = do ; l <- getDirectoryContents; n <- length l; return $ show n; |
| 15:57:00 | <Lemmih> | lars9: Do you want to include the files in subdirectories? |
| 15:57:10 | <doserj> | let n = length l instead of n <- length l |
| 15:57:13 | <ksf> | lars9, length isn't monadic, so don't use <- |
| 15:57:40 | <lars9> | oh, what does let means? |
| 15:58:04 | <ksf> | it introduces a binding. |
| 15:58:09 | <doserj> | a local binding |
| 15:58:14 | <ksf> | you can also say return $ show $ length n |
| 15:58:16 | <lars9> | it works after using "let" instead of "<-" |
| 15:58:53 | <ksf> | ...which is more important to understand. |
| 15:59:05 | <doserj> | But really, I would also expect a function named countFiles to return IO Int |
| 15:59:12 | <b_jonas> | ksf: where by n you mean l ? |
| 15:59:24 | <ksf> | b_jonas, yes. |
| 15:59:56 | <ksf> | I've got a compiler and an irc channel to detect such bugs for me. |
| 16:00:07 | <b_jonas> | :-) |
| 16:00:17 | <lars9> | is ( return . show . length ) converting list to Monad String? |
| 16:00:37 | <ksf> | :t return . show . length |
| 16:00:37 | <Berengal> | lars9: Think of <- as extracting a value from a monad. All monads constist of two things: a box and a value inside it. getDirectoryContents, with type IO [String], has an IO box and a value of type [String]. length l is simply Int, which doesn't have a box, so there's nothing to extract from |
| 16:00:38 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => [a] -> m String |
| 16:00:48 | <ksf> | short answer: yes. |
| 16:01:03 | <ksf> | :t return |
| 16:01:04 | <lambdabot> | forall a (m :: * -> *). (Monad m) => a -> m a |
| 16:01:15 | <hackagebot> | complexity 0.1.3 |
| 16:02:09 | <lilac> | lars9: you also want l <- getDirectoryContents d, not l <- getDirectoryContents. |
| 16:03:32 | <lars9> | it works now.. great, thanks. now i can use it to display number of new mails in xmobar |
| 16:03:59 | <lars9> | countFiles "/home/lars/.mail/inbox/new" |
| 16:04:15 | <hackagebot> | explicit-sharing 0.3.1.3 |
| 16:05:18 | <ksf> | ls ~/.mail/inbox/new | wc -l |
| 16:05:41 | <doserj> | lars9: you might want to subtract 2 from the result, though |
| 16:06:57 | <Berengal> | Since when did we get hackagebot, and who set it up? |
| 16:08:30 | <QtPlaty[HireMe]> | SamB: http://quollified.com/~platypus/Spelling.html |
| 16:18:41 | <aleator> | Stupid non-related question: What use are minimum spanning trees? (#haskell people usually know such things.) |
| 16:20:46 | <Berengal> | aleator: Find the cheapest way to connect all the nodes in a graph |
| 16:21:34 | <aleator> | Berengal: Thanks, sure but I need a motivation to give for about 1st year student on why to learn such |
| 16:21:51 | <joga> | aleator, maybe this helps http://lmgtfy.com/?q=minimum+spanning+tree ;) |
| 16:22:40 | <aleator> | har-har.. |
| 16:23:02 | <joga> | you might for example have a problem where you need to visit certain places and consume as little gas as possible |
| 16:23:04 | <Berengal> | aleator: http://www.facebook.com/careers/puzzles.php?puzzle_id=1 |
| 16:23:33 | <Berengal> | joga: That'd be travelling salesman |
| 16:23:43 | <joga> | well, yeah |
| 16:24:01 | <joga> | my mistake |
| 16:24:19 | <Berengal> | Unless you travelled in an infinitely large group of people who could split up at junctions |
| 16:24:28 | <joga> | the cable tv company example in the wikipedia article is better |
| 16:25:00 | <aleator> | Berengal: Hey, thats actually excellent. I can rephrase it into making chemicals so that idiot lecturers can lecture for 6h a day. :) |
| 16:27:43 | <gigi> | ciao |
| 16:27:46 | <TomMD> | ?quote fusion |
| 16:27:46 | <lambdabot> | ksf says: Confusion is the first step to enlightenment |
| 16:27:51 | <gigi> | !list |
| 16:27:56 | <TomMD> | ?quote fusion |
| 16:27:57 | <lambdabot> | ksf says: Confusion is the first step to enlightenment |
| 16:28:03 | <TomMD> | damn, no more |
| 16:28:21 | <ray> | @quote haskell |
| 16:28:21 | <lambdabot> | roconnor says: I can't wait for the Density Comonad chapter of "learn you a haskell" |
| 16:28:35 | <Berengal> | @quote fusion |
| 16:28:35 | <lambdabot> | Ralith says: I'm sure we'll have fusion within 40 years. |
| 16:28:52 | <ray> | thanks irc lag and silly irc client for making the quote appear before my @quote |
| 16:34:44 | <ksf> | lambdabot's random gen seems to be utterly biased. |
| 16:34:52 | <ksf> | ...at least wrt. quotes. |
| 16:35:24 | <Berengal> | ksf: It also decides to fetch quotes from empty lists from time to time |
| 16:37:41 | <lilac> | @quote fix |
| 16:37:41 | <lambdabot> | mauke says: a hint to beginners: typing 'fix error' in ghci does not have the intended effect |
| 16:37:52 | <lilac> | > fix fail |
| 16:37:53 | <lambdabot> | "" |
| 16:38:07 | <skorpan> | > fix undefined |
| 16:38:16 | <lambdabot> | * Exception: Prelude.undefined |
| 16:38:29 | <skorpan> | > [undefined, undefined..undefined] |
| 16:38:31 | <lambdabot> | * Exception: Prelude.undefined |
| 16:38:36 | <skorpan> | > [1..undefined] |
| 16:38:38 | <lambdabot> | * Exception: Prelude.undefined |
| 16:38:44 | <skorpan> | > take 3 [1..undefined] |
| 16:38:45 | <lambdabot> | * Exception: Prelude.undefined |
| 16:38:48 | <lilac> | > [1,2..undefined] |
| 16:38:49 | <lambdabot> | * Exception: Prelude.undefined |
| 16:39:02 | <Berengal> | @src emumFromTo |
| 16:39:03 | <lambdabot> | Source not found. Where did you learn to type? |
| 16:39:11 | <skorpan> | @src enumFromTo |
| 16:39:11 | <Berengal> | @src enumFromTo |
| 16:39:11 | <lambdabot> | Source not found. My mind is going. I can feel it. |
| 16:39:12 | <lambdabot> | Source not found. I can't hear you -- I'm using the scrambler. |
| 16:39:44 | <mxc> | oh the joys of laziness.. with full logging, everything works, with partial logging, nothing.. |
| 16:39:51 | <Berengal> | ACTION guesses something with "foo <= maxLimit" |
| 16:40:07 | <lilac> | > [1,2..-7] |
| 16:40:09 | <lambdabot> | Not in scope: `..-' |
| 16:40:11 | <lilac> | > [1,2.. -7] |
| 16:40:13 | <lambdabot> | [] |
| 16:40:15 | <lilac> | > [1,2.. 7] |
| 16:40:17 | <lambdabot> | [1,2,3,4,5,6,7] |
| 16:40:17 | <Gracenotes> | > head [1,2..undefined] |
| 16:40:18 | <lambdabot> | * Exception: Prelude.undefined |
| 16:40:23 | <lilac> | first ctor could be either [] or (:) |
| 16:40:27 | <Gracenotes> | hm. So it's not so lazy..? |
| 16:40:37 | <lilac> | Gracenotes: if undefined < 1, then the list is empty |
| 16:40:38 | <Gracenotes> | It guess it has to check if 1 <= undefined |
| 16:40:43 | <Berengal> | Gracenotes: How would you implement it? |
| 16:40:49 | <Gracenotes> | indeedy so, lilac |
| 16:41:03 | <doserj> | > [1..infinity] |
| 16:41:07 | <cfrssv> | hi |
| 16:41:08 | <lambdabot> | [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28... |
| 16:41:27 | <burp> | > [1..] |
| 16:41:29 | <lambdabot> | [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28... |
| 16:41:30 | <Gracenotes> | doserj: that's so un-Natural! |
| 16:41:38 | <NEEDMOAR> | @src infinity |
| 16:41:38 | <lambdabot> | Source not found. Take a stress pill and think things over. |
| 16:41:46 | <lilac> | > [infinity, infinity-1 .. 0] |
| 16:41:47 | <lambdabot> | [] |
| 16:41:58 | <lilac> | huh? |
| 16:42:01 | <centrinia> | :t infinity |
| 16:42:02 | <lambdabot> | Natural |
| 16:42:15 | <lilac> | > [3,2..0] :: [Natural] |
| 16:42:17 | <lambdabot> | [] |
| 16:42:19 | <lilac> | bums |
| 16:42:22 | <centrinia> | > infinity < infinity+1 |
| 16:42:27 | <lambdabot> | mueval-core: Prelude.read: no parse |
| 16:42:27 | <lambdabot> | mueval: ExitFailure 1 |
| 16:42:29 | <lilac> | > [3,2..0] |
| 16:42:30 | <lambdabot> | [3,2,1,0] |
| 16:43:15 | <centrinia> | > infinity < succ infinity |
| 16:43:20 | <lambdabot> | mueval-core: Prelude.read: no parse |
| 16:43:20 | <lambdabot> | mueval: ExitFailure 1 |
| 16:43:22 | <cfrssv> | please, help! i'm linking with self-made opencv ffi (-L./out/ -lcvffi), but, on runtime, program tryes to load it from /usr/lib. Can I use other path? |
| 16:44:02 | <yowgi> | cfrssv, LD_LIBRARY_PATH=./out/ ./program |
| 16:44:04 | <thoughtpolice> | cfrssv: put the .so for your self-made version in the same directory? |
| 16:44:33 | <burp> | <centrinia> > infinity < infinity+1 <- haha nice idea |
| 16:44:34 | <cfrssv> | thoughtpolice, wont work :( |
| 16:44:57 | <cfrssv> | works only with lib in /usr/lib |
| 16:45:30 | <cfrssv> | yowgi, thanx! |
| 16:49:55 | <McManiaC> | http://sprunge.us/NdRZ?hs <- any idea why this isnt working as intended? i still get: |
| 16:49:58 | <McManiaC> | Parallel GC work balance: nan (0 / 0, ideal 2) |
| 16:51:30 | <McManiaC> | what else do i have to do to use multithreading? i already set +RTS -N2 |
| 16:56:11 | <ksf> | centrinia, infinity = succ infinity , so you're going for a _|_. |
| 16:56:38 | <ksf> | ...algebraic smartness is absent, as always. |
| 16:58:29 | <ksf> | zsh: segmentation fault ./TestEmbedMoz |
| 16:58:35 | <ksf> | grargh |
| 17:02:16 | <SamB> | QtPlaty[HireMe]: you know, I think emacs has word completion |
| 17:02:30 | <SamB> | though I guess you have to know what you're going to misspell to use that |
| 17:02:45 | <conal> | i'm moving the checkers package from quickcheck 1 to quickcheck 2. does anyone know why the 'rand' generator disappeared? |
| 17:02:45 | <lambdabot> | conal: You have 2 new messages. '/msg lambdabot @messages' to read them. |
| 17:02:53 | <conal> | is there a recommended replacement? |
| 17:03:06 | <SamB> | QtPlaty[HireMe]: I mean, with ispell |
| 17:03:27 | <SamB> | I wish Python had use strict ;-P |
| 17:07:01 | <Botje> | @quote bondage |
| 17:07:01 | <lambdabot> | No quotes match. Maybe you made a typo? |
| 17:08:40 | <McManiaC> | is there *no* way to do "pure exception handling"? |
| 17:09:17 | <McManiaC> | try / tryJust / catch etc always returns IO monad =( |
| 17:09:31 | <McManiaC> | from Control.Exception |
| 17:09:46 | <Lemmih> | McManiaC: There is no way. |
| 17:10:01 | <Lemmih> | McManiaC: You can always use data types, though. |
| 17:10:37 | <McManiaC> | :S |
| 17:12:24 | <doserj> | pure exception handling is called the Either Monad |
| 17:14:51 | <McManiaC> | i wish every function would return maybe/either ;) |
| 17:16:14 | <pumpkin_> | bos31337: congratulations on first place! |
| 17:18:08 | <zsol> | can someone explain me what's this \mu notation here: http://en.wikibooks.org/wiki/Haskell/Zippers#Differentation_of_Fixed_Point |
| 17:19:07 | <zsol> | I'm tempted to read it as a lambda expression but something tells me it's not accidentally a mu instead of a lambda |
| 17:20:24 | <Baughn> | (Emacs users:) What fontset/font settings are you using to show symbols in haskell-mode (assuming you've got those on)? |
| 17:20:39 | <zsol> | I'm using terminus |
| 17:21:35 | <Baughn> | zsol: And that's got the <- and . glyphs? |
| 17:22:33 | <zsol> | yeah it displays neatly |
| 17:23:01 | <zsol> | it's also got lambda, ->, and a few others |
| 17:25:04 | <Baughn> | zsol: I've got that installed, but it seems not to be an option. How do you set it? |
| 17:25:54 | <zsol> | I've just set the default font face to terminus |
| 17:26:44 | <Baughn> | M-x set-default-font terminus.. gives "Font 'terminus' is not defined" |
| 17:26:49 | <Baughn> | Ah, I'll ask #emacs |
| 17:29:47 | <conal> | yow! i get an error when building QuickCheck 2 from hackage: Class `Exception' used as a type. works fine via 'cabal install', but not with explicit Setup.lhs from source. |
| 17:30:34 | <dcoutts> | conal: cabal install is picking base 3 because it's pessimistic. |
| 17:30:36 | <conal> | Baughn: i use 12x24 from the Misc menu (shift-left). |
| 17:30:55 | <Baughn> | conal: Yow. Way too big, but maybe one of the others.. |
| 17:30:58 | <dcoutts> | conal: where as runghc Setup uses the simple stupid algorithm of picking the latest version of everything |
| 17:31:13 | <conal> | Baughn: yeah. pretty fat. please let me know what you end up liking. |
| 17:31:40 | <dcoutts> | conal: so it sounds like that package needs base < 4 |
| 17:31:51 | <dcoutts> | but did not declare it |
| 17:32:09 | <conal> | dcoutts: maybe so. thanks. hm. will there be trouble if other packages need base 4? |
| 17:32:30 | <BONUS> | when it complains that Exception is used as type it's usually cause of the new style exceptions yeah? |
| 17:32:46 | <dcoutts> | conal: no problem, different packages in a single stack can use base 3 or 4 |
| 17:32:51 | <Baughn> | Yep. It was a type in base-3, but it's a class now |
| 17:33:20 | <Baughn> | conal: I'm still hammering on makeEvent, by the way. I see what you mean about the finalizers. ^^; |
| 17:33:22 | <dcoutts> | conal: so cabal is papering over compatibility issue, if we hadn't done this then nearly every package on hackage would have broken when ghc-6.10 came out |
| 17:33:35 | <conal> | i see in QuickCheck.cabal there's a splitBase flag: http://hackage.haskell.org/packages/archive/QuickCheck/2.1/QuickCheck.cabal relevant? |
| 17:33:57 | <dcoutts> | conal: no, that's about base 2 vs 3. This is about 3 vs 4. |
| 17:34:18 | <dcoutts> | conal: packages should specify an upper bound on base, but not many do yet. |
| 17:34:36 | <conal> | dcoutts: thanks. "base == 3" sound right? |
| 17:34:40 | <hackagebot> | numbers 2009.5.28.1 |
| 17:34:52 | <dcoutts> | conal: that's too strict, that would not work with 3.0.3.0 for example |
| 17:35:06 | <conal> | dcoutts: base >= 3 && base < 4 ? |
| 17:35:15 | <dcoutts> | conal: yep |
| 17:35:18 | <conal> | thx! |
| 17:35:36 | <Baughn> | conal: My favorite font is actulaly the default one; it's easy to read. It just lacks some glyphs. |
| 17:35:36 | <dcoutts> | conal: actually it's "build-depends: base >= 3 && < 4" |
| 17:35:51 | <Baughn> | conal: Now to find out which that is.. |
| 17:35:53 | <dcoutts> | conal: no repetition of the package name is needed |
| 17:36:04 | <TomMD> | dcoutts: I thought you could say something lik "base == 4.*" |
| 17:36:07 | <conal> | dcoutts: worked much better! :) |
| 17:36:14 | <dcoutts> | TomMD: yes, you can |
| 17:36:18 | <TomMD> | great! |
| 17:36:37 | <dcoutts> | TomMD: if you're prepared to require cabal-version: >= 1.6 |
| 17:36:55 | <TomMD> | Sure, I don't mind forcing people to be up to date |
| 17:37:12 | <conal> | hm! now i get an error on a haddock comment: parse error on input `-- * \"Magic\" functions' |
| 17:38:43 | <conal> | never mind. seems to be fixed in the very latest QC |
| 17:39:40 | <conal> | well. phew! checkers now builds with QC2. all but a bit i commented out. |
| 17:42:03 | <jmcarthur_work> | ACTION uses inconsolata in emacs, at the moment. not sure how it does with special symbols and stuff, but it _should_ be okay |
| 17:48:02 | <conal> | i just wrote to koen to tell him about the QC2 compilation problem with base 4 |
| 17:48:17 | <conal> | Baughn: oh -- just noticed your finalizers comment. yeah. tricky stuff! |
| 17:49:01 | <conal> | Baughn: i've seen misc hints about ghc libraries having awkward interface tweaks to work around finalization. |
| 17:49:59 | <conal> | Baughn: which tell me that weak refs & finalizers don't form a robust abstraction. |
| 17:51:58 | <ksf> | I was quite surprised as I read that finalizers aren't guaranteed to run. |
| 17:52:54 | <TomMD> | ksf: I thought that was fixed with the 6.10 branch - where did you read this? |
| 17:53:00 | <lilac> | ksf: presumably that's to do with cycles which are kept alive by the thunks for the finalizers themselves? |
| 17:53:05 | <ksf> | somewhere in the docs, some time ago. |
| 17:53:24 | <lilac> | if a's finalizer references b and b's finalizer references a, then you're hosed |
| 17:53:26 | <ksf> | we have a refcounting gc? |
| 17:54:03 | <lilac> | whichever finalizer runs second is going to see an already-finalized object |
| 17:54:37 | <lilac> | either that or at least one of them does not run |
| 17:54:46 | <ksf> | hmm |
| 17:54:51 | <conal> | ksf: yeah. finalizers (and gc in general) are terribly important but not dependable. |
| 17:55:20 | <conal> | fortunately, now *C*-based finalizers are run promptly. |
| 17:55:38 | <conal> | we pushed on that change at anygma last summer, in order to to do robust graphics programming. |
| 17:57:33 | <conal> | i don't know how to do robust & modular programming without GC, but not GC is reliably only on system RAM, and not on other memory and other resources. |
| 18:05:30 | <burp> | > [0.5,1.0,..5] |
| 18:05:30 | <Taejo> | if I wanted to use GMP functions that aren't currently exposed to Haskell by GHC, would I have to mess about with the runtime? Or could I just do an ordinary FFI? |
| 18:05:31 | <lambdabot> | <no location info>: parse error on input `..' |
| 18:05:38 | <burp> | > [0.5,1.0..5] |
| 18:05:39 | <lambdabot> | [0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0] |
| 18:06:09 | <Zao> | Taejo: You'd probably have some trouble getting an Integer or suchlike to a format usable by GMP FFI. |
| 18:06:39 | <Zao> | There were some documentation recently on implementing additional primops, but it might be out of scope. |
| 18:07:54 | <ksf_> | ACTION switches to links until he wrote his own browser |
| 18:07:59 | <mm_freak> | is there a variant of Chan with a message limit, such that when that limit is exceeded, further writers have to wait? |
| 18:08:05 | <lilac> | how does GHC react if an object's finalizer holds a reference to that object? |
| 18:08:16 | <jzhou> | is setting path var enough for a self-compiled ghc installation? do i need to set ld_library_path as well? |
| 18:08:24 | <lilac> | (and further, what happens if that finalizer extends the lifetime of the object?) |
| 18:11:37 | <conal> | lilac: there's a paper "stretching the storage manager" http://citeseer.ist.psu.edu/peytonjones99stretching.html |
| 18:12:28 | <conal> | lilac: historical trivia: the impetus (at the time) to add these gc features to ghc was data-driven frp. |
| 18:13:01 | <zsol> | anyone willing to help me derive this type: data Tree a = Node a [Tree a] |
| 18:13:11 | <SamB> | lilac: isn't there something to prevent that from happening ? |
| 18:14:01 | <ksf_> | #error "GCC no longer implements <varargs.h>." |
| 18:14:04 | <ksf_> | bastards! |
| 18:14:40 | <lilac> | conal: excellent, thanks! |
| 18:14:45 | <SamB> | ksf: it is marked as legacy |
| 18:14:53 | <SamB> | http://opengroup.org/onlinepubs/007908799/xsh/varargs.h.html |
| 18:14:55 | <conal> | :) |
| 18:15:09 | <lilac> | SamB: it looks like the formulation of weak references is designed to sidestep it |
| 18:15:24 | <mux> | ksf_: you're supposed to use stdarg.h since looooong |
| 18:15:24 | <SamB> | lilac: yeah |
| 18:15:40 | <SamB> | yeah, since at least 12 years ago |
| 18:15:42 | <jzhou> | SamB: is there any replacement of that? |
| 18:16:15 | <SamB> | jzhou: it says right there to use stdarg.h instead |
| 18:17:00 | <jzhou> | SamB: oh, thanks a lot, i used varargs.h a lot in my old cs homeworks |
| 18:17:33 | <mux> | were you also using malloc.h? ;-) |
| 18:17:50 | <zsol> | not really sure if this functor is what I'm looking for: TreeF_A X = A * (List X) = A * (Mu ListF_X) |
| 18:18:56 | <mauke> | SamB: hah, it's more than 20 years old |
| 18:19:15 | <sbahra> | hah |
| 18:19:17 | <sbahra> | hah hah hah |
| 18:19:39 | <jzhou> | mux: lol, according to http://www.opengroup.org/onlinepubs/9699919799/functions/free.html , There is now no requirement for the implementation to support the inclusion of <malloc.h>. |
| 18:19:49 | <mux> | hopefully! |
| 18:20:09 | <sbahra> | Did you sort out your sysctl issues mux? |
| 18:20:41 | <mux> | sbahra: the issue with doc generation? dcoutts helped me write a specific hook to work my way around the problem, only, it doesn't work on hackage :-P |
| 18:20:57 | <mux> | so the generated documentation of my package on hackage is still incomplete and I don't know why |
| 18:20:59 | <sbahra> | No, testing on OpenBSD. |
| 18:21:11 | <mux> | couldn't do this either, but it should work |
| 18:21:15 | <mux> | could you give it a try ? |
| 18:21:47 | <sbahra> | mux, I'm on FreeBSD. |
| 18:21:56 | <sbahra> | mux, but I could ask a friend once he's around. |
| 18:22:45 | <mux> | tbh, I'm more interested in knowing whether it works fine on NetBSD & Mac OS X |
| 18:23:15 | <sbahra> | ACTION wonders what the status is for Mac OS X/PPC |
| 18:23:19 | <sbahra> | I could test there. |
| 18:23:43 | <mux> | would be great |
| 18:24:14 | <sbahra> | mux, you know what would be great? |
| 18:24:22 | <sbahra> | mux, in fact, I think it would be fantastic. |
| 18:24:40 | <mux> | what would? |
| 18:24:54 | <ksf_> | mux, I was trying to compile fudgets... |
| 18:25:12 | <sbahra> | mux, if you took lead of the FreeBSD Haskell project until I am able to work on it again. |
| 18:25:34 | <sbahra> | Your girlfriend will love you more for it, I'm telling you. |
| 18:25:41 | <Twey> | Haha |
| 18:25:42 | <ksf_> | It's not widely known, but there's a web browser implemented in haskell, but it needs fudgets. |
| 18:25:43 | <wahjava> | yeah :) |
| 18:25:49 | <mux> | ksf_: I don't know what that is but this is too bad; if you can do C however, it should be easy to fix |
| 18:26:02 | <mux> | sbahra: no way, sorry |
| 18:26:16 | <mux> | I would have to get my commit bit back etc etc, I don't even want to think about going down that road for now |
| 18:26:22 | <sbahra> | No, you wouldn't. |
| 18:26:27 | <sbahra> | It is a separate project, mux. |
| 18:26:33 | <sbahra> | We have our own hardware resources. |
| 18:26:37 | <ksf_> | well, I don't want to spend my time fixing software that, while really cool, is obsolete. |
| 18:26:40 | <sbahra> | Some committers work with us, and they will deal with the dirty work. |
| 18:26:40 | <mux> | alright, let me find some other reason why I should not then. |
| 18:26:51 | <sbahra> | mux, ok, let me know about them. |
| 18:26:59 | <mux> | time? :-) |
| 18:27:18 | <sbahra> | mux, that is a problem. But any time is better than no time. |
| 18:29:05 | <sbahra> | mux, it isn't much work...in all honesty. If you wish, you could just pick up a small project from it. |
| 18:29:45 | <sbahra> | The GHC port is trivial, I just haven't had time to properly audit it. Several Haskell ports are out of date (also easy to update a lot of them). |
| 18:29:58 | <mux> | seriously, I would if I had more time |
| 18:30:33 | <sbahra> | Ok. |
| 18:30:45 | <mux> | did you guys write a bsd.cabal.mk thingie to automate at least part of the port's writing? |
| 18:31:02 | <TomMD> | Did I hear talk of a bare metal ARM port? |
| 18:31:14 | <sbahra> | mux, I am only working on GHC, my ports and server ...wahjava and jacula were working on that. |
| 18:31:37 | <sbahra> | mux, a cabal2port is very feasible (and it doesn't need a bsd.cabal.mk, but that would be nice for hand-writing). |
| 18:31:46 | <wahjava> | mux, there is a bsd.haskell.mk available |
| 18:31:46 | <sbahra> | wahjava, is there anything in that area? |
| 18:31:49 | <mux> | yes, that too. |
| 18:32:06 | <wahjava> | no nothing in that area, atm. |
| 18:32:10 | <mux> | I'd still make cabal2port use a bsd.cabal.mk framework |
| 18:32:26 | <sbahra> | wahjava, jacula is busy with school, you too. dezzy? |
| 18:32:34 | <sbahra> | mux, sure, but it isn't necessary. |
| 18:33:03 | <sbahra> | mux, for example, bsd.haskell.mk would require more bureaucracy, so efforts can easily be over-lapped. |
| 18:33:12 | <mux> | ACTION tempted to answer the exact same last sentence :-) |
| 18:47:38 | <gigi_> | ciao |
| 18:48:10 | <sayyestolife> | I'd like to "pimp" my laptop a bit. Anyone knows if there is some nice haskell stickers (or similar) for sale anywhere? |
| 18:48:31 | <TomMD> | @tell dcoutts Diving into finals week here (so I don't have time to do any hacking now) but I did just send you some old patches. Feel free to let me know if they need fixing and perhaps I'll get to that on break. |
| 18:48:32 | <lambdabot> | Consider it noted. |
| 18:49:26 | <Lemmih> | sayyestolife: The closest thing I have is a Tupil sticker. |
| 18:49:54 | <TomMD> | Thats your business card? |
| 18:50:31 | <lilac> | @tell Cale Another week, another fix to the numbers package for lambdabot... |
| 18:50:32 | <lambdabot> | Consider it noted. |
| 18:50:32 | <Lemmih> | TomMD: Not mine, I'm afraid. |
| 18:50:53 | <Cale> | okay :) |
| 18:50:54 | <lambdabot> | Cale: You have 2 new messages. '/msg lambdabot @messages' to read them. |
| 18:51:20 | <dcoutts> | TomMD: ok, ta |
| 18:51:20 | <lambdabot> | dcoutts: You have 1 new message. '/msg lambdabot @messages' to read it. |
| 18:51:21 | <lilac> | thankyou, lambdabot :) |
| 18:53:06 | <ksf_> | how come a package installs fine when installed directly, but not if it's installed as a dependency? |
| 18:53:17 | <ksf_> | ...and why does cabal want to reinstall it, even though it's installed? |
| 18:53:42 | <dcoutts> | ksf_: using cabal-install-0.6.2 or 0.6.0? |
| 18:53:46 | <ksf_> | checkers-0.1.4 and reactive-0.10.7 |
| 18:54:00 | <ksf_> | 0.6.0 |
| 18:54:06 | <Baughn> | @pl \val -> readIORef sinkV >>= \c -> c val |
| 18:54:07 | <lambdabot> | (readIORef sinkV >>=) . flip id |
| 18:54:25 | <dcoutts> | ksf_: ok, upgrade and try again, I made an improvement in that area between 0.6.0 and 0.6.2 |
| 18:54:41 | <dcoutts> | ksf_: there are still circumstances where it must reinstall |
| 18:55:21 | <ksf_> | hmmm. emerge is way slower computing dependencies than cabal. |
| 18:55:33 | <dcoutts> | ksf_: heh, that's python for you |
| 18:55:42 | <dcoutts> | ksf_: just cabal install cabal-install |
| 18:56:18 | <ksf_> | nah, it's one of the haskell packages I install system-wide, so I don't feel pain nuking my .cabal and .ghc |
| 18:59:35 | <ksf_> | dcoutts, still doesn't work |
| 19:00:38 | <ksf_> | ...somehow, I doubt that quickcheck should be in the dependency list, anyway. |
| 19:01:18 | <ksf_> | or I could just begin to shout at conal. |
| 19:01:19 | <Baughn> | ACTION cries for joy |
| 19:02:35 | <ksf_> | :t filp id |
| 19:02:37 | <lambdabot> | Not in scope: `filp' |
| 19:02:40 | <ksf_> | :t flip id |
| 19:02:41 | <lambdabot> | forall b c. b -> (b -> c) -> c |
| 19:02:52 | <Baughn> | @tell conal http://hpaste.org/fastcgi/hpaste.fcgi/view?id=5355#a5355 <-- I've got it working. Perfectly. And simpler than ever. |
| 19:02:52 | <lambdabot> | Consider it noted. |
| 19:02:57 | <dcoutts> | ksf_: ok, then it's because it cannot use the installed one because it's deps would conflict |
| 19:03:13 | <dcoutts> | ksf_: if you do --dry-run with -v it'll say a bit more about why it's picking versions |
| 19:03:20 | <lament> | what should i use to catch exceptions from Prelude.read? |
| 19:03:26 | <Baughn> | ACTION found a use for "modifyMVar_ foo return" |
| 19:03:38 | <dcoutts> | lament: you'd use reads instead |
| 19:04:12 | <inimino> | filp (a, b, c, d) = (a, c, b, d) |
| 19:04:13 | <p_l> | Baughn: Did you catch my message about Tor wrt middleware? |
| 19:04:24 | <Baughn> | p_l: Yes |
| 19:04:25 | <dcoutts> | lament: reads :: Read a => String -> [(a,String)] |
| 19:04:45 | <lament> | thanks |
| 19:04:54 | <lament> | and Prelude.(!!) ? |
| 19:05:13 | <p_l> | Baughn: I guess Tor addressing scheme would work nicely for skynet |
| 19:05:34 | <ksf_> | well, the problem is that cabal wants to upgrade checkers from quickcheck 1 to 2, which fails. |
| 19:06:09 | <dcoutts> | ksf_: so checkers mis-specifies the version of QC it needs and presumably because something else needs QC 2 |
| 19:06:30 | <Baughn> | p_l: I wasn't planning to go that far, but it's possible |
| 19:06:47 | <ksf_> | ...checkers 0.1.4, in contrast to 0.1.3, doesn't specify a range for quickcheck, anymore, but uses QuickCheck.Utils... |
| 19:06:53 | <p_l> | Baughn: Mix in direct connections and you have your NAT traversingsocket layer |
| 19:06:54 | <ksf_> | COOOOONAAAAALLLLLL! |
| 19:07:22 | <dcoutts> | ksf_: you could do worse than sending a patch :-) |
| 19:07:44 | <olsner> | all monads should be monad transformers! if need be, they can add some convenience functions for FooT Identity (e.g. runFoo = runIdentity . runFooT), and for your generic functions, use type Foo a = (forall m . Monad m => FooT m a) |
| 19:07:57 | <dcoutts> | lament: you can use drop and then check if the result is empty or not |
| 19:08:02 | <aavogt> | IOT |
| 19:08:30 | <olsner> | (just an rfc, do let me know if I'm wrong) |
| 19:09:03 | <dcoutts> | olsner: sometimes performance dictates not using transformers |
| 19:09:32 | <olsner> | shouldn't the newtypes always go away for the Identity case? |
| 19:10:25 | <olsner> | but yeah, transformers probably do give the optimizer more work that it might not always be able to do |
| 19:11:34 | <centrinia> | What is an IOT? |
| 19:11:55 | <Baughn> | The IO Transformer |
| 19:12:05 | <Baughn> | It's rumored to live in the dark jungles of System.IO.Unsafe |
| 19:12:53 | <jmcarthur_work> | IO transformer?! |
| 19:13:09 | <jmcarthur_work> | supremely evil |
| 19:13:55 | <mux> | dcoutts: do you think it would be a bad idea to upload a package to hackage with more debug output just to understand what's going on? |
| 19:14:07 | <Botje> | me shoots olsner in the FooT |
| 19:14:10 | <dcoutts> | mux: yes, that's cheating ;-) |
| 19:14:17 | <mux> | heh |
| 19:14:30 | <Baughn> | mux: Better would be a version with optional debugging, via a .cabal flag |
| 19:15:03 | <olsner> | Botje: :D |
| 19:15:16 | <dcoutts> | mux: I'd rather just put it off 'til we get the code from Ross |
| 19:15:37 | <dcoutts> | mux: if it's that vital, just upload your own docs somewhere and link to them. |
| 19:15:49 | <mux> | it ain't vital |
| 19:16:06 | <olsner> | Botje: ShooT (FooT IO) () |
| 19:16:17 | <deech_> | Hi all, really simple question, is there a function that removes whitespace around a string? |
| 19:16:22 | <ksf_> | checkers uses generate and configSize out of QC1, what are their QC2 equivalents? |
| 19:16:29 | <jmcarthur_work> | Botje, i can't find this evil IOT in System.IO.Unsafe |
| 19:16:36 | <mux> | dcoutts: I'll wait then, but I guess prodding will be in order in the next few days :) |
| 19:16:37 | <Botje> | jmcarthur_work: don't look at me :) |
| 19:16:48 | <olsner> | jmcarthur: it is only rumored :) |
| 19:16:57 | <Botje> | olsner: heh heh |
| 19:17:11 | <ksf_> | ...in general, all that Util stuff is missing, which is a pita. |
| 19:17:17 | <olsner> | @quote shoot |
| 19:17:18 | <lambdabot> | foot says: You shoot yourself in the foot very elegantly, and wonder why the whole world isn't shooting itself this way. |
| 19:17:37 | <jmcarthur_work> | FooT says it! |
| 19:17:39 | <mux> | dcoutts: the only explanation I can think of right would be that his scripts are using "cabal haddock" instead of "runhaskell Setup.hs haddock" for generating the docs but that sounds highly unlikely |
| 19:18:39 | <dcoutts> | mux: I very much doubt it, it's pre-cabal |
| 19:18:46 | <dcoutts> | pre cabal-install I mean |
| 19:19:06 | <ksf_> | ACTION thinks test suites shouldn't be built by default |
| 19:20:17 | <seliopou> | > let strip = (takeWhile (not . isSpace)) . (dropWhile isSpace) in strip " something " |
| 19:20:19 | <lambdabot> | "something" |
| 19:21:09 | <aavogt> | > isSpace '\n' |
| 19:21:10 | <lambdabot> | True |
| 19:22:14 | <nibro> | dcoutts: a question for you |
| 19:22:38 | <nibro> | I'm sure you're aware of my haskell-src-exts gsoc project |
| 19:22:44 | <dcoutts> | nibro: yep |
| 19:23:01 | <nibro> | one of the first things to do in there is to parametrize parsing on what extensions are expected in the code |
| 19:23:09 | <dcoutts> | right |
| 19:23:28 | <nibro> | so I'd want a list of extensions - incidentally the same list that appears in cabal's Language.Haskell.Extension |
| 19:24:06 | <nibro> | ... which one might think would actually do better to live somewhere like haskell-src-exts in the first place |
| 19:24:07 | <dmwit> | > let strip = (takeWhile (not . isSpace)) . dropWhile isSpace in strip " something else " -- seliopou =/ |
| 19:24:08 | <lambdabot> | "something" |
| 19:24:31 | <dcoutts> | nibro: hmm, though it has to be accurate with what features compilers actually ship |
| 19:24:32 | <seliopou> | heh, right |
| 19:24:51 | <nibro> | so I'm wondering if we want *one* such module somewhere, or if each tool should keep its own list |
| 19:24:55 | <dcoutts> | nibro: I agree that the current Cabal lib seems a little heavyweight to be an appropriate home |
| 19:25:09 | <dmwit> | > let strip = join (.) (reverse . dropWhile isSpace) in strip " something else " |
| 19:25:10 | <lambdabot> | "something else" |
| 19:25:16 | <dmwit> | seliopou: How about that? =) |
| 19:25:33 | <nibro> | when you say accurate, you mean it needs to contain *at least* what compilers need, right? |
| 19:25:35 | <dcoutts> | nibro: my plan on that front is to separate the declarative bit of Cabal from the implementation of the build system. Then people should have fewer qualms about depending on the declarative bit. |
| 19:26:13 | <dcoutts> | nibro: the reason it should be shipped with the compilers is so that when a compiler adds an extension, then people can start using it immediately. |
| 19:26:15 | <aavogt> | > let strip = join fmap $ reverse . dropWhile isSpace in strip " this works too? " |
| 19:26:15 | <SamB> | dcoutts: that's a good idea |
| 19:26:16 | <lambdabot> | "this works too?" |
| 19:26:34 | <SamB> | dcoutts: will it be possible to implement support for a particular compiler seperately, somehow ? |
| 19:26:36 | <nibro> | dcoutts: is GHC using cabal's module for this? |
| 19:26:43 | <SamB> | probably not at first ... |
| 19:26:47 | <dcoutts> | nibro: yes |
| 19:26:50 | <dmwit> | aavogt: Sure, fmap = (.) |
| 19:26:58 | <dcoutts> | SamB: that's not high on the todo list |
| 19:27:18 | <nibro> | dcoutts: interesting, then it certainly needs to be kept in a more "central" location |
| 19:27:45 | <nibro> | since other tools (*cough*) might not want to depend on cabal |
| 19:27:50 | <dcoutts> | nibro: the Cabal lib is fairly central, it's a core lib shipped by every compiler (except jhc). There's no particular problem with depending on it. |
| 19:28:35 | <nibro> | dcoutts: then there is of course also the issue that haskell-src-exts currently supports some non-standard extensions |
| 19:28:57 | <nibro> | or I shouldn't say currently really, it does support them and will continue to do so |
| 19:29:03 | <dcoutts> | nibro: all extensions should be registered. They do not have to be implemented in ghc to be listed in Language.Haskell.Extensions. |
| 19:29:28 | <nibro> | so what would be the procedure to register an extension? |
| 19:29:37 | <dcoutts> | nibro: send a patch with documentation. |
| 19:29:50 | <nibro> | I'll be right on it :) |
| 19:30:11 | <Heffalump> | does jhc actively refuse to integrate with cabal/hackage then? |
| 19:30:36 | <dcoutts> | nibro: it's a central registry of extensions, so that when two compilers implement the same thing they can call it the same thing, or when the want to use the same name for different things then we can decide who got there first! |
| 19:31:05 | <nibro> | what I will want to register is XMLExpressions and RegularPatterns |
| 19:31:07 | <dcoutts> | nibro: so there needs to be enough documentation for another implementer to see if it's the same thing |
| 19:31:11 | <nibro> | any objection to those names? |
| 19:31:40 | <SamB> | XmlExpressions might be better |
| 19:31:41 | <dcoutts> | nibro: not from me, send the patch to the cabal devel list and perhaps cc the ghc and/or libraries list |
| 19:31:55 | <dcoutts> | Heffalump: pretty much |
| 19:32:23 | <Heffalump> | oh well, it's not like it's much use either :-) |
| 19:32:23 | <dcoutts> | Heffalump: I think for jhc it's supposed to be really minimal and people can install Cabal if they feel like it |
| 19:32:39 | <Heffalump> | does it have a package system etc? |
| 19:32:45 | <dcoutts> | sort-of |
| 19:33:00 | <dcoutts> | there's code in Cabal for JHC, has been for ages, but it's a bit hard to test |
| 19:33:13 | <dcoutts> | jhc cannot compile Cabal for example, or most of the packages that Cabal depends on |
| 19:33:50 | <dmwit> | > let strip = stripNoSpace . dropWhile isSpace; stripNoSpace xs = let (b, e) = break isSpace xs in b ++ stripSpace [] e; stripSpace xs [] = []; stripSpace xs (y:ys) | isSpace y = stripSpace (y:xs) ys | otherwise = reverse xs ++ y : stripNoSpace ys in strip " something else " |
| 19:33:51 | <lambdabot> | "something else" |
| 19:33:59 | <dcoutts> | John has the idea that Cabal should be able to just read a file that says "this compiler can be used like ghc, ie call it in batch mode with -c -o" |
| 19:34:01 | <skorpan> | dmwit++ |
| 19:34:09 | <dmwit> | > let strip = stripNoSpace . dropWhile isSpace; stripNoSpace xs = let (b, e) = break isSpace xs in b ++ stripSpace [] e; stripSpace xs [] = []; stripSpace xs (y:ys) | isSpace y = stripSpace (y:xs) ys | otherwise = reverse xs ++ y : stripNoSpace ys in strip (" something else " ++ undefined) |
| 19:34:10 | <lambdabot> | "something else* Exception: Prelude.undefined |
| 19:34:17 | <dmwit> | better for laziness =) |
| 19:34:38 | <skorpan> | was that piece of code your first try or did you test it externally first? |
| 19:34:41 | <dcoutts> | Heffalump: which is pretty ambitious, in practice at the moment one needs quite a bit of code to say how to find, configure and call the compiler and to establish the path conventions etc |
| 19:34:45 | <dmwit> | skorpan: first try =) |
| 19:34:48 | <skorpan> | cool :) |
| 19:35:06 | <dmwit> | I've done it before, though, so I knew which bugs to watch for. =) |
| 19:35:27 | <olsner> | how can it be the first try if you've done it before? :D |
| 19:35:35 | <dmwit> | Okay, not first try. heh |
| 19:35:41 | <skorpan> | still worth the ++ |
| 19:39:05 | <nibro> | dcoutts: I assume it's the head branch of cabal I want to send a patch to? |
| 19:39:21 | <hackagebot> | buster 2.21 |
| 19:39:23 | <dcoutts> | nibro: yep |
| 19:40:05 | <dcoutts> | nibro: ideal would be haddock docs that give a brief description plus a link to papers / websites for details. |
| 19:40:45 | <dcoutts> | nibro: do not be discouraged by the fact that many existing extensions do not give this level of detail! It's my new hardline policy. :-) |
| 19:41:32 | <nibro> | dcoutts: thanks a lot for deciding to implement it today and not tomorrow... :-) |
| 19:41:57 | <Cale> | http://www.youtube.com/watch?v=X9dpXHnJXaE -- this is amusing |
| 19:42:32 | <dcoutts> | nibro: ask Ian, he was the first to be hit with the new policy before they released 6.10 :-) |
| 19:45:44 | <nibro> | dcoutts: so just to get this right, you want me to attach a haddock comment to the constructor that I propose be added, right? |
| 19:46:51 | <dcoutts> | nibro: yes, like the example for PackageImports |
| 19:47:13 | <nibro> | right, I see it now, thanks |
| 19:47:21 | <dcoutts> | nibro: and since you've published things on each of these extensions (right?) you can link to those. (haddock uses <> for hrefs iirc) |
| 19:48:27 | <nibro> | yep, I have a paper each on them |
| 19:48:48 | <nibro> | they've evolved a bit since though, I probably should write that up on the wiki some time... |
| 19:50:07 | <olsner> | Cale: cool! |
| 19:50:35 | <olsner> | I'm amazed it actually works to connect that thing to a modern modem |
| 19:51:04 | <kpreid> | olsner: as long as the protocol is the same...! |
| 19:59:09 | <nibro> | dcoutts: what's the purpose of the knownExtensions list? |
| 19:59:33 | <dcoutts> | nibro: so that we can enumerate the buggers |
| 19:59:41 | <nibro> | (or maybe I should ask, what's the difference between that list and an enum instance?) |
| 19:59:52 | <nibro> | oh, nvm, I should think for myself |
| 19:59:53 | <dcoutts> | nibro: | UnknownExtension String |
| 19:59:59 | <nibro> | yeah, indeed |
| 20:00:42 | <dcoutts> | and it's handy to have for quicker parsing |
| 20:01:09 | <Cale> | olsner: and after 45 years, it's still functioning! |
| 20:01:54 | <byorgey> | dcoutts: what's the syntax is for the 'tested-width:' field in .cabal files? |
| 20:02:04 | <byorgey> | I couldn't find it in the documentation |
| 20:02:12 | <byorgey> | er, tested-with |
| 20:02:19 | <dcoutts> | byorgey: compiler flavour and a constraint, eg GHC == 6.8.3 |
| 20:02:32 | <byorgey> | ah, ok, thanks |
| 20:02:35 | <byorgey> | I was only slightly off =) |
| 20:03:32 | <byorgey> | dcoutts: is there a repo for the documentation somewhere? I could submit a patch |
| 20:03:46 | <dcoutts> | byorgey: yep, same repo, docs/Cabal.xml |
| 20:03:53 | <byorgey> | ah, cool |
| 20:07:04 | <paper_cc> | what can I do to debug a segfault in a Haskell program, provided that GHCi can't load it because it uses the BerkeleyDB binding? I've tracked the segfault down to a single takeMVar, but I can't reproduce it in a small program :( |
| 20:10:10 | <paper_cc> | it still segfaults if I put a readMVar here, but it doesn't do so if I use putMVar, isEmptyMVar, tryTakeMVar, or if I fill the MVar before trying to read it - that is, it fails when it tries to wait. |
| 20:10:30 | <paper_cc> | it also fails the same way if I use TMVars instead. |
| 20:15:03 | <Cale> | paper_cc: That is really interesting and strange. |
| 20:15:49 | <Cale> | paper_cc: Maybe some strange interaction between the details of that C library and GHC's concurrency? |
| 20:16:02 | <nimred> | where can i get types.h breaking my xmobar build --> http://pastebin.ca/1438277 ? |
| 20:16:15 | <paper_cc> | ACTION comments out foreign calls |
| 20:16:17 | <Cale> | paper_cc: But why can't ghci load it? |
| 20:16:40 | <paper_cc> | Cale: BerkeleyDB binding is written in C++ |
| 20:17:30 | <Feuerbach> | nimred: haven't we inferred that you're not on linux and thus cannot have linux/types.h? |
| 20:17:53 | <Cale> | paper_cc: huh? You mean the original BerkeleyDB library is in C++. The binding itself has got to be in Haskell :) |
| 20:19:25 | <paper_cc> | Cale: that is, the binding has a helper C++ file which has to be linked with C++ runtime libraries |
| 20:19:33 | <olsner> | if you have a reliable compiled test-case, you could try to gdb or strace it |
| 20:21:00 | <nimred> | Feuerbach ignoring hinotihy or inotify didn't work neither so that i prefer asking here from the begining of my problem |
| 20:21:35 | <paper_cc> | olsner: well, gdb shows no useful stack trace |
| 20:22:33 | <paper_cc> | Cale: interesting, it also segfaults when I deadlock the whole thing manually |
| 20:23:00 | <Cale> | Which binding are you using? There seem to be a number of them |
| 20:23:37 | <paper_cc> | Cale: the capitalized one =) BerkeleyDB-0.6 |
| 20:24:36 | <paper_cc> | aha |
| 20:24:54 | <byorgey> | anyone know what it means if I use 'cabal upload' and get an error '400 Error in upload'? |
| 20:24:55 | <paper_cc> | ACTION caught the point where GHC stopped producing deadlocking messages |
| 20:25:12 | <Feuerbach> | nimred: making people to guess from the beginning that you're not on linux is not fair -- it's just wasting their time. Isn't it obvious that you are not supposed to have linux/types.h? |
| 20:25:13 | <dcoutts> | byorgey: it means your proxy hates you |
| 20:25:23 | <skorpan> | byorgey: well, that means "bad request", which iirc means that it expected e.g. GET, but you made POST, etc. |
| 20:25:36 | <byorgey> | hrm |
| 20:26:05 | <byorgey> | so if I try uploading from a different network it might work? |
| 20:26:49 | <nimred> | Feuerbach you look like feeling so good to solve my problem --> do it |
| 20:26:52 | <dcoutts> | byorgey: maybe. Out of interest, what version of cabal-install and what version of HTTP do you think it was built with? |
| 20:27:25 | <byorgey> | it's cabal-install 0.6.2, pretty sure it was built with HTTP-4000.0.6 |
| 20:28:28 | <byorgey> | I guess I can just upload manually via the hackage website. |
| 20:29:39 | <Cale> | nimred: I suppose the conclusion is that it requires linux, so if you're not running linux... |
| 20:30:42 | <Feuerbach> | Cale: it's an optional dependency and he cannot figure out how to disable it |
| 20:30:52 | <Cale> | Oh, is it optional? |
| 20:30:52 | <byorgey> | hmm, that didn't work either, but I got a different error message... |
| 20:30:56 | <byorgey> | ACTION investigates further |
| 20:31:35 | <dmwit> | inotify is only required for the Mail plugin in xmobar, IIRC |
| 20:31:53 | <dmwit> | Isn't there a flag in the cabal file or something to disable it? |
| 20:32:43 | <byorgey> | dcoutts: ah, this is bad |
| 20:33:02 | <byorgey> | dcoutts: when I try to upload manually via the hackage web page I get this: |
| 20:33:24 | <byorgey> | '400 Error in upload. Unfortunately the language extensions 'PatternSignatures' break the parser in earlier Cabal versions... blah blah' |
| 20:33:32 | <byorgey> | but 'cabal check' didn't give me any warnings. |
| 20:33:54 | <byorgey> | and when I do 'cabal upload' it just says '400 Error in upload' without telling me the rest of the error. |
| 20:34:24 | <byorgey> | dcoutts: how hard do you think this is to fix? I might have a bit of time to send a patch if it isn't too bad |
| 20:34:42 | <Cale> | try: cabal install --flags="-with_inotify" xmobar |
| 20:34:56 | <Cale> | nimred: ^^ see if that helps |
| 20:35:30 | <nimred> | Cale it is ok :) |
| 20:36:14 | <nimred> | Cale : just one warning : |
| 20:36:21 | <nimred> | ": warning: warning: reference to compatibility setlocale(); include <locale.h> for correct reference" |
| 20:36:41 | <Cale> | Okay, I have no idea what that means |
| 20:37:07 | <Cale> | (I'm not xmobar's developer, I just looked in the .cabal file for what flags were there) |
| 20:37:39 | <hackagebot> | RepLib 0.2.1 |
| 20:44:13 | <mib_mf0uz8d4> | hi |
| 20:54:47 | <byorgey> | hi mib_mf0uz8d4 |
| 21:02:37 | <nibro> | dcoutts: so what would be the expected turnaround time for getting the patch applied, a version including the patch released, and a version including the patch included in the HP? |
| 21:02:51 | <nibro> | (I sent a patch now btw) |
| 21:03:54 | <tibbe> | anyone know what the actual cost of a "safe" FFI call is? |
| 21:04:01 | <inetic> | hi guys, please, what is the (>>) function called again? |
| 21:04:25 | <Botje> | "and then" :) |
| 21:04:32 | <Apocalisp> | @type (>>) |
| 21:04:34 | <lambdabot> | forall (m :: * -> *) a b. (Monad m) => m a -> m b -> m b |
| 21:04:51 | <Apocalisp> | I've heard it called "sequence". |
| 21:05:02 | <Apocalisp> | But there's sequence |
| 21:05:06 | <Apocalisp> | @type sequence |
| 21:05:08 | <lambdabot> | forall (m :: * -> *) a. (Monad m) => [m a] -> m [a] |
| 21:05:34 | <inimino> | "bind, but don't"? |
| 21:05:41 | <inetic> | :-) |
| 21:05:59 | <inetic> | I thought it has a precise one, but thanks |
| 21:08:45 | <paper_cc> | Cale: I've caught the error to some extent |
| 21:08:45 | <paper_cc> | Cale: actually, the program deadlocks, but something prevents GHC from printing out the message |
| 21:12:46 | <inetic> | I have made some pictures (as part of my learning) and I think they might fit nicely in this wiki page: http://en.wikibooks.org/wiki/Haskell/Understanding_monads , would you guys care to review them? |
| 21:14:21 | <codemac> | Is there a good example of getting a binary file into a B.ByteString? |
| 21:17:38 | <paper_cc> | codemac: \filename -> withFile filename ReadMode $ B.hGetContents |
| 21:17:54 | <glguy> | Data.ByteString.Lazy.readFile |
| 21:18:46 | <glguy> | if you want to use withFile, you'll need withBinaryFile |
| 21:21:45 | <dcoutts> | nibro: certainly in time for ghc 6.12. |
| 21:23:11 | <paper_cc> | ACTION wants a good libdb binding ... or will he write one? |
| 21:29:37 | <jeffwheeler> | Is it acceptable to run darcsweb on community.haskell.org? I think it may require using a special port, and running its own server? |
| 21:30:04 | <jeffwheeler> | Alternatively, is there some place that can mirror a repo, and provide RSS feeds for updates? |
| 21:36:38 | <Absolute0> | Instead of composing the same function twice (func . func) is there a shorter way to compose the same function n amount of times? |
| 21:37:20 | <hatds> | :t iterate |
| 21:37:22 | <lambdabot> | forall a. (a -> a) -> a -> [a] |
| 21:37:28 | <mightybyte> | What's the most common way to organize HUnit test cases? Separate test case tree, separate files in the same tree, or included with the actual code? |
| 21:37:30 | <tromp> | :t replicate |
| 21:37:32 | <lambdabot> | forall a. Int -> a -> [a] |
| 21:37:42 | <dolio> | @type \n -> foldr (.) id . replicate n |
| 21:37:44 | <lambdabot> | forall a. Int -> (a -> a) -> a -> a |
| 21:37:49 | <hatds> | @src iterate |
| 21:37:50 | <lambdabot> | iterate f x = x : iterate f (f x) |
| 21:38:05 | <hatds> | Absolute0: (iterate func) !! n |
| 21:38:25 | <Absolute0> | I guess replicate would work too :) |
| 21:39:23 | <hatds> | iterate was written for this though :) |
| 21:40:04 | <Absolute0> | let x = (iterate $ takeWhile (/= '-')) !! 2 <--fails |
| 21:40:07 | <Absolute0> | let me play with this |
| 21:40:26 | <dolio> | iterate needs an initial argument. |
| 21:41:10 | <Absolute0> | oh iterate f x.. |
| 21:41:17 | <Absolute0> | >log 5 |
| 21:41:20 | <Absolute0> | > log 5 |
| 21:41:21 | <lambdabot> | 1.6094379124341003 |
| 21:41:25 | <Absolute0> | sweet :) |
| 21:41:34 | <hatds> | > :t (iterate Just) !! 5 |
| 21:41:36 | <lambdabot> | <no location info>: parse error on input `:' |
| 21:41:37 | <Absolute0> | is lambdabot written in haskell? :-P |
| 21:41:45 | <opqdonut> | Absolute0: yeah |
| 21:41:50 | <hatds> | :t (iterate Just) !! 5 |
| 21:41:52 | <lambdabot> | Occurs check: cannot construct the infinite type: a = Maybe a |
| 21:41:53 | <lambdabot> | Expected type: a |
| 21:41:53 | <lambdabot> | Inferred type: Maybe a |
| 21:42:29 | <Absolute0> | opqdonut: I assume the creator likes southpark : http://www.haskell.org/haskellwiki/Lambdabot |
| 21:42:59 | <hatds> | > ((iterate (*2)) !! 16) 2 |
| 21:43:01 | <lambdabot> | Couldn't match expected type `[a]' |
| 21:43:22 | <glguy> | newtype F a = F (a (F a)) |
| 21:43:24 | <glguy> | iterate (F . Just) :: F Maybe -> [F Maybe] |
| 21:44:07 | <hatds> | > (\x -> (iterate (*2) x) !! 16) 2 |
| 21:44:09 | <lambdabot> | 131072 |
| 21:44:29 | <Absolute0> | composing the function twice looks much cleaner :( |
| 21:44:34 | <Absolute0> | and more readable |
| 21:44:46 | <hatds> | yea, you'll want a cleaner solution |
| 21:45:33 | <Absolute0> | > 2 ^ 16 |
| 21:45:34 | <lambdabot> | 65536 |
| 21:45:40 | <Absolute0> | hmm |
| 21:46:21 | <nibro> | you started with 2, and did *2 16 times |
| 21:46:23 | <Absolute0> | hatds: what is your lambda supposed to do? |
| 21:46:28 | <nibro> | that's 2 ^ 17 :) |
| 21:46:37 | <Absolute0> | > 2 ^ 17 |
| 21:46:38 | <lambdabot> | 131072 |
| 21:46:42 | <Absolute0> | zere we go |
| 21:47:40 | <Absolute0> | oooh MIT student :) |
| 21:48:56 | <ksf_> | @seen conal |
| 21:48:56 | <lambdabot> | I saw conal leaving #haskell, #ghc and #haskell-in-depth 3h 24m 41s ago, and . |
| 21:49:26 | <ksf_> | :q |
| 21:49:32 | <ksf_> | uhhhh... |
| 21:53:40 | <gwern> | 'Lloyd estimates the rate of Moore's Law as 108 factor of improvement in areal bit density over the past 50 years. Assuming that both storage density and computational speed will improve by a factor of 108 per 50 years, the limit will be reached in about 125 years for storage and about 250 years for operations per second. One imagines the final 125 years being spent frantically developing better compression algorithms - or advanced ... |
| 21:53:42 | <dcoutts> | jeffwheeler: generally community.haskell.org isn't powerful enough to run anything extra :-) it suffers enough with what we've got |
| 21:53:46 | <gwern> | ... theoretical physics research. ' |
| 21:53:47 | <gwern> | http://lwn.net/Articles/285790/ heh heh. |
| 21:54:02 | <gwern> | dcoutts: oh darn, I was going to set up some gitit instances on it too! |
| 21:54:05 | <jeffwheeler> | dcoutts: alright, that's why I asked :) |
| 21:54:29 | <dcoutts> | we might switch to a more powerful server, eg the sparc server |
| 21:54:48 | <TomMD> | Or make hackage-server a distributed system? |
| 21:55:01 | <gwern> | dcoutts: I'd, uh, really appreciate c.h.o remaining x86 |
| 21:55:05 | <dcoutts> | TomMD: I don't think that's necessary yet |
| 21:55:10 | <dcoutts> | gwern: you may not have that choice |
| 21:55:35 | <dcoutts> | gwern: but we can probably promise that it remains debian linux |
| 21:55:52 | <dcoutts> | gwern: what difference would it make? |
| 21:56:07 | <gwern> | well, it means I couldn't copy over any of my binaries |
| 21:56:17 | <dcoutts> | but you could compile them locally |
| 21:56:18 | <gwern> | can't copy over and test out darcs darcs, etc |
| 21:56:28 | <dcoutts> | but you can build darcs locally :-) |
| 21:56:40 | <dcoutts> | the server has masses of cpu power |
| 21:56:44 | <gwern> | after setting up an entire sparc toolchain? |
| 21:56:51 | <dcoutts> | one will be provided |
| 21:57:14 | <TomMD> | c.h.o should move to ARM... then a distributed system would be needed. |
| 21:57:34 | <jeffwheeler> | @help quote |
| 21:57:35 | <lambdabot> | quote <nick> |
| 21:57:35 | <lambdabot> | remember <nick> <quote> |
| 21:57:35 | <lambdabot> | Quote somebody, a random person, or save a memorable quote |
| 21:57:44 | <jeffwheeler> | @remember TomMD c.h.o should move to ARM... then a distributed system would be needed. |
| 21:57:45 | <lambdabot> | Nice! |
| 21:57:56 | <gwern> | @quote distributed |
| 21:57:56 | <lambdabot> | TomMD says: c.h.o should move to ARM... then a distributed system would be needed. |
| 21:58:11 | <TomMD> | :-) |
| 21:58:16 | <gwern> | @flush |
| 21:58:24 | <jeffwheeler> | ? |
| 21:58:38 | <dcoutts> | gwern: so nothing apart from concerns about building software easily? |
| 21:58:41 | <TomMD> | Save quote db to disk. |
| 21:58:59 | <TomMD> | jeffwheeler: that is what flush does, saves db to disk, if you were asking. |
| 21:59:09 | <jeffwheeler> | TomMD: yep, thanks |
| 21:59:12 | <gwern> | dcoutts: well, I am concerned that sparc seems to basically untested with the haskell ecosytem |
| 21:59:33 | <dcoutts> | gwern: ghc passes the testsuite and has a native code gen |
| 21:59:45 | <dcoutts> | that's what the project was for |
| 21:59:50 | <gwern> | (which is worth about as far as you can punt the testsuite) |
| 21:59:51 | <dcoutts> | well, and smp etc |
| 22:00:43 | <dcoutts> | well, fortunately it's not as if it can regress from the current c.h.o :-) |
| 22:00:50 | <dcoutts> | you can't run anything there atm |
| 22:01:29 | <TomMD> | But the current c.h.o builds my xen bindings properly - its nice when the c library is already installed by pure coincidence. |
| 22:02:02 | <gwern> | I ran gitit on c.h.o a few times |
| 22:04:17 | <TomMD> | Its too bad gitit hasn't made the switch to happstack. |
| 22:04:37 | <gwern> | ? |
| 22:04:49 | <TomMD> | gwern: It still uses Happs. |
| 22:05:01 | <gwern> | not really |
| 22:06:11 | <TomMD> | Humm... it does for me. I notice an OR there - what flag is it? I'd think anyone with small base set would get the updated (happstack) version. |
| 22:06:36 | <gwern> | I only use HEAD; in there I only see a plugins flag |
| 22:06:55 | <TomMD> | Well when I cabal install it wants to use HaPPs. |
| 22:07:20 | <gwern> | it's been a while since a release |
| 22:07:34 | <gwern> | john got pretty busy because of the academic year; I think he's traveling right now or soemthing |
| 22:12:17 | <dcoutts> | gwern: ah, so we should blame you when c.h.o goes insane? :-) |
| 22:12:29 | <gwern> | dcoutts: sure, why not? |
| 22:12:38 | <dcoutts> | ACTION hopes gitit doesn't take much memory |
| 22:12:54 | <gwern> | ACTION reflects that as a pseudonym, vengeance cannot be visited upon my physical head |
| 22:13:05 | <dcoutts> | heh |
| 22:13:24 | <gwern> | gitit can take a lot of memory, but that's GHC's fault |
| 22:13:26 | <dcoutts> | the server seems to go awol when we go over half memory use, probably because it's not backed by that much physical ram on the real host |
| 22:13:55 | <dcoutts> | gwern: probably best to avoid it on c.h.o then |
| 22:14:06 | <gwern> | at least for large repos |
| 22:14:10 | <RyanT5000> | what's the cleanest way to install GHC 6.10.3 on Ubuntu? 6.8.2 is the latest available in the official repos |
| 22:14:34 | <gwern> | for small repos, it's fine. my local wiki with ~700 patches peaks at 1.2% of my 3.6 gigs of ram |
| 22:14:39 | <gwern> | (seems reasonable to me) |
| 22:14:41 | <dcoutts> | gwern: using anything over 50M would be a bad thing for the server as a whole |
| 22:15:37 | <SamB> | > 0.012 * 3.6*1024 |
| 22:15:39 | <lambdabot> | 44.2368 |
| 22:16:11 | <dcoutts> | on the new sparc you could use 4 gigs and nobody would notice |
| 22:16:23 | <byorgey> | Hac phi registration is now open: http://haskell.org/haskellwiki/Hac_%CF%86 |
| 22:16:32 | <SamB> | whose new sparc? |
| 22:16:43 | <dcoutts> | SamB: the one that belongs to haskell.org |
| 22:16:48 | <dcoutts> | to the community |
| 22:16:55 | <SamB> | accessible how? |
| 22:17:05 | <SamB> | /when ? |
| 22:17:22 | <dcoutts> | we'll be giving out accounts when ben is done with his project, which should be fairly soon now |
| 22:17:42 | <dcoutts> | and we need to set up linux on it yet |
| 22:17:44 | <gwern> | the sparc project has taken longer than I expected, actually |
| 22:17:49 | <gwern> | didn't it start like last summer? |
| 22:18:00 | <dcoutts> | gwern: no, January, he's not been doing it full time |
| 22:18:13 | <gwern> | (oh. maybe last summer was when it was announced) |
| 22:18:21 | <dcoutts> | gwern: yes and we got the server last autumn |
| 22:19:56 | <jeffwheeler> | Where is the server, physically? |
| 22:20:01 | <dcoutts> | Chalmers |
| 22:20:06 | <Jedai> | RyanT5000: use the binary release from GHC homepage |
| 22:20:30 | <Tobsan> | oh, which server are we talking about? |
| 22:20:40 | <jeffwheeler> | The amount of Haskell work there is surprising and impressive . . . |
| 22:20:45 | <Jedai> | RyanT5000: install it in /usr/local and install cabal-install, with that you'll have a nice setup |
| 22:20:46 | <gwern> | our ultra-expensive multi-processor ultra sparc thingy |
| 22:20:52 | <Tobsan> | gwern: ah I see |
| 22:20:56 | <gwern> | jeffwheeler: such as? |
| 22:21:01 | <Tobsan> | I have never got to see it physically :( |
| 22:21:08 | <jeffwheeler> | gwern: just, a lot of people working on Haskell seem to be there |
| 22:21:20 | <TomMD> | Wired... lava... various verification projects |
| 22:21:23 | <jeffwheeler> | gwern: can't think of anybody specifically, just see a lot of @chalmers stuff :P |
| 22:21:35 | <gwern> | TomMD: so nothing very useful to the community then |
| 22:21:54 | <TomMD> | gwern: now now, the community can benefit from the most unexpected of things. |
| 22:21:55 | <dcoutts> | Tobsan: http://blog.well-typed.com/2008/09/the-new-haskellorg-community-sparc-server-is-online/ |
| 22:21:55 | <Tobsan> | QuickCheck? |
| 22:22:15 | <gwern> | Tobsan: I don't think benefitting from quickcheck was very unexpected... |
| 22:22:15 | <Tobsan> | dcoutts: Ah, I remember reading about this |
| 22:22:53 | <TomMD> | And thinking "damn, why didn't I apply" ?? |
| 22:23:05 | <gwern> | although I do wish quickcheck hadn't been cloned so widely... it would've been nice if we could've kept it for ourselves |
| 22:23:41 | <mapreduce> | Yeah, but it's only actually generally usable in Haskell, from what I've seen. |
| 22:23:56 | <Tobsan> | mapreduce: what about the erlang edition? |
| 22:24:19 | <mapreduce> | I haven't seen it. I'd guess the lack of typesystem makes QuickCheck more verbose there. |
| 22:24:38 | <Tobsan> | neither have I |
| 22:24:53 | <dcoutts> | mapreduce: apparently the lack of a type system makes it more useful since it also catches type errors :-) |
| 22:25:08 | <TomMD> | dcoutts: What do you think about a bundling package names with hashes in the index-00.tar.gz for client side verification? |
| 22:25:38 | <mapreduce> | I like Erlang's "types". Tuples where the first element is a symbol. Much more honest than most languages. |
| 22:26:09 | <dcoutts> | TomMD: I think that's a good idea. The index should contain a signed list of tarball hashes. |
| 22:26:29 | <TomMD> | You want it signed? I figured it would remain cheaper than real crypto, but either way. |
| 22:27:51 | <TomMD> | So the full idea is signing index-00.tar.gz, which contains hashes of the files. This as opposed to signing each package separately, allowing verification even without updated index. |
| 22:27:53 | <nibro> | actually, John Hughes likes to speak of how much *less* verbose quickcheck is in erlang since the types don't get in the way |
| 22:28:12 | <gwern> | those goshdarn types |
| 22:28:18 | <nibro> | and he once claimed that he considered quickcheck a reasonable replacement to a type system... |
| 22:28:30 | <dolio> | Hah. |
| 22:29:01 | <nibro> | John is tricky, you never really know if he means it or not :) |
| 22:29:26 | <mapreduce> | Why prove your code correct when you can write n^n tests for it? ;) |
| 22:29:29 | <dcoutts> | TomMD: I'm not sure what you mean about an updated index, but yes, it tells you a package has not been modified since it was uploaded to hackage |
| 22:29:47 | <dcoutts> | TomMD: of course whether you trust the package is your own business |
| 22:30:32 | <dcoutts> | TomMD: so it's a much simpler system than signing each package and trying to track that back to devs, but correspondingly you get less of a guarantee |
| 22:31:37 | <dcoutts> | TomMD: and yes, I think there's little point unless the index is signed. Otherwise it's just a last-hop integrity test which we can do as well using the http md5 header |
| 22:32:25 | <TomMD> | Someone should build an ECC Haskell library. |
| 22:33:55 | <duaneb> | could someone help me with some parsec stuff? |
| 22:34:16 | <duaneb> | identifier = (initial >> many subsequent) <|> peculiarIdentifier |
| 22:34:29 | <duaneb> | problem with this is, 'initial' is lost |
| 22:34:34 | <duaneb> | how can I make it not lost? :P |
| 22:34:53 | <dcoutts> | TomMD: if you're hacking on the hackage-server though I think there are more pressing issues, like doc uploads/downloads |
| 22:35:02 | <Cale> | liftM2 (:) initial (many subsequent) |
| 22:35:28 | <TomMD> | Yep, building haddock docs is perhaps the big issue followed by pretty pages and account management (creation). |
| 22:35:31 | <dcoutts> | TomMD: I started implementing a component for serving the contents of tarballs in a memory-efficient way |
| 22:35:43 | <TomMD> | Great! |
| 22:35:54 | <duaneb> | Cale: that doesn't make sense |
| 22:36:00 | <nibro> | anyone know for sure if ICFP papers can be freely distributed on your own webpage? |
| 22:36:17 | <dcoutts> | TomMD: ie maintaining a file index in memory, mapping file names to (offset,length) in the uncompressed tarball, so that serving the content would be quick. |
| 22:36:28 | <duaneb> | oh wait |
| 22:36:29 | <duaneb> | that does |
| 22:36:35 | <dcoutts> | nibro: unless they've changed the rules, yes you can. |
| 22:36:53 | <dcoutts> | TomMD: but I don't have the time to work on it in the next few months :-( |
| 22:37:27 | <nibro> | dcoutts: thanks - I'm already doing it, but if I was to put the paper in a more stable location then I really needed to know for sure ;) |
| 22:38:10 | <dcoutts> | nibro: we certainly did for our icfp paper, on the understanding we could do so. |
| 22:42:07 | <nibro> | http://www.sherpa.ac.uk/romeo.php |
| 22:42:14 | <nibro> | good site that |
| 22:42:20 | <nibro> | the answer is a definite yes |
| 22:44:18 | <genericBrandRame> | has anyone here installed the reactive-fieldtrip package? I'm having trouble with some of its dependencies |
| 22:46:18 | <ksf_> | genericBrandRame, I'm attempting to install reactive, myself. |
| 22:46:41 | <ksf_> | ...and run into issues regarding quickcheck 1 vs. quickcheck 2 |
| 22:46:49 | <genericBrandRame> | yep, same here |
| 22:47:29 | <genericBrandRame> | Could not find module `Test.QuickCheck.Utils': |
| 22:47:29 | <genericBrandRame> | it is a member of package QuickCheck-1.2.0.0, which is hidden |
| 22:48:07 | <ksf_> | conal knows about it, I just send him an email asking for some help how to best remove both checker and quickcheck dependencies from reactive... I didn't plan on running the tests, anyway. |
| 22:49:19 | <RyanT5000> | i'm having the same issue |
| 22:59:27 | <Baughn> | @type id |
| 22:59:29 | <lambdabot> | forall a. a -> a |
| 22:59:30 | <Baughn> | @type flip id |
| 22:59:31 | <lambdabot> | forall b c. b -> (b -> c) -> c |
| 22:59:33 | <Baughn> | @type flip |
| 22:59:35 | <lambdabot> | forall a b c. (a -> b -> c) -> b -> a -> c |
| 23:02:46 | <duaneb> | cycle "OM N" |
| 23:02:52 | <duaneb> | > cycle "OM N" |
| 23:02:53 | <lambdabot> | "OM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM... |
| 23:03:46 | <ksf_> | > cycle [1..] |
| 23:03:47 | <lambdabot> | [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28... |
| 23:03:51 | <Japsu> | > fix ("OM N":) |
| 23:03:52 | <lambdabot> | ["OM N","OM N","OM N","OM N","OM N","OM N","OM N","OM N","OM N","OM N","OM ... |
| 23:03:58 | <Japsu> | :( |
| 23:04:14 | <ksf_> | > fix ("OM N" ++) |
| 23:04:16 | <lambdabot> | "OM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM NOM... |
| 23:04:23 | <ksf_> | @src cycle |
| 23:04:24 | <lambdabot> | cycle [] = undefined |
| 23:04:24 | <lambdabot> | cycle xs = xs' where xs' = xs ++ xs' |
| 23:04:42 | <duaneb> | cycle 1 |
| 23:04:48 | <duaneb> | >cycle 1 |
| 23:04:51 | <duaneb> | > cycle 1 |
| 23:04:52 | <lambdabot> | No instance for (GHC.Num.Num [a]) |
| 23:04:52 | <lambdabot> | arising from the literal `1' at <inter... |
| 23:04:53 | <ksf_> | > fix (""++) |
| 23:04:56 | <Japsu> | > fix ('O':'M':' ':'N':) |
| 23:04:57 | <lambdabot> | The operator `:' [infixr 5] of a section |
| 23:04:57 | <lambdabot> | must have lower precedence th... |
| 23:04:58 | <lambdabot> | mueval-core: Prelude.read: no parse |
| 23:04:58 | <lambdabot> | mueval: ExitFailure 1 |
| 23:04:59 | <duaneb> | > cycle "1" |
| 23:05:00 | <lambdabot> | "11111111111111111111111111111111111111111111111111111111111111111111111111... |
| 23:05:14 | <ksf_> | > fix (""++) |
| 23:05:18 | <duaneb> | > cycle [1,1] |
| 23:05:19 | <lambdabot> | mueval-core: Prelude.read: no parse |
| 23:05:19 | <lambdabot> | mueval: ExitFailure 1 |
| 23:05:19 | <lambdabot> | [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,... |
| 23:06:00 | <gwern> | (ah, good ol mueval. one of the few haskell things I can be proud of) |
| 23:06:33 | <ksf_> | well, you could make her report "hey, don't give me headaches" |
| 23:07:06 | <gwern> | that is too silly & irreverent |
| 23:07:12 | <gwern> | mueval is more dignified than lambdabot |
| 23:07:13 | <iop> | is there a function: splitOn :: (a -> Bool) -> [a] -> [[a]] ; ? |
| 23:07:35 | <gwern> | iop: see the split package in hackage |
| 23:07:36 | <iop> | @hoogle (a -> Bool) -> [a] -> [[a]] |
| 23:07:37 | <lambdabot> | Distribution.Simple.Utils breaks :: (a -> Bool) -> [a] -> [[a]] |
| 23:07:37 | <lambdabot> | Prelude dropWhile :: (a -> Bool) -> [a] -> [a] |
| 23:07:37 | <lambdabot> | Prelude filter :: (a -> Bool) -> [a] -> [a] |
| 23:08:08 | <gwern> | yeah, you shouldn't use that Distribution one :) |
| 23:09:14 | <aconbere_> | anyone here know much about optimizing hopengl performance? |
| 23:09:27 | <aconbere_> | I'm new to both opengl and hopengl and haskell! so this is fun :) |
| 23:09:50 | <ksf_> | ...well, if it's slower than opengl/c, report a bug. |
| 23:09:56 | <TomMD> | aconbere_: The first step is in knowing what (if anything) is performing poorly. |
| 23:09:56 | <aconbere_> | that's fair |
| 23:10:00 | <aconbere_> | yeah |
| 23:10:03 | <aconbere_> | so I've run the profiler |
| 23:10:04 | <TomMD> | aconbere_: So start profiling! |
| 23:10:08 | <TomMD> | good |
| 23:10:21 | <aconbere_> | and I guess I'm just suprised by the cose of rendering some of the basic primitives I'm using |
| 23:10:24 | <aconbere_> | (squares) |
| 23:10:26 | <aconbere_> | cost |
| 23:10:39 | <ksf_> | aconbere_, you could be stressing the command pipeline. |
| 23:11:09 | <ksf_> | (or be running software gl...) |
| 23:11:28 | <aconbere_> | ACTION nods |
| 23:12:07 | <aconbere_> | this is the profile output form the function that renders the squares |
| 23:12:11 | <aconbere_> | renderQuad Shape 587 1676579 14.4 44.7 0.0 0.0 |
| 23:12:22 | <aconbere_> | maybe a key would help as well :) |
| 23:12:37 | <aconbere_> | COST CENTRE MODULE no. entries %time %alloc %time %alloc |
| 23:13:20 | <ksf_> | uhhh... If I'm not really mistaken, you shouldn't be able to derive much meaning out of the profile, as you're basically talking over a socket. |
| 23:13:24 | <aconbere_> | so basically rendering probably... 200 2D squares is taking up most of the time |
| 23:13:33 | <aconbere_> | hmmm |
| 23:13:35 | <aconbere_> | that's fair |
| 23:13:40 | <TomMD> | So you are running it 16M times - is that more than you'd expect? Sometimes I find that I can drastically reduce the number of calls because some calls are unneeded (or a I can use a smarter alg). |
| 23:13:56 | <ksf_> | or display lists. |
| 23:14:15 | <aconbere_> | display lists? |
| 23:14:15 | <ksf_> | if you're sending unchanging geometry to the renderer on every frame, you're doing it wrong. |
| 23:14:41 | <ksf_> | they safe gl commands to be executed later, and multiple times. |
| 23:14:49 | <aconbere_> | ah yes |
| 23:14:56 | <aconbere_> | well maybe the answer is to actually read the red book |
| 23:14:58 | <ksf_> | ...and the renderer can pre-compile them and do other smart stuff |
| 23:15:09 | <ksf_> | that's an excellent idea. |
| 23:15:28 | <aconbere_> | I'm definitely sending non-changing pieces to the render, but basically as a side effect of how I've created my map / finding intersections etc. |
| 23:15:46 | <aconbere_> | I could probably isolate a number of the non-change pieces though |
| 23:15:57 | <aconbere_> | which definitely make up a bulk of those calls |
| 23:16:03 | <aconbere_> | ACTION goes off to poke around |
| 23:18:26 | <aconbere_> | thanks :) |
| 23:20:01 | <skorpan> | hi, i have a problem which i kind of understand, but i'm not sure how to get around it... |
| 23:20:02 | <skorpan> | lol = Hello <$> sym "hello" <|> World <$> sym 2 |
| 23:20:02 | <skorpan> | sym x = symbol (== x) |
| 23:20:25 | <skorpan> | by 'sym "hello"' it infers that the function works with Strings, but the function itself is polymorphic |
| 23:20:41 | <skorpan> | how do i get around this problem? |
| 23:21:26 | <Botje> | explicit type annotation |
| 23:21:35 | <ksf_> | you can't have a function that's polymorphic between "hello" and 2, they share no usable common class. |
| 23:21:48 | <Botje> | Eq? |
| 23:21:57 | <ksf_> | oh. yeah. |
| 23:22:18 | <iop> | how can I regex in haskell? |
| 23:22:28 | <skorpan> | Botje: you mean i should give "sym" an explicit type? |
| 23:22:33 | <Botje> | yes |
| 23:22:39 | <skorpan> | okay, makes sense. |
| 23:22:44 | <ksf_> | there's multiple regex libraries, take your pick, or use a proper parser library like parsec/polyparse |
| 23:23:11 | <ksf_> | I'd recommend a parser library, they tend to be less messy. |
| 23:28:03 | <whoppix> | http://www.getacoder.com/projects/detect_loop_106243.html < someone feels like solving the halting problem today? :) |
| 23:29:45 | <aconbere_> | is there a way to create portable executables via ghc / hugs? |
| 23:29:50 | <ksf_> | "suspectible" is nice. you can just collect fixpoints and print them. |
| 23:31:08 | <ksf_> | ghci is a bytecode interpreter, so I guess it wouldn't be too much work to hack something up. |
| 23:31:11 | <int-e> | or modify a compiler to inject infinite loops |
| 23:31:20 | <sjanssen> | aconbere_: how portable? |
| 23:31:43 | <sjanssen> | GHC executables are portable to like architectures and operating systems |
| 23:32:05 | <mmorrow> | and if you -static, you just need the same libc |
| 23:33:12 | <aconbere_> | sjanssen: yeah I guess I'm just wondering if I need to pass some options to GHC to staticlly link libraries, etc. |
| 23:33:29 | <aconbere_> | I haven't /tried/ running any of my executables on other machines |
| 23:33:37 | <aconbere_> | which really I suppose would answer my question |
| 23:33:42 | <mmorrow> | you need to pass the necessary opts to the linker |
| 23:33:57 | <mmorrow> | -optl-static -optl-lgmp -optl-l... |
| 23:34:21 | <ksf_> | you should be automagically fine on linux/osx/windoze, except if you use low-level stuff like posix sockets or something. |
| 23:34:37 | <sjanssen> | aconbere_: GHC doesn't have many dynamic links by default |
| 23:34:54 | <sjanssen> | aconbere_: GMP is the only one AFAIK |
| 23:34:56 | <mmorrow> | yeah, sometimes -optl-static Just Works, and sometimes you have to mess with optl-.. options |
| 23:36:11 | <iop> | is there a function f = drop 1 ? |
| 23:36:36 | <ksf_> | > let f = drop 1 |
| 23:36:38 | <lambdabot> | not an expression: `let f = drop 1' |
| 23:36:49 | <ksf_> | > let f = drop 1 in f "foo" |
| 23:36:50 | <lambdabot> | "oo" |
| 23:37:02 | <ksf_> | I think it's called "tail". |
| 23:37:52 | <aconbere_> | haha |
| 23:38:29 | <dibblego> | > dropWhile (== '0') &&& length $ "00123" -- what operation do I want for ("123", 3) ? |
| 23:38:31 | <lambdabot> | ("123",5) |
| 23:39:55 | <mmorrow> | > (id &&& length) . dropWhile (== '0') $ "00123" |
| 23:39:56 | <lambdabot> | ("123",3) |
| 23:40:15 | <dibblego> | hmm thanks |
| 23:40:31 | <gwern> | @src tail |
| 23:40:31 | <lambdabot> | tail (_:xs) = xs |
| 23:40:31 | <lambdabot> | tail [] = undefined |
| 23:40:33 | <iop> | duht tail yes |
| 23:40:49 | <gwern> | tail isn't the same as drop 1, as you can see. they deal with empty lists differently |
| 23:40:51 | <dibblego> | tail /= drop 1 |
| 23:41:01 | <gwern> | @check \x -> tail x == drop 1 x |
| 23:41:02 | <lambdabot> | "* Exception: Prelude.tail: empty list |
| 23:41:06 | <idnar> | > drap 1 [] |
| 23:41:07 | <lambdabot> | Not in scope: `drap' |
| 23:41:10 | <idnar> | > drop 1 [] |
| 23:41:12 | <lambdabot> | [] |
| 23:41:23 | <mmorrow> | > take 100000000000000000 [] |
| 23:41:25 | <lambdabot> | [] |
| 23:41:36 | <gwern> | @src take |
| 23:41:37 | <lambdabot> | take n _ | n <= 0 = [] |
| 23:41:37 | <lambdabot> | take _ [] = [] |
| 23:41:37 | <lambdabot> | take n (x:xs) = x : take (n-1) xs |
| 23:42:42 | <gwern> | hm. how is take evaluated for 'take 100 []'? does it pattern match on [] first and fall through to [], or does it do positive-number test first and then return []? |
| 23:43:12 | <mmorrow> | i'd think the posnum test first, then matches [] |
| 23:43:38 | <idnar> | > take 100 [1,2] |
| 23:43:38 | <mmorrow> | , take (negate 10000000000000) [0..] |
| 23:43:39 | <lambdabot> | [1,2] |
| 23:43:40 | <lunabot> | [] |
| 23:43:53 | <gwern> | mmorrow: that seems inefficient, then |
| 23:43:54 | <mmorrow> | , take (negate 10000000000000) undefined |
| 23:43:55 | <lunabot> | [] |
| 23:44:31 | <idnar> | > take (negate 100) undefined |
| 23:44:32 | <mmorrow> | gwern: true, i'd hope in the real implem they don't test for negative every loop |
| 23:44:33 | <lambdabot> | [] |
| 23:44:50 | <gwern> | mmorrow: I suppose we could check the core... |
| 23:45:04 | <mmorrow> | (or GHC.List (or whatever)) |
| 23:46:06 | <dolio> | It has to test for 0 every iteration anyway. |
| 23:46:12 | <mmorrow> | take n _ | n <= 0 = []; take n xs = let go _ [] = []; go 0 _ = []; go n (x:xs) = x : go (n-1) xs in go n xs |
| 23:46:21 | <mmorrow> | actually, you have to test for 0 anyways.. |
| 23:46:24 | <mmorrow> | yeah |
| 23:46:39 | <gwern> | why do you have to test for zero? |
| 23:46:54 | <mmorrow> | because how else would you know when to stop? |
| 23:47:00 | <gwern> | if the second arg is [], then you can instantly stop there and return [] |
| 23:47:11 | <mmorrow> | , take 10 [0..] |
| 23:47:12 | <lunabot> | [0,1,2,3,4,5,6,7,8,9] |
| 23:47:30 | <mmorrow> | without the 0 test, that never would finish |
| 23:48:22 | <dolio> | The only question is whether "n <= 0" turns into two operations or one. |
| 23:48:33 | <mmorrow> | yeah, true |
| 23:48:45 | <dolio> | It's probably 2. |
| 23:48:47 | <mmorrow> | ACTION looks at the asm |
| 23:49:15 | <dolio> | Unless it does some fancy stuff for 0 comparisons. |
| 23:49:49 | <dolio> | Or, I suppose you could always turn it into one operation, but whatever. |
| 23:50:35 | <ksf_> | ACTION bets you're going to find a jle |
| 23:50:38 | <dolio> | I know that compare on Ints isn't terribly optimal. |
| 23:51:02 | <mmorrow> | what's "jb" again? |
| 23:51:16 | <ksf_> | below. |
| 23:51:20 | <ksf_> | that's the inverse of le |
| 23:51:38 | <ksf_> | wait, no, taht'll be ja |
| 23:51:55 | <mmorrow> | JB Jump if Below |
| 23:52:11 | <ksf_> | wtf does ghc do there? |
| 23:52:21 | <idnar> | jb == jl right? |
| 23:52:36 | <ksf_> | modulo signedness, yes. |
| 23:53:04 | <idnar> | oh right, signedness |
| 23:53:10 | <ksf_> | there's also other equivalences due to bit reprentation, I constantly forget them. |
| 23:53:36 | <ksf_> | if you don't see another je or jne, it's one operation. |
| 23:53:36 | <mmorrow> | hmm, it's hard to tell since i don't see any tests against an immediate $0 or $1 |
| 23:55:20 | <dolio> | There's actually a <=# primop. |
| 23:55:21 | <dolio> | How nice. |
| 23:55:41 | <TomMD> | @seen shapr |
| 23:55:42 | <lambdabot> | shapr is in #haskell-blah and #haskell. I last heard shapr speak 14m 14s ago. |
| 23:55:56 | <mmorrow> | oh yeah, i forgot what we're looking for |
| 23:56:03 | <mmorrow> | yeah, it looks like it's one op |
| 23:56:18 | <iop> | is there something about \n00 that makes zeros be regarded as terminating or newline chars? |
| 23:56:24 | <iop> | as opposed to just \n |
| 23:56:48 | <ksf_> | there's CString |
| 23:57:03 | <idnar> | ksf_: '0' is not a NUL |
| 23:57:35 | <mmorrow> | here's the asm + hs if anyone want to look http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=2515#a2515 |
| 23:57:38 | <mmorrow> | (x86_64) |
| 23:57:56 | <sjanssen> | iop: that string is just a newline followed by two '0' characters |
| 23:57:59 | <ksf_> | well, if it's that, then the answer is map (\x -> if x == '0' then '\n' else x) |
| 23:58:34 | <mmorrow> | ooh wait, it might be two tests |
| 23:59:15 | <shapr> | TomMD: You called? |
| 23:59:19 | <mmorrow> | preflex: zdec ghczmprim_GHCziTypes_ZMZN_closure |
| 23:59:19 | <preflex> | ghc-prim_GHC.Types_[]_closure |
| 23:59:36 | <ksf_> | wow |
| 23:59:50 | <TomMD> | shapr: I just wanted you to know that every time I google for anything new on h@lvm your IRC statement always comes up first. |
Back to channel and daily index: content-negotiated html turtle