<     May 2017     >
Su Mo Tu We Th Fr Sa  
    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 29 30 31
00:10 halogenandtoast joined
00:17 acarrico joined
00:19 Gurkenglas joined
00:26 halogenandtoast joined
00:45 juanpaucar joined
01:04 conal joined
01:04 geekosaur joined
01:07 erisco joined
01:08 juanpaucar joined
01:09 BOOKBOOK joined
01:26 kaychaks joined
01:27 vaibhavsagar joined
01:35 juanpaucar joined
01:36 dni- joined
01:41 louispan joined
01:43 jship joined
01:44 louispan joined
01:48 conal joined
01:52 louispan joined
02:01 cschneid_ joined
02:03 louispan joined
02:12 machinedgod joined
02:20 mac10688 joined
02:22 louispan joined
02:32 jle` joined
02:34 diegs_ joined
02:35 juanpaucar joined
02:35 peterbecich joined
02:46 exferenceBot joined
02:47 louispan joined
02:51 hexagoxel joined
02:58 halogenandtoast joined
02:58 juanpaucar joined
03:09 buoto joined
03:18 brailsmt joined
03:18 blissdev joined
03:25 juanpaucar joined
03:25 dni- joined
03:25 systemfault joined
03:27 conal joined
03:32 uglyfigurine joined
03:45 aarvar joined
03:49 texasmynsted joined
03:50 Geekingfrog joined
03:51 halogenandtoast joined
03:52 diegs_ joined
03:53 louispan joined
03:54 ianandrich joined
04:03 malaclyps joined
04:10 cschneid_ joined
04:43 begriffs joined
04:45 louispan joined
04:54 uglyfigurine joined
04:55 <uglyfigurine> hi im new to haskell and tryin to write a method unsucessfully
04:55 <uglyfigurine> the compiler is not being very helpful
04:55 <uglyfigurine> module Cipher where
04:55 <uglyfigurine> import Data.Char
04:55 <uglyfigurine> caesar :: Int -> [Char] -> [Char]
04:55 <uglyfigurine> caesar n [] = []
04:55 <uglyfigurine> caesar 0 xs = xs
04:55 zero_byte joined
04:55 <uglyfigurine> caesar n x:[] = shift n x : []
04:55 <uglyfigurine> caesar n (x:xs') = shift n x : ceasar n xs'
04:55 <uglyfigurine> shift :: Int -> Char -> Char
04:55 <uglyfigurine> shift n x = chr $ ord x + n
04:55 <uglyfigurine> whoops sorry i thoughti had the pastebin link
04:55 <Cale> caesar n x:[]
04:55 <uglyfigurine> https://hastebin.com/wovuhepaqa.hs
04:56 <Cale> This parses as (caesar n x) : []
04:56 <uglyfigurine> yeah thats the line its complaining abt
04:56 <jle`> looks like you got (x:xs') right
04:56 <Cale> You wanted to write caesar n (x:[])
04:56 <jle`> so you understand how parsing works
04:56 <jle`> but for some reason you wrote x:[]
04:56 <Cale> or simply caesar n [x]
04:56 <glguy> or even better: caesar n []
04:56 <uglyfigurine> oh rip
04:56 <uglyfigurine> ty
04:56 <Cale> oh, and indeed, handle the empty list case instead
04:57 <Cale> caesar n [] = []
04:57 <Cale> and then you don't need a special case for lists of length 1
04:57 <Cale> ah, but you already are
04:58 <Cale> So that case for lists of length 1 is just totally unnecessary, you can delete it
04:58 <uglyfigurine> oh yea.
04:58 <uglyfigurine> now i am gettgin an error saying not in scope caesar perhaps u meant caesar
04:58 <Cale> uhh
04:59 <Cale> I'm pretty sure GHC doesn't use 'u' ;)
04:59 <Cale> ceasar
04:59 <uglyfigurine> u?
04:59 <Cale> ^^
04:59 <Cale> "perhaps u meant caesar"
04:59 <uglyfigurine> ohhh
04:59 <glguy> uglyfigurine: When you retype instead of paste the error message about a typo
04:59 <glguy> and then make the same typo...
05:00 <uglyfigurine> So imagine if i hadnt deleted that x:[] case
05:00 <uglyfigurine> glguy: sorry.XD
05:00 <uglyfigurine> i read it just fine which is why i didnt make it
05:01 <uglyfigurine> so yeah if i hadnt deleted the case x:[] and the body of that case was "shift x n : []"
05:01 <uglyfigurine> and the main body had a shift too. could i define shift in the where clause of the method?
05:01 <uglyfigurine> and have it share among the two cases?
05:02 <uglyfigurine> coz right now i had to write shift as its own method that got exposed too. but i dont want to expose it
05:03 <Cale> If you wanted to put the definition of shift in a where clause and use it from more than one pattern match, you'd have to switch to using a case expression to do the pattern matching
05:03 <Cale> Where clauses scope only over a single pattern match
05:03 <geekosaur> also consider just not exporting shift
05:03 <Cale> (but all of its guards)
05:03 <Cale> Yeah, you can also just add a module declaration which doesn't export it
05:04 <Cale> module Cipher (caesar) where
05:04 howdoi joined
05:04 <uglyfigurine> oh
05:04 <uglyfigurine> how do i decide which format to use for pattern matching?
05:04 <uglyfigurine> are there any conventions?
05:08 diegs_ joined
05:09 <glguy> uglyfigurine: What alternatives are you considering?
05:10 <uglyfigurine> I am wondering whats the convention to pick between guards, function pattern matching , case pattern matching
05:12 kritzcreek joined
05:14 dni- joined
05:14 meandi_2 joined
05:25 shayan_ joined
05:25 <uglyfigurine> Since i cant put multiple modules in the same file, Main always has to be its own module?
05:28 zolamusic joined
05:35 geekosaur joined
05:37 uglyfigurine_ joined
05:37 uglyfigu_ joined
05:37 <uglyfigurine_> whoops i did not notice i got disconnected. ty if u answered my questions
05:38 <glguy> Yes, the Main module is always a separate module and a separate file from any other module. One module per file
05:43 hellworld joined
05:43 hellworld left
05:44 juanpaucar joined
05:48 zolamusic joined
05:48 zolamusic left
05:48 halogenandtoast joined
05:54 malaclyps joined
05:58 ThomasLocke joined
06:08 malaclyps joined
06:09 ianandrich joined
06:38 brailsmt joined
06:49 juanpaucar joined
06:54 louispan joined
07:03 dni- joined
07:09 govg joined
07:13 uglyfigurine joined
07:21 thc202 joined
07:22 bvad joined
07:26 Pupnik joined
07:38 brailsmt joined
07:49 dni- joined
07:53 juanpaucar joined
07:54 ralu joined
08:12 cschneid_ joined
08:33 cschneid_ joined
08:41 louispan joined
08:44 malaclyps joined
08:44 louispan joined
08:59 prophile joined
09:00 WhereIsMySpoon joined
09:00 WhereIsMySpoon joined
09:01 aphorisme joined
09:02 WhereIsMySpoon joined
09:02 cur8or joined
09:05 tsmish joined
09:06 juanpaucar joined
09:16 yellowj joined
09:23 cschneid_ joined
09:27 louispan joined
09:30 Gurkenglas joined
09:32 meandi joined
09:39 brailsmt joined
09:45 test42893121525 joined
09:45 im0nde joined
09:51 pcb joined
10:00 uglyfigurine joined
10:06 juanpaucar joined
10:09 louispan joined
10:11 mstruebing joined
10:13 yellowj joined
10:21 louispan joined
10:23 netheranthem joined
10:27 louispan joined
10:30 louispan joined
10:31 hphuoc25 joined
10:39 fotonzade joined
10:42 hphuoc25 joined
10:42 hphuoc25 joined
10:55 mstruebing joined
10:57 TCZ joined
11:07 louispan joined
11:07 mr_sm1th joined
11:09 mheinzel joined
11:10 juanpaucar joined
11:11 cschneid_ joined
11:14 louispan joined
11:15 mstruebing joined
11:18 im0nde joined
11:20 louispan joined
11:22 takle joined
11:29 louispan joined
11:31 pbrant joined
11:34 grdryn joined
11:39 brailsmt joined
11:43 hphuoc25 joined
11:56 stevenxl joined
12:09 romank joined
12:09 mengu joined
12:10 aphorisme joined
12:14 juanpaucar joined
12:27 vmeson joined
12:28 aphorisme joined
12:32 WhereIsMySpoon joined
12:33 lewis joined
12:43 sbodin joined
13:02 vaibhavsagar joined
13:07 chlong joined
13:09 test42893121525 left
13:10 vmeson joined
13:13 iAmerikan joined
13:28 not_on_fp joined
13:29 uglyfigurine_ joined
13:30 brailsmt joined
13:32 jathan_ joined
13:34 exferenceBot joined
13:35 carlomagno1 joined
13:38 kritzcreek joined
13:43 uglyfigurine joined
13:43 mac10688 joined
13:46 bvad joined
13:47 simendsjo joined
13:53 aphorisme joined
14:01 juanpaucar joined
14:06 aphorisme joined
14:12 diegs_ joined
14:26 blissdev joined
14:26 halogenandtoast joined
14:32 vmeson joined
14:34 aphorisme joined
14:50 bvad_ joined
14:53 bvad joined
15:11 cschneid_ joined
15:11 bkonkle left
15:24 juanpaucar joined
15:26 bvad joined
15:26 colt44 joined
15:34 ianandrich joined
15:39 saussure joined
15:58 <benzrf> trying to build nixos on top of unix is like trying to build lens on top of javascript
15:58 <benzrf> imho
15:58 bvad joined
16:02 netheranthem joined
16:07 conal joined
16:08 bvad joined
16:14 <benzrf> oops wrong channel
16:24 diegs_ joined
16:38 nullcone joined
16:46 hphuoc25 joined
16:48 netheranthem joined
16:52 <evilmaid> hi. if i wanted to do something like filtering values of a arbitrary type, i keep thinking i'd need something like a getter where i could specify the name of a field, or some form of reflection. am i right to assume that i should throw that idea out and look at lenses (full disclosure, i've never used lenses)
16:55 jathan_ joined
16:56 vmeson joined
16:58 <evilmaid> sorry, i'll do a proper example of what i'm trying to do. that question made no sense, please disregard
16:59 MetaMutt joined
17:03 <Xion_> Well there is
17:03 <Xion_> :t filter
17:03 <lambdabot> (a -> Bool) -> [a] -> [a]
17:03 <Xion_> You can put whatever you want in the first argument :)
17:06 <evilmaid> hehe, true. there's also Data.Map filter, or filterWithKey which is something along the lines of what i'm trying to do (if I make the type a map, or transform it when filtering)
17:07 netheranthem joined
17:08 thc202 joined
17:12 <Akii> evilmaid: a bit more info would be nice
17:14 MetaMutt joined
17:15 MetaMutt joined
17:17 MetaMutt joined
17:24 MetaMutt joined
17:25 juanpaucar joined
17:25 <evilmaid> right. i don't have any actual code yet, as i'm just pondering how i'd go about doing it. given a list of [{"name": "john"}, {"parent": "john"}] i'd like to be able to filter the two (different types) if a given key matches a predicate, e.g. filter $ fn "parent" "john" $ list. we actually talked about a different issue a while back, where we used HashMap lookup on an Aeson Object
17:26 MetaMutt joined
17:27 <Akii> the weird json, I think I remember :D
17:27 <evilmaid> i'm thinking that'd be the most normal way to do it, but would i have an alternative to using a HashMap instead of distinct types, or could i make my types instances of hashmap (or something similar)?
17:27 <evilmaid> indeed :)
17:29 <evilmaid> it doesn't have to be json or anything, that's just the first example i could think of. overall the question is, short of accessing fields by an argument (key) in a hashmap, can i do anything else? in records the getter is a function, and that might do
17:30 <evilmaid> i.e. get_val "key" = key; get_val that_type
17:30 <Akii> :t lookup
17:30 <lambdabot> Eq a => a -> [(a, b)] -> Maybe b
17:30 <Akii> hmpf
17:31 <Akii> the answer is likely to be lenses
17:31 <Akii> but then again, everything can be done with lenses
17:32 <evilmaid> oh, neat. i'll try that for the --hell-- thrill of it. i'm a bit wary of lenses still
17:32 iAmerikan joined
17:33 <Akii> my take on lenses is this: if you have a deeply nested kinda random data structure and you want to get/set -> might be something for lenses
17:33 carlomagno joined
17:33 <Akii> not saying random as in actually random
17:33 <Akii> but like few well known sets of structure
17:34 <Akii> (although I'm pretty sure this lense stuff can also handle random structure.. somehow)
17:34 <evilmaid> you do have a good point, i've just never looked at lenses
17:35 <Akii> just check out lenses :D if they're not solving the thing you know lenses, if it does you know lenses
17:35 <Akii> win win
17:36 <evilmaid> with the chance of ending up not knowing lenses :D
17:36 <evilmaid> but yeah, you're right. thanks
17:36 <Akii> nah, they're not so hard
17:36 <Akii> I got proof for that
17:36 <Akii> I kinda used them, so they can't be too hard
17:36 <Akii> just did very basic stuff with them though
17:36 <evilmaid> mathematical proof? :)
17:37 <Akii> you can go apeshit crazy with lenses and generic programming
17:37 <Akii> like "append 'your mom' to every string in an arbitrary datastructure"
17:38 <evilmaid> ok, you figured me out
17:38 <Akii> ha that's what you wanted to do all along, huh? :D
17:39 <evilmaid> i mean, i'm sure there are *other* uses of generic programming, but... :)
17:41 <Akii> let's just say, there are practical uses and not so practical
17:41 <Akii> can't find the talk but it's possible
17:41 <Akii> and I don't think you need that anyway xD
17:42 <Akii> everytime I thought "this is the time, this time you need generics" I ended up not needing them
17:42 <Akii> wait, that's the wrong word
17:42 <Akii> not generics; generic programming
17:42 <Akii> generics is this Java thing in brakets
17:46 diegs_ joined
17:50 louispan joined
17:54 halogenandtoast joined
17:54 <Cale> Well, people use the word "Generics" for this in Haskell.
17:55 <Cale> Java's idea of "generics" is basically just parametric polymorphism.
17:55 louispan joined
18:03 yellowj joined
18:11 aarvar joined
18:13 jathan_ joined
18:34 mac10688 joined
18:36 grizwako joined
18:47 juanpaucar joined
18:48 hphuoc25 joined
18:55 thc202 joined
19:00 iAmerikan joined
19:00 pilne joined
19:09 albertus1 joined
19:10 eHammarstrom joined
19:19 mr_sm1th joined
19:22 brailsmt joined
19:24 juanpaucar joined
19:27 saussure joined
19:28 louispan joined
19:30 slomo joined
19:30 slomo joined
19:32 brailsmt joined
19:39 jathan_ joined
19:44 saussure joined
19:44 brailsmt joined
19:53 takle joined
19:58 saussure joined
19:59 takle joined
20:07 saussure joined
20:08 saussure joined
20:11 saussure joined
20:14 brailsmt joined
20:14 juanpaucar joined
20:23 govg joined
20:49 hphuoc25 joined
20:53 takle joined
21:02 louispan joined
21:02 <coredump> hah, the haskell book said to not skip Lambda Calculus chapter and I as like I should skip this chapter.
21:04 diegs_ joined
21:11 amuck joined
21:11 <Cale> coredump: tbh, it probably can wait until later -- you can learn about lambda in the context of Haskell as a whole. However, the thing which probably can't wait is the ability to think in terms of equations and substitution of variables.
21:13 Durbley_ joined
21:15 plakband joined
21:16 <coredump> Man this book is putting some pressure on me
21:16 <coredump> as in
21:16 <coredump> if I don't learn it's probably because I am dumb :P
21:23 juanpaucar joined
21:24 plakband left
21:25 plakband joined
21:43 test42893121525 joined
21:47 test42893121525 left
21:52 hiratara joined
22:02 <MarcelineVQ> coredump: there's more than a couple exercises I spent multiple hours on that were simple in hindsight. don't feel dumb, it's new stuff, you'll get it
22:11 sigmundv joined
22:16 peterbecich joined
22:16 jrm joined
22:27 juanpaucar joined
22:31 hiratara joined
22:33 cschneid_ joined
22:39 fotonzade joined
22:41 xeno7 joined
22:43 nullcone joined
22:59 howdoi joined
23:02 wildlander joined
23:20 systemfault joined
23:25 yellowj joined
23:29 peterbecich joined
23:31 juanpaucar joined
23:42 jmiven joined
23:51 Gurkenglas joined
23:53 exferenceBot joined
23:55 halogenandtoast joined