Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-24 14:25:22 <dminuoso> ski: Mmm good question. I think it doesn't matter.
2020-11-24 14:25:43 <dminuoso> Ah no, it will be depth first
2020-11-24 14:25:51 <nr3rsl> i'm looking for people that is independent we are hiring juniors also but we need experienced people in the beggining (if you are intrested private msg pls)
2020-11-24 14:25:59 <ski> are you trying to avoid a (multiply) recursive parsing ?
2020-11-24 14:26:38 × Gurkenglas quits (~Gurkengla@unaffiliated/gurkenglas) (Ping timeout: 256 seconds)
2020-11-24 14:27:06 <ezzieyguywuf> is this standard syntax or a language extension? `inp,outp :: Maybe String -> Flag`
2020-11-24 14:27:42 <dminuoso> ezzieyguywuf: standard haskell
2020-11-24 14:27:43 <geekosaur> standard syntax
2020-11-24 14:28:07 <ezzieyguywuf> oh wow! does it have a fancy name? I've never seen it before.
2020-11-24 14:28:12 <geekosaur> you can declare multiple names that way, it's just not considered the best of style except in some cases
2020-11-24 14:28:24 <ezzieyguywuf> ah, ok
2020-11-24 14:28:31 <geekosaur> better is considered to keep name declarations and definitions together
2020-11-24 14:29:26 <merijn> If you wanna define a type, for a tuple it can work well
2020-11-24 14:29:59 <merijn> "a, b :: Int; (a, b) = (1, 2)" that's a dumb example, of course, but you get the idea
2020-11-24 14:30:07 <merijn> ezzieyguywuf: Lemme blow your mind further :p
2020-11-24 14:30:25 <merijn> ezzieyguywuf: You can define module variables using pattern matching just fine
2020-11-24 14:30:28 × texasmynsted quits (~texasmyns@212.102.44.39) (Ping timeout: 260 seconds)
2020-11-24 14:30:42 <geekosaur> you did there
2020-11-24 14:30:46 <merijn> "[x,y,z] = [1,2,3]" at the module top level is perfectly legal
2020-11-24 14:31:00 × trcc quits (~trcc@130.225.16.16) (Ping timeout: 260 seconds)
2020-11-24 14:31:07 mputz joins (~Thunderbi@dslb-084-058-211-084.084.058.pools.vodafone-ip.de)
2020-11-24 14:33:50 × adm_ quits (~adm@43.229.88.197) (Remote host closed the connection)
2020-11-24 14:34:12 adm_ joins (~adm@43.229.88.197)
2020-11-24 14:36:57 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2020-11-24 14:39:34 <dminuoso> ski: Mmm. That question made me think.
2020-11-24 14:39:43 texasmynsted joins (~texasmyns@212.102.44.39)
2020-11-24 14:41:06 bergey` joins (~user@107.181.19.30)
2020-11-24 14:44:12 × bergey quits (~user@pool-74-108-99-127.nycmny.fios.verizon.net) (Ping timeout: 256 seconds)
2020-11-24 14:45:23 × mputz quits (~Thunderbi@dslb-084-058-211-084.084.058.pools.vodafone-ip.de) (Quit: mputz)
2020-11-24 14:45:31 × geekosaur quits (ac3a549d@172.58.84.157) (Remote host closed the connection)
2020-11-24 14:47:45 <hekkaidekapus> dminuoso: You could also give tries a try.
2020-11-24 14:48:01 <dminuoso> Not sure whether you just wanted to make that pun..
2020-11-24 14:48:09 <hekkaidekapus> heh
2020-11-24 14:48:31 <hekkaidekapus> Ok, seriously, why not a trie?
2020-11-24 14:49:09 <merijn> So, I basically have this tree encoded as a Vector. I was hoping I could somehow (abuse) pattern synonyms to represent it as an ADT style true, but I can't quite make that work, it seems?
2020-11-24 14:49:33 <dminuoso> hekkaidekapus: Generating a tree from a recursive algorithm is easy, but the data I have make a recursive parser tough to write.
2020-11-24 14:50:45 <dminuoso> But.. perhaps Zipper from uniplate is the real solution here
2020-11-24 14:50:55 royal_screwup213 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2020-11-24 14:50:56 × Iceland_jack quits (~user@31.124.48.169) (Ping timeout: 240 seconds)
2020-11-24 14:51:01 <dminuoso> So my parser essentially drives a Zipper around, and constantly runs `replaceHole`
2020-11-24 14:51:26 <dminuoso> The alternate option is I try and transform the data and implement a recursive parser.
2020-11-24 14:52:14 geowiesnot joins (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr)
2020-11-24 14:52:42 fendor_ is now known as fendor
2020-11-24 14:52:48 <hekkaidekapus> Which bring you back to deciding how you want to traverse.
2020-11-24 14:53:59 <dminuoso> Maybe I misunderstood, what is the purpose of that question, hekkaidekapus?
2020-11-24 14:54:02 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 272 seconds)
2020-11-24 14:55:41 × da39a3ee5e6b4b0d quits (~da39a3ee5@mx-ll-171.5.161-165.dynamic.3bb.co.th) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-11-24 14:55:53 <hekkaidekapus> It was just an idea: if you represent the data as a multi-keyed map, each step forming a key, you could later merge it into a trie.
2020-11-24 14:56:08 <hekkaidekapus> But maybe that’s not how your data is organised.
2020-11-24 14:56:40 <acagastya> What is this line supposed to mean? `quicksort :: Ord a => [a] -> [a]`. Specifically, `Ord a =>`
2020-11-24 14:56:53 × elfets quits (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) (Ping timeout: 256 seconds)
2020-11-24 14:56:57 <xerox_> acagastya: means whatever type 'a' ends up being, it has to have an Ord instance, it's a constraint
2020-11-24 14:57:36 Sgeo joins (~Sgeo@ool-18b982ad.dyn.optonline.net)
2020-11-24 14:57:55 × geowiesnot quits (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr) (Ping timeout: 246 seconds)
2020-11-24 14:58:19 ph88 joins (~ph88@ip5f5af6cd.dynamic.kabel-deutschland.de)
2020-11-24 14:58:55 × madnight quits (~madnight@static.59.103.201.195.clients.your-server.de) (Quit: ZNC 1.7.1 - https://znc.in)
2020-11-24 14:59:20 <acagastya> Okay. When I just type `quicksort :: [a] -> [a]` and have the implementation -- it does not work -- it gives an error. Why?
2020-11-24 14:59:28 <solonarv> the fact that 'a' is a type variable means "the caller of this function can choose to replace a with any type"; the Ord a => bit means "... as long as there exists an Ord a instance"
2020-11-24 14:59:34 madnight joins (~madnight@static.59.103.201.195.clients.your-server.de)
2020-11-24 14:59:41 <merijn> acagastya: Presumably because you're using < :p
2020-11-24 14:59:45 <merijn> :t (<)
2020-11-24 14:59:46 <lambdabot> Ord a => a -> a -> Bool
2020-11-24 14:59:48 <merijn> :t (<=)
2020-11-24 14:59:49 <solonarv> this is needed because the implementation of quicksort uses functions like <= or < and so on
2020-11-24 14:59:49 <lambdabot> Ord a => a -> a -> Bool
2020-11-24 14:59:50 <xerox_> acagastya: because the implementation uses some methods from the ord class on the elements of the list, in this case to compare them
2020-11-24 15:00:21 <xerox_> hence its argument can't be a list of things that are not comparable
2020-11-24 15:00:23 <acagastya> `<=` and `<` are functions?
2020-11-24 15:00:32 <xerox_> they are!
2020-11-24 15:01:09 <acagastya> Wow -- I have so much to unlearn to learn Haskell.
2020-11-24 15:01:10 <xerox_> if you type :info Ord on ghci you'll see all the functions in the Ord class at the top of the output
2020-11-24 15:01:23 <xerox_> followed by a decently long list of the instances already in scope
2020-11-24 15:01:35 gproto23 joins (~gproto23@unaffiliated/gproto23)
2020-11-24 15:01:56 heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net)
2020-11-24 15:02:05 <dminuoso> hekkaidekapus: Roughly the data is organized like this: https://gist.github.com/dminuoso/e05c57c211a4b544052dc26f99e9266f
2020-11-24 15:02:19 <dminuoso> (I've cleaned it from a lot of the other baggage)
2020-11-24 15:02:46 <dminuoso> So each line containing a number is a node in that tree
2020-11-24 15:02:51 <acagastya> I have been thinking how would the minds of the beginners to programming evolve, if they were taught Haskell as their first PL. The way to think abstractly is so different from what I am used to!
2020-11-24 15:02:55 <xerox_> they might seem special because they are operators and hence use infix syntax, i.e. you put them between tha arguments instead of before the argument with standard functions, but that's just syntax
2020-11-24 15:03:20 <merijn> acagastya: Operators are just "functions that you write infix"
2020-11-24 15:03:25 × alp quits (~alp@2a01:e0a:58b:4920:d1f9:69ca:c0b0:463d) (Ping timeout: 272 seconds)
2020-11-24 15:03:28 <xerox_> you *can* use them with the standard function application too tho, with parens:
2020-11-24 15:03:33 <xerox_> > (<=) 2 5
2020-11-24 15:03:35 <lambdabot> True
2020-11-24 15:03:35 <acagastya> Like a `mod` b, merijn?
2020-11-24 15:03:41 <merijn> Can even define your own
2020-11-24 15:03:50 <dminuoso> hekkaidekapus: oh and these numbers could be even more nested, so you could have .11.2, and so forth
2020-11-24 15:03:55 <dminuoso> these would represent further nested nodes
2020-11-24 15:03:57 <merijn> > let x ☃ y = (x-y) * (y-x) in 3 ☃ 5
2020-11-24 15:03:59 <lambdabot> -4
2020-11-24 15:04:06 <xerox_> what a cutie of an operator
2020-11-24 15:04:11 <dminuoso> if a number starts with `.` its a child of the previos absolute number
2020-11-24 15:04:31 <dminuoso> I mean yeah, with a recursive parser I'd have to do a lot of lookahead
2020-11-24 15:04:37 <merijn> xerox_: Everyone loves unicode snowman :p
2020-11-24 15:04:56 <xerox_> it's basically seasonal too
2020-11-24 15:05:19 mputz joins (~Thunderbi@dslb-084-058-211-084.084.058.pools.vodafone-ip.de)
2020-11-24 15:05:20 <hekkaidekapus> dminuoso: I see. So, it’s not only about data representation, it’s also about parsing strategy.
2020-11-24 15:05:48 <dminuoso> hekkaidekapus: Maybe, I dont know. Until now I parsed it into a sort intermediate language with a sketchy interpreter
2020-11-24 15:06:27 <hekkaidekapus> Maybe write down a grammar and be done with parsing.
2020-11-24 15:06:49 × heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 264 seconds)

All times are in UTC.