<    April 2017    >
Su Mo Tu We Th Fr Sa  
 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  
00:00 mariusz89016 joined
00:17 <qu1j0t3> Durbley: haven't watcht his, but maybe relevant... https://twitter.com/1HaskellADay/status/851951868834197504
00:24 exferenceBot joined
00:26 Rodya_ joined
00:32 dni- joined
00:50 malaclyps joined
00:52 yellowj joined
00:53 bschwb joined
00:56 vaibhavsagar joined
00:58 malaclyps joined
01:05 malaclyps joined
01:05 eacameron joined
01:11 hoffmeyer joined
01:23 mariusz89016 joined
01:29 Pupnik_ joined
01:48 NoCreativity joined
01:50 Youmu joined
02:06 exferenceBot joined
02:11 hexagoxel joined
02:11 hoffmeyer joined
02:20 dni- joined
02:22 vaibhavsagar joined
02:24 Orion3k joined
02:25 takle joined
02:26 systemfault joined
02:29 Rodya_ joined
02:31 takle joined
02:38 eacameron joined
02:49 takle joined
02:55 meandi_2 joined
02:59 takle joined
03:03 chlong joined
03:03 chlong_ joined
03:10 takle joined
03:12 hoffmeyer joined
03:16 harfangk joined
03:18 takle joined
03:25 mariusz89016 joined
03:30 Rodya_ joined
03:35 takle joined
03:42 malaclyps joined
03:42 takle joined
03:53 takle joined
03:55 <jle`> MarcelineVQ: i think that's a part of the "point" of the post, i suppose
03:59 Sose_ joined
03:59 cschneid_ joined
04:00 NoCreativity joined
04:00 takle joined
04:02 ali_bush_ joined
04:04 ali_bush joined
04:04 ali_bush joined
04:09 dni- joined
04:13 hoffmeyer joined
04:14 takle joined
04:18 mariusz89016 joined
04:23 mariusz89016 joined
04:31 Rodya_ joined
04:35 takle joined
04:39 des_ joined
04:46 malaclyps joined
04:46 des_ joined
04:49 <MarcelineVQ> jle`: Yeah turns out to be a continuation of another hyperbole post :>
04:59 des_ joined
05:00 takle joined
05:10 des_ joined
05:14 hoffmeyer joined
05:21 Kuros joined
05:21 lithie joined
05:26 <jle`> rather unfortunate, because it might have made a very educational post in another life :)
05:27 takle joined
05:29 condy joined
05:29 DataComputist joined
05:39 govg joined
05:42 hoffmeyer joined
05:50 Mutter joined
05:54 ThomasLocke joined
05:54 ThomasLocke joined
05:56 eacameron joined
05:58 dni- joined
06:01 haskelleksah joined
06:02 mariusz89016 joined
06:03 takle joined
06:13 eacameron joined
06:18 hoffmeyer joined
06:21 takle joined
06:21 eacameron joined
06:25 <peterbecich> Hello, would someone give me a hint on this `perClient` function of the NICTA/Data61 course? It's the chat server capstone project. Thank you. https://github.com/peterbecich/fp-course/blob/master/projects/NetworkServer/haskell/src/Network/Server/Chat/Loop.hs#L91-L95
06:26 hoffmeyer joined
06:27 Pupnik joined
06:28 takle joined
06:30 azahi joined
06:31 systemfault joined
06:31 eatman joined
06:32 <eatman> Hi!
06:32 <peterbecich> eatman: hi!
06:32 systemfault joined
06:33 systemfault joined
06:34 Rodya_ joined
06:38 takle joined
06:47 nick_h joined
06:52 takle joined
06:52 Sose_ joined
06:53 sujeet` joined
06:55 threshold joined
06:56 threshold joined
06:56 stvc joined
06:56 damncabbage joined
06:56 thallada joined
06:56 machinedgod joined
06:56 tjt joined
06:56 monochrom joined
06:57 exio4 joined
06:57 mitchty joined
06:57 gspia joined
06:57 brisbin joined
06:58 kori joined
06:58 CuriousErnestBro joined
06:59 ThomasLocke joined
06:59 bduc joined
07:00 aarvar joined
07:10 takle joined
07:11 mariusz89016 joined
07:12 dni- joined
07:15 yellowj joined
07:16 Boarders joined
07:19 emilis joined
07:20 jgertm- joined
07:30 takle joined
07:34 Rodya_ joined
07:36 kadoban joined
07:37 fading joined
07:39 thc202 joined
07:39 peterbecich joined
07:40 takle joined
07:41 cur8or joined
07:53 Amir_ joined
07:56 mariusz89016 joined
07:58 takle joined
08:00 cschneid_ joined
08:06 yellowj joined
08:06 mattyw joined
08:08 pbrant joined
08:08 colt44 joined
08:10 Pupnik_ joined
08:11 grdryn joined
08:17 takle joined
08:21 haskelleksah_ joined
08:28 sigmundv_ joined
08:31 takle joined
08:32 madjestic joined
08:35 Rodya_ joined
08:36 hdeshev joined
08:41 meandi joined
08:44 galderz joined
08:44 hdeshev1 joined
08:46 cschneid_ joined
08:49 hdeshev joined
08:51 hdeshev2 joined
08:51 hdeshev1 joined
08:52 gregman_ joined
08:52 <eatman> Hi. Just wondering where is the Reader data constructor? Any clue?
08:53 hdeshev3 joined
08:53 takle joined
08:53 <Akii> @src Reader
08:54 <lambdabot> type Reader r = ReaderT r Identity
08:54 <lambdabot> --OR
08:54 <lambdabot> data Reader r a = Reader { runReader :: r -> a }
08:54 <Akii> eatman
08:55 <eatman> I've the second in Control.Monad.Reader
08:55 <eatman> But I guess I did somthing wrong somewhere.
08:55 haskelleksah joined
08:56 <eatman> In the "Haskell From First Principle" boook there is this exercise: "ask :: Reader a a; ask = Reader ???"
08:56 <Iceland_jack> eatman: It used to be there
08:56 <eatman> I thoght the answer ws 'id'.
08:56 <Iceland_jack> and it will be added probably as a pattern synonym
08:56 <eatman> But I probably got something wrong.
08:57 <Iceland_jack> See this https://ghc.haskell.org/trac/ghc/ticket/12767
08:57 hdeshev joined
08:57 <kadoban> eatman: Why do you assume you got something wrong?
08:57 <eatman> GHCI is not ok with me :-)
08:58 <eatman> And usally the problem lays between the chair and the keyboard.
08:58 <Iceland_jack> eatman: Are you new to Reader? It helps to look past the newtype at first
08:58 <Iceland_jack> @let type READER r a = r -> a
08:58 <lambdabot> Defined.
08:58 <eatman> Complet noob yeah.
08:58 <Iceland_jack> :t id :: READER a a
08:58 <lambdabot> READER a a
08:58 <Iceland_jack> okay
08:59 <Iceland_jack> A reader is exactly a function
08:59 <Iceland_jack> You could even define: type READER = (->)
09:01 <eatman> Not sure to get your point.
09:01 <eatman> I mean, id :: a -> a, the ONLY function with that type signature.
09:01 <Iceland_jack> Yes
09:02 <Iceland_jack> If you look at: data Reader r a = Reader { runReader :: r -> a }
09:02 <eatman> So when I read Reader a a, it's obviously refering to id.
09:02 <Iceland_jack> there is a *lot* of noise
09:02 <eatman> Yes, a == r.
09:02 <eatman> Indeed.
09:02 <Iceland_jack> We can write: data Reader r a = Reader (r -> a)
09:03 <Iceland_jack> which means the same thing (doesn't create a boring accessor function 'runReader')
09:03 <Iceland_jack> and we see that 'Reader r a' just wraps a function (r -> a)
09:05 <eatman> Well, Reader is not even a data constructor in my GHCI.
09:05 <Iceland_jack> Right, reality is more complicated now
09:05 <eatman> I got that Reader is just a function wrapper,
09:05 <eatman> I also saw ReaderT.
09:06 <Iceland_jack> When starting out, I prefer thinking about the essence of what I'm working with
09:06 <eatman> I'ok with that.
09:06 <Iceland_jack> 'State s a' is a function: s -> (a, s)
09:06 <eatman> I was just wodering why I wassn't able to use it as a data constructor.
09:06 <Iceland_jack> sure
09:06 <Iceland_jack> that's because of historical reasons, unfortunately
09:07 <Iceland_jack> and GHC didn't have pattern synonyms way back when
09:11 <eatman> Well... I fell stupid right now.
09:11 <eatman> Can't understand what you keep telling me.
09:12 <eatman> If Reader is a function wrapper, why can't it wrap id?
09:12 <Iceland_jack> The onus is on me to explain it better :)
09:13 <Iceland_jack> Use the 'reader' function, with a lower case
09:13 <Iceland_jack> :t reader id :: Reader a a
09:13 <lambdabot> Reader a a
09:13 <eatman> reader id :: MonadReader a m => m a
09:13 <eatman> At home...
09:14 corintho[m] joined
09:14 <Iceland_jack> That's why I added teh ":: Reader a a" at the end :)
09:14 <Iceland_jack> *the
09:14 <geekosaur> more historical baggage
09:14 <Iceland_jack> heh
09:14 <geekosaur> once upon a time there was mtl1, which had data Reader = Reader ...
09:14 <geekosaur> and you could use the Reader constructor
09:15 <geekosaur> later came mtl2, and Reader was turned into a type alias. Type aliases have no constructors; the actual constructor involved is ReaderT.
09:15 <geekosaur> Haskell '98-based texts still talk about Reader, but it's gone
09:15 <eatman> All right!
09:15 <geekosaur> so you use lowercase reader instead
09:15 <eatman> m a === a -> a in my case, right.
09:16 <geekosaur> (and can;t pattern match. But with bidirectional pattern synonym this should be hopefully corrected in the next mtl release)
09:16 moei joined
09:16 <eatman> I thought Reader was a newtype, not a type alias.
09:16 <Iceland_jack> eatman: It can be BOTH (Reader a a) and (a -> a)
09:17 <Iceland_jack> :t reader id :: a -> a
09:17 <lambdabot> a -> a
09:17 <geekosaur> newtypes have constructors and can be pattern matched
09:17 <Iceland_jack> :t reader id :: Reader a a
09:17 <lambdabot> Reader a a
09:17 <eatman> Yep, perfectly equivalent types.
09:17 <geekosaur> type aliases do not
09:17 <Iceland_jack> It's confusing :)
09:17 emilis joined
09:17 <eatman> geekosaur: that's the root of my mistake I guess.
09:18 sudoreboot[m] joined
09:18 agates joined
09:18 prose[m] joined
09:18 unclechu joined
09:18 dyce[m] joined
09:18 <eatman> As I was expecting it to be a newtype I wass looking for it's contructor.
09:18 korayal[m] joined
09:18 <geekosaur> (newtypes go way after typechecking, but typechecking is where the constructor matters :)
09:18 <eatman> All right, thanks a lot!
09:18 eacameron joined
09:18 curry[m] joined
09:18 <eatman> Ho, so the book is somehow wrong here?
09:19 <geekosaur> and the problem with using a newtype is you'd then need *two* constructors: Reader (ReaderT r Identity a)
09:19 <geekosaur> just out of date
09:19 <eatman> "ask :: Reader a a; ask = Reader ???"
09:19 <eatman> Ok.
09:19 <geekosaur> change the second Reader to lowercase
09:19 <Iceland_jack> ask = reader id
09:19 <eatman> Yep, that was my point.
09:20 <geekosaur> Haskell changes fairly rapidly. (golamng changes even faster; i feel sorry for anyone trying o write a book about it...)
09:20 <eatman> Are there any known out of date exercises in this book?
09:20 <eatman> Don't know go for now.
09:21 <geekosaur> the book _Real World Haskell_ was out of date when it hit the bookshelves, because the exception mechanism had been overhauled in the time between submission and printing/distribution :)
09:21 <Iceland_jack> The timing of RWH was unfortunate
09:21 <eatman> Erf, ok.
09:22 <eatman> The advantage of the Haskell FFP is in the numeric version.
09:22 <eatman> Anyway, I go back to my reading.
09:22 <eatman> Many thanks all!
09:24 haskelleksah joined
09:26 <Iceland_jack> eatman: yw!
09:26 <Iceland_jack> hope this part of Haskell doesn't scare you off :D
09:29 <__rgn> ~
09:29 <eatman> Nothing to be scared of.
09:30 <Iceland_jack> Fear doesn't type check
09:30 mengu joined
09:30 <eatman> I simply hope that i'll get the chance to use it at work one day.
09:31 <eatman> Got a littler bored of C++.
09:32 <Iceland_jack> Haskell is the most fun language I've ever learnt / used by far
09:32 zero_byte joined
09:36 Rodya_ joined
09:51 <adarqui> i'm afraid of haskell but i still love it
09:51 binaryplease joined
09:53 <Iceland_jack> Doesn't sound like a healthy relationship
09:54 haskelleksah joined
09:55 <tuturto> I started learning haskell recently on my own time
09:55 <adarqui> 8|
09:55 <tuturto> really liking it so far, but everything feels so slow to write
09:56 <tuturto> I'm using hoogle a lot it seems
09:57 <tuturto> and I'm learning quite a bit just sitting here and following discussions
09:57 Gurkenglas joined
09:59 <Iceland_jack> @let data Foo a = F [a] a (Maybe a) deriving (Show, Functor, Foldable)
09:59 <lambdabot> Defined.
10:00 <Iceland_jack> F "hello" '!' (Just '.')
10:00 <Iceland_jack> F "hello" '!' (Just '.')
10:00 <Iceland_jack> darn
10:00 <Iceland_jack> > F "hello" '!' (Just '.')
10:00 <lambdabot> F "hello" '!' (Just '.')
10:00 <Iceland_jack> > toList (F "hello" '!' (Just '.'))
10:00 <lambdabot> error:
10:00 <lambdabot> Ambiguous occurrence ‘toList’
10:00 <lambdabot> It could refer to either ‘F.toList’,
10:00 <Iceland_jack> > F.toList (F "hello" '!' (Just '.'))
10:00 <lambdabot> "hello!."
10:00 <Iceland_jack> > fmap ord (F "hello" '!' (Just '.'))
10:00 <lambdabot> F [104,101,108,108,111] 33 (Just 46)
10:00 <Iceland_jack> > F.sum (fmap ord (F "hello" '!' (Just '.')))
10:00 <lambdabot> 611
10:25 madjestic joined
10:27 howdoi joined
10:32 eacameron joined
10:37 Rodya_ joined
10:37 netheranthem joined
10:38 eacameron joined
10:58 dni- joined
11:00 cschneid_ joined
11:04 prose[m] left
11:04 Iceland_jack joined
11:04 Pupnik joined
11:10 Gurkenglas_ joined
11:19 sivs joined
11:23 tdfirth joined
11:37 Rodya_ joined
11:42 jathan joined
11:43 harfangk joined
11:49 acarrico joined
11:53 chlong_ joined
11:53 chlong joined
12:01 ederign joined
12:02 dni- joined
12:03 meandi joined
12:08 <eatman> Damn'... the whole Reader chapter is out of date...
12:09 <eatman> I guess that'll be the same for the state chapter.
12:09 yellowj joined
12:10 <geekosaur> yes, Reader / Writer / State all changed in mtl2
12:11 <Iceland_jack> eatman: it should be the same out-of-date'ness
12:11 <Iceland_jack> To construct, use lowercase (reader / state / writer)
12:12 <Iceland_jack> To pattern match, use functions (runReader / runState / runWriter)
12:13 jarshwah joined
12:13 Durbley joined
12:15 <__rgn> silly question. what does runReader have to do with pattern matching?
12:16 <Iceland_jack> Not a silly question, the definition of runReader is basically
12:16 <Iceland_jack> runReader (Reader a) = a
12:16 <Iceland_jack> (assuming the old definition of Reader: newtype Reader a r = Reader { runReader :: a -> r })
12:17 <Iceland_jack> Currently you cannot use Reader as a pattern, for historical reasons
12:17 <__rgn> as opposed to the new version which is?
12:17 <__rgn> must be somewhere in the backlog
12:17 <Iceland_jack> type Reader r = ReaderT r Identity
12:17 grdryn joined
12:17 <Iceland_jack> It will be amended in future versions
12:18 <Iceland_jack> but for now, you can use "runReader" to "unwrap" the Reader
12:18 <Iceland_jack> __rgn: You can even write (using ViewPatterns)
12:18 <Iceland_jack> foo (runReader -> a) = ...
12:18 <__rgn> yeah ok i see
12:19 <Iceland_jack> My proposal (https://ghc.haskell.org/trac/ghc/ticket/12767) will actually let you use Reader
12:19 <Iceland_jack> as you can see it's defined in terms of reader / runReader
12:19 <Iceland_jack> pattern Reader :: (r -> a) -> Reader r a
12:19 <Iceland_jack> pattern Reader {runReader} <- (R.runReader -> runReader)
12:19 <Iceland_jack> where Reader a = reader a
12:20 <__rgn> i'm not familiar with `pattern` yet
12:20 <Iceland_jack> Pattern synonyms allow you to define a synonym for a... pattern :)
12:20 <Iceland_jack> pattern JustOne = Just 1
12:21 <Iceland_jack> Now you can pattern match on JustOne
12:21 <Iceland_jack> and use it as an expression
12:22 <Iceland_jack> __rgn: You could make a pattern that matches lists of length 3
12:22 <Iceland_jack> pattern List3 a b c = [a, b, c]
12:24 <__rgn> how would that be used
12:24 <Iceland_jack> Just like any pattern
12:24 <Iceland_jack> f (List3 a b c) = a + b + c
12:24 <Iceland_jack> Is the same as
12:24 <Iceland_jack> f [a,b,c] = a + b + c
12:25 <__rgn> makes sense
12:25 <Iceland_jack> You can make a lot more complicated patterns
12:25 <Iceland_jack> but that's a start
12:26 xificurC joined
12:27 Rodya_ joined
12:27 <__rgn> so runReader is obsolete in latest haskell?
12:27 <Iceland_jack> not really
12:27 <__rgn> because there are better ways to squeeze a out of a reader
12:28 <Iceland_jack> the pattern synonyms haven't been merged yet
12:30 <xificurC> I'd need some explanation - I created a new project with stack. Now I'm trying to make tests work (running `stack test`) and it seems I cannot import things from the src folder unless I add it to hs-source-dirs in the test-suite section of .cabal file. Here is the file structure http://sprunge.us/fPQQ or if more is needed here's the whole repositor
12:30 <xificurC> y - https://gitlab.com/xificurC/cis194/tree/master
12:30 <geekosaur> that sounds expected to me
12:31 <xificurC> with this setup (adding "src" in the test-suite section) running `stack test` works, albeit with a warning I should add the source level stuff to other-modules or exposed-modules
12:35 <geekosaur> I think that's an edge case; that warning shouldn't apply to executables but currently does
12:35 <__rgn> Iceland_jack: thank you the explanation
12:36 <Iceland_jack> __rgn: No problem, the whole Reader/.. situation is a wart atm
12:43 abhiroop joined
12:46 <eatman> Iceland_jack: I was afk. So you're saying that we'll sooner or later be able to, again, use Reader as a data constructor.
12:46 <abhiroop> I was working with the path library
12:47 <abhiroop> And basically I am trying to catch exceptions
12:47 <abhiroop> I have a function like this http://lpaste.net/354533
12:47 <abhiroop> But this doesn't seem to type check
12:47 <Iceland_jack> eatman: That's exactly right
12:47 <Iceland_jack> I just need to get off my ass and make a patch
12:48 earldouglas joined
12:50 <eatman> Sweet, It's pretty awesome to "see" sch a great tool being built.
12:51 vaibhavsagar joined
12:52 GreySunshine joined
12:54 eacameron joined
13:02 grdryn joined
13:03 <Iceland_jack> Maybe you want to make the patch for me?
13:06 eacameron joined
13:06 <GreySunshine> Hello! I want to pass commandline arguments to ghc when using stack, I did this: 'stack ghc -Wall test.hs -o test'. What is the right way to do it?
13:06 <eatman> Well, I'm not done with the book.
13:06 <eatman> Not sure to be able to patch it by myself.
13:06 <eatman> But, yes, I'd like to try.
13:07 <geekosaur> GreySunshine, you need -- to stop stack from reading options
13:08 <geekosaur> stack ghc -- -Wall test.hs -o test
13:10 <GreySunshine> geekosaur: Thank you!
13:10 eacameron joined
13:13 cur8or joined
13:14 iAmerikan joined
13:25 <xificurC> geekosaur: sorry I was interrupted.. So you're saying it it expected of me to add src there?
13:26 <xificurC> s/it it/it is/
13:26 <geekosaur> yes, and ignore the warning about other-modules because it's a bug that it checks that for executables
13:26 <geekosaur> (known bug iirc)
13:26 <xificurC> in that case it seems like a logical default to have, doesn't it? Why would one write tests that don't have access to the source?
13:28 <xificurC> I mean, why is the default cabal file generated without it?
13:29 <geekosaur> one normally writes tests that link the library, not import the source
13:29 <geekosaur> but you could do either and cabal does not compel you to do one or the other
13:30 <geekosaur> that is, you can either add the src directory, or you can specify a dependency on your library
13:30 <geekosaur> (not both as that would cause duplicate symbol errors)
13:30 machinedgod joined
13:31 <xificurC> geekosaur: any guidance which to do when? I'm going through the recommended course and keeping the work in this project. Just trying to create some tests next to the homework
13:35 kalley joined
13:35 vmeson joined
13:36 <kalley> hey guys, i want to generate all possible consecutive lists from a given list, .e.g: [1,2,3] -> [[1,2,3], [1,23], [12,3]] can somebody help me with this?
13:37 <geekosaur> xificurC, I think I'd do the library one as that means your tests match what a user of your library would get
13:38 <geekosaur> there are rare circumstances where the other one makes sense
13:38 <geekosaur> which is why I started by saying [12 13:29:02] <geekosaur> one normally writes tests that link the library, not import the source
13:38 <xificurC> geekosaur: I'm not building a library per se, just working on the assignments, which are independent of each other. There's no API to fall out, just me compiling and testing
13:39 <geekosaur> then you;re hitting a case the Cabal library does not handle well. it's generally easier to split into library/main program/tests
13:40 guampa joined
13:41 <xificurC> I see. Thank you for the explanation geekosaur
13:43 <geekosaur> IIRC you can get link errors under obscure circumstances when not using a library. it's annoying. probably could search the Cabal bug tracker
13:47 mizu_no_oto_work joined
13:55 eacameron joined
13:55 <kalley> got it
13:59 takle joined
14:01 gpolitis joined
14:02 eacameron joined
14:08 eacameron joined
14:09 abhiroop joined
14:20 <eatman> fg
14:20 eacameron joined
14:21 takle_ joined
14:22 NeverDie joined
14:28 haskelleksah joined
14:29 abhiroop joined
14:40 DrMentats joined
14:40 carlomagno joined
14:44 jship joined
14:51 abhiroop joined
14:54 nitrix joined
15:06 <sudoreboot[m]> ^Z
15:09 <Iceland_jack> ^\
15:10 iAmerikan joined
15:12 nacon joined
15:12 nacon joined
15:20 marvin2 joined
15:20 nacon joined
15:20 nacon joined
15:24 cschneid_ joined
15:27 nacon_ joined
15:31 albertus1 joined
15:32 Boarders joined
15:32 haskelleksah joined
15:32 NeverDie joined
15:34 nacon joined
15:39 nacon_ joined
15:48 abhiroop joined
16:01 abhiroop joined
16:08 mattyw joined
16:09 mattyw joined
16:12 abhiroop joined
16:16 hdeshev joined
16:18 geekosaur joined
16:20 Rodya_ joined
16:21 aarvar joined
16:23 mengu joined
16:27 iAmerikan joined
16:49 abhiroop joined
17:00 albertus1 joined
17:18 peterbecich joined
17:18 madjestic joined
17:22 govg joined
17:23 DrMentats joined
17:58 sigmundv_ joined
18:02 guampa joined
18:03 ralu_ joined
18:08 nacon joined
18:08 nacon joined
18:17 govg_ joined
18:26 haskelleksah joined
18:29 malaclyps joined
18:34 NeverDie joined
18:46 Zialus joined
18:48 saidinwot joined
18:50 expo873 joined
18:53 pilne joined
18:57 <peterbecich> Hello, would someone give me a hint on this `perClient` function of the NICTA/Data61 course? It's the chat server capstone project. Thank you. https://github.com/peterbecich/fp-course/blob/master/projects/NetworkServer/haskell/src/Network/Server/Chat/Loop.hs#L93-L97
19:01 govg joined
19:19 peterbecich joined
19:19 peterbecich joined
19:20 ma489 joined
19:24 <Gurkenglas> peterbecich, what sort of hint do you mean?
19:26 <Gurkenglas> Rephrasing: I'm guessing you're supposed to replace that definition with another; what should it do?
19:26 iAmerikan joined
19:31 <peterbecich> Gurkenglas: thanks. I have not changed the signature of `perClient` but have made a bogus implementation to try its behavior. `Loop` confuses me: https://github.com/peterbecich/fp-course/blob/master/projects/NetworkServer/NetworkServer.markdown#loop
19:32 <peterbecich> Gurkenglas: I'm not sure what `perClient` should do.
19:34 <Gurkenglas> *reads around that code file a bit* we only have one Env v, and we know nothing about v, so we can only pass the Env v to every place that needs it, so the type signature might as well be "IO x -> (String -> IO a) -> IO ()"
19:34 <Gurkenglas> (Unless Env does some other stuff - where is Env defined?)
19:34 guampa joined
19:35 <peterbecich> Gurkenglas: Env is defined here: https://github.com/peterbecich/fp-course/blob/master/projects/NetworkServer/haskell/src/Network/Server/Common/Env.hs
19:38 <Gurkenglas> Uh oh. I think I just took apart the gun I was supposed to fire in order to find the trigger.
19:39 <peterbecich> Hahah
19:40 <Gurkenglas> Where did you get perClient's type signature?
19:41 <peterbecich> It was provided in the template. Here is the template: https://github.com/data61/fp-course/blob/master/projects/NetworkServer/haskell/src/Network/Server/Chat/Loop.hs#L86
19:44 <Gurkenglas> We know nothing about x and a, so the type signature may as well be (IOLoop v () -> (String -> IOLoop v ()) -> IOLoop v ())
19:44 santoast joined
19:45 <peterbecich> Gurkenglas: thank you. I will think about it further in those terms
19:45 mengu joined
19:46 <Gurkenglas> I'm not done yet! Unless that was your way of saying "I don't think you'll be much help." :P
19:46 <santoast> hello while using list comprehensions is there a way to check the head of the tail of a list (like cadr in scheme) for example [ if head x < head (tail x) then True | x <- (x:xs)]
19:47 iAmerikan joined
19:47 <santoast> I know it's a clumsy question, but I don't really know a good way to ask it aka google it
19:47 <Gurkenglas> "x <- (x:xs)" looks wrong
19:48 <peterbecich> Gurkenglas: Haha, not at all. I just didn't want to withhold my appreciation until the end.
19:48 <monochrom> No, don't use list comprehension, just use ordinary "case".
19:48 <kadoban> santoast: What is your input, a single list of elements? What are the elements? If I'm understanding you correctly, a list comprehension just doesn't seem like a good idea.
19:49 <santoast> so that part is okay, and it works when I do .... increasing (x:xs) = [ if ..... then....else .... | x <- (x:xs)]
19:49 <monochrom> case yourlist of x1:x2:xs | x1 < x2 -> what do you want here? ; _ -> what do you want here?
19:49 <santoast> yes a single list of chars or integers
19:50 <Gurkenglas> peterbecich, we only have one v to pass to all places that require it, so the type signature may as well be: ((Accept, IORef (Set Ref)) -> IO ()) -> (String -> (Accept, IORef (Set Ref)) -> IO ()) -> (Accept, IORef (Set Ref)) -> IO ()
19:52 <Gurkenglas> I'll just guess that we'll hardly be expected to build new IORefs here instead of passing the one already have, but we might well want to access it, so: IORef (Set Ref) -> (Accept -> IO ()) -> (String -> Accept -> IO ()) -> Accept -> IO ()
19:54 wildlander joined
19:56 <Gurkenglas> Wait, how can we have a set of Refs if Ref doesn't have Ord?
19:56 <peterbecich> Gurkenglas: I could try using `modifyIORef` and `id` just for a start.
19:56 <Gurkenglas> combining modifyIORef and id sounds like it does nothing
19:57 <peterbecich> Gurkenglas: agree, it's just the easiest thing I can think of
19:57 azahi joined
19:57 <peterbecich> Without an implementation for `perClient` the chat server is unusable.
19:57 <peterbecich> Ref does have an Ord, one moment please
19:58 <peterbecich> Gurkenglas: Ord instance for Ref: https://github.com/peterbecich/fp-course/blob/master/projects/NetworkServer/haskell/src/Network/Server/Common/Ref.hs#L14
19:58 <Gurkenglas> Ah, missed that, kk
19:58 <Gurkenglas> Let's see where perClient is used.
20:00 Mutter joined
20:00 <Gurkenglas> In loop and iorefLoop, which both pass it to server as the third argument, which spawns a new thread for perClient
20:01 Uniaika joined
20:01 DataComputist joined
20:01 <Gurkenglas> So it looks like perClient is supposed to have a lot of side effects, and it's probably given its own thread so it can wait for handles without the whole program seizing up
20:02 Kuros joined
20:02 DataComputist joined
20:03 <peterbecich> Gurkenglas: so it's probably not a trivial solution
20:03 vicfred joined
20:04 DataComputist joined
20:05 <Gurkenglas> It looks like when someone wants you to write a complicated program but knows that the scaffolding isn't so interesting, so they write that part and then leave you a spot with a "write your program here" sign on it
20:05 DataComputist joined
20:06 DataComputist joined
20:07 <peterbecich> heh, I'm sure the implementation of `perClient` will be illuminative
20:07 iAmerikan joined
20:08 DataComputist joined
20:08 DataComputist joined
20:11 <peterbecich> Gurkenglas: You've given me a lot to think about, in particular this: IORef (Set Ref) -> (Accept -> IO ()) -> (String -> Accept -> IO ()) -> Accept -> IO () I will report back. Thanks!!
20:13 user22 joined
20:14 <user22> Hey
20:14 <user22> Is there anyone in here?
20:14 <geekosaur> nope :p
20:14 <user22> Lol
20:15 <peterbecich> user22: hi
20:16 <user22> I have a problem with a prime generating program I was writing while practicing haskell if anyone can help
20:17 <user22> I'm typing the info into a ghostpaste so that I don't spam the chat
20:19 <user22> https://ghostbin.com/paste/oh662
20:21 <peterbecich> user22: you may be able to fix it by just adding signatures on your functions `prime`, `isPrime` and `divList`
20:22 <peterbecich> a.f.a.i.k. using the values 2, 3, 5, etc. is not adequate to infer you want to work with Integers
20:23 <geekosaur> did defaulting get turned off somehow? I don't see any typeclasses that would block it offhand
20:23 <kadoban> user22: You're using sqrt on something that you appear to assume is an Integer or something like that.
20:24 <kadoban> user22: If you add some type annotations, it'll be clearer where the problem lies.
20:24 <geekosaur> hm, it should be reporting that though
20:25 <kadoban> Well, it kind of is, isn't it? Does it know that there's no Floating that are Integral, or whatever would be required?
20:25 <user22> The problem I can only write really basic type annotations like [Int] -> [Int] or so
20:25 <kadoban> I don't think it typically knows that kind of stuff for error reporting. Or maybe I'm missing some easier thing it could understand to give a better message.
20:26 <geekosaur> doesn;t it normally say that though? that it can't find a type satisfying (Floating t, Integral t) or whatever
20:26 <kadoban> user22: Even giving a type to the very top level definitions themselves should help I believe. None of them are very advanced annotations required.
20:27 <kadoban> geekosaur: I don't think I've seen that message personally. Which doesn't mean it doesn't exist though. So I'm not sure :-/
20:27 <geekosaur> I have seen it, fairly often --- it's the usual thing people seem to show up asking about
20:28 <geekosaur> ...usually while sprinkling coercions randomly...
20:28 <kadoban> Is it new in 8.x or something possibly? Or have I just never happened upon it somehow?
20:28 iAmerikan joined
20:30 <user22> I updated the paste with new info after adding type annotations
20:31 exferenceBot joined
20:31 madjestic joined
20:35 mizu_no_oto_work joined
20:36 <user22> Hey
20:37 <kadoban> user22: Looks more like what I said before. You're using sqrt on Int
20:37 <kadoban> :t sqrt
20:37 <lambdabot> Floating a => a -> a
20:37 <kadoban> Int isn't Floating. You need a fromIntegral wrapper in there I guess?
20:37 <user22> How to do that?
20:37 <monochrom> @quote monochrom fromIntegral
20:37 <lambdabot> monochrom says: You've got an Int / But you want Double / Who do you call? / "fromIntegral!"
20:38 <kadoban> (sqrt (fromIntegral n))
20:40 <user22> Ok thanks a lot guys, you were very helpful.
20:42 <monochrom> The two number-conversion tools you want to bear in mind are fromIntegral and realToFrac.
20:44 <user22> Thanks a lot
20:45 <monochrom> Actually I lied. By the time you want to convert fractions to integers, you will also want to know about floor, ceiling, truncate, round (based on how you want to round).
20:45 <user22> I know about those lol
20:45 <kadoban> It's certainly possible to write an integer sqrt function, which would be another way to go, but AFAIK one doesn't exist in base
20:45 <user22> Except truncate
20:47 <user22> Oh, it basically removes all the decimal points, cool
20:57 govg joined
21:02 merijn joined
21:05 DrMentats left
21:06 taksuyu joined
21:07 <user22> Ok, I'll leave now guys
21:07 <user22> Goodbye
21:08 <kadoban> See you later, good luck
21:12 circ-user-YJwe5 joined
21:17 takle joined
21:18 Rodya_ joined
21:28 kritzcreek_ joined
21:31 malaclyps joined
21:53 hiratara joined
21:54 acarrico joined
22:06 zero_byte joined
22:07 Rodya_ joined
22:10 malaclyps joined
22:10 malaclyps joined
22:11 baldfat_ joined
22:13 NoCreativity joined
22:39 Sose_ joined
22:47 hiratara joined
22:48 <benzrf> :t realToFrac
22:48 <lambdabot> (Fractional b, Real a) => a -> b
22:48 <benzrf> huh
22:53 <NoCreativity> :t (fmap . fmap)
22:53 <lambdabot> (Functor f, Functor f1) => (a -> b) -> f1 (f a) -> f1 (f b)
23:01 mengu joined
23:06 circ-user-YJwe5 joined
23:20 eacameron joined
23:21 eacameron joined
23:46 Geekingfrog joined
23:47 Robin_Jadoul joined
23:51 <NoCreativity> Hello people
23:52 <NoCreativity> Can anyone suggest me some material how this type level evaluation works on Haskell?
23:52 <NoCreativity> I mean
23:52 <NoCreativity> I know fmap :: (a -> b) -> f a -> f b
23:53 <NoCreativity> I know (.) :: (b -> c) -> (a -> b) -> a -> c
23:53 <Cale> Read that as (a -> b) -> (f a -> f b)
23:53 <Cale> (which is the same thing)
23:53 <NoCreativity> I really wanted to understand how (fmap . fmap) :: (a -> b) -> f1 (f a) -> f1 (f b)
23:54 <Cale> So if f :: a -> b
23:54 <Cale> then fmap f :: f a -> f b
23:54 <NoCreativity> Right
23:54 <Cale> (for some functor f)
23:54 <Cale> and then fmap (fmap f) :: f1 (f a) -> f1 (f b)
23:55 <Cale> We could typecheck with the (.) there, but it's more unification and amounts to the same thing :)
23:55 <Cale> Okay, let's just do it :)
23:55 DrMentats joined
23:55 <Cale> (.) :: (v -> w) -> (u -> v) -> (u -> w)
23:56 <NoCreativity> Right
23:56 <Cale> We know we want the second argument to be fmap :: (a -> b) -> (f a -> f b)
23:56 <Cale> So u = a -> b, and v = f a -> f b
23:57 <Cale> (.) :: ((f a -> f b) -> w) -> ((a -> b) -> (f a -> f b)) -> ((a -> b) -> w)
23:57 <Cale> and now we want the first argument to be fmap as well
23:57 <Cale> fmap :: (s -> t) -> (f1 s -> f1 t)
23:57 <Cale> say
23:57 <Cale> So, to match that with ((f a -> f b) -> w)
23:58 <Cale> we need s = f a, t = f b, and w = f1 s -> f1 t
23:58 <Cale> So w = f1 (f a) -> f1 (f b)
23:59 <NoCreativity> Right
23:59 <NoCreativity> I 'll process this a little bit
23:59 <Cale> So that (a -> b) -> w has become (a -> b) -> f1 (f a) -> f1 (f b)