<<25-04-2013>>

00:20:56*fowl quit (Read error: Connection reset by peer)
00:25:04*Trixar_za is now known as Trix[a]r_za
01:13:35*fowl joined #nimrod
01:28:46*erlnoob joined #nimrod
02:22:38*Trix[a]r_za is now known as Trixar_za
03:01:12*Boscop quit (Read error: Connection reset by peer)
03:02:30*Boscop joined #nimrod
03:35:07*Trixar_za is now known as Trix[a]r_za
03:49:54*OrionPK quit (Quit: Leaving)
03:57:38*fowl quit (Ping timeout: 258 seconds)
04:02:05*fowl joined #nimrod
07:33:27*fowl quit (Ping timeout: 258 seconds)
07:38:44*fowl joined #nimrod
08:26:43*erlnoob quit (Quit: erlnoob)
09:05:34*fowl_ joined #nimrod
09:05:46*fowl_ quit (Remote host closed the connection)
10:48:33*fowl quit (Ping timeout: 258 seconds)
10:57:14*xcombelle joined #nimrod
11:22:06*Roin_ joined #nimrod
11:26:52*comex` joined #nimrod
11:29:18*reactormonk quit (*.net *.split)
11:29:19*Roin quit (*.net *.split)
11:29:19*comex quit (*.net *.split)
11:30:09*reactormonk joined #nimrod
11:34:05*Roin_ is now known as Roin
11:48:38*Trix[a]r_za is now known as Trixar_za
12:13:34*q66 joined #nimrod
12:55:34*XAMPP joined #nimrod
12:55:34*XAMPP quit (Changing host)
12:55:34*XAMPP joined #nimrod
14:04:20*XAMPP_ joined #nimrod
14:07:53*XAMPP quit (Ping timeout: 258 seconds)
15:09:40dom96hello
15:13:59reactormonkmorning
15:18:22*comex` is now known as comex
16:32:44*Trixar_za is now known as Trix[a]r_za
17:14:43*zahary_ quit (Read error: Connection reset by peer)
17:15:30*zahary_ joined #nimrod
17:29:24*fowl joined #nimrod
18:21:49*zahary joined #nimrod
18:28:38*xcombelle quit (Remote host closed the connection)
18:48:19fowltype TMaybe*[T] = tuple[has: bool, val: T]
18:51:21dom96https://gist.github.com/dom96/5462115
18:52:05fowli like that
18:52:16*apotheon quit (Read error: Connection reset by peer)
18:52:23*apotheon joined #nimrod
18:52:23*apotheon quit (Changing host)
18:52:23*apotheon joined #nimrod
18:52:39dom96Inspired by haskell ;)
18:53:53*Roin quit (Ping timeout: 240 seconds)
18:56:31fowlthat is not very safe though
18:56:47fowli just hit enter and got Error: unhandled exception: value is not accessible [EInvalidField]
18:57:35dom96indeed. that's just testing code.
18:57:52dom96I haven't fully developed it
18:58:06dom96also that code is probably at least a year old :P
18:58:37dom96you need a way to get the value out of it safely.
18:58:39fowlin haskell how do you use it? i cant read haskell at all, needs more parens or something
18:59:03*Roin joined #nimrod
18:59:15dom96in haskell you would pattern match to retrieve the value
18:59:28dom96or have functions which work on the Maybe
19:00:06dom96It should be composable.
19:00:12dom96so
19:00:17fowlno idea what that means
19:00:24fowlsry
19:00:41dom96You should implement something like:
19:01:31dom96hrm.
19:02:01dom96proc `>>`[T](m: TMaybe[T], m2: TMaybe[T]): TMaybe[T]
19:02:30dom96safeReadLine() >> safeAdd("blah")
19:02:47dom96If m is Nothing then it should simply return Nothing.
19:03:24dom96er, hrm
19:03:30dom96no that doesn't make sense lol
19:03:58dom96It should work on functions.
19:04:38dom96proc `>>`[T](m: proc (): TMaybe[T], m: proc (): TMaybe[T]): TMaybe[T]
19:04:47dom96But we would need currying first.
19:05:09dom96It really makes more sense in Haskell
19:05:12fowli like this better its shorter :) https://gist.github.com/fowlmouth/5462239
19:05:16dom96because of the way Haskell does currying
19:06:29dom96In Haskell Maybe is a monad...
19:06:37dom96So it works well with everything else.
19:07:28dom96might want to set has to true when assigning :P
19:07:42fowlyea i forgot about that
19:07:45dom96I prefer my approach with the object variant.
19:07:58dom96Your approach will hide errors.
19:07:58fowli thought the goal for maybe was just to guard it
19:08:37dom96Maybe, I dunno.
19:09:04fowlmaybe[t] doesnt have to be immutable, you should be able to set/unset it imo
19:09:14reactormonkfowl, you know, you can also have TEither with T and Unit
19:09:22dom96I don't see the point.
19:09:28dom96You can just use Just :P
19:10:25dom96fowl: If you feel like playing around, you should try to write a curry macro.
19:13:06fowldom96: this is currying right https://gist.github.com/fowlmouth/5462316
19:14:04dom96pretty much
19:14:19dom96but it shouldn't be restricted to that proc type
19:14:27dom96which is why a macro is necessary I guess
19:14:28fowlyea
19:14:36fowli can write a macro for that :>
19:15:26dom96cool
19:16:24dom96hrm, interesting.
19:17:09fowldom96: hey do you know how to get someones host name from an async socket
19:17:24dom96use acceptAddr
19:18:50dom96gah, doc gen for the sockets module is broken.
19:19:15dom96There is another function which you need to use to transform the IP address that you get from acceptAddr into a hostname
19:19:28fowlasyncio has broken docs too
19:19:42dom96getHostByAddr IIRC
19:23:09fowlcool thanks
19:28:43fowli dont think i can use a macro
19:29:00dom96why?
19:29:02fowlgiven curry(foo, args..) i dont have a way to find out what foo is unless its a literal proc
19:29:41fowlhowever with curry generics with 1-9 generic params you could probably curry any function
19:30:06dom96Yeah, but that's a bit bleh.
19:30:13dom96Wait until Araq shows up and ask him.
19:44:35fowlhm i have problems when trying to curry a function that returns void
19:45:56fowlcurry[int, void](squaz, 9001)() works but curry(squaz, 9001)() is a no-go =(
19:50:25dom96that kinda sucks :\
19:50:50reactormonkfowl, can't you ask the compiler for type information?
19:51:28fowlreactormonk: its not matching the function to the generic
19:53:13fowlah it matches proc curry[A] (func: proc(someA: A), valueA: A): proc()
19:53:25fowlthat will be annoying to have a no-return variant for each of these
19:59:20dom96yeah, which is why we should just have a macro :P
20:30:04fowlif its possible to get the info needed and match to the right function, sure
20:35:19*zahary quit (Quit: Leaving.)
21:01:06dom96fowl: how far are you planning to take your ircd?
21:14:01fowlprobably just basic functionality
21:14:08*Amrykid_ joined #nimrod
21:15:34*Amrykid quit (*.net *.split)
21:19:03AraqI'm here now
21:19:25Araqwhat's the question?
21:20:19dom96read the log, there isn't much of it.
21:20:30Araqand why don't people get that currying is trivial in every language with closures: f(x, y) = f_x(y)
21:21:45dom96sure it's "trivial", but it requires you to write way too much code to accomplish.
21:22:56fowlthis is my solution https://gist.github.com/fowlmouth/5462316 there's a problem that functions returning void dont match so it would require duplicates for void functions
21:26:15Araqfowl: looks easy to support, make a bug report please
21:26:34Araqin fact, it looks like 1 missing line in the compiler :-)
21:27:22fowlok
21:27:37fowlis there a limit for generics
21:29:06Araqwell we don't have variadic generics yet as you noticed ;-)
21:29:27Araqthere is no limit in the compiler though
21:31:23dom96what about implementing this curry as a macro?
21:32:00Araqwhat about it? should be possible
21:32:07dom96read the logs
21:33:30*Amrykid_ is now known as Amrykid
21:34:25Araqwell the macros API is missing a 'getProcBody(s: PSym)' then
21:34:46Araqor rather a getProcImpl()
21:34:59Araqwhich would include the parameter list
21:35:13fowlonly need the params and return type i think
21:35:18*Amrykid quit (Changing host)
21:35:18*Amrykid joined #nimrod
21:36:10Araqyeah but getProcImpl is more flexible :P
21:41:08reactormonkAraq, getProcImpl and getProcSig?
21:41:58AraqgetProcSig(n) = getProcImpl(n)[2]
21:42:10fowlyea that would be dope
21:42:25reactormonkAraq, so you don't have to look up the magic number 2
21:42:39fowlfuzz reflection, i could do miracles with compile-time introspection
21:43:03Araqreactormonk: yes sure, however macros.nim mostly gives you the bare bones
21:43:29Araqwe have macros_dsl to hide the magic numbers
21:43:38reactormonkkk
21:44:41Araqsomehow nobody gets the real point behind the macros api :P
21:44:50reactormonk^^
21:44:59Araqthe compiler itself uses the very same AST
21:45:19Araqwhich means once you mastered it, the step to become a compiler dev is small :P
21:46:01fowlAraq: building the nodes with macros.add is archaic and tedious, requiring you to declare each small part
21:46:20fowlplease make add() function like my und()
21:46:36Araqhe he, that's what I wanted to do
21:46:47Araqand I know that it's tedious
21:47:56Araqthe macros.nim is mostly an experiment; it's never really been designed
21:48:34fowlis the dsl in stdlib now
21:48:46AraqI guess it was so hard to implement that that used up all of my brain :P
21:49:20Araqand no, it's still not in the stdlib, sorry
21:49:21fowli looked at the impl of mAdd, code is scary >_>
21:49:29reactormonkfowl, ^^
21:49:39reactormonkI take > 10 lines as scary
21:50:11Araqfowl: as I said, it was mostly an experiment ...
21:51:23AraqI wondered if it can be made to work this way :P
21:51:41fowlyou could rename it to addNode and add und as add
21:51:52Araqno need
21:52:02Araqthe builtin add can easily return the node
21:52:12Araqand be .discardable of course
21:54:02Araqfowl: try this: replace 'result = emptyNode' with 'result = a' in evals.nim:1102
21:54:13Araqsame for mNAddMultiple
21:54:24Araqchange the prototypes in macros.nim
21:54:29Araqand try it out please
21:54:36Araqif it works, make a pull request
21:54:50fowlok
21:55:03AraqI'm busy rewriting the JS backend
21:56:44reactormonk\o/
21:57:14Araqreactormonk: if you want to help with it you better learn luajit ;-)
21:57:41Araqbecause it's soon a luajit code generator at the same time
21:57:58fowlneat :]
22:03:42reactormonkAraq, luajit? Never heard of.
22:03:55Araqlol
22:04:44Araqyeah, a JIT for a dynamic language that generates on par code with GCC for floating point stuff ... why should you have heard of it? :P
22:06:51reactormonknot bad
22:27:49dom96Araq: I think the newparser branch breaks docgen for sockets/asyncio
22:28:41Araqyeah haven't checked docgen with it
22:33:58*OrionPK joined #nimrod
22:34:37*Trix[a]r_za is now known as Trixar_za
23:30:23*q66 quit (Remote host closed the connection)