<    March 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 _2_4 25  
26 27 28 29 30 31
00:02 louispan joined
00:02 conal joined
00:04 pie_ joined
00:08 damason joined
00:10 MotherFl1 joined
00:10 MotherFlojo joined
00:17 cschneid_ joined
00:18 <sshine> toying around with Text.Megaparsec. trying to find a prettier way to express 'digit = Digit <$> lexeme (read . return <$> satisfy isDigit)'
00:22 <benzrf> sshine: hold on, i have an idea
00:23 <sshine> I specifically want a single-digit parser.
00:23 <sshine> the whole '. return' is ruining it for my sense of aesthetics.
00:24 <benzrf> sshine: ok well while looking up docu to write out my idea, i found this https://hackage.haskell.org/package/megaparsec-5.2.0/docs/Text-Megaparsec-Char.html#v:digitChar
00:24 <benzrf> :D
00:24 <glguy> :t Data.Char.digitToInt
00:24 <lambdabot> Char -> Int
00:24 <benzrf> and that i guess lol
00:24 <benzrf> > digitToInt 0
00:24 <benzrf> > digitToInt '0'
00:24 <lambdabot> error:
00:24 <lambdabot> • No instance for (Num Char) arising from the literal ‘0’
00:24 <lambdabot> • In the first argument of ‘digitToInt’, namely ‘0’
00:24 <lambdabot> 0
00:24 <benzrf> huh
00:24 <benzrf> > digitToInt 'a'
00:24 <sshine> benzrf, glguy: thanks! :)
00:24 <lambdabot> 10
00:24 <benzrf> > digitToInt '.'
00:24 <lambdabot> *Exception: Char.digitToInt: not a digit '.'
00:25 <benzrf> ewww
00:25 <sshine> that's tolerable. I'll only feed it digits.
00:26 <benzrf> smdh
00:27 <benzrf> guarding partial functions with boolean conditionals makes my skin crawl
00:27 <sshine> >_<
00:27 <sshine> also, digitToInt doesn't produce an Integer like Megaparsec's lexeme thingy wants.
00:28 <benzrf> what type is lexeme?
00:30 <sshine> :t Text.Megaparsec.Lexer.lexeme
00:30 <lambdabot> error:
00:30 <lambdabot> Not in scope: ‘Text.Megaparsec.Lexer.lexeme’
00:30 <lambdabot> No module named ‘Text.Megaparsec.Lexer’ is imported.
00:30 <sshine> :: Text.Megaparsec.Prim.MonadParsec e s m => m () -> m a -> m a
00:30 <sshine> wait.
00:30 <sshine> that's my AST. never mind!
00:31 <sshine> that didn't make sense either way. I was combining lexeme with a space parser, so no Integers involved.
00:32 <benzrf> lol
00:39 systemfault joined
00:39 NoCreativity joined
00:44 conal joined
00:45 cschneid_ joined
00:46 <MarcelineVQ> you could use count 1 (satisfy idDigit) but it's not really nicer than just making your Char a [Char] yourself, Digit . read . pure <$> lexeme (satisfy isDigit)
00:51 argent0 joined
00:51 fhoffmeyer joined
00:52 <MarcelineVQ> I'm assuming the lexeme you're using there is a specialization of Text.Megaparsec.Lexer.lexeme such as lexeme = L.lexeme space
00:55 fDev2179 joined
00:57 fDev2179 left
01:00 mjs2600 joined
01:01 conal joined
01:16 Levex joined
01:17 malaclyps joined
01:25 harfangk joined
01:29 moei joined
01:37 jmg8766 joined
01:39 Youmu joined
01:52 fhoffmeyer joined
01:59 hphuoc25 joined
02:00 mizu_no_oto_work joined
02:04 Rizy joined
02:10 Levex joined
02:10 takle joined
02:16 eacameron joined
02:27 eacameron joined
02:28 takle joined
02:35 eacameron joined
02:35 skeet70 joined
02:36 takle joined
02:42 argent0 joined
02:43 cschneid_ joined
02:46 eacameron joined
02:50 eacamero_ joined
02:50 hphuoc25 joined
02:51 hphuoc25 joined
02:54 fhoffmeyer joined
02:57 takle joined
02:57 eacameron joined
02:58 conal joined
03:04 <sshine> MarcelineVQ, thanks.
03:05 louispan joined
03:05 takle joined
03:07 lspitzner joined
03:07 exferenceBot joined
03:08 hexagoxel joined
03:18 Rizy joined
03:22 takle joined
03:24 justicefries joined
03:28 hphuoc25 joined
03:29 takle joined
03:35 dni- joined
03:36 damason joined
03:37 takle joined
03:38 uglyfigurine joined
03:44 damason joined
03:47 takle joined
03:51 Rizy joined
03:54 takle joined
03:55 fhoffmeyer joined
04:01 louispan joined
04:03 lithie joined
04:04 takle joined
04:06 mac10688 joined
04:20 aarvar joined
04:21 cmoresid joined
04:24 louispan joined
04:25 takle joined
04:25 shayan_ joined
04:30 wukong12 joined
04:48 takle joined
04:49 pie_ joined
04:53 fhoffmeyer joined
04:57 <mac10688> is there a way to tell cabal to have my test-suite depend on all modules located within a folder?
04:57 <mac10688> without listing each module
05:00 mitchty joined
05:02 takle joined
05:03 <tolt> I don't think so mac10688
05:05 <mac10688> oh ok thanks tolt
05:05 <MarcelineVQ> depends what you mean by depend-on, do you mean a listing in the other-modules section?
05:06 <mac10688> yeah
05:06 <mac10688> I think so
05:06 <mac10688> in the build-depends section of cabal
05:06 <mac10688> I believe I have to list each module I want right?
05:06 <MarcelineVQ> build-depends is for packages not modules
05:06 <mac10688> oh yeah...
05:06 <mac10688> wait let me see
05:07 louispan joined
05:07 <mac10688> incoming screenshot
05:08 <mac10688> http://imgur.com/a/Zg53F
05:08 <mac10688> so in this situation, I want all of test-suite to depend on my library
05:08 <mac10688> every module in my library
05:08 <mac10688> but I don't see a package name for library
05:09 <MarcelineVQ> allright, in that case you'd have CodeWarsHaskell as a named dependency, and you'd need to add any module you want test-suite to use to exposed-modules in the library section
05:09 <mac10688> that's making sense
05:10 takle joined
05:11 <mac10688> wish I didn't have to add the module name to the cabal file for each one I make. Is there a way I can do that?
05:12 Levex joined
05:12 conal joined
05:13 <MarcelineVQ> Yeesss, but you probably shouldn't :> The most direct way that comes to mind is to make a module that exports all the other modules and name that single one for exposure, you could update that one module manually or with a script
05:13 <mac10688> that's good info. Thanks MarcelineVQ !
05:13 <MarcelineVQ> another option is to set the src dir for your test suit to the same as the lib
05:14 <mac10688> oh I like that option actually
05:15 <mac10688> because once I solve a problem, I really don't want to run an entire test suite on all the previous problems. This is just for practice
05:15 <mac10688> ok I can probably just get rid of that test-suite definition then
05:18 louispan joined
05:19 <MarcelineVQ> this is a long page but it's absolutly lousy with good information if you'd like to know more about pacakges http://cabal.readthedocs.io/en/latest/developing-packages.html
05:19 <MarcelineVQ> er, lousy in a good way, rife, stocked, bloated, corpulent
05:20 <mac10688> lol ok thanks
05:20 <mac10688> oh it's easy to read. I like that
05:20 eldiz joined
05:26 cschneid_ joined
05:27 systemfault joined
05:27 uglyfigurine joined
05:47 takle joined
05:53 hphuoc25 joined
06:01 louispan joined
06:10 takle joined
06:10 Rizy joined
06:11 hexagoxel joined
06:13 wukong12 joined
06:28 takle joined
06:28 aarvar joined
06:45 hexagoxel joined
06:50 slomo joined
06:50 slomo joined
06:53 ThomasLocke joined
06:59 hphuoc25 joined
07:00 takle joined
07:02 RusAlex joined
07:02 hphuoc25 joined
07:08 takle joined
07:12 hphuoc25 joined
07:20 towerio joined
07:21 takle joined
07:30 hexagoxel joined
07:31 takle joined
07:38 kritzcreek_ joined
07:41 cschneid_ joined
07:45 lak joined
07:47 hdeshev joined
07:53 takle joined
07:54 mengu joined
08:01 takle joined
08:11 hphuoc25 joined
08:12 mattyw joined
08:20 bruschkov joined
08:20 bruschkov joined
08:21 Gurkenglas joined
08:26 louispan joined
08:31 Kuros` joined
08:32 takle joined
08:35 thc202 joined
08:38 zero_byte joined
08:38 fbergmann joined
08:39 bruschkov joined
08:39 fbergmann joined
08:41 fbergmann joined
08:42 towerio joined
08:46 pie_ joined
08:46 lak joined
08:56 hphuoc25 joined
08:56 sigmundv joined
08:57 louispan joined
09:04 hexagoxel joined
09:07 takle joined
09:11 MotherFlojo joined
09:11 takle joined
09:15 nacon joined
09:15 nacon joined
09:17 grdryn joined
09:30 eacameron joined
09:33 tolt joined
09:34 sujeet joined
09:37 mengu joined
09:39 merijn joined
09:40 bruschkov joined
09:40 hphuoc25 joined
09:44 <mounty> It really is irritating that tabs aren't allowed in cabal files. It's a pity that some FSF zealot managed get his/her fascism in there somehow.
09:45 howdoi joined
09:46 <hdeshev> I thought FSF zealots preferred tabs (makefiles, yuck!)
09:46 lak joined
09:47 moei joined
09:49 <MarcelineVQ> they'll bite you in haskell, seems like a good habbit to keep it out of related things
09:49 hphuoc25 joined
09:51 takle joined
09:52 <mounty> In 35 years of programming, they've never ever bitten me.
09:54 <merijn> mounty: GHC enforces the classic "tabs jump to next 8 space tabstop" of tabs on unix, combined with the fact that Haskell's layout rules are more flexible than simple "indented blocks" leads to many people to make mistakes
09:55 <merijn> hdeshev: I know lots of FSF people and they all hate tabs
09:55 <Akii> mounty: aren't you impressed that Haskell single handedly just removed one of the biggest arguments there is?
09:55 <Akii> no tabs, done
09:55 <merijn> Also, aside from Makefiles using tab make is pretty amazing
09:55 <Akii> end of discussion :D
09:55 <merijn> Akii: You can use tabs, but they tend to not mean what people expect
09:56 <hdeshev> I've developed an appreciation for make, but those tabs ... :)
09:56 <merijn> For example "<tab><space><space>" is not the same indent as "<space><space><tab>"
09:56 <merijn> The former being an indent of 10, whereas the latter is an indent of 8
09:56 <mounty> In 35 years of programming, I've never been 'bitten' by tabs. In 35 years of programming, I've never been 'bitten' by tabs. In 35 years of programming, I've never been 'bitten' by tabs.
09:56 <Akii> now you have :D
09:57 <Akii> in 25 years I've never been bitten by snakes!
09:58 <hdeshev> tabs don't break file indentation. people break file indentation :)
09:58 <Akii> xD
10:00 mjs2600 joined
10:00 bruschkov joined
10:04 takle joined
10:08 <Akii> :t contramap
10:08 <lambdabot> Contravariant f => (a -> b) -> f b -> f a
10:08 <Akii> I don't get it
10:08 <Akii> how is this possible
10:12 <Akii> @let foo :: a -> b ; foo = undefined
10:12 <lambdabot> .L.hs:168:1: error:
10:12 <lambdabot> Multiple declarations of ‘foo’
10:12 <lambdabot> Declared at: .L.hs:165:1
10:12 <Akii> @let foo1337 :: a -> b ; foo = undefined
10:12 <lambdabot> .L.hs:164:1: error:
10:12 <lambdabot> The type signature for ‘foo1337’ lacks an accompanying binding
10:12 <lambdabot>
10:12 <Akii> foo!
10:12 merijn joined
10:12 <Akii> anyway
10:12 <Akii> type of foo is "a -> b"; type of flip foo is "b -> a -> c"
10:13 <Akii> I thought that maybe flipping the first argument of contramap would somehow shed light into this
10:14 jarshwah_ joined
10:24 hexagoxel joined
10:33 <MarcelineVQ> that's a fun one, I don't remember at all what to do about it
10:33 madjestic joined
10:33 <Akii> contravariant functors?
10:34 <MarcelineVQ> ye, contra-anything really, reversing the direction of ->
10:34 <Akii> Bartosz explained it in one of his videos
10:34 <Akii> but I forgot the details
10:34 <Akii> like you can create a category where all arrows are reversed
10:34 <MarcelineVQ> I've done a tutorial on it but can't recall how it goes :>
10:34 <Akii> and then magic
10:35 <Akii> maybe I'll come across a real usage some day
10:35 <Akii> always trying to see the practical side of things
10:36 <MarcelineVQ> hmm, well a category (from what I've seen in haskell) consists of id and composition so maybe the answer is defining a reverse composition
10:38 tapirus joined
10:42 mjs2600 joined
10:43 grdryn joined
10:48 lak joined
10:51 gregman_ joined
10:53 Gurkenglas joined
11:01 ederign joined
11:06 hphuoc25 joined
11:07 netheranthem joined
11:16 uglyfigurine joined
11:31 pie_ joined
11:33 jmg8766 joined
11:36 bruschkov joined
11:38 hexagoxel joined
11:53 Denth joined
11:54 bruschkov joined
11:54 bruschkov joined
11:56 mlehmk joined
11:57 carlomagno joined
12:01 mattyw joined
12:04 bruschkov joined
12:07 jmg8766 joined
12:16 Sose joined
12:17 sarkin joined
12:21 merijn joined
12:24 Uniaika joined
12:36 NoCreativity joined
12:37 stianhj joined
12:42 snowcrshd joined
12:45 bruschkov joined
12:45 jmg8766 joined
12:46 bruschkov joined
12:47 bruschkov joined
12:49 Levex joined
12:53 shayan_ joined
13:00 madjestic joined
13:03 Pupnik joined
13:07 lithie joined
13:09 hphuoc25 joined
13:14 cschneid_ joined
13:21 Levex joined
13:21 jmg8766 joined
13:23 mojjo joined
13:27 mengu joined
13:31 wei2912 joined
13:35 mjs2600 joined
13:36 harfangk joined
13:37 lak joined
13:38 greeny joined
13:41 catalin joined
13:42 animated joined
13:44 <catalin> Hi. Can someone provide me with an example (or maybe a link to an article) where Functor / Applicative aren't powerful enough and Monad is needed? I read for example that Applicative can't be used to parse context-sensitive grammars but Monad can. But this seems to complex of an example to develop an intuition.
13:48 <PiDelport> catalin: The core intuition is that you need monad when you want to construct monadic values based on the output / result of a monadic value.
13:48 <PiDelport> Applicative only lets you combine independent functor values, in a sense. They all have to be constructed independently, then combined; you can't construct one using the result of another.
13:49 <Akii> (how are Applicatives combined?)
13:49 <PiDelport> Akii: <*> and friends.
13:49 <PiDelport> So, for example:
13:49 mojjo joined
13:50 <PiDelport> Taking IO as an example, Applicative lets you sequence: putStr "foo" *> putStrLn "bar"
13:50 <PiDelport> Or: (++) <$> getLine <*> getLine
13:50 freechips joined
13:51 <PiDelport> But what if you want to write an echo action, that reads a line and then prints it out again?
13:51 <Akii> you can also throw away results: putStrLn "foo" <* getLine
13:51 <PiDelport> putStrLn <$> getLine is not enough, because it constructs an IO action as a result of another IO action.
13:51 <PiDelport> putStrLn <$> getLine :: IO (IO ())
13:52 <PiDelport> If you try to run that, it will do the getLine, but then nothing further, because you've just constructed an inner putStrLn action without executing it.
13:52 <PiDelport> So the only way to collapse or join those two layers of action is (surprise) join
13:52 <PiDelport> join (putStrLn <$> getLine) :: IO ()
13:52 <PiDelport> And that will work as expected.
13:54 <PiDelport> So join defines the difference between Applicative and Monad: any time you need to go m (m a) -> m a, you require join / Monad, not just Applicative.
13:55 <PiDelport> Oh, and (join (f <$> a)) is the same as (f =<<a)
13:55 <PiDelport> So you can also write the above as putStrLn =<< getLine
13:55 <PiDelport> IOW, you can intuitively remember that (=<<) is (<$>) followed by join
13:56 Robin_Jadoul joined
13:56 <PiDelport> catalin: Does that make sense?
13:57 Tene joined
13:57 Tene joined
13:57 <catalin> PiDelport: It does. I really like the example where you read a line and then print it out. Indeed it seems there is no way to collapse the IO (IO ()) into IO () as functors only add context.
13:57 <catalin> Thank you
13:58 <PiDelport> Right. Join is the only way to do it.
13:58 <PiDelport> This is one of the guarantees that Functor / Applicative gives you: the evaluation of all functorial values being combined are "independent" in the above sense.
13:58 <PiDelport> No one can depend on the result of another.
13:59 <PiDelport> (Not without going beyond Applicative, that is.)
13:59 mattyw joined
14:00 <catalin> PiDelport: Thanks again for the intuition. It really helps.
14:00 <PiDelport> Cool. :)
14:01 <Akii> @karma+ PiDelport
14:01 <lambdabot> PiDelport's karma raised to 2.
14:01 <Akii> :o
14:01 greeny joined
14:03 <PiDelport> Can I set my karma to 355 / 113 ?
14:12 bruschkov joined
14:13 Levex joined
14:17 mounty joined
14:18 pie_ joined
14:20 mizu_no_oto_work joined
14:37 mizu_no_oto_work joined
14:37 pbrant joined
14:40 mojjo joined
14:41 hphuoc25 joined
14:42 Levex joined
14:46 blissdev joined
14:50 bruschkov joined
14:51 Rodya_ joined
15:00 e14 joined
15:10 bruschkov joined
15:15 hvr joined
15:15 Levex joined
15:16 eacameron joined
15:22 hvr joined
15:22 hvr joined
15:26 Levex joined
15:36 chlong joined
15:36 Levex joined
15:41 madjestic joined
15:49 hphuoc25 joined
15:52 Rodya_ joined
15:53 chlong joined
15:54 uglyfigurine joined
16:16 cschneid_ joined
16:31 sujeet joined
16:38 NoCreativity joined
16:44 <Tspoon> Since haskell has these type classes that have certain laws that the instances should abide by, is there, like, some official-ish list-of-type-class-instances-that-are-proved-to-be-legit?
16:45 <Tspoon> or some other community in the habit of going through new interesting instances and confirming their legitimity
16:45 <Tspoon> just wondering
16:46 <PiDelport> Tspoon: The standard library, I guess?
16:47 <PiDelport> In general, any violation of a type class law is just considered a bug, I think.
16:47 <Tspoon> ok
16:47 <monochrom> Yeah, we trust authors to abide. When found otherwise, we yell. That's it.
16:47 <PiDelport> The assumption is all of them try to be and should more or less assumed to be correct according to the laws.
16:48 <Tspoon> alright. I guess the laws aren't really that involved to go through, if one really wants to be sure
16:49 e14 joined
16:49 <Tspoon> or some might be, haven't seen many different instances yet :)
17:01 skeet70 joined
17:08 conal joined
17:16 simendsjo joined
17:17 zero_byte joined
17:18 Rodya_ joined
17:21 Durz0 joined
17:26 pilne joined
17:30 tsmish joined
17:31 jmg8766 joined
17:32 sarkin joined
17:35 Rizy joined
17:38 Denthir joined
17:39 jathan joined
17:40 Foras joined
17:40 lithie joined
17:43 <nitrix> There are some rare cases where it's not law abiding.
17:43 <nitrix> bimap id id = id
17:44 <nitrix> bimap id id _|_ = (_|_, _|_)
17:44 <benzrf> Tspoon: ones that violate the laws tend to be obviously "off" somehow
17:44 <benzrf> er, except for when their violations have to do with bottoms, i guess... :)
17:45 <benzrf> but as we all know, fast and loose reasoning is morally correct :>
17:45 <monochrom> Actually we usually expect no violation in the presence of bottom too.
17:46 <benzrf> o wait
17:46 <benzrf> nitrix: surely that's fixable by just pattern matching in the argument
17:46 <benzrf> which is the most natural way to implement it anyway!
17:46 <benzrf> bimap f g (x, y) = (f x, g y)
17:46 louispan joined
17:47 <monochrom> For example the monad law "m >>= return = m" with bottom implies that return is non-strict, and we actually expect it.
17:47 <benzrf> @let bimap' f g (x, y) = (f x, g y)
17:47 <lambdabot> Defined.
17:47 <monochrom> Having said that, "usually".
17:47 <benzrf> > case bimap id id undefined of (_, _) -> "OK!"
17:47 <lambdabot> "OK!"
17:47 <benzrf> er
17:47 <benzrf> > case bimap' id id undefined of (_, _) -> "OK!"
17:47 <lambdabot> "*Exception: Prelude.undefined
17:47 <benzrf> oh wait what the heck
17:47 <benzrf> the standard library doesnt do that? why not?
17:48 <nitrix> c:
17:48 greeny joined
17:48 <monochrom> To avoid a violation? :)
17:48 <monochrom> Err no, I have to think again.
17:48 <benzrf> monochrom: no, it CAUSES a violation!
17:49 <nitrix> > case bimap' id id undefined of ~(_, _) -> "OK!"
17:49 <nitrix> Lazy patterns works.
17:49 <nitrix> > case bimap' id id undefined of ~(_, _) -> "OK!"
17:49 <lambdabot> "OK!"
17:49 <benzrf> instance Bifunctor (,) where
17:49 <benzrf> bimap f g ~(a, b) = (f a, g b)
17:49 <benzrf> wtf
17:49 <nitrix> Yup :)
17:49 <benzrf> they're deliberately explicitly violating the law??
17:49 <nitrix> Mhhhhm~
17:50 <monochrom> There is a practical benefit for this.
17:50 <monochrom> But there is also a practical benefit for being more strict.
17:50 <monochrom> There was a similar debate on swap. swap (x, y) = (y, x)? swap ~(x, y) = (y, x)?
17:52 hphuoc25 joined
17:53 pdgwien joined
17:54 <monochrom> And you can also see that Control.Monad.State.Strict vs Control.Monad.State.Lazy boils down to that same discussion.
17:55 zipper joined
17:55 zipper joined
18:04 <benzrf> > let (a, b) = undefined in 3
18:04 <lambdabot> 3
18:04 <benzrf> ah right, let is lazy by default
18:04 <monochrom> let puts a ~
18:06 pdgwien joined
18:06 <monochrom> But see http://lpaste.net/100588
18:11 jmg8766 joined
18:12 Durz0 joined
18:15 malaclyps joined
18:19 cmos joined
18:23 wildlander joined
18:23 e14 joined
18:24 wildlander joined
18:26 wildlander joined
18:27 wildlander joined
18:33 zipper joined
18:38 Denthir joined
18:40 Axman6 joined
18:40 Axman6 joined
18:44 <jmg8766> why can't I filter by (not $ null) ?
18:44 <jmg8766> > filter (not $ null) [[],[1]]
18:44 <lambdabot> error:
18:44 <lambdabot> • Couldn't match expected type ‘[t] -> Bool’
18:44 <lambdabot> with actual type ‘Bool’
18:45 <Akii> > filter (not . null) [[],[1]]
18:45 <lambdabot> [[1]]
18:45 <jmg8766> oh ok
18:46 nomotif joined
18:46 Rodya_ joined
18:47 kmelva joined
18:48 <Akii> :t (($) null)
18:48 <lambdabot> Foldable t => t a -> Bool
18:49 <Akii> jmg8766: that probably answers thy "why"
18:49 <Akii> the*
18:49 <Akii> :t not
18:49 <lambdabot> Bool -> Bool
18:49 <Akii> personally I just play around with $ and . until it works
18:50 <jmg8766> I think I understand I was trying to define a function with funtion application not applied would be boolean
18:50 <geekosaur> very short version that might get you farther, but really learn how the types work:
18:50 <geekosaur> $ applies function to value
18:50 <geekosaur> . composes function
18:50 <Akii> filter (\x -> not $ null x)
18:50 <Akii> would work
18:50 <geekosaur> not and null are functions and you want a filter function: this is composition
18:50 <jmg8766> Akii oh yah I did have that
18:50 <geekosaur> application would treat null as a value instead of as a funciton
18:51 vmeson joined
18:51 <Akii> geekosaur: good insight
18:51 <geekosaur> but, really, learn how the types work. otherwise, . and $ will confuse you... and then you hit the real higher order stuff and will be completely lost
18:51 <Akii> I try to think of it that way from now on
18:52 <Akii> although I'd argue that you learn how types work by playing around with $ and . xD
18:52 <Akii> :t ($)
18:52 <lambdabot> (a -> b) -> a -> b
18:55 <Akii> jmg8766: I guess the essence is to at some point stop playing around and just know stuff
18:55 <Akii> I've not reached that point but I'm heading in that direction
18:59 <ski> jmg8766 : what did you think of the `transpose' solution ?
19:00 <jmg8766> ski well I was pretty happy when I figured it out
19:01 <ski> and do you think it's neater than the explicit recursion thing you were about to do ?
19:01 <jmg8766> to be honest, I'm having trouble remembering what I was about to do
19:01 prophile joined
19:02 <ski> ok
19:02 <jmg8766> but I'm sure it is
19:08 <jmg8766> I'm definitely finding it difficult to think about solving sudoku without using arrays
19:08 <jmg8766> but I have a feeling my eventual solution will look much nicer than one with arrays
19:18 <nitrix> Akii: I think you're definitely in the right direction.
19:18 <nitrix> Akii: You seem to be able to play with types just fine.
19:18 acarrico joined
19:20 bruschkov joined
19:20 <Akii> nitrix: thanks!
19:20 <Akii> really appreciate it ^^
19:21 <nitrix> Akii: If I recall, you block around polykinds, which is pretty damn good already. And you are curious for the theory as well.
19:22 <Akii> that I copy&pasted
19:22 <Akii> let me remember where that was important
19:23 <Akii> I think I ended up not needing it
19:23 <MarcelineVQ> and then one day you catch yourself writing something like (((sum .) . map) . (+)) and wonder when it all went wrong, and then after that it gets better
19:23 <Akii> hah
19:24 <nitrix> I hate (x .) . y)
19:24 <nitrix> Sorry, (x .) . y
19:25 <Akii> nitrix: but to my defence: I come back to that stuff all the time. Had some func dep recently; came back to it, looked at it again; didn't need it
19:25 <Akii> I'm the ultimate laziness
19:25 <Akii> everything is a thunk unevaluated
19:25 <nitrix> In the rare cases where I'm tempted to do it, I define (.:) = (.) . (.) but I still don't like that.
19:25 <MarcelineVQ> I'm good with at most one of them. (sum .) . map isn't out of control
19:26 <nitrix> (Composing a function of one argument with one of two arguments)
19:26 <MarcelineVQ> you start tacking onto that no one's gonna have a fun time
19:26 <Akii> there was this blog post today
19:26 <Akii> https://twitter.com/taylorfausak/status/836935520752128000
19:26 <Akii> I really liked this quote
19:27 <Akii> in Haskell there is a fine line between point-freeing the shit out of it and writing understandable code
19:27 <Akii> and you've to adjust to the audience reading
19:27 <Akii> and they do that by code-reviewing
19:27 <Akii> brilliant
19:28 <nitrix> I think the quote is mocking the idea of having abstractions just for the sake of building abstractions.
19:28 <MarcelineVQ> I don't think I get the quote but I'm glad you're finding things you like
19:30 <Akii> (submittedCount m) + 1 vs succ . submittedCount $ m
19:31 <Akii> well almost bad example
19:31 metalbot joined
19:31 <Akii> the problem with the whole point is: the more you learn haskell the less of an issue it is
19:32 <* ski> mostly takes issue with the use of `$' ..
19:33 <Akii> anyway, back to this (sum .) . map stuff I'll refuse to parse atm :D
19:36 <MarcelineVQ> it's probably best worked out on paper, I​ need a review of it myself, . is one of those things I can use due to knowing the pattern but don't understand as well as one should how the types are plugging together
19:36 bruschkov joined
19:37 bruschkov joined
19:39 <srhb> Whenever you see sectioned composition, reviewing Conal's semantic editor combinator blog post may also help.
19:39 <ski> sometimes it's nicer to use `result :: (b0 -> b1) -> ((a -> b0) -> (a -> b1)', `argument :: (a1 -> a0) -> ((a0 -> b) -> (a1 -> b))' or `(~>) :: (a1 -> a0) -> (b0 -> b1) -> ((a0 -> b0) -> (a1 -> b1))'
19:39 <ski> @where SEC
19:39 <lambdabot> http://conal.net/blog/posts/semantic-editor-combinators/
19:40 <Akii> MarcelineVQ: that's the point, if you need a paper to read a piece of code it's by my definition unreadable
19:40 <* ski> fie hives srhb
19:40 <srhb> :-)
19:40 <Akii> for the given person
19:40 <MarcelineVQ> Not to read it, to practice it :>
19:40 <Akii> if you have a team of akiis and present that code, which could be expressed differently in 2 lines
19:41 <Akii> might be a good idea to not go apeshit pointfree-crazy atm
19:41 <Akii> just sayin
19:41 NoCreativity joined
19:41 <Akii> aanyway
19:42 <srhb> Sectioned composition is one of the most difficult-to-read things, in my experience. Luckily it's rarely ever encountered outside of golfing.
19:42 <srhb> (Section other-things can be quite readable, of course)
19:42 <monochrom> Is there a conspiracy behind "SEC" being a prefix of "sectioned"? :)
19:42 <srhb> monochrom: Ha! Never thought of that.
19:43 bruschkov joined
19:43 <monochrom> More seriously, "need a paper" is a moving target.
19:43 <monochrom> Just 40 years ago, you "needed a paper" to read while-loops (as opposed to liberal goto's).
19:44 <monochrom> to read while-loops and if-then-else.
19:44 <* ski> idly recalls self-modifying programs
19:45 <monochrom> And just 30 years ago, you "needed a paper" to read lambdas. (Look for the series of papers all prefixed by "lambda the ultimate")
19:45 <PiDelport> Obligatory! https://en.wikisource.org/wiki/Lambda_Papers :D
19:45 bruschkov joined
19:46 <monochrom> And just 20 years ago, you "needed a paper" to read monadic code. (Phil Wadler's ones.)
19:46 <monochrom> Times flies like an arrow, eh? 20 years from now, we will all probably use lens.
19:47 e14 joined
19:47 <Akii> what is your definition of "needing a paper"?
19:47 <MarcelineVQ> oh maybe, some people quite like it
19:47 <Akii> I thought about writing down stuff like a math equation
19:47 <srhb> I have a feeling that some of us are talking about paper as in "work it out on paper"
19:47 <Akii> types and stuff
19:47 <srhb> And some as "scientific paper"
19:47 <Akii> thank_you.gif
19:47 <MarcelineVQ> so coy
19:48 <Akii> removed an ambigous variable!
19:48 <srhb> Clearly we need typed papers. On types.
19:48 <Akii> someone should make this a game
19:48 <monochrom> Oh nevermind.
19:48 <MarcelineVQ> @roll d20
19:48 <lambdabot> MarcelineVQ: 13
19:49 <Akii> monochrom: agreeing with what you said though
19:49 <MarcelineVQ> I always get 13
19:49 <Akii> like wtf
19:49 <Akii> Servant
19:49 <nitrix> MarcelineVQ: You miss. The Paper Orc grawls and slice your finger open. You're bleeding.
19:49 <nitrix> MarcelineVQ: -10 HP
19:49 <srhb> Akii: Did you see the blog post (or was it a series) on writing a minimal Servant?
19:49 <Akii> all those papers and brilliant guys ended up in something so great I've difficulties explaining how good it is
19:49 <MarcelineVQ> servant is pretty amazing, any advanced type system hackery with real world results is amazing
19:50 <srhb> Akii: Oh, from that perspective. Yes. :)
19:50 <Akii> I am blown away
19:50 <Akii> especially since I've been dealing with Swagger
19:50 <srhb> It is truly amazing. And probably the most advanced type features I use in real life, even if I'm only the consumer of it.
19:50 <Akii> if you don't know that; good!
19:50 <Akii> srhb: can only agree
19:51 <srhb> (Though I think that should be seen as a victory for Servant, not a detractor)
19:51 <Akii> just to quote a seasoned php guy "woooaaahhh"
19:52 <Akii> and yes
19:52 <Akii> servant was just an additional paper
19:52 <Akii> "just"
19:52 <Akii> Swagger was just shit
19:52 <Akii> and is shit
19:53 <Akii> and they just pump man power into it until it's somehow something
19:53 <Akii> like even the fricken name
19:53 <srhb> Well at least it's true to the spirit of it...
19:53 <Akii> I am ranting; I'll stop ranting
19:53 <srhb> :)
19:54 <MarcelineVQ> watched Stephanie Weirich's Dependently-Typed Haskell keynote today, had seen the slides before but not the vid, it's quite approachable and worth a watch if you like types and kinds and the foggy greylands bewteen them where the dragon hides with teeth of gold and a hideous voice of magma that is powered by a pure and innocent heart. https://www.youtube.com/watch?v=P4Io2CRpwyg
19:54 <Akii> servant generates swagger
19:54 <Akii> that's all I need to know
19:54 hphuoc25 joined
19:54 <srhb> MarcelineVQ: She was also Richard Eisenberg's advisor, wasn't she?
19:55 <MarcelineVQ> iirc she referrs to him as her student
19:55 <Akii> I shall consume this video now :D
19:55 mengu joined
19:58 <MarcelineVQ> there's, I think two, slides that they don't switch the camera back to so if you're suddenly confused about what she's talking about it's due to that, but not terribly important
19:58 <MarcelineVQ> it only matters if you're coding along with what she presents
20:01 chlong_ joined
20:01 <Akii> totally unrelated classic Haskell moment
20:02 <Akii> the other day I learned there are comments in E-Mail addresses
20:02 vadimich joined
20:03 lspitzner joined
20:05 <Akii> I notice this a lot where in the Haskell community, people pay attention to detail
20:05 <Akii> RFC -> WorkingLibrary
20:05 <Akii> where I come from nobody knows emails can have comments ^^
20:06 saylu joined
20:06 <MarcelineVQ> I didn't even suspect that was a thing until we looked at that parser in the lib you found
20:07 Deide joined
20:09 <Akii> same
20:10 bruschkov joined
20:14 AndreasK joined
20:15 bruschkov joined
20:16 catalin joined
20:17 <Akii> funny how tabs vs. spaces isn't a thing but every other day I see a new way of indenting where clauses or let clauses
20:17 <Akii> or a mix of both
20:19 <MarcelineVQ> let's always a grab-bag but I'd advocate where indented as specified here: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
20:20 <monochrom> I like that too.
20:21 <Akii> I will consume this next
20:21 chlong_ joined
20:21 <monochrom> Especially because you indent a do-block by 4 and "where" by 2 so you do not mislead yourself or readers into believing that "where" belongs to "do".
20:21 <Akii> most of the time I just use a mix of stylish-haskell and hindent
20:24 <* ski> indents the body of a module
20:24 <MarcelineVQ> you madman
20:25 <* ski> chuckles
20:26 <Akii> you should use HTML
20:26 <Akii> like body is already one intendation step
20:26 <Akii> and then you indent some more
20:27 <monochrom> Indent the <html> element with respect to the doctype heading, too!
20:27 <Akii> I was thinking of this, but did not write it down
20:28 <monochrom> Because I'm Madman!
20:28 <Akii> didn't want to push it too far
20:34 animated joined
20:34 e14 joined
20:38 takle joined
20:41 Malakai joined
20:42 albertus1 joined
20:42 albertus1 joined
20:44 greeny__ joined
20:48 andreass_ joined
20:48 Tspoon_ joined
20:49 baldfat_ joined
20:49 i-amd3_ joined
20:51 chlong_ joined
20:55 darthdeus joined
20:56 mengu joined
20:58 machuga joined
20:58 Denthir joined
21:02 <saylu> Hey guys! Anyone know a decent alternative to Cassava? I can't even get the 5-line examples to work.
21:03 <saylu> Need to process a batch of CSV files
21:04 bjoernfan joined
21:05 <srhb> saylu: You can probably get help with getting cassava to work for you, if you like. :)
21:07 abcxyz123robert joined
21:10 <saylu> The example for named records fails, like this --
21:10 <saylu> http://pasteboard.co/EjjscRAJn.png
21:10 <saylu> Though the other example, not using named records, does work OK
21:10 <saylu> (for the first example, I've literally copy/pasted and am using an identical csv -- http://pasteboard.co/Ejk7BkgA1.png)
21:12 <saylu> I suppose I really just need to play around with it more, but it's a bit frustrating as still fairly a beginner
21:12 pbrant joined
21:12 <saylu> no clue what the 'scopedtypevariables' extension is about, so digging into that a little bit
21:12 tdfirth joined
21:12 <saylu> aaanyway that was a quick vent, sorry about that!
21:12 louispan joined
21:16 mheinzel joined
21:18 <srhb> saylu: I can't reproduce this, but it's hard to tell what mistake you made with screenshots instead of actual code and data.
21:18 <saylu> Works fine for yoU?
21:18 <saylu> *you?
21:18 <srhb> Well, I just quickly wrote down the gist of what you were doing, and yes.
21:18 <saylu> ooooooof
21:18 <srhb> Did you accidentally stick in spaces in the headers or something?
21:21 <saylu> well, shoot
21:21 <saylu> i have no clue, but re-saving the file again as a csv just made it work
21:21 <saylu> i think i'm up too late
21:21 <saylu> thank you for taking the time to reproduce
21:21 <srhb> No problem. :)
21:21 kritzcreek_ joined
21:23 <saylu> I've gone through the haskell book to ~ch. 22 solving every exercise, but still finding it frustrating doing simple tasks like this one ;) I might be a little quick to blame that on external stuff rather than my own continued misunderstanding
21:23 <srhb> saylu: This was probably some small nit, cassava is a good bet. :)
21:24 <saylu> Have you used it much in the past?
21:24 <srhb> Not a lot, but when I did it was a breeze.
21:25 <saylu> Haha, well, I'm looking forward to some version of that ;)
21:25 <srhb> You'll get there. :-)
21:27 <srhb> saylu: I tried converting to Mac line endings to provoke the error, but that works just fine, too.
21:30 emmanuel_erc joined
21:38 peterbec` joined
21:38 peterbecich joined
21:44 shayan_ joined
21:45 Foras joined
21:51 e14 joined
21:52 hiratara joined
22:04 emmanuel_erc joined
22:09 <jmg8766> > concatMap concat $ concatMap (replicate 3) $ chunksOf 3 $ map (replicate 3) [1..9]
22:09 <lambdabot> [1,1,1,2,2,2,3,3,3,1,1,1,2,2,2,3,3,3,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,4,4...
22:09 <jmg8766> is there a better way to say this?
22:10 sigmundv joined
22:14 <monochrom> What is it doing?
22:15 argent0 joined
22:15 <kadoban> And which parts are parameters?
22:16 <jmg8766> so I have a list of boxes and It gives me the box for a given sudoku cell when traversing it left to right top to bottom
22:17 <jmg8766> but I haven't fully thought this through, not sure if this approach is gonna work anyway
22:23 <glguy> Maybe not better, but we can make it shorter :)
22:23 <glguy> > replicate 3 =<< concat . replicate 3 =<< chunksOf 3 [1..9]
22:23 <lambdabot> [1,1,1,2,2,2,3,3,3,1,1,1,2,2,2,3,3,3,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,4,4...
22:26 <jmg8766> >:t (=<<)
22:26 <glguy> (=<<) is the Monad (>>=) flipped. For lists, (=<<) is concatMap
22:31 hiratara joined
22:31 <jmg8766> gonna hold off on Monads for a little while longer lol
22:32 <glguy> You don't have to "learn monads", it's just an infix name for concatMap here
22:32 louispan joined
22:33 <glguy> > replicate 2 =<< "abc"
22:33 <lambdabot> "aabbcc"
22:36 <nitrix> > concatMap (replicate 2) "abc"
22:36 <lambdabot> "aabbcc"
22:38 <nitrix> > "abc" >>= \element -> [element, element]
22:38 <lambdabot> "aabbcc"
22:38 <nitrix> Maybe as an intermediary step, this helps.
22:39 <nitrix> If not, it's alright. concatMap is perfectly fine until you're interested in learning its generalization.
22:45 mheinzel joined
22:52 <tapirus> I still can't figure out what the code is *supposed to do*
22:55 <tapirus> does it go 1,2,3,1,2,3,1,2,3,4,5,6,4,5,6,4,5,6,7,8,9,7,8,9,7,8,9,..... etc.
22:56 <tapirus> (except 1,1,1,2,2,2,... instead of 1,2,... etc.)
22:56 <glguy> [1,1,1,2,2,2,3,3,3,1,1,1,2,2,2,3,3,3,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,4,4,4,5,5,5,6,6,6,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,9,7,7,7,8,8,8,9,9,9,7,7,7,8,8,8,9,9,9]
22:57 pbrant joined
22:57 <glguy> Sudoku is a (typically) 9x9 board where the board is divided up into 9 row, 9 columns and 9 squares
22:58 <glguy> the code is trying to returns the "square" address of each cell of the board when read left to right, top to bottom
22:58 <tapirus> ah, I see
22:58 <jmg8766> better than I could have explained
23:03 pbrant joined
23:05 damason joined
23:20 malaclyps joined
23:25 conal joined
23:30 sigmundv joined
23:30 <jmg8766> is there a better way to define singleton :: [a] -> Bool than singleton [_] = true singleton _ = false ?
23:31 <glguy> capitalizing true and false would be a good start :)
23:31 <jmg8766> whoops sorry
23:35 peterbecich joined
23:36 damason joined
23:41 zanshin joined
23:42 Uniaika joined
23:48 <tapirus> > let a = [[".x."],["x.x"],[".x."]]
23:48 <lambdabot> <no location info>: error:
23:48 <lambdabot> not an expression: ‘let a = [[".x."],["x.x"],[".x."]]’
23:48 <tapirus> > map (map (concatMap (replicate 4))) $ [[".x."],["x.x"],[".x."]]
23:48 <lambdabot> [["....xxxx...."],["xxxx....xxxx"],["....xxxx...."]]
23:49 <tapirus> is there a better way of doing this (i.e. without the map map map nesting, some way to say I want a function to apply to the lowest rank elements?
23:51 texasmynsted joined
23:52 cschneid_ joined
23:57 mengu_ joined
23:58 <SaidinWoT> I'm trying to do the nicta course to get back into Haskell, but whenever I try to load ghci, I get this issue: https://github.com/data61/fp-course/issues/177
23:58 <SaidinWoT> It was never addressed on github... does anyone know what might be going wrong? I'm using stack rather than cabal.