|
gonadic io posted:io is literally the reason that monads exist in haskell. drat I knew it was one way or the other but couldnt remember which way
|
# ? Mar 21, 2016 20:07 |
|
|
# ? May 12, 2024 03:12 |
|
Plorkyeran posted:like the whole point of ?. and >>= is to let you call a function from A -> B on a value of A? and get a result of B? no, it's a null-safe dereferencing helper, butt.?trash.?poo poo.?smegma all of those intermediate properties can be of any type, and i'm pretty sure any ultimate result is going to be nullable
|
# ? Mar 21, 2016 20:08 |
|
Plorkyeran posted:like the whole point of ?. and >>= is to let you call a function from A -> B on a value of A? and get a result of B? you just described what haskell calls a functor. think like mapping over a list >>= is to let you call a function from A -> B? on a value of A? and get a B?
|
# ? Mar 21, 2016 20:11 |
|
pretty sure ?. is basically snytactic sugar for if(lhs != null) return lhs.rhs; else return null; which, yeah, is basically the same as Maybe a >>= a -> Maybe b
|
# ? Mar 21, 2016 20:12 |
|
Awia posted:that's cheating Is it just me or does it smell like "amonad" in here?
|
# ? Mar 21, 2016 20:12 |
|
Bloody posted:pretty sure ?. is basically snytactic sugar for the definition on Maybe is like code:
fart simpson fucked around with this message at 20:24 on Mar 21, 2016 |
# ? Mar 21, 2016 20:17 |
|
E: nvm
gonadic io fucked around with this message at 20:27 on Mar 21, 2016 |
# ? Mar 21, 2016 20:22 |
|
hackbunny posted:you want a technical windows debugger with an arcane command language, try windbg. it's not as nice as vs, it's only really good for debugging native code where vs will let you debug scripts and tsql and .net and whatnot, but it's super low level, in some regards lower than even gdb. it has surprising uses too, like you can use it as a disassembler (by loading an executable as a crash dump), you can debug the live kernel (can't set breakpoints ofc) to read low level system data, you can diagnose bsods by loading crash dumps and using the !analyze extension. it used to be available as a standalone but it seems nowadays you have to download the whole driver development kit to get it i did take a look at it out of curiosity before, but i don't have any use for it that would make it worthwhile to spend time learning it. the only feature the vs debugger doesn't have (last time i checked) which i wish it did, but which windbg does have, is automatically attaching to all processes spawned by a process which you're already attached to. learning windbg just for that is kind of overkill, even if it would make things a lot easier sometimes i do know that when there's a bug that seems to be coming from some microsoft code, they'll sometimes ask to attach windbg and tell you to type in some incomprehensible series of character that makes perl look normal and then send them the result
|
# ? Mar 21, 2016 20:23 |
|
gonadic io posted:That's the definition of map, >>= doesn't insert a Just at the end and instead lets f decide to return a Just or a Nothing oh yah i wrote the wrong thing and just edited it
|
# ? Mar 21, 2016 20:24 |
|
Hey Bloody, a good exercise is implementing Functor and Monad (and applicative) for a bunch of Base types like Maybe, List and Identity Applicative on lists has two possible valid but different ways of doing it that behave totally differently data Identity a = Iden a
|
# ? Mar 21, 2016 20:26 |
|
fart simpson posted:oh yah i wrote the wrong thing and just edited it this is why i like haskell btw, if i was actually writing that it wouldnt compile and i would have seen the problem right away
|
# ? Mar 21, 2016 20:26 |
|
i have no idea how to parse but i made a type for representing verilog numeric literals and defined a function to convert them to actual numbers
|
# ? Mar 21, 2016 20:31 |
|
code:
this was the first rube goldbergian attempt that actually worked
|
# ? Mar 21, 2016 20:32 |
|
gonadic io posted:Hey Bloody, a good exercise is implementing Functor and Monad (and applicative) for a bunch of Base types like Maybe, List and Identity thats easy code:
|
# ? Mar 21, 2016 20:33 |
|
itt liveblogging haskell learning time
|
# ? Mar 21, 2016 20:34 |
|
http://www.imada.sdu.dk/~rolf/Edu/DM22/F06/haskell-operatorer.pdf i found that useful when i was learning haskell
|
# ? Mar 21, 2016 20:36 |
|
gonadic io posted:Hey Bloody, a good exercise is implementing Functor and Monad (and applicative) for a bunch of Base types like Maybe, List and Identity I should reiterate that this is in no way necessary to use Haskell, only to make it less magical.
|
# ? Mar 21, 2016 20:36 |
|
Awia posted:http://www.imada.sdu.dk/~rolf/Edu/DM22/F06/haskell-operatorer.pdf ive never used some of those
|
# ? Mar 21, 2016 20:37 |
|
>@> wtf lol, never heard of tht before. it's not in control.monad.
|
# ? Mar 21, 2016 20:42 |
|
p.s. if anybody was curious about io pre monads, there essentially wasn't any: http://stackoverflow.com/questions/17002119/haskell-pre-monadic-i-o
|
# ? Mar 21, 2016 20:53 |
|
Bloody posted:
p.s. don't reverse right before summing. (unless you're using a really wacky integral type for which + isn't associative but I doubt this) i'd go with code:
but what you came up with was not at all terrible gonadic io fucked around with this message at 21:10 on Mar 21, 2016 |
# ? Mar 21, 2016 21:06 |
|
Oh yeah good point there's probably a better way with zero reverses tbh
|
# ? Mar 21, 2016 21:08 |
|
if you reverse your indexes so instead of starting from 0 and going up you start from len - 1 and go down then you wont need to reverse will you?
|
# ? Mar 21, 2016 21:13 |
|
Bloody posted:Oh yeah good point lists being singly linked makes this harder than you think. you could zip with "iterate (negate 1) (length a -1)" to get a list counting down but length is O(n) anyway so there's no point. e: if you're using a type where length doesn't traverse the whole collection then it's for sure better (or if you know your length ahead of time) but the default list type won't see an improvement using length
|
# ? Mar 21, 2016 21:14 |
|
default lists in haskell seem like the wrong choice for a lot of things
|
# ? Mar 21, 2016 21:17 |
|
like String
|
# ? Mar 21, 2016 21:17 |
|
fart simpson posted:default lists in haskell seem like the wrong choice for a lot of things yes. really yes. parsing? poo poo. string operations? poo poo. unicode? unusable. anything at all that isn't iterating once over them? poo poo. there's a reason that the first answer on every single SO "why is this haskell code slow?" is to stop using the default lists they are easily remimplementable by beginners though. on the other hand, most other langs have opaque types just fine so i don't see this as much of an advantage. god haskell's lists get me mad one of valeyard's questions when he was learning was "how to do string replace"? the answer is literally to convert to data.text, do the op, and then go back again. or use the regex library which i'm sure does the same thing with worse syntax.
|
# ? Mar 21, 2016 21:19 |
|
the actual answer is to just use Data.Text instead of using String at all
|
# ? Mar 21, 2016 21:23 |
Bloody posted:Oh yeah good point I'd do this: code:
|
|
# ? Mar 21, 2016 22:03 |
|
i think gdb is ok but ive mainly used it on server code in controlled scenarios like tracing a deadlock in a stress test across multiple multithreaded processes which is regardless of what debugger im using
|
# ? Mar 22, 2016 00:01 |
|
one distributed systems ppl might find interesting: http://arxiv.org/pdf/1602.02672v1.pdf quote:Learning to Communicate to Solve Riddles with
|
# ? Mar 22, 2016 00:25 |
|
i parsed a csv file
|
# ? Mar 22, 2016 13:19 |
|
Bloody posted:i parsed a csv file
|
# ? Mar 22, 2016 14:18 |
|
i put a rather wide data bus in my fpga and now the toolchain is crashing and its just doing pre-synthesis checks lmao gently caress fpga tools forever
|
# ? Mar 22, 2016 15:58 |
|
literally all it is doing right now should be emitting code that says reallyWidePortA -> reallyWidePortB. a CPU core has been pegged for several minutes to accomplish this task.
|
# ? Mar 22, 2016 16:03 |
|
https://petitions.whitehouse.gov/petition/outlaw-programming-languages-threaten-safety-american-people-and-work-counter-our-way-life javascript doesn't belong in that list.
|
# ? Mar 22, 2016 17:19 |
|
shock horror, workmen blaming the tools for their own failings.
|
# ? Mar 22, 2016 17:23 |
|
Or it's a joke
|
# ? Mar 22, 2016 17:31 |
|
Finster Dexter posted:Or it's a joke jokes? in my internet?
|
# ? Mar 22, 2016 17:39 |
|
|
# ? May 12, 2024 03:12 |
Bloody posted:i parsed a csv file Nice! Did you handle escaping and everything?
|
|
# ? Mar 22, 2016 18:15 |