<    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 24 25  
26 27 28 29 30 31
00:01 cdg joined
00:05 Sigyn joined
00:06 pleax joined
00:06 nakal joined
00:07 replay joined
00:09 markus1209 joined
00:09 markus1219 joined
00:09 cschneid_ joined
00:10 unmanbearpig joined
00:10 buglebudabey joined
00:10 steeze joined
00:11 umib0zu left
00:13 buglebudabey joined
00:16 roconnor joined
00:20 eacameron joined
00:22 kthnnlg joined
00:23 doyougnu joined
00:24 lambda-11235 joined
00:25 buglebudabey joined
00:26 mhagemeister joined
00:26 eacameron joined
00:26 <dmj`> Ptival: you might need to start ghc with -itest as well
00:26 theDon_ joined
00:27 kakashiAL joined
00:27 kini joined
00:29 <dmj`> ghci*
00:30 ub joined
00:31 andyhuzhill joined
00:31 <robkennedy> Just checking this
00:31 <robkennedy> :t \x y -> x / y
00:31 <lambdabot> Fractional a => a -> a -> a
00:32 <Koterpillar> robkennedy: FYI, /msg lambdabot :t "This works too"
00:34 qinusty joined
00:36 louispan joined
00:37 argent0_ joined
00:41 <metalbot> anyone know the authors of "Real World Haskell"?
00:41 <metalbot> there's a bizarre chapter of their book being sold on Amazon by a different author...
00:42 <Clint> is it one that's not completely out of date?
00:42 augur joined
00:42 Swizec joined
00:42 <metalbot> no - it's literally the text of their chapter on monads republished under a new name
00:43 <metalbot> https://www.amazon.com/Monads-Programming-World-Haskell-Ellis/dp/1542739640
00:43 Unhammer joined
00:43 <monochrom> They don't come to IRC often these days. (They used to.)
00:43 _ashbreeze_ joined
00:44 <monochrom> But I bet O'Reilly is eager to know too, and more influential in taking action.
00:44 <glguy> That's got a pretty sweet title going for it
00:44 <metalbot> oreilly isn't on IRC either, and i'm pretty damn lazy...
00:44 <glguy> Oh well, it was a good effort
00:44 eacameron joined
00:45 <dolio> This wouldn't be the first time someone has put a Haskell book they haven't written on Amazon, I think.
00:46 mbrane joined
00:46 ericsagnes joined
00:46 <robkennedy> It's worth the effort, if you can afford to expend it - Haskell lives because of SPJ, and Simon Marlow, and Bryan O'Sullivan, giving humanity the man-hours
00:46 <robkennedy> (and many many many others
00:47 <mmaruseacph2> wow, plagiarism even here :(
00:48 <metalbot> ah - found "infringement@oreilly.com" address :)
00:48 <robkennedy> Not here. Plagiarism is not the fault of the producers. Don Stewart didn't wear anything to ask for it ;)
00:48 Squarism joined
00:49 <robkennedy> metalbot: thanks
00:49 <dmj`> world haskell ?
00:49 <dolio> Easy publishing lowers the bar for profitability, I imagine.
00:50 <dolio> Like spam.
00:50 mdarse joined
00:51 zcourts joined
00:52 <mmaruseacph2> robkennedy: I know
00:52 <mmaruseacph2> metalbot: sent them an email, the more the merrier :)
00:53 <mmaruseacph2> *the easier will be for them to see that it is an issue they need to tackle
00:53 TxmszLou joined
00:53 taksuyu joined
00:54 nighty joined
00:54 modlin joined
00:54 justanotheruser joined
00:58 FjordPrefect joined
00:59 dan_f joined
01:05 cogrendel joined
01:07 jacqueline[m] joined
01:07 hakan[m] joined
01:07 foldu[m] joined
01:07 shiona[m] joined
01:07 Soif[m] joined
01:07 FederalRick[m] joined
01:07 noraesae joined
01:07 chef_excellence[ joined
01:07 rakete joined
01:07 miviotros[m] joined
01:07 goodboy[m] joined
01:07 Guest91110[m] joined
01:07 el_tejon[m] joined
01:07 pleax joined
01:07 sazert[m] joined
01:07 drasich[m] joined
01:07 M-Quora joined
01:07 Naughtmare[m] joined
01:07 rodoa96[m] joined
01:07 jyp[m] joined
01:07 closures999[m] joined
01:07 zaphar_ps[m] joined
01:07 na9da[m] joined
01:07 bolton joined
01:08 M-berdario joined
01:09 plutoniix joined
01:09 hiq[m] joined
01:10 herzmeister[m] joined
01:10 ProofTechnique[m joined
01:10 tfc[m] joined
01:10 M-Magnap joined
01:10 Yves[m] joined
01:10 bobjason[m] joined
01:10 yerhausin[m] joined
01:10 gentam[m] joined
01:10 tom7942 joined
01:10 unmanbearpig joined
01:10 ayk[m] joined
01:10 isair[m] joined
01:10 corintho[m] joined
01:10 M-Shrike joined
01:10 M-BostonEnginerd joined
01:11 karroffel joined
01:11 M-krsiehl joined
01:11 alaradia[m] joined
01:11 curry[m] joined
01:11 aspiwack[m] joined
01:11 elwan7[m] joined
01:11 jmnoz[m] joined
01:11 FreeBirdLjj joined
01:12 wictory[m] joined
01:12 M-schmittlauch joined
01:13 markasoftware joined
01:15 k0001 joined
01:15 gkaplan[m] joined
01:15 cbHXBY1D[m] joined
01:15 mmmrrr[m] joined
01:15 iffsid[m] joined
01:15 acidjnk22 joined
01:15 j201[m] joined
01:15 hendrik[m] joined
01:15 TylerCecil[m] joined
01:15 TesX[m] joined
01:15 jacobm[m] joined
01:15 roadrunner168[m] joined
01:15 Aidan[m] joined
01:15 SteinsGate[m] joined
01:15 unknownln joined
01:16 M92854[m] joined
01:16 rkazak joined
01:16 m4lvin[m] joined
01:16 NopeMarker[m] joined
01:16 monomon[m] joined
01:16 davidar_ joined
01:16 seequ_ joined
01:16 radix joined
01:16 srenatus[m] joined
01:16 M-wamaral joined
01:16 bb010g[m] joined
01:16 sudoreboot[m] joined
01:16 unclechu joined
01:16 M-Illandan joined
01:17 Gurkenglas joined
01:17 cdg joined
01:17 davidar joined
01:19 aib joined
01:20 jmcarthur joined
01:23 contiver joined
01:23 buglebudabey joined
01:26 mhagemeister joined
01:27 clmg joined
01:27 GlobalAtom joined
01:28 ramzifu joined
01:28 <clmg> How do I make a "reference" in Haskell such that when I change one field of a record it updates that same field of another record?
01:30 <clmg> In C terms: I want my object (record) to have a field whose value is a pointer to another object (record).
01:30 <pacak> MVar, IORef
01:30 <jle`> is there a common term for something like (a, b) -> Either c d -> Either (a, c) (b, d)
01:31 <pacak> STRef, TVar
01:31 <clmg> pacak: is there a more "haskell" way to accomplish this?
01:31 <clmg> pacak: rather than actually having references/pointers?
01:31 <jle`> mvars/iorefs are pretty 'haskell'
01:31 <jle`> but it's hard to tell if there's a better way without more context
01:31 <pacak> clmg: Referential transparency is a nice thing.
01:31 <jle`> you're just giving us a very narrow/thin slice and from this perspective, mvar/ioref is the naive answer
01:32 Rodya_ joined
01:32 <dolio> :t uncurry $ \x y -> bimap (x,) (y,)
01:32 <lambdabot> Bifunctor p => (t, t2) -> p t1 t3 -> p (t, t1) (t2, t3)
01:32 <clmg> pacak: I have two data constructors: window and buffer. Windows need to have buffers, but a buffer can be shared between two windows. I want it so that when one window edits its buffer, the other windows which ahve that buffer get updated also.
01:33 <clmg> pacak: all I can think of is passing around the list of buffers and storing the buffer index in the window. But that's cumbersome.
01:33 <jle`> dolio: i can implement it, i just was wondering if there was some name
01:33 Anthaas joined
01:33 <Anthaas> ~ books
01:33 psilo2 joined
01:33 <Anthaas> ! books
01:33 <jle`> what i'm actually doing is "zipping" (?) an n-ary product with an n-ary sum
01:33 <Anthaas> bot?
01:34 <ski> clmg : you could have windows include buffer identifiers, and have a separate data structure mapping buffer identifiers to buffer contents
01:34 <jle`> so like Tuple '[a,b,c,d] -> Sum '[e,f,g,h] -> Sum '[(a,e), (b f), (c, g), (d, h)]
01:34 <Anthaas> Meh, Hi guys - I have literally 0 experience with FP outside of Java 8 - can anyone suggest the "canonical" books which can explain everything from the start?
01:34 <clmg> Anthaas: I found learn you a haskell helpful.
01:35 <ski> Anthaas : i learned the basics from "Haskell: The Craft of Functional Programming" by Simon Thompson
01:35 <Anthaas> Im sort of looking for language agnostic, but with examples in a popular language/practice questions, etc.
01:35 <clmg> ski: how do I avoid passing that separate data structure around the entire application? Basically everything my application does works on a (buffer, window) pair.
01:35 <robkennedy> Arthaas: Learn You A Haskell and Parallel and Concurrent Programming in Haskell
01:35 <jle`> there's also haskellbook that is popular these days
01:35 <psilo2> I've got got this in an example xmonad config and can't find any explanations of the =<< operator: main = xmonad =<< statusBar myBar myPP toggleStrutsKey myConfig Can anybody explain (or tell me what I should be googling for)?
01:35 <jle`> @where haskellbook
01:35 <lambdabot> http://haskellbook.com
01:36 ramzifu joined
01:36 <Nolrai> What is Typeable1 as compared to Typeable?
01:36 <ski> clmg : `State'/`StateT' .. or `ST' or `IO'
01:36 <psilo2> Similarly, I've seen <+> somewhere (can't find it now) and not finding that in haskell syntax documentation
01:37 <clmg> ski: https://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-State-Lazy.html
01:37 <robkennedy> Bah humbug @haskellfromfirstprincipals
01:37 <clmg> that?
01:37 <jle`> psilo2: it's not a part of syntax
01:37 <jle`> psilo2: it's probably a custom defined operator
01:37 <ski> Nolrai : `Typeable1' is for types of kind `* -> *'
01:37 <Nolrai> Ah.
01:37 <monochrom> psilo2: "y =<< x" = "x >>= y"
01:37 <ski> clmg : that's one possibility
01:38 <psilo2> jle`: AH! So the Xmonad core source/docs is where I need to be looking. thanks!
01:38 <jle`> no problem!
01:38 xpika joined
01:38 <jle`> custom operaters are always one of the "ugh really" moments when you are trying to read code heh
01:38 <jle`> in haskell at least
01:38 <Nolrai> Wait ...why is that exported from Contro.Monad.Exceptions, but Typeable or Typeable0 isn't?
01:38 <Nolrai> jle' : I dont agree.
01:39 <robkennedy> :t (undefined :: Show a => a ->
01:39 <lambdabot> error:
01:39 <lambdabot> parse error (possibly incorrect indentation or mismatched brackets)
01:39 <Nolrai> They are just infix functions.
01:39 <Fairy> I'm feeling a bit stupid, but I'm trying to create a function notFollowedBy :: Parser b a -> Parser b () and I can't for the life of me figure it out :S
01:39 rekahsoft joined
01:39 <psilo2> monochrom: that makes sense, since you seem to be familiar with it already, is it correct that it comes from the xmonad libraries and not haskell?
01:40 <slaterr> @hoogle <+>
01:40 <lambdabot> Control.Arrow (<+>) :: ArrowPlus a => a b c -> a b c -> a b c
01:40 <lambdabot> Language.Haskell.TH.PprLib (<+>) :: Doc -> Doc -> Doc
01:40 <lambdabot> Text.PrettyPrint (<+>) :: Doc -> Doc -> Doc
01:40 <jle`> Nolrai: yes, it's true that they are just infix functions
01:40 <jle`> but that doesn't magically make them readable
01:40 <monochrom> >>= is a commonly used operator in most Haskell code.
01:40 <Nolrai> I guess it depends on how useful you find names.
01:40 <psilo2> Might be time to finally learn a bit of Haskell after a couple years of stumbling through my xmonad configs.
01:40 <jle`> "infix functions are readable functions" is not a logical conclusion i'd make
01:40 halogenandtoast joined
01:40 <robkennedy> :t undefined :: Show a => a -> String
01:40 <lambdabot> Show a => a -> String
01:40 <monochrom> But <+> is more custom-made.
01:40 <jle`> functions don't become readable just because they're infix
01:40 <Nolrai> No..
01:40 <psilo2> monochrom: right I see that but what about =<<?
01:41 <Nolrai> I never said that.
01:41 <Nolrai> (=<<) = flip (>>=)
01:41 <jle`> "i don't agree that they are bad; they are infix functions"
01:41 <monochrom> =<< is less common but sometimes people want it for the other operand order.
01:41 <jle`> sorry, sort of implicitly injected a "because" in the middle there :)
01:41 <jle`> *i sort of
01:42 <Nolrai> jle': Yes I don't find worse then normal functions, nor do I find them better.
01:42 cschneid_ joined
01:42 <monochrom> Put it this way. >>= has been in the standard library for a long time. =<< is a fairly recent addition, but still to the standard library. <+> is custom-made.
01:42 <psilo2> monochrom: Ah ok, I'm just looking at http://www.imada.sdu.dk/~rolf/Edu/DM22/F06/haskell-operatorer.pdf and I suppose they fairly considered it obvious what =<< is after defining >>=
01:42 <dolio> (=<<) is not recent.
01:42 <psilo2> Thanks for everyone's input. this stuff's kinda hard to google sometimes (for me apparently)
01:43 <Nolrai> A couple of your responces only made sense if I said I liked operators /better/ then normal functions.
01:43 <monochrom> It is hard to Google. But xmonad assumes a fair bit of Haskell knowledge.
01:43 <Nolrai> (Though googleability is a real issue with operators.)
01:43 Retri joined
01:43 <monochrom> "Our config file is just a Haskell code file!"
01:44 <monochrom> Imagine if Windows config were "just a cmd.exe script".
01:44 <monochrom> (Wait, that actually happened to Windows 95.)
01:44 mbrane joined
01:44 <Clint> win95 had cmd.exe?
01:45 <monochrom> Oh tonight everyone is going to anal nitpick on everything I said, right?
01:45 <Clint> could be
01:45 <psilo2> That's fair, I did learnyouahaskell probably literally a decade ago and then dropped it. If I want to try haskell again, is that still a decent place to start?
01:45 <monochrom> If you have an erratum to my sentences, just say the erratum, don't bother questioning me, I won't answer.
01:45 <psilo2> monochrom: it's a day of the week on an IRC programming channel, isn't that traditional? ;)
01:45 ego joined
01:46 <monochrom> Not traditional on #haskell.
01:46 <psilo2> Sounds lovely, maybe I'll hang around for once
01:48 <Fairy> I'm trying to implement "notFollowedBy" function, using "lookahead" @ http://lpaste.net/4639017352053129216 but I can't seem to figure out a way to do it, I would have thought that "lookahead p <|> return ()" would work, but it doesn't :S
01:51 RGamma joined
01:51 petervaro joined
01:52 cpup joined
01:52 <Fairy> am I being stupid? :S
01:52 zcourts joined
01:52 <monochrom> No, but you're confusing. The code on the webpage is not the code you just said.
01:53 sykora joined
01:53 <monochrom> I don't see "lookahead p <|> return ()" in the paste. I only see another version.
01:54 FreeBirdLjj joined
01:54 <Fairy> oh, sorry, that was the only version of "notFollowedBy" that I could get to work properly :S
01:55 mada joined
01:56 <monochrom> OK, first a fixable technicality. "lookahead p <|> return ()" is a type error. But can be fixed by "(lookahead p >> return ()) <|> return ()"
01:57 <monochrom> But the real, semantic problem is that this attempt always succeeds.
01:57 <monochrom> If "lookahead p" succeeds, then the whole thing succeeds. This is not what you want for notFollowedBy.
01:58 <Fairy> yeah :S notFollowedBy is basically supposed to be the opposite of lookahead :S
01:58 <Fairy> I've spent around 3hrs thinking about a solution, and I can't come up with one
01:59 <* mniip> picks some nits
01:59 <monochrom> Suppose I give you && and ||, and ask you to implement "not", and I ask you to only use && and || to do it, no lowering yourself into the actual True's and False's. You will not be able to do it.
02:00 cpup joined
02:00 <mniip> ooh ooh that's a consequence of the post theorem isn't it
02:00 <mniip> && and || are monotonic but 'not' isn't :p
02:00 <monochrom> notFollowedBy is a similar story. It is a negation. You can't combine a lot of positive things to implement negation.
02:01 Swizec joined
02:01 Anthaas left
02:02 juhp joined
02:03 <Fairy> so there's no way to do it?
02:04 drostie joined
02:04 takle joined
02:08 pleax joined
02:08 <monochrom> You have to first implement (by going low level) one kind of negation operator or another. Because it cannot be derived from the positive ones.
02:09 <monochrom> And the first negation operator you implement may as well be notFollowedBy itself.
02:09 Textmode joined
02:09 <monochrom> Just like when doing booleans, you have to have a "not" as a basic operator, or "nor", or "nand", or "xor".
02:10 <Fairy> interesting
02:11 unmanbearpig joined
02:11 <mniip> yeah
02:12 michael4 joined
02:12 <mniip> you need a function that is non-monotonic, one that is nonlinear, one that is non-1-preserving, one that is non-0-preserving, and one that is non-selfconjugate
02:13 hexagoxel joined
02:13 <mniip> nand is all of those things simultaneously and hence you can implement all of boolean algebra with just that
02:14 <Fairy> and here I was sitting confident that the <|> would be sufficient
02:14 <monochrom> That is a cunning plan. We need a "nor" or "nand" parser combinator!
02:16 <ski> i'm very sorry, but your negation won't be involutive
02:16 infinity0_ joined
02:16 infinity0_ joined
02:17 pleax joined
02:18 Rotaerk joined
02:18 conal joined
02:19 dsantiago joined
02:19 infinity0 joined
02:20 mizu_no_oto joined
02:20 indi_ joined
02:22 infinity0 joined
02:24 chrisbdaemon joined
02:25 infinity0 joined
02:25 krauq joined
02:25 chrisbdaemon left
02:25 mbo_ joined
02:26 mhagemeister joined
02:27 infinity0 joined
02:28 robertkennedy joined
02:28 krauq joined
02:28 <mniip> what languages even are closed under nand?
02:29 tom7942 joined
02:29 <mniip> regular and recursively enumerable only I think
02:30 infinity0 joined
02:31 cyborg-one joined
02:32 Argue_ joined
02:32 danharaj joined
02:34 conal joined
02:34 Rodya_ joined
02:37 alx741 joined
02:37 cdg_ joined
02:39 Jesin joined
02:41 dustmote joined
02:41 mac10688 joined
02:41 sellout- joined
02:44 Welkin joined
02:44 MrWoohoo joined
02:45 hexagoxel joined
02:45 <dolio> I don't think RE is.
02:45 <Welkin> lambdabot: @messages
02:45 <lambdabot> You don't have any messages
02:45 <Welkin> D:<
02:46 <ski> @tell Welkin You've got a message
02:46 <lambdabot> Consider it noted.
02:46 <dolio> Recursive is.
02:47 sq_sqd joined
02:47 <Nolrai> So in 8.0.2 deriving Typable is unnessary?
02:47 <Nolrai> *ghc 8.0.2
02:47 cdg joined
02:49 Ch3ck joined
02:50 <lyxia> it has been unnecessary for a while.
02:50 <Nolrai> Really?
02:50 <Nolrai> I am behind the times.
02:52 Uakh joined
02:53 zcourts joined
02:54 mrkgnao joined
02:57 safe joined
02:58 <mniip> dolio, wait
02:58 <mniip> which is the class for which a TM terminates and says yes/no
02:58 Uakh joined
02:58 vadimich joined
02:58 <monochrom> Recursive.
02:59 <mniip> aha
02:59 <monochrom> Recursively enumerable = semidecidable = If the answer should be yes, the TM terminates and says yes; else the TM could say no or go on forever
02:59 louispan joined
02:59 <mniip> RE are the ones for which a TM terminates or doesn't
02:59 <mniip> right
03:00 hucksy_ joined
03:02 <Nolrai> And Regular = decided by a context-free grammar, right?
03:03 <mniip> cfgs are strictly weaker
03:03 <monochrom> regular expression, finite state automaton
03:03 <mniip> ah er
03:03 <mniip> regular
03:03 <monochrom> context-free is when nondeterministic pushdown automaton
03:03 <mniip> cfgs are strictly stronger than regulars
03:04 <mniip> and contextful grammars are linearly bounded terminating TMs iirc
03:04 <monochrom> (In the case of finite state automata, determinism and nondeterminism don't matter, apart from exponential blowup.)
03:04 <mniip> yep
03:04 <mniip> deterministic pushdown automata define DCFGs
03:05 <mniip> which is strictly weaker than CFGs
03:05 <monochrom> Strangely, by the time you hit TM, again det vs nondet don't matter.
03:05 <mniip> are you sure in the case of a linearly bounded TM?
03:06 <monochrom> No.
03:06 <monochrom> I just meant unrestricted TM.
03:06 <mniip> ok
03:06 <monochrom> Haven't studied the context-sensitive class.
03:07 <mniip> we have barely touched it in our language theory course
03:07 <monochrom> It does seem a less popular topic.
03:07 <Nolrai> Because you can simulate NDTM's fairly straightforwardly with a DTM.
03:08 lambda-11235 joined
03:09 <Nolrai> Are infinite Regular Expressions equivalent to CFGs?
03:09 <monochrom> What are those?! :S
03:11 <dolio> Any language can be given an "infinite regular expression".
03:11 tom7942 joined
03:11 <mniip> do you mean a countable state automaton?
03:11 <mniip> :p
03:11 <Nolrai> mniip: I think so?
03:11 <dolio> Just take the union of all the strings in the language.
03:11 <mniip> well
03:11 amiri joined
03:11 <mniip> that's an unrestricted language
03:12 <mniip> because it all depends on the final states set
03:12 <Nolrai> Right.
03:12 unmanbearpig joined
03:12 eklavya joined
03:13 <mniip> if you however restrict to recursively enumerable or computable sets, you get RE and resp. recursive languages
03:13 <dolio> Or yeah. Define states for every possible string, and circle the ones in the language.
03:13 <Nolrai> I meant things like mp='('mp*')' .
03:13 harfangk joined
03:14 systemfault joined
03:14 browndawg joined
03:15 connrs joined
03:16 _sg joined
03:16 <mniip> like an EBNF?
03:16 <mniip> that's just a fancy cfg
03:17 <monochrom> Yes it doesn't exceed CFG yet. It's just using syntax sugar.
03:17 <monochrom> (FSVO "yes" I guess)
03:17 pleax joined
03:18 sword865 joined
03:21 the|auriscope joined
03:24 yfeldblum joined
03:25 uglyfigurine joined
03:25 mjs2600 joined
03:27 FreeBird_ joined
03:27 krauq joined
03:28 TxmszLou joined
03:29 raycoll joined
03:30 augur joined
03:33 AndiK joined
03:33 fabianhu_ joined
03:33 aarvar joined
03:34 xtreak joined
03:36 hexagoxel joined
03:36 raycoll joined
03:38 mbrane joined
03:38 Argue__ joined
03:39 pavonia joined
03:39 cschneid_ joined
03:40 tmtwd joined
03:42 eacameron joined
03:45 mizu_no_oto joined
03:45 cads joined
03:46 mbo_ joined
03:48 <theelous3> can someone help me wrap my head around how this is evaluated? let rightTriangles = [ (a,b,c) | c <- [1..10], b <- [1..c], a <- [1..b] ]
03:50 <lyxia> theelous3: are you familiar with nested for loops
03:50 <theelous3> I'd've presumed that, in order, we'd get say, [(1, 1, 1), (2, 2, 2) (etc.)], but we get [(1,1,1),(1,1,2) etc.]
03:50 <theelous3> ah
03:50 <theelous3> right
03:50 <lyxia> heh
03:50 <theelous3> so it evals the c's
03:50 <theelous3> gottcha I think
03:51 <theelous3> yeah makes sense
03:51 <theelous3> ty lyxia
03:51 <lyxia> yw
03:51 zcourts joined
03:54 cyborg-one joined
03:55 mdual joined
03:57 <Nolrai> So I am rather confused by this ghc error: http://lpaste.net/353164
03:57 <Nolrai> I am using FlexibleContexts, so why isn't it accepting the type it inffers?
03:58 <mniip> LANUAGE
03:58 <Nolrai> Oh god. Of course!
03:59 <ertes> Nolrai: it should have complained about an unknown pragma, too
03:59 <cads> Hey guys, I'm parsing some unformatted string output from an automated manufacturing service - basically these strings specify how much of which file needs to be manufactured, what material and thickness to use, and what finish to provide
03:59 <cads> Here's a sample: https://gist.github.com/maxsu/a64a5ad97c7f36591627abc7be311f21
03:59 <lispy> hello
04:00 <cads> there's some variability in the format, and I suspect that the format will continue to change as they tweak their code
04:00 <Nolrai> ertes: hmm. I don't think I've seen it ever make that complaint. Is there like a flag to turn that warnning on?
04:00 vtomole_ joined
04:00 <ertes> Nolrai: not sure if a warning is needed, but i always use -W
04:00 <cads> so I'm wondering what's the best way to write a parser that will turn these unstructured strings into more tame structured json
04:00 <lispy> What sorts of projects are people working on these days?
04:01 <lispy> cads: well that's a pretty verbose english-y format
04:01 <cads> in practice it'll have to be fault tolerant enough to notify the admin when it can't parse a string
04:02 YongJoon joined
04:02 <lispy> But, since everything tends to be on online, you'd get pretty far with a regex as much as it pains me to suggest that
04:02 <lispy> er, on one line*
04:02 <cads> lispy, I was thinking regexes won
04:02 <cads> won't be too bad of an idea *
04:03 Koterpillar joined
04:03 exferenceBot joined
04:03 tctara joined
04:04 dougvann joined
04:04 tripped joined
04:04 <Nolrai> ertes: stack build doesn't seem to be using the ghc-options in my .cabal file.
04:04 <lispy> cads: Actually, I might throw sed at it to preprocess into json, sexpr, csv, etc and then try to read that in
04:04 <ezyang> Nolrai: How can you tell?
04:05 <lispy> cads: Basically going with a design where I would decouple input massaging from the Haskell code
04:05 jedws joined
04:06 <Nolrai> From this? https://www.irccloud.com/pastebin/hOOo8mei/message_from_stack
04:06 alasi joined
04:07 hexagoxel joined
04:07 lspitzner joined
04:07 <glguy> the ghc options wouldn't be passed to the setup executable
04:08 <Nolrai> Okay..so how do I tell then?
04:08 leat joined
04:09 modlin joined
04:11 roconnor joined
04:11 <Nolrai> Okay I think I solved this, I had a "ghc-options:" line for app and test, but not lib.
04:12 ali_bush joined
04:12 xall joined
04:13 unmanbearpig joined
04:14 <cads> For a simple line like "1. qty 10, Custom part from R3J8-M0X4-aluspacer.dxf, Aluminum 6061 0.5, Process: Waterjet Machining," I can use a sed expression like 's/^[0-9]+\. qty \([0-9]\), Customer part from \(\w*.dxf\), \([^,]*\) \([0-9.]+\).*$/{"qty": "\1", "material": "\3", "thickness": "\4", "file": "\2"}/'
04:14 <cads> lispy, oh god that is so terrible, lol
04:14 <Nolrai> Does -W include warnings -Wall doesn't?
04:14 <cads> lemme see if that even works
04:15 mbeidler joined
04:16 <MarcelineVQ> Nolrai: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/using-warnings.html#options-sanity
04:17 unK_ joined
04:18 <lispy> cads: it is pretty bad, but making a parser is going to have similar issues like, what is a token in this language? split on whitespace and punctuation, but then what about things like '-', you probably don't want to split on that.
04:20 pleax joined
04:20 <Nolrai> Hmm. It says "-Wunrecognised-pragmas" is on by default, but I am prettysure it shouldn't recognize "LANUAGE".
04:20 louispan joined
04:20 <Nolrai> lispy: using char as the tokens can work pretty well with haskell parsers.
04:22 <cads> lispy, that's true
04:23 <Squarism> why doesnt this work in ghci
04:23 otto_s_ joined
04:23 <Squarism> Prelude> :{
04:23 <Squarism> Prelude| g :: Int -> String
04:23 <Squarism> Prelude| g i = show i
04:23 <Squarism> Prelude| :}
04:23 <cads> I guess I'm going to try it the regex way, but I'll probably do it in node or something more portable
04:23 <Squarism> get
04:23 <Squarism> <interactive>:54:5: parse error on input ‘=’
04:23 <cads> Kinda wish I could just train the parser
04:24 <lispy> cads: if you want something more magical that might just work, there is this: http://www.padsproj.org/
04:25 <monochrom> Squarism: I just tried. Works.
04:25 <Squarism> gah
04:25 <cads> lispy, a concern is that this will have to be fault tolerant - if the data producer changes its format and the parser can't make sense of the new format, it needs to tell the human operator "hey, the format has changed"
04:26 <cads> I'll have to see about making an agreement for the producer to not change the format without notice
04:26 <lispy> ah
04:26 <lispy> Yeah, that means regular expressions are a liability
04:27 <lispy> If you're open to trying new things (I assumed this needed to be in Haskell), then PADS is probably the best tool I can think of
04:27 <cads> already in the three months of data I'm working with I've seen the data format change a bit, and there are also entries which seem hand written
04:27 <cads> lispy, checking pads out right now
04:27 brynser_ joined
04:27 mhagemeister joined
04:28 <lispy> looks like there is a Haskell backend
04:28 <cads> lol, I'm only asking in here because I know haskellites have been exposed to advanced parser generation techniques :)
04:28 JuanDaugherty joined
04:28 <cads> but yeah, this is probably going to be written in node or python
04:29 <lispy> cads: like this example is kind of cool: http://pads.cs.tufts.edu/examples.html
04:29 <lispy> they generate C code that can parse the example log format
04:29 <lispy> You could call C code from python
04:30 <cads> yeah, shouldn't be a problem
04:30 Rainb joined
04:31 <lispy> http://pads.cs.tufts.edu/doc/tutorial.html#toc11
04:32 mbeidler joined
04:33 <Nolrai> what do ":{" and ":}" mean in ghci?
04:33 <lyxia> start and end a multiline section
04:33 <Nolrai> Ah.
04:37 Goplat joined
04:38 buttons840 joined
04:38 handyc joined
04:40 mwilly joined
04:41 eacameron joined
04:43 <jle`> Squarism: what version of ghc are you using?
04:43 <jle`> Squarism: in versions before 8.0, you aren't allowed to define functions like that
04:43 <Squarism> jle`, 7.10
04:43 <jle`> ah yeah
04:43 <Squarism> i figured it out though
04:43 <jle`> prior to ghci 8.0 functions have to be defined using 'let'
04:43 <jle`> this has always caused a lot of confusion
04:43 roconnor joined
04:44 maybefbi joined
04:44 <Squarism> had to do:
04:44 <Squarism> *JC.Facade.Console.Controller> :{
04:44 <Squarism> *JC.Facade.Console.Controller| let g :: Int -> String
04:44 <Squarism> *JC.Facade.Console.Controller| g i = show i
04:44 <Squarism> *JC.Facade.Console.Controller| :}
04:44 <jle`> yeah, you have to 'let' function declarations
04:44 <* jle`> shrugs
04:44 <jle`> glad they finally got rid of that requirement
04:44 <Squarism> i really have no good reason beeing on 7.10 still as im using stack
04:45 <Squarism> but just havent gotten to it
04:45 BANNED_IRL_BRO joined
04:45 ertes joined
04:45 <MarcelineVQ> alternatively: let g :: Int -> String; g i = show i
04:46 <BANNED_IRL_BRO> Alright..im down bitch
04:46 <jle`> sed -i 's/resolver:.*/resolver: lts-8.3/' ~/.stack/global-project/stack.yaml i suppose
04:46 <jle`> disclaimer i didn't test that
04:47 <BANNED_IRL_BRO> hello?!?!
04:47 <jle`> i don't know how regexes are supposed to be escaped in sed anymore
04:47 <BANNED_IRL_BRO> can;t you see im dope
04:47 <BANNED_IRL_BRO> baby im dope
04:47 <BANNED_IRL_BRO> can';t even type inm sod ope
04:47 <lispy> @ops
04:47 <lambdabot> Maybe you meant: pl oeis docs
04:47 <BANNED_IRL_BRO> blah balhb ablah
04:47 <BANNED_IRL_BRO> dont' bee so gay
04:47 <BANNED_IRL_BRO> im cool baby
04:47 <jle`> oh hey it worked
04:48 <jle`> between vim's regexes and grep's and sed's i always mix up what needs to be escaped
04:48 johnw_ joined
04:48 <jle`> especially cause you can toggle the regex mode in vim
04:48 <Squarism> MarcelineVQ, oh ok
04:50 ramzifu joined
04:52 zcourts joined
04:52 <pavonia> Any hints on how to write a Parsec parser for this? http://lpaste.net/353165
04:53 <pavonia> The problem is that I don't know in advance which entry starts a section and which one is a simple one
04:54 tommd joined
04:54 FreeBirdLjj joined
04:56 wtetzner joined
04:59 <maybefbi> I want :: [[a]] -> [Int] -> [([a], [Int])] such that [Int] is "eaten" by the lengths of each [a] to make each ([a], [Int])
04:59 <maybefbi> i cant decide if it is a zipWith or something else
05:01 pasukon joined
05:04 mwsb joined
05:04 <pavonia> maybefbi: Do you have a sample for this? I don't know what you're looking for
05:04 <Cale> It's not entirely straightforward
05:04 Nezteb joined
05:04 _Nezteb joined
05:05 justanotheruser joined
05:05 thunderrd joined
05:05 <S11001001> maybefbi: I think you can replace Int with b, right?
05:05 tom7942 joined
05:05 <S11001001> maybefbi: in your types
05:06 <maybefbi> yes
05:06 nemorichard joined
05:06 <S11001001> maybefbi: it's not a zipWith, but it's a mapAccumL
05:06 <Cale> pavonia: I believe maybefbi wants f ["abc","de","fghi"] [1..] = [[('a',1),('b',2),('c',3)],[('d',4),('e',5)], ...]
05:07 <pavonia> Ah, thanks
05:08 <maybefbi> pavonia, example [[(),(),()], [()], [(), ()]] [2,7,1,8,2,8] = [([(),(),()], [2,7,1]). ([()], [8]), ([(), ()], [2, 8])]
05:08 <Cale> ohh, yeah, I misread that
05:09 <Cale> I thought you wanted it to pair them up one level deeper
05:09 afarmer joined
05:09 <maybefbi> im thinking of some combination of zip and scanr
05:09 <nshepperd> it's what Cale said except `map unzip`d
05:10 <maybefbi> i could be wrong about zip + scanr
05:10 <ertes> pavonia: do you expect the grammar to get more complicated later?
05:10 <maybefbi> but the example is what im trying to achieve
05:10 zcourts joined
05:10 <ertes> pavonia: if not, i'd honestly not use parsec at all… just split into lines and count leading spaces to determine nesting
05:11 conal joined
05:11 <ertes> then you can use a one-line lookahead using e.g. a simple foldr
05:11 <nshepperd> f ass bs = zip ass (splitPlaces (map length ass) bs)
05:11 <Cale> > let next = do (x:xs) <- get; put xs; return x in evalState (mapM (mapM (\x -> fmap ((,) x) next)) ["abc","de","fghi"]) [1..]
05:11 <lambdabot> [[('a',1),('b',2),('c',3)],[('d',4),('e',5)],[('f',6),('g',7),('h',8),('i',9)]]
05:11 <pavonia> ertes: The grammar for each entry is already more complex, that's why I'd like to use a parser comibator for it. But yeah, doing a two-phase process is probably the easier solution
05:12 <nshepperd> (splitPlaces is from @hackage split)
05:12 <ertes> pavonia: you can still parse individual components with parsec
05:12 <maybefbi> :t splitPlaces
05:12 <lambdabot> Integral a => [a] -> [e] -> [[e]]
05:12 <nshepperd> oh hey, lambdabot has it
05:12 <Cale> > let next = do (x:xs) <- get; put xs; return x in map unzip $ evalState (mapM (mapM (\x -> fmap ((,) x) next)) ["abc","de","fghi"]) [1..]
05:12 avn joined
05:12 <nshepperd> :t let f ass bs = zip ass (splitPlaces (map length ass) bs) in f
05:12 <lambdabot> [("abc",[1,2,3]),("de",[4,5]),("fghi",[6,7,8,9])]
05:12 <lambdabot> Foldable t => [t a] -> [e] -> [(t a, [e])]
05:13 <ertes> pavonia: i believe there is also a ready-made layout parser in trifecta… that might make it easier, too
05:13 unmanbearpig joined
05:13 xtreak joined
05:14 <nshepperd> using `length` is a bit of laziness on my part, but it's easy to understand..
05:14 osa1 joined
05:14 osa1 joined
05:14 <johnw_> nshepperd: was there a pun intended there?
05:15 <nshepperd> heh
05:15 <Cale> :t \us vs -> let next = do (x:xs) <- get; put xs; return x in evalState (mapM (mapM (\x -> fmap ((,) x) next)) us) vs
05:15 <lambdabot> (Traversable t1, Traversable t) => t (t1 a) -> [b] -> t (t1 (a, b))
05:15 Nezteb_ joined
05:16 <pavonia> ertes: This one? https://hackage.haskell.org/package/trifecta-0.52/docs/Text-Trifecta-Layout.html
05:16 <nshepperd> a bit of laziness, but not lazy enough
05:16 <ertes> pavonia: yeah, although i don't know how to use it
05:16 <ertes> pavonia: i suppose you transform Layout into Parser
05:17 <ertes> i.e. use the (Layout Parser) monad
05:17 <maybefbi> nshepperd, thanks
05:17 <nshepperd> @let choppy ass bs = zip ass (splitPlaces (map length ass) bs)
05:17 <lambdabot> Defined.
05:17 <nshepperd> > choppy ["abc","de","fghi"]) [1..]
05:17 <lambdabot> <hint>:1:27: error: parse error on input ‘)’
05:18 <ertes> pavonia: at least that's what the API suggests
05:18 <nshepperd> > choppy ["abc","de","fghi"] [1..]
05:18 <lambdabot> [("abc",[1,2,3]),("de",[4,5]),("fghi",[6,7,8,9])]
05:18 pleax joined
05:18 <nshepperd> excellent
05:18 path[l] joined
05:18 graygoose124 joined
05:19 <maybefbi> :)
05:19 <nshepperd> actually I guess this would be sufficiently lazy if I used genericLength with lazy peano nats there
05:19 <pavonia> ertes: Hhm, I guess I'll just do the structure parsing separately and use Parsec for the entries
05:20 nemorichard joined
05:20 <ertes> pavonia: reasonable… you can also easily use stream processing that way… parsec insists on having the whole input in memory
05:21 Guest45288 joined
05:21 sobaken joined
05:22 vtomole_ joined
05:22 chenshen joined
05:25 pushp0p_ joined
05:26 <pushp0p_> hey i dont understand the function signature for: unfix :: Fix f -> f (Fix f)
05:26 <pushp0p_> unfix (Fix f) = f
05:26 <pushp0p_> it seems backwards to me
05:26 FreeBirdLjj joined
05:27 deeiinu joined
05:27 mda1 joined
05:28 <S11001001> pushp0p_: what's the signature for Fix?
05:29 <pushp0p_> fix :: f (Fix f) -> Fix f
05:29 <pushp0p_> fix = Fix
05:29 <S11001001> pushp0p_: it's just the reverse of that
05:30 daddychevere joined
05:30 <pushp0p_> yeah i understand they are reverse of each other
05:30 shafox joined
05:30 <pushp0p_> its just weird that the signatures look like that to me
05:31 <pushp0p_> is it point free style or something?
05:31 <pacak> Fix is a bit weird as it is.
05:31 <pacak> But useful
05:32 <pushp0p_> yeah i understand what it does
05:32 <pushp0p_> i just dont get why the signatures are like that i guess
05:33 wtetzner joined
05:33 <pushp0p_> fix :: f (Fix f) -> Fix f
05:34 <pushp0p_> ^this looks like its 'tearing down a level of recursion'
05:34 <pushp0p_> but its the opposite, right?
05:34 inad922 joined
05:34 <pushp0p_> nvm i guess i see it now looking at the type constructor for Fix
05:35 <pushp0p_> https://jtobin.io/tour-of-some-recursive-types
05:36 TxmszLou joined
05:37 <ertes> pushp0p_: let (x = Fix y) :: Fix F
05:37 <ertes> pushp0p_: what's the type of y?
05:38 mbuf joined
05:39 xtreak joined
05:40 ddere joined
05:40 <pushp0p_> Fix (y (Fix y))
05:40 Nerterologist joined
05:41 <ertes> pushp0p_: nope (and don't confuse the value level with the type level)
05:41 <ertes> Fix y :: Fix F
05:41 <ertes> y :: ?
05:41 <pushp0p_> i honestly don't know haskell at all
05:41 <pushp0p_> i'm just reading this article to try to understand recursive types
05:42 <ertes> pushp0p_: look at the definition of Fix
05:42 CurryWurst joined
05:42 <ertes> newtype Fix f = Fix { unFix :: f (Fix f) }
05:42 <ertes> the Fix data constructor takes one argument of type (f (Fix f))
05:43 <pushp0p_> yeah
05:43 <ertes> let (blah :: Blubb (Fix Blubb))
05:43 <ertes> then: Fix blah :: Fix Blubb
05:43 <ertes> does that make sense?
05:43 wineho joined
05:44 <pushp0p_> yeah
05:46 <ertes> good
05:46 <ertes> now use the same logic in the other direction
05:46 <pushp0p_> yah it made sense when i started looking at the type constructor
05:46 <ertes> Fix y :: Fix F
05:46 <ertes> y :: ?
05:46 mrd joined
05:46 mrd joined
05:46 <pushp0p_> the way it looks is still strange but if i substitute the type constructor into unfix it makes sense
05:50 <Squarism> So a value cant have type "Eq *" ?
05:50 mbo_ joined
05:53 takle joined
05:53 igniting joined
05:53 BartAdv joined
05:55 eazar001 joined
05:56 ner0x652 joined
05:58 pantsman_ joined
05:59 jhrcek joined
05:59 osa1 joined
05:59 osa1 joined
06:02 Sose joined
06:02 <geekosaur> Eq is not a type. You could think of it as an interface
06:03 <geekosaur> A typeclass (interface) is not a type and cannot be used as one. (It's actually a hint to the compiler to include a pointer to a type's implementation of the typeclass. Thus you must have a type, otherwise there is no pointer.)
06:04 takle joined
06:04 Xanather joined
06:05 dec0n joined
06:05 doomlord joined
06:06 andyhuzhill joined
06:06 caumeslasal joined
06:06 Yuras joined
06:06 <Squarism> geekosaur, i suspected that. I need to get rid o my scala/java mind set and learn my "generic" options in haskell
06:07 Majora320 joined
06:12 kurnevsky joined
06:13 takle joined
06:15 unmanbearpig joined
06:16 humboldt joined
06:20 augur joined
06:25 eacameron joined
06:26 krauq joined
06:28 doodlehaus joined
06:28 mhagemeister joined
06:28 krauq joined
06:31 takle joined
06:32 GGMethos joined
06:33 infinity0 joined
06:33 henriksod joined
06:34 stoopkid joined
06:36 xtreak joined
06:38 pickle_ joined
06:41 takle joined
06:41 jutaro joined
06:41 <ongy> hm, cabal new-build confuses me. It looks like it chokes on atomic-primops
06:43 fizruk joined
06:43 insitu joined
06:43 raycoll joined
06:45 <ezyang> ongy: Post error?
06:45 Cale joined
06:46 Swizec joined
06:46 <lpaste_> ongy pasted “cabal new-build doing nothing” at http://lpaste.net/4545204614789595136
06:47 <ezyang> it hung?
06:47 <ongy> not at all
06:47 <ongy> just ended itself, but no shell error
06:47 <ezyang> this is 1.24?
06:47 <ezyang> If you pass -j0 I bet you'll get an error
06:47 ThomasLocke joined
06:47 ThomasLocke joined
06:47 <ongy> 1.24.0.0
06:47 <ezyang> this is a dumb bug and we fixed it in HEAD
06:48 <ongy> I get an error I don't really understand
06:48 <ezyang> paste it?
06:48 Swizec joined
06:48 <ongy> error, called at libraries/Cabal/Cabal/Distribution/ReadE.hs:44:24 in Cabal-1.24.0.0:Distribution.ReadE
06:49 <ongy> oh when it's in one line I see it's just 'error' called -.-
06:49 takle joined
06:49 <ongy> still, not that helpful for a user
06:49 treehaqr joined
06:49 edsko joined
06:49 laz joined
06:50 <ezyang> that's unusuuuual
06:51 <ezyang> uhh, can you post -v3 logs
06:51 pickle_ joined
06:51 <ezyang> with -j0
06:53 Rainb joined
06:53 <lpaste_> ongy pasted “cabal new-build -j0 -v3 >/tmp/log 2>&1” at http://lpaste.net/353167
06:53 connrs joined
06:53 <ongy> this looks useful. and I just checked, the redirections don't void anything
06:53 Micamo joined
06:54 <ezyang> ok......
06:54 <ezyang> well, I think the easiest thing to try next is to grab a cabal-install HEAD and see if the problem arises there
06:54 <ezyang> you want to use HEAD anyway. Ubuntu? You can get one off of hvr's PPA
06:54 <ongy> arch
06:55 <ongy> but we probably have a cabal-install-git in aur, let me check
06:55 Yuras joined
06:55 <ongy> also I'm not sure if I want to run HEAD :)
06:55 <ezyang> it's not too hard to build yourself either
06:55 <ezyang> I know HEAD is bootstrapping off of 1.24 new-build :)
06:55 <ongy> we don't -.- anything to worry about when building from HEAD? Also where is that
06:56 <ezyang> get it off of https://github.com/haskell/cabal
06:56 <ezyang> just run cabal new-build cabal
06:56 <ezyang> I don't believe there are any known problems
06:56 aarvar joined
06:58 <ongy> oh, I ran the bootstrap.sh in cabal-install inside there
06:58 <ongy> I should wait for answers when I ask something...
06:59 raichoo joined
06:59 takle joined
07:00 <ezyang> oh bootstrap.sh is ok too
07:00 <ezyang> we test that too :)
07:00 <ezyang> but it's mostly intended for when you don't have any working cabal at all
07:01 freusque joined
07:01 <ongy> ohh, well I did it in an tmpfs, so it shouldn't litter
07:02 xtreak joined
07:02 hexagoxel joined
07:04 <ongy> oh we are having fun today
07:04 <lpaste_> ongy pasted “./bootstrap.sh” at http://lpaste.net/8695420333114523648
07:05 <ongy> should I just try the new-build?
07:05 <ezyang> bootstrap is supposed to work. Let's see
07:05 <ezyang> TBC, you've got both Cabal and cabal-install dirs in tmpfs?
07:06 <ezyang> but yes, maybe try new-build
07:06 path[l] joined
07:07 <ezyang> let me see if I can repro
07:07 <ongy> ah maybe I ran it in the wrong directory? I cd'ed into cabal-install inside the repo
07:08 <ongy> I ran my git clone inside /tmp/ so /tmp/cabal is the root of the repo
07:08 <ezyang> no that's fine
07:08 mrcrjs joined
07:08 <ezyang> is your new-build humming? Do you want to help debug bootstrap?
07:09 insitu joined
07:09 <ongy> new-build is running, but the bootstrap ran for a good while aswell
07:10 <ongy> sure I can help debug bootstrap
07:12 <ezyang> first, did you pass any arguments to bootstrap.sh?
07:12 <ongy> no
07:12 <ezyang> ok, is there a ./Setup exec in cabal-install dir?
07:13 <ezyang> if so, tell me what ./Setup --version says
07:13 takle joined
07:14 Textmode joined
07:14 <ongy> I'll run this on a different machine, to not interrupt the new-build going on
07:15 <ongy> this one has a bit more power aswell, so it shouldn't take too long
07:15 <ezyang> oh, I was assuming you had kept the intermediate products around
07:16 <ongy> I did the new-build in the same git checkout, not sure if that keeps things around
07:16 <ezyang> it will
07:16 pickle_ joined
07:16 <ongy> ./Setup --version: Cabal library version 1.24.0.0
07:17 begriffs joined
07:17 <ezyang> :O
07:17 <ezyang> that's not supposed to happen haha
07:17 <ongy> git log --oneline | head -n 1 :(
07:17 <ongy> cef856fc9 Merge pull request #4363 from ezyang/pr/hs-libraries-indefinite
07:18 zeroed joined
07:18 zeroed joined
07:19 pickle__ joined
07:19 <ezyang> well
07:19 <ezyang> I see the bug, looking at bootstrap.sh
07:19 <ezyang> thanks, we'll try and fix this. new-build should still work
07:20 Argue__ joined
07:20 <ongy> still running, but I ran into oom on my laptop so it got interrupted
07:21 takle joined
07:21 certainty joined
07:23 <ezyang> https://github.com/haskell/cabal/issues/4365
07:23 <ongy> so what does new-build do with the binary? install them into ~/.cabal/bin ?
07:23 suls joined
07:24 <ongy> feel free to highlight me when you mention me on github, I'm ongy there aswell
07:25 <ezyang> ongy: No, it gets put in dist-newstyle
07:25 <ezyang> look for the "Linking" line
07:25 <ezyang> I symlinked something to that path
07:25 mbeidler joined
07:26 <ongy> this is in /tmp/ so I'd rather not :). Do I need to copy anything out but the cabal binary? hackage-security?
07:27 kthnnlg joined
07:28 <ezyang> I think it's statically linked by default so the binary is good enough
07:28 <ezyang> ldd it to be sure :o)
07:28 <ongy> static against haskell libs, dynamic against external dependencies
07:28 <ongy> I really like that default
07:29 unmanbearpig joined
07:29 <ongy> now I'll see if I can get my first aur PKGBUILD done
07:30 <ezyang> haha, back to the original problem
07:30 <ezyang> but, actually, I kind of wonder if the problem that caused bootstrap to not work is also the same problem that caused your package not to build originally
07:31 alfredo joined
07:33 <ongy> ah no, I want to have cabal-install-git or aur. I don't like to install things as user that I haven't written myself
07:33 <ezyang> :)
07:33 takle joined
07:34 <ongy> how long until cabal new-run? Or does it exist on HEAD?
07:35 fendor joined
07:35 <ezyang> ongy: https://github.com/haskell/cabal/pull/4304
07:35 <ezyang> it's not green on CI so we haven't merged yet
07:35 insitu joined
07:36 zero_byte joined
07:37 <ezyang> but you could give it a try if you were so inclined
07:37 <ezyang> testing = good :)
07:37 <ongy> that's not `cabal run` is it? looks more like it would be useful to run ghc-mod and such
07:38 <ongy> I'm not at home over the weekend, not sure how much time and internet I will have
07:39 <ezyang> I think cabal new-exec knows how to find executables you built
07:39 <ezyang> I haven't used it so I'm not sure
07:39 <ongy> dmwit should know :)
07:40 insitu joined
07:41 takle joined
07:44 _sg joined
07:44 yoneda joined
07:45 <ongy> but skimming the changes, it can run the build tools installed as dependencies, not sure about the built project
07:45 <ezyang> yeah, dunno. Code is the gospel
07:45 insitu joined
07:47 <ongy> I got a 101 character long path from new-build to run the binary...
07:47 <ongy> that's equal parts hilarious and horrible
07:47 madbot joined
07:49 <ezyang> yeah, HEAD new-build puts it in a bit longer path
07:49 <ezyang> Maybe we should drop the arch
07:49 <ezyang> but I've found ghc version quite useful
07:50 <ongy> if we get cabal new-run/ or something to get the newest paths from cabal (useful for automated install scripts) I don't mind it
07:50 takle joined
07:50 <ongy> but parsing the output of new-build for the Linking line... not my favorite passtime
07:50 bjz joined
07:50 <ezyang> yeah...
07:50 guiben joined
07:51 insitu joined
07:51 eklavya joined
07:53 louispan joined
07:57 danvet joined
07:59 hexagoxel joined
08:00 uglyfigurine joined
08:01 mhagemeister joined
08:01 uglyfigurine joined
08:03 Gurkenglas joined
08:03 cyanobacteria joined
08:03 johnmendonca joined
08:04 odyjm joined
08:05 uglyfigu_ joined
08:06 FreeBird_ joined
08:07 mattyw joined
08:07 raichoo joined
08:08 mbo_ joined
08:08 takle joined
08:09 _sg joined
08:09 srbaker_ joined
08:09 jgertm joined
08:10 andyhuzhill joined
08:13 insitu joined
08:13 albertid joined
08:15 pleax joined
08:15 FreeBirdLjj joined
08:16 mrkgnao joined
08:16 emin joined
08:17 shayan_ joined
08:17 Iskarlar joined
08:17 xall joined
08:18 insitu joined
08:18 xinming_ joined
08:18 caumeslasal joined
08:19 JanBessai joined
08:20 haennar joined
08:20 Swizec joined
08:21 pleax joined
08:23 insitu joined
08:24 Nerterologist joined
08:24 calincru joined
08:25 Aidan[m] joined
08:26 certainty joined
08:27 insitu joined
08:28 hdeshev joined
08:28 <ongy> symlinks it is for now :) also why have I never seen cabal exec before? I think that fixes a problem I had
08:29 takle joined
08:29 <ezyang> :)
08:30 plutoniix joined
08:32 louispan joined
08:32 bollu joined
08:33 systadmin joined
08:34 nek0 joined
08:34 anton___ joined
08:34 jgertm joined
08:35 ramzifu joined
08:37 takle joined
08:38 Sigyn joined
08:39 rgc joined
08:40 xtreak joined
08:42 <ongy> what's the best way to make a dev-only feature with cabal? I have something I would like for debugging but really makes no sense/would confuse people in practice. Make a flag and use CPP in the file?
08:43 <ezyang> manual flag
08:43 <ongy> ok
08:44 <ongy> and that flag should define a define that I can check with CPP in source then?
08:45 <ezyang> yeah, that's one way to do it
08:45 <ezyang> you could also use it to just define extra modules, whatever
08:45 takle joined
08:46 <ongy> that's not enough to enable/disable a feature, is it? I either include the module and get a compile erorr, or don't and it's not in
08:47 <ezyang> well, it depends on who is using he dev features
08:47 <ezyang> but yes, CPP is normal
08:49 <ezyang> Conditional jump or move depends on uninitialised value(s) ==12128== at 0x421284: runInteractiveProcess
08:49 <ezyang> HMMMM
08:52 soLucien joined
08:53 pleax joined
08:53 takle joined
08:54 thatguy joined
08:54 Miroboru joined
08:54 <alanz> ongy: you can have conditional hs-source-dirs, where you have a debug and non-debug version of the debug routines
08:55 <alanz> similar to https://github.com/alanz/ghc-exactprint/blob/ghc-8.2/ghc-exactprint.cabal#L92
08:59 <ongy> oh that's a nice way to do it. Not applicable for what I want to use, but I like it
08:59 <alanz> CPP is evil
09:01 mohsen_ joined
09:01 takle joined
09:04 <ongy> maybe what I want to do is stupid... But I want to disable a single packet (A constructor in a sum type) of my ipc that allows to bypass some checks. It's really useful for testing but a dumb idea otherwise
09:04 MrcRjs joined
09:04 thc202 joined
09:05 <jchia> Question about Data.Binary.Builder. How do I check whether a Builder is empty? I can't use (== mempty) because Builder has no Eq instance although it has a Monoid instance. Is there a better way than using (null . toLazyByteString)?
09:05 mohsen_ joined
09:06 <ezyang> ongy: Sounds like you want Backpack :)
09:06 abhiroop joined
09:06 rotcev joined
09:07 <phadej> jchia: IIRC there isn't better way, and if I think right, that shouldn't be too bad
09:08 <ongy> ezyang: I do? isn't that similar to the aproach alanz linked? (from user perspective, I bet the way it works is quite different)
09:08 tsmish joined
09:08 <ezyang> ongy: Yeah, except with Backpack you get to typecheck without committing to an implementation :) :) :)
09:08 <ezyang> (Note: Not actually a good idea, unless you like GHC 8.2...)
09:09 oisdk joined
09:10 <alanz> ongy: cant you declare the small version in one file and the one with the debug constructor in another, and pull them in via source dirs?
09:10 BartAdv joined
09:10 <alanz> so same file name
09:10 <ongy> my current idea is to use the MonadFail instance from cereal with an error that says "this is a dev feature" which disables one line and enables one other line. Without keeping 2 versions of the parser for everything else
09:11 <ongy> removing one of the Constructors in a sum type would break every case match that handles it, so I don't think that's a good idea
09:12 chenyu joined
09:12 <ongy> it's not a library, so the parser *should* be the only way to get something of that type
09:13 xnyhps joined
09:14 <ongy> ezyang: why 8.2? Is that required for backpack?
09:14 <ezyang> yeah
09:15 yfwyfw joined
09:15 <ongy> what's the eta on that release? I will probably want to use that for another part in the same project
09:16 <ongy> and for once I don't care much about compat to old ghc
09:16 <ezyang> well, we haven't cut the branch yet. So....
09:16 oisdk joined
09:17 <yfwyfw> I was wondering if someone could explain me how "> (fmap . fmap) sum Just [1, 2, 3]" produce the same result as "> fmap sum $ Just [1,2,3]"
09:18 <ongy> > (fmap . fmap) sum Just [1, 2, 3]
09:18 <lambdabot> Just 6
09:18 <yfwyfw> lifting sum twice should be like "Just [sum 1, sum 2, sum 3]"
09:18 na9da[m] joined
09:18 srenatus[m] joined
09:18 isair[m] joined
09:18 el_tejon[m] joined
09:18 hiq[m] joined
09:18 NopeMarker[m] joined
09:18 corintho[m] joined
09:18 TesX[m] joined
09:18 M-schmittlauch joined
09:18 Yves[m] joined
09:18 drasich[m] joined
09:18 M-Illandan joined
09:18 sudoreboot[m] joined
09:18 M-berdario joined
09:18 gkaplan[m] joined
09:18 radix joined
09:18 M-Magnap joined
09:18 noraesae joined
09:18 bolton joined
09:18 M-Shrike joined
09:18 davidar_ joined
09:18 rodoa96[m] joined
09:18 aspiwack[m] joined
09:18 M-wamaral joined
09:18 tfc[m] joined
09:18 M92854[m] joined
09:18 jmnoz[m] joined
09:18 rakete joined
09:18 hendrik[m] joined
09:18 Guest91110[m] joined
09:18 ProofTechnique[m joined
09:18 ayk[m] joined
09:18 M-Quora joined
09:18 <ezyang> it's a little confusing though cuz it's not (Just [1, 2, 3])
09:18 gentam[m] joined
09:18 louispan joined
09:19 foldu[m] joined
09:19 seequ_ joined
09:19 monomon[m] joined
09:19 <jchia> phadej: OK
09:19 miviotros[m] joined
09:19 elwan7[m] joined
09:19 unclechu joined
09:19 m4lvin[m] joined
09:19 shiona[m] joined
09:19 herzmeister[m] joined
09:19 M-BostonEnginerd joined
09:19 curry[m] joined
09:19 karroffel joined
09:19 Naughtmare[m] joined
09:19 Soif[m] joined
09:19 iffsid[m] joined
09:19 zaphar_ps[m] joined
09:19 goodboy[m] joined
09:19 jyp[m] joined
09:19 jacqueline[m] joined
09:19 sazert[m] joined
09:19 davidar joined
09:19 SteinsGate[m] joined
09:19 bb010g[m] joined
09:19 alaradia[m] joined
09:19 <ezyang> > map @Int (+2) [1,2]
09:19 FederalRick[m] joined
09:19 chef_excellence[ joined
09:19 mmmrrr[m] joined
09:19 roadrunner168[m] joined
09:19 closures999[m] joined
09:19 <lambdabot> error:
09:19 <lambdabot> Pattern syntax in expression context: map@Int
09:19 <lambdabot> Did you mean to enable TypeApplications?
09:19 j201[m] joined
09:19 jacobm[m] joined
09:19 <ezyang> drat! No type applications
09:19 M-krsiehl joined
09:19 wictory[m] joined
09:19 yerhausin[m] joined
09:19 hakan[m] joined
09:19 cbHXBY1D[m] joined
09:19 bobjason[m] joined
09:19 TylerCecil[m] joined
09:19 unknownln joined
09:19 mrkgnao joined
09:20 oisdk joined
09:20 <yfwyfw> lifting sum twice should be like "Just [sum 1, sum 2, sum 3]" instead of "Just (sum [1, 2, 3])"
09:21 takle joined
09:21 <ezyang> that's not what it's doing
09:21 <ezyang> @pl (fmap . fmap) sum Just [1, 2, 3]
09:21 <lambdabot> fmap sum (Just [1, 2, 3])
09:22 <ongy> :t (fmap . fmap) sum
09:22 <lambdabot> (Foldable t, Num b, Functor f1, Functor f) => f (f1 (t b)) -> f (f1 b)
09:22 orbifx joined
09:22 <ongy> ok that looks worse than I expected
09:22 <ezyang> so f is gonna be function
09:22 <ezyang> cuz the next argument is Just
09:23 <ezyang> > 2 :: _
09:23 <ongy> maybe we should mention that there's Monad/Applicative/Functor instances for ((->) a)
09:23 <lambdabot> error:
09:23 <lambdabot> • No instance for (Num t1)
09:23 <lambdabot> Possible fix:
09:23 fendor joined
09:23 FreeBirdLjj joined
09:23 <yfwyfw> ah.
09:23 <yfwyfw> right
09:24 <yfwyfw> Now I know what you mean
09:24 mekeor joined
09:24 <ongy> :t fmap fmap fmap -- This is the example that comes up from time to time and confuses people (sometimes including me)
09:24 <yfwyfw> Thank you very much :)
09:24 <lambdabot> (Functor f1, Functor f) => (a -> b) -> f (f1 a) -> f (f1 b)
09:24 <yfwyfw> happy again
09:25 raichoo joined
09:25 systadmin joined
09:27 freusque joined
09:27 ericsagnes joined
09:27 takle joined
09:28 louispan joined
09:29 mmmrrr[m] joined
09:30 FreeBird_ joined
09:32 ljc joined
09:32 thunderrd joined
09:33 cdidd joined
09:34 <cocreature> "fmap fmap fmap max max" is the maximum function on three numbers :)
09:35 fendor joined
09:36 xall joined
09:36 mda1 joined
09:38 <yfwyfw> that's now a proper type tetris.. I must play a lot
09:38 augur joined
09:39 <cocreature> yfwyfw: be careful, it’s addictive
09:39 <yfwyfw> :)
09:39 R13N54 joined
09:40 takle joined
09:40 R13N joined
09:41 pleax joined
09:41 e_svedang joined
09:42 Ch3ck joined
09:42 free_beard joined
09:43 xtreak joined
09:43 tomphp joined
09:45 R13N joined
09:45 ibKH joined
09:46 bennofs joined
09:48 thatguy joined
09:48 palo_ joined
09:48 rps1 joined
09:49 mrkgnao joined
09:50 xpika joined
09:51 jgertm joined
09:51 cur8or joined
09:52 fizruk joined
09:53 demin joined
09:53 hexagoxel joined
09:56 Jicoss joined
09:56 calincru joined
09:56 epsilonhalbe joined
09:57 xall joined
09:59 Rizy joined
10:00 riddle_ joined
10:01 takle joined
10:02 certainty joined
10:02 beanbagu1 joined
10:02 Olumide joined
10:05 mrkgnao joined
10:06 ub joined
10:07 sgflt joined
10:08 takle joined
10:11 mkoenig joined
10:11 bollu joined
10:12 alexknvl joined
10:12 <jle`> wrote my first literate haskell file today, wasn't all that bad
10:12 <bollu> jle`: I quite like TH
10:13 <jle`> maybe i'll do it more often
10:13 <jle`> i don't know why i avoided it for so long
10:13 <jle`> the file was mostly an executable demo...i was just writing block comments until i just gave up and flipped everything
10:16 exferenceBot joined
10:17 hyPiRion joined
10:19 fendor joined
10:21 Rotaerk_ joined
10:23 marr joined
10:24 prophile joined
10:26 <JuanDaugherty> which thing is this?
10:26 <JuanDaugherty> not CWeb i take it
10:27 schjetne joined
10:27 janos joined
10:27 <JuanDaugherty> template haskell has a literate programming aspect?
10:28 <Rodenbach> Are there many Lens libs for Haskell? Is there one which is kind of _the_ Lens lib? The one that nearly everyone is using?
10:28 <cocreature> Rodenbach: the lens lib is definitly https://hackage.haskell.org/package/lens
10:28 <cocreature> there are several other libs (e.g. microlens) but the main ideas are basically the same
10:29 pickle_ joined
10:29 <cocreature> at least to some degree they can also interoperate
10:30 dhil joined
10:30 oish joined
10:31 mattyw joined
10:31 systadmin joined
10:31 haennar joined
10:31 pleax joined
10:34 danza joined
10:34 Mon_Ouie joined
10:35 takle joined
10:39 augur joined
10:39 mmn80 joined
10:40 bollu1 joined
10:40 louispan joined
10:41 trevb joined
10:41 <riddle_> exit
10:41 <riddle_> sorry
10:41 <riddle_> mistyped
10:43 janos joined
10:44 <bennofs> Rodenbach: there's a few libraries other than 'lens', but those ('microlens', 'lens-family') are stripped-down versions of the 'lens' library with less dependencies and sometimes less general types. The types of both are compatible though, so you can use a lens defined using one of the libraries also with another
10:44 uglyfigurine joined
10:44 mattyw joined
10:46 tlaxkit joined
10:46 ftlava joined
10:46 <liste> fclabels and data-lens are not compatible with 'lens' AFAIK
10:46 balor joined
10:47 <bennofs> liste: yeah but those are not so popular neither, are they?
10:47 cyphase joined
10:47 <liste> not anymore at leawt
10:47 <liste> least*
10:48 mdarse joined
10:48 guardianJ joined
10:48 janos joined
10:48 connrs joined
10:49 augur joined
10:49 takle joined
10:50 <liste> 40 hackage packages depend on fclabels, 34 on data-lens, 14 on lens-family and 704 on lens
10:50 <Rodenbach> bennofs: ah okay, so in some cases the alternative libs offer what is needed for my specific case, and their selling point is that they introduce fewer deps. Oki, makes sense, thx.
10:51 John[Lisbeth] joined
10:52 <John[Lisbeth]> I hate to interject but this is album is named after a haskell joke: https://www.youtube.com/watch?v=Iozs9yOztQA
10:52 <John[Lisbeth]> or maybe even not
10:52 EuAndreh[m] joined
10:53 guardianJ joined
10:53 <Taneb> John[Lisbeth], if it is I do not recognize it
10:53 madbot` joined
10:54 <John[Lisbeth]> if https://www.youtube.com/watch?v=RqvCNb7fKsg
10:55 Nik05 joined
10:56 certainty joined
10:56 bjz joined
10:57 takle joined
10:58 fizruk joined
11:01 systadmin joined
11:01 cogrendel joined
11:03 Mon_Ouie joined
11:05 staafl joined
11:06 augur joined
11:10 nbro joined
11:10 <nbro> Hi!
11:10 <ski> hello again nbro
11:11 <nbro> playing again with Haskell…
11:11 zuck007 joined
11:11 <mekeor> already? it's not even weekend yet... ;P
11:12 <zuck007> ?src
11:12 <lambdabot> src <id>. Display the implementation of a standard function
11:12 <zuck007> ?src (map)
11:12 <lambdabot> Source not found. Maybe you made a typo?
11:12 <mekeor> ?src map
11:12 <lambdabot> map _ [] = []
11:12 <lambdabot> map f (x:xs) = f x : map f xs
11:12 <zuck007> ?filter
11:12 <lambdabot> Unknown command, try @list
11:12 <zuck007> ?src filter
11:12 <lambdabot> filter _ [] = []
11:12 <lambdabot> filter p (x:xs)
11:12 <lambdabot> | p x = x : filter p xs
11:12 <lambdabot> | otherwise = filter p xs
11:13 <zuck007> ?src $
11:13 <lambdabot> f $ x = f x
11:13 <nbro> I’ve an exercise where it’s required to bind specifically an Integer to a variable and then produce a square root of that Integer… I’m not 100% sure if functions can also be considered expressions, I guess, yes
11:14 silver joined
11:14 <nbro> sorry, I didn’t express myself in the best wa
11:14 <nbro> *way
11:14 groscoe joined
11:14 <nbro> it’s required to bind the Integer to a variable in an expression
11:15 <AndreasK> nbro: Probably wants you to define a lambda expression
11:15 <ski> or possibly even a named function
11:15 contiver joined
11:16 <AndreasK> Yeah it's not that well worded
11:16 <nbro> I thought to create a function by declaring explicitly also its type, e.g. f :: Integer -> Double; f x = sqrt(fromInteger(x))
11:17 <nbro> but, at this point, I would have a question: what isn’t an expression in Haskell?
11:17 gregman_ joined
11:17 <ski> `f x = sqrt(fromInteger(x))' isn't an expression (it's a defining equation)
11:17 <ski> `f :: Integer -> Double' isn't an expression (it's a type signature)
11:17 takle joined
11:17 Rainb joined
11:18 <ski> neither `f x', nor `f' nor `x' in `f x = sqrt(fromInteger(x))' are expressions either (they are patterns)
11:18 <nbro> here https://www.haskell.org/onlinereport/exps.html it’s written that type signature are expressions
11:19 inad922 joined
11:19 <ski> (i.e. talking about the `x' on the left of `=', in the definiendum, the "thing to be defined"; as opposed to the right of `=', the "definiens", what it's being defined as)
11:19 <ski> that's type ascriptions
11:20 <ski> (unfortunately the report doesn't use separate terminology here)
11:20 <nbro> ok
11:21 <nbro> but, at this point, if a function definition isn’t an expression, then what could they actually mean by “An expression that binds a variable x to an Integer, then evaluates to the square of x.”?
11:21 <ski> .. anyway, one way of interpreting your exercise (given what you've said here) might be that you're to find the square root, without using the library `sqrt' operation (or say any other operation involving floating-point numbers)
11:22 <ski> nbro : interpreting that literally, what AndreasK said
11:23 xtreak joined
11:23 <ski> .. have you seen function expressions/abstractions (aka "lambda expressions/abstractions") yet ?
11:24 CurryWurst joined
11:24 zuck007 joined
11:25 <nbro> well, not in class, but I’ve already had a look at the syntax of lambda expressions, like (\x -> sqrt(x))?
11:25 mohsen_ joined
11:26 <ski> ok, *nod*
11:26 jomg joined
11:26 <ski> nbro : another interpretation of "An expression that binds a variable x to an Integer, then evaluates to the square of x." would be a `let'-`in' expression ..
11:26 connrs joined
11:27 <* ski> realizes that sentence didn't say anything about "root"
11:27 systadmin joined
11:27 <nbro> @ski the previous exercise was (I know this are stupid exercises): “An expression that binds a variable x to a number (using let), then evaluates to the square of x.“. So here they were specifically requiring us to use the let .. in .. with any number..
11:27 <lambdabot> Maybe you meant: wiki src ask
11:27 <tabaqui1> Just 1 <|> Just 2
11:28 <tabaqui1> >Just 1 <|> Just 2
11:28 <tabaqui1> > Just 1 <|> Just 2
11:28 <lambdabot> Just 1
11:28 <tabaqui1> :t some $ Just 1
11:28 <lambdabot> Num a => Maybe [a]
11:28 <tabaqui1> head $ some $ Just 1
11:28 <tabaqui1> > head $ some $ Just 1
11:28 <lambdabot> error:
11:28 <lambdabot> • Couldn't match type ‘Maybe’ with ‘[]’
11:28 <lambdabot> Expected type: [[a]]
11:28 <tabaqui1> > head <$> some $ Just 1
11:28 <lambdabot> error:
11:28 <lambdabot> • Couldn't match type ‘[a]’ with ‘Maybe Integer’
11:28 <lambdabot> Expected type: Maybe Integer -> [a]
11:29 groscoe joined
11:29 <ski> tabaqui1 : perhaps you could speak to lambdabot in private, at least until you're satisfied with a lambdabot query you'd like to show the channel ?
11:29 <tabaqui1> ski: I want to demonstrate it first
11:29 novakboskov joined
11:29 netheranthem joined
11:29 <ski> you want to demonstate typos and error messages ?
11:30 <tabaqui1> here
11:30 <tabaqui1> > head <$> some (Just 1)
11:30 <lambdabot> mueval-core: Time limit exceeded
11:30 <tabaqui1> some (Just 1) returns Maybe [Int]
11:30 certainty joined
11:30 epsilonhalbe left
11:30 <tabaqui1> but it cannot be used even in lazy way
11:30 <ski> correct
11:30 <tabaqui1> what's the purpose of Alternative class?
11:31 <ski> it's often used with parsers
11:31 <tabaqui1> empty and <|> seem fine
11:31 <ski> > some Nothing
11:31 <lambdabot> Nothing
11:31 <tabaqui1> but some and many cannot be evaluated at all
11:32 <tabaqui1> > some [] :: [[Int]]
11:32 <ski> `some' will retry until the action fails. `Just 1' never fails, so it's retry infinitely many times
11:32 <lambdabot> []
11:32 <novakboskov> Is it possible to provide "bare" switches from https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html#compiler-options-for-profiling to stack build command? It looks to me like stack build --executable-profiling --library-profiling somehow provides -fprof-cafs to ghc and I don't want it.
11:33 <ski> however, the type indicates that it *might* fail, so it can't return a `Just (...)' answer before it has found the first failing execution of the action -- which will never happen in this case
11:33 <tabaqui1> but it is still useless with pure types
11:33 <ski> i don't know what "pure types" mean
11:34 <tabaqui1> yeah, "some . print" do something
11:34 <ski> `IO' is just as pure as `Maybe'
11:34 <tabaqui1> ghc evaluate (return 1) each time
11:34 <tabaqui1> even if it gain us the same result
11:34 <ski> as is `StateT Foo Maybe'
11:35 <tabaqui1> there is no reason to check "some $ Just 1"
11:35 <ski> nbro : with any number, or with a specific number (possibly of your choosing) ?
11:35 <tabaqui1> if it doesn't fail once, it doesn't fail anytime
11:35 <ski> `some' can't know that
11:36 <ski> `some' is just a general function written in terms of `(<|>)'
11:36 Sampuka joined
11:36 <tabaqui1> still can't imagine code with "some $ Just smth
11:37 pita joined
11:37 <ski> it doesn't seem very useful, no
11:37 <nbro> @ski : I’m not sure. Since function definitions are not expressions, then I interpreted ““An expression that binds a variable x to a number (using let), then evaluates to the square of x.” as something like “myexp = let x = 3 in sqrt(x)”, so I’m in reality binding x to a specific number (but not strictly an Integer)...
11:37 <lambdabot> Maybe you meant: wiki src ask
11:38 <ski> however, `(<|>)' is still useful on `Maybe'
11:38 <tabaqui1> yeah, these function can be applicable
11:38 Aaaron1 joined
11:38 <tabaqui1> except of some/many
11:39 <ski> nbro : fyi, it's not IRC custom to prefix the nickname of a person with `@', when addressing them. (also lambdabot gets confused, as you see). it's traditional to begin the message with the nickname in question, directly, followed e.g. by a colon or a comma, then the message
11:40 <ski> nbro : many IRC clients (by default) highlight/alert the user when someone addresses them in that way. not as many do that when the nickname is not eh very first thing in the message, though
11:40 jutaro joined
11:40 bollu joined
11:40 JeanCarloMachado joined
11:41 <ski> nbro : again, since it says "square of x", not "square root of x", i doubt very much that you're to use `sqrt' at all
11:41 <tabaqui1> "/query nick" opens the new channel
11:41 <tabaqui1> btw
11:41 <nbro> ski: yes, sorry for that, I realized I was mentioning differently other people with respect to the other times… I may have got confused since in few certain other forums they usually use @
11:41 <tabaqui1> but channels don't handy in many clients
11:41 <* ski> nods
11:41 <ski> (IRC predates those forums)
11:41 <* tabaqui1> foo
11:43 <nbro> ski: yes, you’re right, I should not be using sqrt but x*x
11:43 <ski> > 5^2
11:43 <lambdabot> 25
11:43 <ski> > x^2
11:43 <lambdabot> x * x
11:43 <nbro> what
11:43 <nbro> lol
11:43 <nbro> ahah
11:43 <nbro> what’s happening to me
11:43 <nbro> ?
11:43 <nbro> ahah
11:43 <brynser_> > x ** 3
11:43 <lambdabot> x**3
11:44 <* ski> believes it's called "laughter"
11:44 <ski> (perhaps aka "having fun", depending on circumstances)
11:45 <jle`> > x ^ 3
11:45 <lambdabot> x * x * x
11:46 <jle`> > x ^ 5
11:46 <lambdabot> x * x * (x * x) * x
11:46 <brynser_> huh
11:46 <ski> it's probably using the repeated squaring method for computing powers
11:47 <jle`> @src (^)
11:47 <lambdabot> x ^ 0 = 1
11:47 <lambdabot> x ^ n | n > 0 = f x (n-1) x
11:47 <lambdabot> where
11:47 <lambdabot> f _ 0 y = y
11:47 <lambdabot> f x n y = g x n
11:47 <lambdabot> [3 @more lines]
11:47 <ski> @more
11:47 <lambdabot> where g x n | even n = g (x*x) (n `quot` 2)
11:47 <lambdabot> | otherwise = f x (n-1) (x*y)
11:47 <lambdabot> _ ^ _ = error "Prelude.^: negative exponent"
11:47 fnurglewitz joined
11:48 ij joined
11:48 <* ski> nods
11:48 psychicist__ joined
11:48 halogenandtoast joined
11:49 <ij> Could you define a monad without type classes? Somehow capture the idea as much as possible.
11:49 <MarcelineVQ> novakboskov: stack build accepts a --ghc-options flag for passing specific things, e.g. stack build --ghc-options="-O1 -prof" but it doesn't seem to accept -prof due to https://github.com/commercialhaskell/stack/issues/1015 :(
11:49 <ski> `f x n y = x ^ n * y' is the invariant there
11:49 <MarcelineVQ> novakboskov: appearantly it's inherited from https://github.com/haskell/cabal/issues/2827#issuecomment-141783201 since stack uses Cabal
11:49 petermw joined
11:50 <brynser_> :t concatMap
11:50 <lambdabot> Foldable t => (a -> [b]) -> t a -> [b]
11:50 <ski> ij : yes, you could make a data type for the operations
11:50 <liste> ij: you could pass around the dictionaries yourself
11:51 <liste> so instead of Monad m => m Integer, you'd have Monad m -> m Integer
11:51 <liste> and Monad would be just a record of functions
11:51 systadmin joined
11:51 soLucien joined
11:52 <ski> ij : of course this requires higher-order types, to be able to abstract over arbitrary monads like this
11:52 <novakboskov> MarcelineVQ: I'm still investigate but something like `stack build --profile --ghc-options="-fno-prof-cafs"` acts like `ghc -prof -fprof-auto Module.hs`
11:53 R13N left
11:53 Sigyn joined
11:53 pleax joined
11:54 <MarcelineVQ> are you sure that's not -fprof-auto-exported or -fprof-auto-top and not -fprof-auto?
11:54 LKoen joined
11:54 <MarcelineVQ> I wonder if you can pass Cabal options somewhere, 1.23 provides http://cabal.readthedocs.io/en/latest/nix-local-build.html?highlight=--enable-profiling#cfg-flag---profiling-detail
11:57 thatguyfrombefor joined
11:57 <novakboskov> I guess... I really have no experience in this so I have to try... :)
11:58 petermw joined
11:58 <* JuanDaugherty> sees that as a weaver TH would have an implicit LP aspect
11:59 <ski> weaver ?
11:59 <JuanDaugherty> code weaver
12:00 <JuanDaugherty> LP weaves code and doc
12:00 <ski> does that mean the same as staged programming ?
12:00 <JuanDaugherty> no like in AOP
12:00 <ski> oh, Literate Programming. i was for some reason thinking Logic Programming
12:01 <JuanDaugherty> prolly cause you know me mostly from prolog
12:02 <ski> possibly
12:02 Snircle joined
12:03 mathkb joined
12:04 nbro joined
12:04 <MarcelineVQ> novakboskov: I can't seem to find anything particularily helpful beyond the mentioned links
12:05 <MarcelineVQ> especially I don't see any way to pass cabal options, possibly it's because such things are really cabal-install options which stack isn't.
12:05 zv joined
12:05 <MarcelineVQ> though idk if that's the case, just my immediate thought
12:06 <mathkb> I am looking for the wiki page that speak about hiding the type constructor. How is this idiom called?
12:07 <MarcelineVQ> novakboskov: poossssibly if you specify your .cabal version to be >= 1.23 you could set these as options in your .cabal file, lemme see
12:07 mbo_ joined
12:07 sellout- joined
12:08 hexagoxel joined
12:09 marekw2143 joined
12:09 <marekw2143> hello
12:09 <ski> hello
12:11 <marekw2143> is there something wrong near here https://bitbucket.org/chessRepo/c7/src/08f9d9bd00825500ba10056bedbdbd410b1f9975/main.hs?at=master&fileviewer=file-view-default#main.hs-131 ?
12:11 mirpa joined
12:12 <marekw2143> compiler tells me : main.hs:131:20: parse error on input ‘=’
12:12 ziocroc joined
12:12 vektorweg1 joined
12:12 JanBessai joined
12:12 <novakboskov> Marceline
12:13 <ski> marekw2143 : `getNextMoves' has no body after `do'
12:14 <marekw2143> oh
12:14 <ski> you could put `undefined' there for the time being
12:14 <MarcelineVQ> novakboskov: stack doesn't seem to recognise cabal .project files so it may not be possible to specify these flags manually :(
12:15 gillesmajor joined
12:15 <marekw2143> ski: ok, works
12:15 <marekw2143> undeifned is just a mock?
12:15 <marekw2143> or a type in haskell
12:15 <ski> yes
12:15 <ski> @src undefined
12:15 <lambdabot> undefined = error "Prelude.undefined"
12:16 <ski> it's not a type, it's an ordinary variable
12:16 <MarcelineVQ> novakboskov: this is a .project file, it's different than a .cabal file and appearantly where these options could be passed if not on the command line, but stack doesn't seem to check it: http://cabal.readthedocs.io/en/latest/nix-local-build.html#configuring-builds-with-cabal-project
12:16 <marekw2143> ski, but it can be assigned to everything ?
12:16 <ski> it has every type, yes
12:16 <ski> @type undefined
12:16 <lambdabot> a
12:17 coot joined
12:17 <marekw2143> ski, :)
12:17 OnkelTem joined
12:17 <marekw2143> btw, are there lot of people using haskell in their daily job ?
12:18 <novakboskov> MarcelineVQ: Nevermind, --ghc-options stack flag is OK for my current needs... It seems like this is the only way to pass these options all the way down to ghc. Thank you! :)
12:19 mekeor joined
12:19 MrcRjs joined
12:19 unK_ joined
12:20 <MarcelineVQ> np, note that you should be able to turn off things with ghc options, so you could stack build --profile --ghc-options="-fno-prof-cafs" or somesuch, dunno if that works as expected
12:21 al-damiri joined
12:21 <MarcelineVQ> ah you mentioned that earlier anyway hehe :>
12:21 SepakoRayl joined
12:21 <halogenandtoast> Is there a preferred safe library for HTTP requests?
12:22 <SepakoRayl> hello everyone
12:22 <brynser_> hi
12:23 <JuanDaugherty> halogenandtoast, last i knew there was only streit for the title
12:24 <brynser_> halogenandtoast: check http://haskelliseasy.readthedocs.io/en/latest/#http-clients
12:26 dsm joined
12:26 <brynser_> http-conduit also has a Simple module which is my current go-to, tutorial here: https://haskell-lang.org/library/http-client
12:26 buglebudabey joined
12:27 k0001 joined
12:27 <halogenandtoast> brynser_: I'll check it out.
12:28 lep-delete joined
12:28 wlemuel joined
12:29 <halogenandtoast> thanks
12:30 novakboskov left
12:30 dramforever joined
12:32 moongazer joined
12:34 fDev2179 joined
12:36 <brynser_> np :)
12:38 pita left
12:45 jchia_ joined
12:46 kuttifunk joined
12:46 FjordPrefect joined
12:47 lukaramu joined
12:49 pleax joined
12:51 oisdk joined
12:54 skeuomorf joined
12:55 esclear joined
12:55 pleax joined
12:56 pickle_ joined
12:57 pickle_ left
12:58 eklavya joined
13:01 ibKH joined
13:01 <ibKH> hello i m learning haskell and i'm having difficult time understanding monoid, functor, applicative functor and monads. Can anyone suggest me link to a tutorial or some easy way to understand them
13:03 <hpc> ibKH: take it one thing at a time, and learn them in that order
13:03 <oherrala> ibKH: have you already found this: http://dev.stephendiehl.com/hask/ ?
13:04 rgc joined
13:04 <oherrala> ibKH: and this one: https://wiki.haskell.org/Typeclassopedia
13:05 <ibKH> the first one i haven't checked i'll look now thanks
13:05 Rizy joined
13:10 fizruk joined
13:11 <dramforever> ibKH: Are you trying to know 'What exactly *is* a functor'?
13:11 <dramforever> Don't do that
13:11 <dramforever> Just keep going
13:11 <dramforever> Things will make much more sense later on
13:11 fDev2179 left
13:11 haennar joined
13:12 <Athas> Man, "functor" gotta be the most overloaded term in computer science.
13:12 <dramforever> *If* you understand typeclasses, you know enough about monoid, functor, applicative to get going
13:12 <dramforever> (unrelated note: you mentioned functor twice :P)
13:12 <hpc> especially Monoid, which you probably know already and just don't know it yet
13:12 <ibKH> @dranforever yes, i know that is a mappable over a structure but that's it
13:12 <lambdabot> Unknown command, try @list
13:13 <dramforever> *If* you get do-notation desugaring you know enough about Monoid
13:13 <dramforever> ibKH: That's it
13:13 <ski> @where on-functors
13:13 <lambdabot> "On Functors" (in C++,Standard ML,Haskell,Prolog) by Peteris Krumins in 2010-05-17 at <http://www.catonmat.net/blog/on-functors/>
13:13 eacameron joined
13:13 buglebudabey joined
13:14 <dramforever> If you don't find the meaning of functors, that's because there's no such meaning
13:14 <dramforever> ibKH: Do you know typeclasses?
13:14 <ibKH> yes
13:14 <* ski> doesn't see what `do'-notation desugaring has to do with `Monoid'
13:14 <dramforever> ibKH: And you've seen the typeclasses of those things?
13:15 <dramforever> Uh, sorry I meant monad
13:15 <ibKH> fmap and things like that ?
13:15 <dramforever> class Functor f where
13:15 oisdk joined
13:15 <ski> or `(==)',`show',&c.
13:15 <dramforever> fmap :: (a -> b) -> f a -> f b
13:15 <ibKH> aa yes
13:15 <dramforever> ibKH: Thank you
13:15 janos joined
13:16 <dramforever> You have learned functor, applicative, monad, etc.
13:16 pickle_ joined
13:16 jomg joined
13:16 <ibKH> ok so i need practice to know how to use them i guess
13:16 <dramforever> ibKH: To practice, keep going forwards
13:17 <dramforever> Don't struggle to understand them -- there isn't anything to understand
13:17 mirpa joined
13:17 <ibKH> ok i ll try to use them in practice thanks.
13:20 vektorweg11 joined
13:20 MrcRjs joined
13:20 haennar joined
13:20 vadimich joined
13:21 vadimich joined
13:23 revprez_atlanta joined
13:24 SepakoRayl joined
13:25 sdothum joined
13:28 <SepakoRayl> When using Alex with the monad wrapper, is runAlex supposed to return a single match ?
13:29 <nbro> if I define a function like this: k = 1; h k = True; h _ = False; why, if I call f 1, or f 2, I’m not the first pattern?
13:30 shayan_ joined
13:30 <Ferdirand> nbro: because of shadowing
13:31 <nbro> Ferdirand: how does it work exactly here? If I calll f k, it still returns False...
13:32 vektorweg1 joined
13:32 <Ferdirand> wait that should not even compile
13:32 <Ferdirand> it would complain of overlapping patterns
13:33 lukaramu_ joined
13:33 oisdk joined
13:34 <nbro> Ferdirand: you’re right, I was trying it on the interpreter...
13:34 <nbro> so f k = True should actually match anything
13:35 pickle_ joined
13:35 <Ferdirand> oh
13:35 <Ferdirand> then your second clause shadows the first as an entirely new function
13:35 vinumq joined
13:36 tommd joined
13:37 netheranthem joined
13:38 mjs2600 joined
13:38 <nbro> Ferdirand: yes
13:38 <nbro> btw, is it a good idea to say that a function returns a value?
13:39 <nbro> with respect to the word “returns”
13:39 <nbro> should I prefer for example “produces”?
13:39 <nbro> I know there’s also the keyword return in Haskell, even though I’ve still not had a look at it
13:41 <liste> nbro: it's a function, not a keyword
13:41 <liste> :t return
13:41 <lambdabot> Monad m => a -> m a
13:41 <nbro> ahah, this bot is funny
13:41 <nbro> liste: ok
13:42 <Ferdirand> maybe "evaluates to" is more accurate, I don't know, let's ask the elders for their opinion
13:42 <Logio> nbro: I would prefer 'return' to 'produce' myself
13:42 fDev2179 joined
13:42 <dminuoso> nbro: The book Im reading uses the word reduction actually.
13:44 <ski> nbro : "returns" or "outputs" is fine, imho
13:44 <Logio> if you feel like avoiding 'return', it's probably best to go towards the abstract math version of mapping values to values, instead of the intuitive 'doing stuff' to values interpretation
13:44 <ski> "produces" might work as well
13:45 <Logio> but that depends on what you want the reader to think about
13:45 <ski> one could say the function call evaluates or reduces to a result
13:45 oisdk joined
13:46 FjordPrefect joined
13:46 <nbro> ok, at least saying “returns” it does not seem to be a sin
13:47 cdg joined
13:47 <liste> yeah, the "return" function is badly named anywahy
13:47 <liste> these days you can use "pure" instead of "return"
13:48 <liste> > do { putStrLn "hi"; pure 4 }
13:48 <lambdabot> <IO Integer>
13:49 Claudius1aximus joined
13:50 <nbro> let me try to play also with this bot
13:50 <ski> @help run
13:50 <lambdabot> run <expr>. You have Haskell, 3 seconds and no IO. Go nuts!
13:50 <nbro> :t map
13:50 <lambdabot> (a -> b) -> [a] -> [b]
13:50 <ski> `> ...' short for `@run ...'
13:50 exferenceBot joined
13:50 <ski> `:t ...' is short for `@type ...'
13:51 <Tuplanolla> You can send private messages to it as well, nbro.
13:51 pickle_ joined
13:52 theelous3 joined
13:52 <nbro> ahah, I saw the source code is hosted on Github, maybe I will have a look at it
13:53 <liste> > isGreat "liste" -- pm's with lambdabot rock
13:53 <lambdabot> yeah!
13:53 allegorical joined
13:54 xfix joined
13:55 danthemyth joined
13:56 pickle_ joined
13:57 oisdk joined
13:57 berndl joined
13:59 Ch3ck joined
13:59 umib0zu joined
14:00 jutaro joined
14:00 MattWest joined
14:01 <nbro> :t toDegress x = x * 180.0 / pi
14:01 <lambdabot> error:
14:01 <lambdabot> parse error on input ‘=’
14:01 <lambdabot> Perhaps you need a 'let' in a 'do' block?
14:02 <Xnuk> :t \x -> x * 180.0 / pi
14:02 <lambdabot> Floating a => a -> a
14:02 <Xnuk> > isGreat "Haskell"
14:02 <lambdabot> nah...
14:02 <nbro> ahah
14:03 <Tuplanolla> The documentation for `Control.Concurrent` says that "if you have a `ThreadId`, you essentially have a pointer to the thread itself".
14:03 <fDev2179> That's funny.
14:03 <Tuplanolla> Does this mean that if a thread dies and I start another one, it could get the now-unused `ThreadId` of the dead thread?
14:04 Jicoss joined
14:05 <Tuplanolla> This feels like the pid reaping problem all over again.
14:05 insitu joined
14:05 eacameron joined
14:07 balor joined
14:07 <mauke> Tuplanolla: what's the problem?
14:07 cfricke joined
14:08 nak left
14:08 <Tuplanolla> You may accidentally kill the wrong thread, mauke.
14:08 <mauke> how so?
14:09 mada joined
14:10 pickle_ joined
14:14 mohsen_ joined
14:14 simukis__ joined
14:15 <Tuplanolla> Let's say I spawn threads #1, #2 and #3. Before #2 manages to start, #1 dies due to an exception. Now #3 may get the `ThreadId` of #1, so when I try to kill #1, which should do nothing, #3 dies instead.
14:15 slomo joined
14:15 slomo joined
14:15 Gurkenglas joined
14:17 doodlehaus joined
14:17 marfoldi joined
14:17 <Tuplanolla> This is the stuff nightmares are made of.
14:17 fall_ joined
14:17 doodlehaus joined
14:18 cpennington joined
14:19 doodlehaus joined
14:20 Boomerang joined
14:21 MrcRjs joined
14:21 raichoo joined
14:21 <mauke> Tuplanolla: you can only kill #1 if you have its ThreadId
14:22 <mauke> if you have a ThreadId, you have a pointer to the thread
14:22 <mauke> if you have a pointer to it, it can't be garbage collected
14:22 <mauke> so it can't be reused
14:22 fDev2179 left
14:22 <Tuplanolla> Oh, of course!
14:22 doodlehaus joined
14:22 chlong__ joined
14:23 Rizy joined
14:24 uglyfigurine joined
14:24 oisdk joined
14:25 Gloomy joined
14:27 chocopuff joined
14:28 Boomerang joined
14:29 e14 joined
14:31 janos joined
14:31 vaibhavsagar joined
14:31 xpika joined
14:31 Yuras joined
14:32 coot joined
14:33 ystael joined
14:33 janos__ joined
14:33 chrissl joined
14:33 <vaibhavsagar> I'm having insane memory usage on this program for the Coursera algorithms 1 course
14:33 mkoenig joined
14:34 <vaibhavsagar> is there a way to get around this?
14:34 codesoup joined
14:34 <vaibhavsagar> http://lpaste.net/1337420848532815872
14:34 mizu_no_oto_work joined
14:35 fall_ joined
14:36 robotroll joined
14:36 <robertkennedy> If I implement a class with a non transitive version of Eq, will my code work?
14:36 <vaibhavsagar> the input is roughly 1 million lines, and it all seems fine until I try to calculate the intersections
14:36 rekahsoft joined
14:37 Ch3ck joined
14:37 alx741 joined
14:38 oisdk joined
14:38 <robertkennedy> Ie will pattern matching literals use Eq? Probably not?
14:38 <lyxia> robertkennedy: maybe, if your code doesn't rely on transitivity.
14:39 <lyxia> pattern matching literals uses Eq
14:39 <robertkennedy> Oh tight
14:40 <lyxia> that sounds like a bad idea out of any context though
14:40 <robertkennedy> Well I'm thinking to represent computable numbers with equality on intervals
14:40 crobbins joined
14:41 dhil joined
14:41 meba joined
14:41 Argue__ joined
14:42 <robertkennedy> So I could say "1.66666 == 1.67"
14:42 dbmikus joined
14:42 janos__ joined
14:42 animated joined
14:43 <robertkennedy> Not intervals, maybe, but I just wanted to ensure I wasn't dead out of the gate
14:43 <nbro> I’m creating an “unhex” function that, given a character from ‘1’ to ‘f’ (i.e. the hexadecimal characters) it returns the decimal representation… I’m enumerating all possible pattern matchings in different lines, like “…unhex 'c' = Just 12; unhex 'd' = Just 13; …”. Is there a way to shorten this code?
14:44 Micamo joined
14:44 <Tuplanolla> You can make use of `ord`, nbro.
14:44 JuanDaugherty left
14:44 <Tuplanolla> :t ord
14:44 <lambdabot> Char -> Int
14:44 <mauke> > digitToInt 'c'
14:44 <lambdabot> 12
14:44 <liste> > digitToInt 'g'
14:44 <lambdabot> *Exception: Char.digitToInt: not a digit 'g'
14:44 fall_ joined
14:45 <nbro> @Tuplanolla : I’m required to use pattern matching where appropriately required and this function should actually return a Maybe Int...
14:45 <lambdabot> Unknown command, try @list
14:45 <robertkennedy> > fromEnum 'c'
14:45 <lambdabot> 99
14:45 <Tuplanolla> All these options!
14:46 connrs joined
14:46 <robertkennedy> > fromEnum '😎'
14:46 <lambdabot> 128526
14:47 <mauke> > let unhex c | any (`inRange` c) [('0', '9'), ('A', 'F'), ('a', 'f')] = Just (digitToInt c) | otherwise = Nothing in unhex 'c'
14:47 <lambdabot> Just 12
14:47 <mauke> > let unhex c | any (`inRange` c) [('0', '9'), ('A', 'F'), ('a', 'f')] = Just (digitToInt c) | otherwise = Nothing in unhex 'g'
14:47 <lambdabot> Nothing
14:47 <mauke> nbro: you can shorten it but not with pattern matching
14:48 ThomasLocke joined
14:48 <Tuplanolla> Compress the code with gzip and then extract it at compile time with TH.
14:48 <liste> nbro: you can do "unhex x = case x in { '0' -> ... }"
14:49 <lyxia> vaibhavsagar: you have 1M lines, is the size of "values" going to be around that order of magnitude as well? then for each element you produce a set of size 20k.
14:50 cyborg-one joined
14:51 e14 joined
14:51 <nbro> liste: case .. in ?
14:51 boombanana joined
14:51 <liste> > case 5 in { 5 -> "five"; _ -> "not five; }
14:52 <lambdabot> <hint>:1:8: error: parse error on input ‘in’
14:52 <liste> oh wait
14:52 <liste> brainfart
14:52 <liste> > case 5 of { 5 -> "five"; _ -> "not five"; }
14:52 <lambdabot> "five"
14:52 ChristopherBurg joined
14:52 pasukon joined
14:53 argent0 joined
14:53 fendor joined
14:53 nycs joined
14:54 <liste> > let unhex x = case x of { '0' -> Just 0; '1' -> Just 1; '2' -> Just 2; _ -> Nothing } in unhex '2'
14:54 <lambdabot> Just 2
14:54 coltfred joined
14:57 <nbro> liste: ok, that could actually work and I would not be using if-then-else (which I shouldn’t be using in this exercise)… but this would be as cumbersome as the pattern matching solution
14:57 certainty joined
14:57 raylocal joined
14:57 moongazer joined
14:57 <mauke> nbro: case/of *is* pattern matching
14:58 <nbro> mauke: what does the | (i.e. the pipe) actually means in Haskell, for example you used it here: “let unhex c | any (`inRange` c) [('0', '9'), ('A', 'F'), ('a', 'f')] = Just (digitToInt c) | otherwise = Nothing in unhex 'g'”...
14:58 <raylocal> hi i have a question . why does this work pure (++"foobar") <*> ("foo", "bar")
14:58 <raylocal> but not -> pure (+2) <*> (2,3)
14:58 <Ferdirand> > pure (+2) <*> (2,3)
14:58 <lambdabot> error:
14:58 <lambdabot> • Ambiguous type variable ‘t0’ arising from a use of ‘show_M727212133103...
14:58 <lambdabot> prevents the constraint ‘(Show t0)’ from being solved.
14:59 <mauke> nbro: in that case it introduces a "guard", i.e. a boolean condition in addition to the pattern match
14:59 <Ferdirand> > pure (+2) <*> (2,3) :: (Int,Int)
14:59 <lambdabot> error:
14:59 <lambdabot> • No instance for (Monoid Int) arising from a use of ‘<*>’
14:59 <lambdabot> • In the expression: pure (+ 2) <*> (2, 3) :: (Int, Int)
14:59 <Tuplanolla> > pure (+ 2) <*> (2, 3)
14:59 Rizy joined
14:59 dbmikus joined
14:59 <lambdabot> (2,5)
15:00 carlomagno joined
15:00 <mauke> > mempty :: Integer
15:00 <lambdabot> 0
15:00 <mauke> that's cheating
15:00 <Tuplanolla> You need a `Monoid` instance for this to work.
15:00 <Ferdirand> :t (+ 2)
15:00 <lambdabot> Num a => a -> a
15:00 <Ferdirand> :t (+2)
15:00 <lambdabot> Num a => a -> a
15:01 <Ferdirand> huh
15:01 <Tuplanolla> Check the constraint of `Monoid ((,) a)`, raylocal.
15:01 Nicnux joined
15:01 <Tuplanolla> Actually `Monoid ((,) a b)`.
15:01 <raylocal> yeah i was thinking that in that case this should work pure (++"test") <*> (2, "test") but it doesn't
15:02 <robertkennedy> ?src instance Monoid ((,) a b)
15:02 <lambdabot> Source not found. It can only be attributed to human error.
15:02 connrs joined
15:02 FjordPrefect joined
15:02 <nbro> mauke: I can use a boolean condition in the left side of the definition of a function?!!
15:02 <mauke> nbro: sure
15:03 <nbro> mauke: can I use only guards in the left side of the function def?
15:03 <mauke> there are language extensions for even crazier things, such as pattern guards and view patterns
15:03 <nbro> to introduce a condition?
15:04 <mauke> function definition syntax is just sugar for case/of
15:04 drostie joined
15:04 <mauke> and I think guards work in any context where a pattern is allowed
15:05 janos__ joined
15:05 <mauke> > let foo | False = 42 in foo
15:06 <lyxia> > pure (++ "test") <*> (2, "test") :: (Product Integer, String)
15:06 <lambdabot> *Exception: <interactive>:3:5-20: Non-exhaustive patterns in function foo
15:06 <glguy> not lambda s
15:06 <lambdabot> (Product {getProduct = 2},"testtest")
15:06 <lyxia> raylocal: totally works ^
15:06 <mauke> > (\foo | False -> foo) 42
15:06 <lambdabot> <hint>:1:7: error: parse error on input ‘|’
15:06 <glguy> or do notation <-
15:06 mkoenig joined
15:07 <Tuplanolla> Why though?
15:08 pleax joined
15:08 <vaibhavsagar> @lyxia I just found out that HashSet is implemented in terms of Data.HashMap.Lazy
15:08 <lambdabot> Unknown command, try @list
15:08 <vaibhavsagar> maybe that is why?
15:08 eqxakv joined
15:08 <glguy> the @ is for bot commands
15:09 <argent0> Hi, I itend to use sqlite in haskell, is HDBC the prefered way?
15:09 <nbro> can we import modules or functions from modules only if the current file is defined as a module?
15:09 <vaibhavsagar> thanks glguy :)
15:10 <mauke> nbro: all files are modules
15:10 Saizan joined
15:10 fendor joined
15:10 <mauke> if you don't have an explicit module declaration, it's 'module Main where'
15:10 <argent0> s/itend/want
15:10 <nbro> well, I’ve read that modules must be explicitly defined with a name that starts with a capital letter…
15:11 <nbro> mauke: ok, so I’m currently on the Main module
15:11 <lyxia> vaibhavsagar: that doesn't matter though. The laziness of HashMap only affects values, i.e., (), not keys.
15:11 <mauke> https://www.haskell.org/onlinereport/haskell2010/haskellch5.html#x11-990005.1
15:11 mirpa joined
15:12 <raylocal> thanks Tuplanolla and lyxia . I understand that the monoid instance should be there for both the members of the tuple and not only the 2nd one as i has thought /imagined
15:12 <lyxia> vaibhavsagar: but isn't your program representing 20 billion elements?
15:12 <liste> argent0: check out https://hackage.haskell.org/package/sqlite-simple
15:12 <raylocal> i understand NOW i mean :)
15:12 <lyxia> vaibhavsagar: how did you expect it to fit
15:13 <vaibhavsagar> lyxia: are you saying that that is where the memory usage is coming from?
15:13 <Tuplanolla> For `Monoid` you need both, but `Applicative` only requires the first, raylocal.
15:13 <vaibhavsagar> not the intersection that I'm doing?
15:13 revtintin joined
15:13 <lyxia> well the intersections surely don't help
15:16 <vaibhavsagar> fair call, I changed it so that I'm computing intersections when I first build the hashmap
15:16 Ch3ck joined
15:18 SepakoRayl joined
15:18 <argent0> liste: thanks for the info
15:19 gawen joined
15:19 ludat joined
15:20 MrcRjs joined
15:20 schjetne joined
15:21 R13N joined
15:23 suls joined
15:23 danthemyth joined
15:23 danthemyth joined
15:26 wraithm joined
15:26 <nbro> mauke: I was looking at your solution of unhex, and there’s one part that I actually didn’t fully understand
15:26 <nbro> and which is: any (`inRange` c) [('0', '9'), ('A', 'F'), ('a', 'f')]
15:26 <nbro> :t any
15:26 <lambdabot> Foldable t => (a -> Bool) -> t a -> Bool
15:26 <nbro> any :: (a -> Bool) -> [a] -> Bool
15:27 benjwadams joined
15:27 <nbro> any requires a predicate
15:27 <nbro> in your example, apparently (`inRange` c) is the predicate
15:27 <nbro> :t inRange
15:27 <lambdabot> Ix a => (a, a) -> a -> Bool
15:27 <benjwadams> Where can I learn more about Haskell's build system? I've only dabbled with haskell, but I'm getting irritated with python's model breaking everything.
15:27 <benjwadams> heard mixed things about cabal
15:29 ajhager joined
15:29 <sm> http://haskell-lang.org/get-started
15:30 Jicoss joined
15:30 <vaibhavsagar> benjwadams: https://docs.haskellstack.org/en/stable/README/
15:31 <nbro> :info inRange
15:31 <mauke> @hoogle inRange
15:31 <lambdabot> Data.Ix inRange :: Ix a => (a, a) -> a -> Bool
15:31 <lambdabot> Data.Ix.Enum inRange :: Enum a => (a, a) -> a -> Bool
15:31 <lambdabot> Data.Ord.HT inRange :: Ord a => (a, a) -> a -> Bool
15:32 puregreen joined
15:33 cpup joined
15:33 doomlord joined
15:34 <nbro> mauke: in the first signature of inRange function we have: Data.Ix inRange :: Ix a => (a, a) -> a -> Bool, we have that it receives two arguments, a tuple (a, a) and a
15:34 janos__ joined
15:34 conal joined
15:34 <nbro> but in your usage: any (`inRange` c) [('0', '9'), ('A', 'F'), ('a', ‘f’)], you don’t seem to use the two arguments correctly
15:35 <nbro> maybe I’m just misinterpreting the signature
15:35 vektorweg1 joined
15:35 <mauke> nbro: do you know what ` ` does?
15:36 fbergmann joined
15:36 handyc joined
15:36 <mauke> also, you retyped the 'f' part. weird
15:36 <nbro> mauke: from my understanding it’s used to make the function be infix
15:36 <mauke> correct
15:37 <mauke> do you know about operator sections?
15:37 <mauke> > (/ 2) 3
15:37 <lambdabot> 1.5
15:37 Nicnux joined
15:37 <nbro> mm…I think I briefly saw something like that before
15:38 <mauke> > map (/ 2) [1 .. 10]
15:38 eklavya joined
15:38 <lambdabot> [0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0]
15:38 <nbro> you essentially can precede the operator
15:38 <nbro> with the second part
15:38 halogenandtoast joined
15:38 eklavya joined
15:38 osa1 joined
15:38 <mauke> :t (`inRange` ?c)
15:38 <lambdabot> (?c::a, Ix a) => (a, a) -> Bool
15:38 <mauke> :t (`inRange` (?c :: Char))
15:38 <lambdabot> (?c::Char) => (Char, Char) -> Bool
15:39 nemorichard joined
15:40 mjs2600 joined
15:41 <lep-delete> :t (`inRange` _)
15:41 <lambdabot> error:
15:41 <lambdabot> • Found hole: _ :: a
15:41 <lambdabot> Where: ‘a’ is a rigid type variable bound by
15:41 <lep-delete> :D
15:42 feri joined
15:42 puregreen joined
15:42 <mauke> @undo (`inRange` c)
15:42 <lambdabot> (`inRange` c)
15:42 <mauke> @unpl (`inRange` c)
15:42 <lambdabot> (\ a0 -> inRange a0 c)
15:42 <tabaqui1> I have one config file for my application
15:43 lwm joined
15:43 <tabaqui1> in Python I would parse it and put in one global singleton
15:43 Shatnerz joined
15:44 <tabaqui1> because I don't want to pass fields up to down, from main to actual function
15:44 <tabaqui1> which pattern do you use in haskell?
15:44 Guest17847 left
15:44 <tabaqui1> *what pattern
15:45 lwm joined
15:45 Luke joined
15:45 insitu joined
15:46 puregreen joined
15:46 feri joined
15:46 <tabaqui1> ah, haskell wiki recommends to wrap the whole code into configuration monad
15:47 <tabaqui1> I hope there is more elegant solution
15:47 <mauke> @where configurations
15:47 <lambdabot> http://okmij.org/ftp/Haskell/dependent-types.html#Prepose
15:47 <mauke> @where reflection
15:47 <lambdabot> I know nothing about reflection.
15:47 <Sornaensis> is anyone ever going to fix the syntax highlighting bugs in the haskell wiki
15:47 hazmat_ joined
15:47 <liste> @hackage reflection
15:47 <mauke> @where+ reflection http://hackage.haskell.org/package/reflection
15:47 <lambdabot> http://hackage.haskell.org/package/reflection
15:47 <lambdabot> Good to know.
15:47 hazmat__ joined
15:47 janos__ joined
15:48 tommd joined
15:48 janos__ joined
15:49 crobbins joined
15:50 FjordPrefect joined
15:50 lwm joined
15:50 hazmat_ joined
15:51 edsko joined
15:51 bollu joined
15:52 sepp2k joined
15:52 <nbro> I’m curious to know what Haskell programmers that have at least some experience with Scala think about this latter?
15:52 <maerwald> nothing
15:53 <maerwald> it's an incredibly unfocussed language and not really functional for a haskeller
15:53 <bollu> lens question: is there a way to simplify this? I have two (Data.Map x y), call them "m1" and "m2". I want to extract the key out of m1. if it does not exist, I want to take it out of m2. Best I could come up with way m1 ^. key <|> m2 ^. key
15:53 feri joined
15:54 puregreen joined
15:54 eacameron joined
15:54 Ch3ck joined
15:54 stites joined
15:54 Wizek joined
15:55 Wizek_ joined
15:55 <nbro> maerwald: you mean that it supports different paradigms as opposed to Haskell
15:55 <nbro> ?!
15:55 <lambdabot> Maybe you meant: v @ ? .
15:55 <maerwald> no, it's unfocusses
15:55 Guest35649 left
15:55 coltfred joined
15:55 <maerwald> e.g. try to write a proper ADT in Scala... there are 5-10 ways to do it and all are different and have oddities
15:55 <berndl> I think Haskellers will all prefer Haskell over Scala any day.
15:55 <maerwald> and ultimately, all of them are not what you want
15:55 Khisanth joined
15:56 <maerwald> the Scala developers keep adding stuff to the language without much thought
15:56 <maerwald> it's like C++
15:56 mlev joined
15:56 sellout- joined
15:56 <Sornaensis> yea my problem with scala/c++ is how many divergent ways of doing things there are
15:56 <berndl> maerwald: yes, indeed.
15:56 <Sornaensis> makes understanding what's happening in a piece of code take longer than necessary
15:56 <nbro> oh, I see, I also like languages that are more focused, like Haskell or C
15:57 <berndl> How many ways can you define a int variable with a value of 27 in C++?
15:57 <nbro> lol
15:57 <mlev> Can someone please help me with this memoization within an instance declaration question? http://stackoverflow.com/questions/42583263/memoization-of-intermediate-values-in-a-typeclass-instance
15:57 <berndl> There are 6 ways of doing it.
15:57 GlobalAtom joined
15:57 <nbro> but I think this problem comes from the fact that people in those programming languages come from different areas and require different things
15:57 <Sornaensis> berndl: only 6?
15:58 <berndl> Last I counted, yes.
15:58 <mauke> int i = 27; int i(27); int i = { 27 }; int i { 27 }; ?
15:58 <berndl> Don't forget the auto versions.
15:58 feri joined
15:58 <mauke> signed int i = 27; int signed i = 27; int (i) = 27; int ((i)) = 27;
15:58 sternmull joined
15:59 <nbro> well, guys, I must say one thing
16:00 lithie joined
16:00 <nbro> C++ is complex mostly because it strives to be back-compatible with C and because of a bad type system
16:00 <mauke> C++ doesn't strive to be compatible with C
16:00 <nbro> mauke: it was originally designed to be
16:00 <mauke> no
16:01 <nbro> mauke: yes
16:01 <mauke> it stopped when it added the 'class' keyword
16:01 mjs2600 joined
16:01 <brynser_> "C with Classes"
16:01 cschneid_ joined
16:02 <nbro> mauke: backward compatible means that any (or almost any) C program can be compiled by a C++ compiler
16:02 <mauke> not "almost"
16:02 jophish joined
16:02 johnw_ joined
16:03 <mauke> C++ made 'class' a keyword, which broke all C programs that did 'int class;' or similar
16:03 <nbro> mauke: you’re saying different things
16:03 <nitrix> The OOP mania doesn't help.
16:03 <nbro> C is not C++, of course!
16:03 <mauke> this wouldn't be such a big deal, but C++ also redefined 'struct' to create classes
16:03 <berndl> C++ is complex because it inherited most of the stuff from C and added even more stuff on top.
16:03 <nbro> but C++ is (almost always) C
16:03 <mauke> so 'class' is actually 100% redundant
16:03 <c_wraith> that was an early goal of C++, but it was abandoned long ago. even without that keyword collision, some C constructs have different semantics in C++ now
16:04 ClaudiusMaximus joined
16:04 <mauke> nbro: nonsense
16:04 doodlehaus joined
16:04 <nbro> mauke: class and struct are different in C++
16:04 <nbro> struct makes fields public by default, class makes them private
16:04 <mauke> nbro: yes, one defaults to public, the other to private
16:04 <mauke> big deal
16:04 animated joined
16:04 connrs joined
16:05 <mauke> you could still use 'struct Foo { private: ...}' everywhere and never need 'class'
16:05 janos__ joined
16:06 <nbro> look, I’m not saying C++ is the most elegant language in terms of design, but it beats almost all the others almost in all context in terms of performance, so it’s useful as a language
16:06 tigerfinch joined
16:06 feri joined
16:06 <Sornaensis> C++ is going to be entirely replaced by rust in a few years
16:06 <bollu> is there a way to simplify this? I have two (Data.Map x y), call them "m1" and "m2". I want to extract the key out of m1. if it does not exist, I want to take it out of m2. Best I could come up with way m1 ^. key <|> m2 ^. key
16:06 <mauke> performance is not a language property
16:06 <karroffel> Sornaensis: yeah, just like IPv6 replaced IPv4 5 years ago
16:06 <Sornaensis> bollu: is there a reason that's not simple enough for you?
16:06 <karroffel> I love Rust
16:06 <karroffel> don't get me wrong
16:06 <nbro> mauke: yes, I said it in that way to simplify things
16:06 <Sornaensis> karroffel: C++ is not as entrenched as C
16:06 <bollu> Sornaensis: curiosity, mostly
16:07 <bollu> Sornaensis: I want to see how much I can push lens
16:07 <karroffel> I see rust as a really really really capable competitor to C++, but I don't think C++ is going anywhere the next 10 years unfortunately
16:08 <nbro> Sornaensis: I’m also curious about rust, zero-cost abstractions, no gc, it really seems the most promosing language to replace C++ step by step
16:08 <bollu> karroffel: hm, why?
16:08 <karroffel> bollu: because the industry is slow when it comes to adapting new stuff
16:08 Guest59277 left
16:08 <glguy> the comparison of rust and c++ is off topic in #haskell
16:08 <karroffel> AAA games will still count on C++ as Rust is a bit too pure
16:09 <karroffel> Yeah true, sorry glguy :/
16:09 <Sornaensis> rust is heavily influenced by haskell tho
16:11 <bollu> Sornaensis: more ML
16:11 <shapr> Has anyone use HaNS for packet manipulation instead of purely as a TCP/IP stack?
16:11 danthemyth joined
16:12 <fendor> Short question, how can i get the binary representation of a number?
16:12 mwilly joined
16:13 wedens joined
16:13 <glguy> > showIntAtBase 2 intToDigit 42 ""
16:13 <lambdabot> "101010"
16:13 tigerfinch left
16:13 <fendor> thanks a lot
16:14 <nbro> I really like Haskell, but there also a few minor things that I’ve already perceived in the language that could have been designed better, for example the fact that you need to wrap negative numbers with parenthesis when passing them to a function, that’s kind of unnecessary tedios for such a minor thing
16:14 loanatic joined
16:15 <coltfred> I agree that's a little annoying.
16:15 <shapr> nbro: what about keeping a list of the things that bug you, and then when you've learned Haskell, come back and fix them?
16:15 robkennedy joined
16:15 <shapr> or at least share the list after a month or two?
16:15 buglebudabey joined
16:15 <shapr> nbro: Mind you, I'd want to see the other list as well, things that thrill you :-)
16:15 steeze joined
16:16 <fendor> the thing that thrills me most is when c++ programmers come at me and act like haskell is not a real language
16:16 <nbro> shapr: eheh
16:16 <fendor> that thrills me in haskell develeopment :D
16:16 <shapr> fendor: That's an odd way to start a discussion
16:16 <fendor> shapr, that was just a joke
16:16 <shapr> I like to show people useful everyday code I've written in Haskell.
16:16 <shapr> ha
16:16 <nbro> shapr: definitely not many things, I predict, compared to other lists ;)
16:17 <fendor> shapr, was not meant to be taken seriously, sorry
16:17 <shapr> nbro: well, keep track of the lists, I'm interested
16:17 serendependy joined
16:17 <glguy> There's already an extension you can turn on to support negative literals
16:17 <shapr> nbro: Want to see some cool code I wrote as a weekend hack?
16:17 <blackdog> nbro: problem is that you'd have to make that a special case and make it more complicated to understand how operators work in general.
16:17 <nbro> shapr: yeah, why not?
16:17 mjs2600 joined
16:18 <shapr> nbro: This displays info in my status bar from the JSON API of Atlanta's subway trains so I can get to work and other places on time: https://github.com/shapr/tmuxmarta/blob/master/src/Lib.hs
16:19 dan_f joined
16:19 augur joined
16:19 <shapr> nbro: I use byobu, and I put the resulting binary into ~/.byobu/bin/ as 60_marta so byobu will refresh the info every sixty seconds.
16:20 mjs2600 joined
16:20 <shapr> output (at this instant) looks like: ["M:10","N:Arriving"] meaning a train going south from North Avenue is arriving, and a train going north from Midtown is ten minutes away.
16:21 zzz joined
16:21 MrcRjs joined
16:21 mkoenig_ joined
16:21 loanatic_ joined
16:21 fosskers joined
16:22 <shapr> nbro: are you familiar with list comprehensions in Python?
16:23 BlueRavenGT joined
16:23 simukis__ joined
16:24 <nbro> shapr: yes, I’m familiar with them
16:25 gienah joined
16:25 <shapr> nbro: Python's list comps were borrowed from Haskell, and TransformListComp gives even MOAR super list comp powers!
16:26 <nbro> shapr: yes, I noticed ;)
16:26 <shapr> nbro: Have you used LINQ in C#? The TransformListComp extensions remind me of LINQ: https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/guide-to-ghc-extensions/list-and-comprehension-extensions
16:26 tommd joined
16:27 ljc joined
16:27 <nbro> shapr: I’ve used C# 2-3 years ago and I don’t think I’ve ever used LINQ…
16:28 <shapr> oh, I really enjoyed writing LINQ, you can make some amazingly powerful pipelines that mix sql results, anonymous objects, and everything else.
16:28 <shapr> nbro: What got you interested in Haskell?
16:29 <nbro> I would like to have the opportunity to go back to C#, but I’ve not programmed on Windows for a while, even though now it can also be used as a cross-platform language because of mono
16:30 mirpa joined
16:30 afarmer joined
16:30 <nbro> shapr: I got interested in Haskell already a few months ago, but I only started learning it like not even a week ago
16:31 <nbro> oh
16:31 <nbro> sorry, you asked “what"
16:31 <shapr> sure, that's fine too
16:31 <nbro> first because it’s a pure functional language
16:32 urodna joined
16:32 <nbro> it’s also probably the most used one
16:32 buglebudabey joined
16:32 <shapr> Yeah, lots of commercial use of Haskell
16:33 <maerwald> lots?
16:33 <shapr> Here at work Haskell is mostly used for pandoc, xmonad, and shellcheck.
16:34 <shapr> Though we almost chose PFQ instead of DPDK, oh well
16:34 <maerwald> last I checked even Prolog was ahead on the Tiobe index. Then there was a survey about used programming languages where haskell scored as a "weekend language"
16:34 <shapr> maerwald: yeah, I think lots, have you seen the CUFP talks?
16:34 Maxou joined
16:35 <shapr> nbro: Do you have a project you want to implement in Haskell?
16:35 <maerwald> do they provide numbers or talk about surveys in industry?
16:37 Nicnux joined
16:38 <nbro> shapr: I would like to exploit Haskell where, let’s say, it excels, for example in a multi-threading environment, but first I need to learn the language very well
16:38 schjetne joined
16:39 dustmote joined
16:39 <nbro> it excels in the sense that by default we do not have mutable things
16:39 leat joined
16:39 <nbro> now I’m still not familiar with libraries and the actual support for multi-threading
16:39 <shapr> Yeah, the multicore support is especially nifty
16:40 <Sornaensis> haskell has the finest implementation of software transactional memory afaik
16:40 <Sornaensis> well, ghc
16:41 <maerwald> and ghc breaks errno thread safety :P
16:42 SpinTensor joined
16:42 deepfire joined
16:43 janos__ joined
16:43 <ongy> I thought ghc saves errno into the haskell threads for that reason?
16:43 meijiJAPAN joined
16:43 <meijiJAPAN> Is it possible to do web development with Haskell
16:44 mjs2600 joined
16:44 trism joined
16:44 <meijiJAPAN> And if so, how it is different compared to Scala
16:44 fizruk joined
16:44 <liste> karroffel: yes, it's possible.
16:44 <liste> meijiJAPAN: ^
16:44 <liste> not karroffel, sorry
16:44 <maerwald> ongy: I don't know, that's what I got from discussions with more knowledable people here, I asked about it
16:45 <liste> meijiJAPAN: the libraries, programming techniques and ecosystem are different
16:45 eschnett joined
16:45 <fendor> does someone know a good template haskell tutorial?
16:46 Snircle joined
16:46 Luke joined
16:46 dsh joined
16:46 wraithm joined
16:46 <nbro> joke: I think Haskell is not the mostly widely used programming language only because people are lazy enough to avoid the laziness of Haskell
16:46 <nbro> well, not that funny
16:46 <nbro> :D
16:47 <nbro> lol
16:47 <Sornaensis> maerwald: you mean web frameworks? yesod is quite mature
16:48 jathan joined
16:48 raycoll joined
16:48 raichoo joined
16:49 GlobalAtom joined
16:50 jmelesky joined
16:50 thatguyfrombefor joined
16:51 <maerwald> ongy: http://tunes.org/~nef/logs/haskell/17.01.09 check the logs for "errno"
16:51 <maerwald> ircbrowse is down, no idea why
16:53 k0001 joined
16:53 <sm> thread-safe current working directory has been a problem, also
16:53 elperdut joined
16:53 <maerwald> sm: heh... are you referring to darcs? :P
16:54 <sm> we've seen it in darcsden, yup
16:54 <maerwald> anyway, for that there is an "easy" solution: absolute paths :P
16:54 <sm> just adding that to the list while we're pointing out flaws in haskell's gem-like perfection
16:54 <Tuplanolla> Haskell's what?
16:55 calincru joined
16:55 <maerwald> sm: however, I'm not actually sure that working directory thing is a problem with GHC/the runtime... could just be the way darcs/darcsden or libraries (mis-)handle things?
16:55 Apocalisp joined
16:55 <maerwald> could even be Snap
16:56 <sm> it is a piece of state that's not thread-safe, IIRC
16:56 kuribas joined
16:57 <sm> perhaps we have some process lib that handles it better now
16:58 koitalel joined
16:58 animated joined
16:58 Noldorin joined
16:58 <kuribas> Hi, I have a profiling graph of my library http://kuribas.hcoop.net/Overlap.html : http://kuribas.hcoop.net/graph.svg
16:59 <kuribas> Control.Monad.State.Class.modify seems to take a large chunck of the time, is there a way to optimize that?
16:59 <kuribas> Shouldn't ghc optimize it away?
16:59 Snircle joined
16:59 moongazer joined
16:59 meijiJAPAN joined
17:00 <Tuplanolla> Is that state lazy, kuribas?
17:01 <kuribas> Tuplanolla: I think not...
17:01 HarveyPwca joined
17:02 <Tuplanolla> That would explain it.
17:02 <kuribas> Tuplanolla: why?
17:02 <kuribas> the algorithm is strict...
17:03 janos__ joined
17:03 preyalone joined
17:04 <Tuplanolla> Since `modify` does not evaluate its arguments.
17:04 <Tuplanolla> There's `modify'` for that.
17:04 janos__ joined
17:04 meijiJAPAN joined
17:04 Sonolin joined
17:05 <kuribas> right
17:06 janos___ joined
17:07 <kuribas> what about modifying?
17:07 <kuribas> :t modifying
17:07 <lambdabot> MonadState s m => ASetter s s a b -> (a -> b) -> m ()
17:07 Snircle joined
17:08 hackebeilchen joined
17:08 <kuribas> is there a strict version of modifying?
17:08 route joined
17:08 fProgrammer joined
17:08 <Tuplanolla> @hoogle modifying'
17:09 <lambdabot> No results found
17:09 janos__ joined
17:09 <Tuplanolla> Not reassuring.
17:09 <fProgrammer> quick question: I've a created a datatype using record syntax. What is the most efficient way to convert it to a map, where the accessor functions are key and the values are Map Values. For ex: http://lpaste.net/353181
17:09 <Tuplanolla> There may be some lens magic to get around this.
17:09 CurryWurst joined
17:10 <kuribas> modifying l f = State.modify' (over l f)
17:10 <kuribas> erm modifying'
17:11 janos___ joined
17:12 janos____ joined
17:12 zclod joined
17:13 janos____ joined
17:15 dbmikus joined
17:15 Snircle_ joined
17:16 <lyxia> fProgrammer: Text and Int are different types so you can't put both of them in a map
17:16 hackebeilchen joined
17:18 coot joined
17:18 <kuribas> perhaps I should try lens instead of microlens...
17:18 eacameron joined
17:20 dbmikus joined
17:22 <ongy> is there a reason strerror is not exposed in haskell? I wanted to reuse the errno definitions for sending errors over sockets
17:22 jao joined
17:23 mhagemeister joined
17:23 magneticduck joined
17:24 chenyu joined
17:25 xkapastel joined
17:25 meijiJAPAN joined
17:26 Lord_of_Life joined
17:28 edsko joined
17:28 fizruk joined
17:29 vaibhavsagar joined
17:30 freusque joined
17:30 cyanobacteria joined
17:30 wildlander joined
17:31 Fairy joined
17:32 jinblack left
17:32 <hongminhee> I got this error which is new to me. Do anyone know what does this mean?
17:32 <hongminhee> • Couldn't match type ‘Constraint’ with ‘*’
17:32 <hongminhee> Expected type: Proxy * (Target Nirum.Targets.Python.Python)
17:32 <hongminhee> Actual type: Proxy Constraint (Target Nirum.Targets.Python.Python)
17:34 <lyxia> this means you used a Proxy with the wrong type.
17:34 <lyxia> hongminhee: can you paste the offending code
17:34 owiecc joined
17:35 resolve joined
17:35 <hongminhee> I'm actually using some TemplateHaskell now...
17:36 ess_sing joined
17:36 gillesmajor joined
17:36 lodin_ joined
17:36 edwinvdg_ joined
17:37 inr_ joined
17:37 Flint joined
17:37 AlainODea_ joined
17:37 dstockwell_ joined
17:37 rann_ joined
17:37 hansihe_ joined
17:37 mbrock_ joined
17:37 dsm_ joined
17:37 Tritlo_ joined
17:37 ppnkk_ joined
17:37 <hongminhee> github gist seems not to support directories
17:37 mankyKitty_ joined
17:37 <hongminhee> https://gist.github.com/dahlia/e0b726810b90806a3e1c7791d7499c6d#file-nirum-targets-hs-L48
17:37 fuziontech_ joined
17:38 jonrh_ joined
17:38 jorendorff__ joined
17:38 Guest49740_ joined
17:38 LeNsTR|away joined
17:38 <hongminhee> That line is where the error comes from
17:38 caw__ joined
17:38 reynir1 joined
17:38 staffehn_ joined
17:38 bbielsa_ joined
17:38 shennyg_ joined
17:38 feepo_ joined
17:38 `DanZimm joined
17:39 klugez_ joined
17:39 fryguybo1 joined
17:39 flxw_ joined
17:39 dequbed_ joined
17:39 solarus_ joined
17:39 kafke joined
17:39 brassel joined
17:39 bjarki joined
17:40 integral_ joined
17:40 integral_ joined
17:40 Kestrel-029 joined
17:40 s4kashya1 joined
17:40 Hafydd_ joined
17:40 Hafydd_ joined
17:40 atomi_ joined
17:40 sovreign_ joined
17:40 frontend1oader joined
17:40 tjbp_ joined
17:40 mathu_ joined
17:40 Chousuke_ joined
17:40 magicman_ joined
17:40 joachifm_ joined
17:40 cjh` joined
17:40 hxegon joined
17:40 afarmer joined
17:40 eagleflo_ joined
17:40 avn_nb_ joined
17:40 Jaak_ joined
17:40 caasih_ joined
17:40 mou_ joined
17:40 Tazca_ joined
17:40 kafke joined
17:40 Ptival_ joined
17:40 pingu_ joined
17:40 `0660 joined
17:40 Vq_ joined
17:40 Wojciech_K joined
17:40 zerokarm1left joined
17:40 Deaddy_ joined
17:41 cods_ joined
17:41 pent_ joined
17:41 roark joined
17:41 mokus_ joined
17:41 cheater__ joined
17:41 hegge_ joined
17:41 tinkyholloway joined
17:41 deeepy joined
17:41 mudfog- joined
17:41 Athas_ joined
17:42 esph_ joined
17:42 emily1 joined
17:42 oberste1n joined
17:42 sqrt2_ joined
17:42 srenatus[m]1 joined
17:42 dcoutts__ joined
17:42 karce- joined
17:42 kafke joined
17:42 Qommand0r_ joined
17:42 fugyk_ joined
17:42 benkard joined
17:42 realcse joined
17:42 aminb_ joined
17:42 Majoo joined
17:42 gabiruh_ joined
17:42 hendrik[m]1 joined
17:42 Frankablu_ joined
17:43 _jzl joined
17:43 cpu1_ joined
17:43 rom15041 joined
17:43 bssmt joined
17:43 bjarki joined
17:43 dpepsilon joined
17:43 johhfabley joined
17:43 hiptobecubic_ joined
17:43 chin-tasti_ joined
17:43 chef_excellence[ joined
17:43 mindos_cloud____ joined
17:43 \u joined
17:43 \u joined
17:43 dibblego joined
17:43 dibblego joined
17:43 Cerise joined
17:43 Cerise joined
17:43 joehillen joined
17:43 ij joined
17:43 carc joined
17:43 orcus joined
17:43 BrAsS_mOnKeY joined
17:43 epsilonhalbe joined
17:44 lukky513 joined
17:44 kian joined
17:44 kian joined
17:44 cjwelborn joined
17:44 cjwelborn joined
17:44 cjwelborn joined
17:44 asm89 joined
17:44 gareth__ joined
17:44 divVerent joined
17:45 <lyxia> hongminhee: InstanceD _ _ t _ here t is not the type for which the instance is being defined.
17:45 SolarAquarion joined
17:45 <lyxia> When you write instance Monoid (), here t corresponds to the whole "Monoid ()"
17:45 <lyxia> rather than just "()"
17:46 <hongminhee> oh
17:46 jml joined
17:47 roconnor joined
17:47 <hongminhee> lyxia: really thanks for your advice! :-) it was my first TemplateHaskell coding, so I'd mistaken...
17:47 <hongminhee> 🙏
17:48 <lyxia> you're welcome
17:48 DrCode joined
17:49 moongazer joined
17:50 nilof_ joined
17:51 lithie joined
17:52 urban24 joined
17:52 tsmish joined
17:53 _kit_ joined
17:53 wraithm joined
17:54 mhagemeister joined
17:54 lspitzner joined
17:54 sibi joined
17:55 crobbins joined
17:56 mjs2600 joined
17:56 conal joined
17:57 doomlord joined
17:59 mwilly joined
17:59 michaelw joined
18:01 t7 joined
18:02 <Ch3ck> is there any GHC playground online?
18:02 <Ch3ck> Where I can run my haskell code on the browser
18:02 zeroed joined
18:03 fkurkowski joined
18:04 <danza> Ch3ck, a web search should bring you some, this was added lately https://repl.it/site/blog/haskell
18:05 cfricke joined
18:06 raichoo joined
18:06 Jacoby6000__ joined
18:07 mannen joined
18:07 <Tuplanolla> @let m = Data.Map.fromList [(1, 'a'), (2, 'b')] :: Map Int Char
18:07 <lambdabot> .L.hs:164:47: error:
18:07 <lambdabot> Not in scope: type constructor or class ‘Map’
18:07 <lambdabot> Perhaps you meant ‘M.Map’ (imported from Data.Map)
18:07 <Tuplanolla> @let m = M.fromList [(1, 'a'), (2, 'b')] :: M.Map Int Char
18:07 <lambdabot> Defined.
18:07 <Tuplanolla> > has (at 3) m -- Why?
18:07 <lambdabot> error:
18:07 <lambdabot> Ambiguous occurrence ‘m’
18:07 <lambdabot> It could refer to either ‘Debug.SimpleReflect.m’,
18:08 <Tuplanolla> > has (at 3) M.m -- Why?
18:08 <lambdabot> error:
18:08 <lambdabot> Not in scope: ‘M.m’
18:08 <lambdabot> Perhaps you meant ‘L.m’ (line 164)
18:08 <Tuplanolla> > has (at 3) L.m -- Once more why? And lambdabot's imports are the worst.
18:08 <lambdabot> True
18:08 pasukon joined
18:08 unmanbearpig joined
18:10 k0001 joined
18:10 xacktm joined
18:10 pasukon joined
18:11 <mauke> @undefine
18:11 <lambdabot> Undefined.
18:11 <mauke> just don't define single-letter variables
18:12 Aune joined
18:12 <Tuplanolla> Shouldn't import `SimpleReflect` or use single-letter module aliases.
18:12 epsilonhalbe left
18:13 mannen left
18:14 oisdk joined
18:14 paolino joined
18:19 srcerer joined
18:19 phyrex1an joined
18:20 louispan joined
18:20 chlong__ joined
18:21 shafox joined
18:22 takle joined
18:23 Swizec joined
18:23 CountryNerd joined
18:24 MrcRjs joined
18:25 MrcRjs joined
18:29 afarmer joined
18:29 gcross joined
18:30 MrcRjs joined
18:32 replay joined
18:32 raycoll joined
18:32 jmelesky joined
18:33 <c_wraith> SimpleReflect is valuable for lambdabot's main purpose.
18:33 chenshen joined
18:33 <lyxia> Yeah, lambdabot is no ghci
18:34 Klumben joined
18:34 ricardo82 joined
18:34 _flow__ joined
18:35 mjs2600 joined
18:35 _flow__ joined
18:35 albel727 joined
18:36 osa1 joined
18:36 osa1 joined
18:39 pietra joined
18:39 Berra joined
18:39 pietra left
18:40 <Tuplanolla> It's nice that you undefined my example and didn't answer my question. I don't need variables for it though.
18:40 <Tuplanolla> > has (at 3) (mempty :: Data.Map.Map Int Char)
18:40 <lambdabot> True
18:40 <Tuplanolla> Why does this happen?
18:41 fre joined
18:42 TxmszLou joined
18:43 <lyxia> at is a lens, it always matches.
18:44 nadirs joined
18:44 <Tuplanolla> Is there something I can compose it with to make it behave like `ix`? Perhaps `each`?
18:44 nadir_ joined
18:45 rgc joined
18:45 meghnath joined
18:45 acarrico joined
18:45 saylu joined
18:46 <c_wraith> why not just use ix?
18:46 arj joined
18:46 <Tuplanolla> The lens is an argument and it's used in more than one spot.
18:46 <lyxia> at 3 . _Just
18:47 <c_wraith> yeah, I was just hoping to check that.. since at points to a Maybe, the _Just works.
18:48 <Tuplanolla> Great.
18:48 twanvl joined
18:50 hrehf joined
18:50 <michalrus> Hey, is there a “deterministic” code formatter in the sense that it will always output the same whitespace, irregardless of formatting it gets as its input?
18:51 chaosmasttter joined
18:51 <lyxia> Just parse the code and print it?
18:52 vaibhavsagar joined
18:53 Luke joined
18:53 sobaken joined
18:54 <mauke> "irregardless" :-(
18:56 <c_wraith> mauke, now accepted by dictionaries as a synonym of regardless! :)
18:56 fryguybob joined
18:56 mirpa joined
18:57 urban24 joined
18:57 connrs joined
18:57 <* michalrus> grins
18:57 <mauke> but not by me!
18:57 <mauke> infidels
18:58 fryguybob joined
18:59 prohobo joined
18:59 fryguybob joined
18:59 <michalrus> lyxia: but isn’t there some commonly used solution for that? I wanted to setup a CI (or update/post-receive hook) script to reject unformatted changes. Writing the formatter myself seems wrong. (:
19:00 <michalrus> I tried hindent once, but I think it behaved strangely…
19:00 prohobo left
19:00 fnurglewitz joined
19:01 <michalrus> (And arguing over formatting in CRs is time lost.)
19:02 emmanuel_erc joined
19:04 shayan_ joined
19:07 fre joined
19:07 t7 joined
19:07 bahtiyar joined
19:09 path[l] joined
19:09 a3Dman joined
19:10 paolino_ joined
19:10 Miroboru joined
19:11 maerwald_mob joined
19:12 <lyxia> michalrus: why is it important for it to be deterministic
19:12 danthemyth joined
19:12 AndreasK joined
19:12 <lyxia> I think the way you worded it implies every AST has a unique source code representation
19:13 mhagemeister joined
19:13 <lyxia> but this is not really desirable because you may want to choose yourself how to break some lines
19:13 <lyxia> I bookmarked this some time ago but have never tried it https://github.com/lspitzner/brittany
19:13 <michalrus> AST might be too much, but every source… has one best whitespace arrangement?
19:14 <Tuplanolla> I reckon it would still be desirable to have a generalized isomorphism between source code and syntax trees.
19:14 doodlehaus joined
19:14 <michalrus> I just wanted to limit formatting discussions to 0. I might be spoiled by this one(!) part of Scala ecosystem (scalafmt). =)
19:15 <michalrus> Thank you for the link!
19:15 <lyxia> I like the idempotence requirement
19:15 <cocreature> iirc brittany tries even harder to preserve the original formatting than hindent
19:15 <monochrom> For each person, there exists uniquely a canonocial source code format.
19:16 <monochrom> The problem is different people demand different, conflicting canonical formats.
19:16 <shapr> monochrom: but I don't like line noise
19:16 <Tuplanolla> That is, f . g . f = f and g . f . g = g instead of just f . g = id and g . f = id.
19:16 <dolio> Scala is spoiling you because there are 0 best arrangements for all source? :P
19:16 buglebudabey joined
19:16 <michalrus> Haha.
19:17 <lyxia> Tuplanolla: Okay that one's much more reasonable
19:17 Kreest__ joined
19:18 <Tuplanolla> Doesn't Go have this?
19:18 <monochrom> This lack-of-consensus problem is mitigated in the Scala community (similarly the Python community) by a strong leader and the rest being docile (even religious) followers.
19:18 <monochrom> But the Haskell community is very close to being a diverse democracy.
19:19 <michalrus> But time! Time is lost on these discussions. And they don’t necessarily contribute much… value? :)
19:19 <monochrom> (Just look at how many web frameworks to choose from!)
19:19 <shapr> michalrus: On the other hand, if you don't have multiple valid approaches, how do you advance?
19:20 <monochrom> You don't have to discuss. You can just go ahead implement your ideal.
19:20 <shapr> michalrus: Whatever programming will be in 100 years, I hope it's not just like it is now, I want to steal those things from the future and use them now!
19:21 <monochrom> For example the GHC people do implement first then let the community discuss. And it is a good idea because the discussion is based on actual usage experience not armchair what-ifs.
19:22 mjs2600 joined
19:22 <monochrom> And the perk up is that if everyone else merely propose ideas, but you have a ready-to-use implementation of your idea, you gain de facto followers. This is what happened to lens.
19:22 <michalrus> shapr: that would be awesome and is one of my greatest sorrows, that we’re in the Middle Ages of programming… =( Maybe in the next incarnations⸮
19:22 <michalrus> Mhm. :)
19:22 fre joined
19:24 R13N left
19:24 <shapr> michalrus: we can rebuild it! We have the technology!
19:24 <EvanR> congratulations youre what conal called a "priestly caste"
19:24 <EvanR> people who can comprehend and officiate over the arcane processes of software
19:25 halogenandtoast joined
19:25 kosk joined
19:26 <EvanR> hopefully in the future the distilled essence of programming language becomes available to everybody
19:28 rperry joined
19:29 deeiinu joined
19:29 uglyfigurine joined
19:30 <monochrom> That is only half of the story. The other half is: Do people actually want it?
19:30 <shapr> EvanR: my girlfriend has been learning Python the past few months. When we started she had never heard of a terminal or command line.
19:30 kaeluka joined
19:31 <shapr> I realize that anyone who joins this channel is almost certainly part of that priestly caste.
19:31 <EvanR> yes when the sales girl remarked/jokes she wanted to learn "coding" i just sent her iterm2
19:31 <monochrom> The distilled essence of programming language is available today. It is a solved problem. Denotation semantics and stuff. But look at the programmers, they actually hate it.
19:31 <EvanR> technically all you need
19:31 <dolio> Do you folks call mechanics the, "priestly class of auto repair," too?
19:32 <monochrom> Everyone is a priestly caste member of something.
19:32 <EvanR> electricians and mechanics have well defined environments and ways to solve every problem
19:32 <EvanR> they have been doing X for 100 years
19:32 amatecha joined
19:33 <EvanR> outside microsoft certified IT stuff, you can do anything, and we get in trouble for it on a regular basis
19:33 marr joined
19:33 <EvanR> no ones right
19:33 <shapr> dolio: I've seen people break their cars because they didn't understanding anything about them, so maybe?
19:34 <EvanR> the complexity of car maintenance pales in comparison to "coding"
19:34 jessicah joined
19:34 arj left
19:34 <shapr> Don't recent cars have many millions of lines of code in them?
19:34 <EvanR> even the computer parts which is just a thing you plug a thing into and press a button
19:35 <EvanR> the mechanic is readin or writing the code in the car
19:35 <EvanR> isn*
19:35 <monochrom> I doubt that electrician jobs have existed for 100 years. :)
19:36 <EvanR> the 19th century screwing-around with electricity and radio, yeah that seems like where we are
19:36 <monochrom> True.
19:36 mkoenig joined
19:36 <monochrom> Car mechanics are still not touching the software.
19:37 <EvanR> now you plug in LCD shield, internet shield, accelerometer shield... even the potentiometer shield
19:37 michael4 joined
19:37 ompaul joined
19:38 <monochrom> Also, car manufacturers have been modularizing cars so much that car mechanics do not have to understand intra-module things. They just have to replace modules.
19:38 <monochrom> (Some car mechanics can choose to dig deeper. They personal preference. Not a majority.)
19:39 christiansen left
19:39 <EvanR> i go to work, hope that i can choose to not dig deeper and just use 2 gems together, it explodes in my face, i now need to understand the code of 2 terrible projects
19:39 <monochrom> So these days car mechanics are more at the level of Cisco Certified Network persons.
19:39 <monochrom> (who do not have to code up TCP/IP stacks, clearly)
19:40 <maerwald_mob> EvanR: xD
19:40 MrcRjs joined
19:40 chaosmasttter joined
19:40 kazagistar joined
19:42 <monochrom> Consider "FPComplete Certified XMonad Engineer" :)
19:43 <monochrom> No no, re-order the words, "XMonad FPComplete Certified Engineer", XFCE.
19:43 <maerwald_mob> where can I apply for certified for complete jobs?!
19:43 Argue joined
19:44 <maerwald_mob> oh wait. this is not -offtopic
19:45 SepakoRayl joined
19:45 <SepakoRayl> Jgiyo
19:46 govg joined
19:46 <SepakoRayl> that was VimFx :(
19:46 <monochrom> So you meant "yo", right?
19:46 uglyfigurine joined
19:47 fre joined
19:47 <SepakoRayl> yup, what's everyone doing
19:48 <monochrom> We got off-topic a bit, then it died.
19:50 <shapr> greetings SepakoRayl, how's code? Tried opaleye yet?
19:50 path[l] joined
19:51 Maxou joined
19:51 crobbins joined
19:52 <Athas> Is it generally considered a good or a bad thing that Prelude.union or Data.Map.union is left-biased in case of duplicates?
19:52 <SepakoRayl> nope! I'll check it out after I am done with my parser
19:52 <monochrom> Yes Athas.
19:52 coot joined
19:52 t7 joined
19:52 <Athas> Is it generally considered a bad thing that Prelude.union or Data.Map.union is left-biased in case of duplicates?
19:52 <monochrom> At least for people who are used to left-to-right mother tongues.
19:53 <monochrom> I mean a good thing.
19:53 <Athas> Really? I'd assume that left-to-right-readers would conclude the _last_ statement to be the true one.
19:54 <monochrom> Ah.
19:54 <Tuplanolla> I'm sure there's a connection to `foldr` here, Athas.
19:54 <monochrom> Dunno. But looks like people have settled for it.
19:55 <Athas> I suspect the reason is that if you implement an association table as a list, and 'lookup' picks the first match, then union is just concatenation.
19:55 marvin2 joined
19:56 <Athas> But it never made much sense to me. I've memorised it for Data.Map.union, but I recently got tripped up by the fact that `mappend` for Data.Map.Map is also left-biased! (Because it is synonymous with union.)
19:56 <nitrix> Wouldn't concatenating the two lists risk creating duplicates though?
19:56 <nitrix> This doesn't sound like union.
19:56 <Athas> Sure, but the lookup function picks the first one it sees.
19:57 jomg joined
19:57 <nitrix> Ah that's interesting.
19:57 <nitrix> "Note that the implementation is left-biased -- the elements of a first argument are always preferred to the second, for example in union or insert."
19:57 <Theophane> *left-padded
19:58 <Theophane> :P
19:58 <Athas> At least that behaviour is consistent among all Haskell libraries I've used.
19:58 <monochrom> You have to break ties and someone has to pick a convention and the rest of us have to suffer it. It can't be helped.
19:58 <Athas> But I was considering whether to adopt the same design for a non-Haskell language.
19:58 zcourts joined
19:58 <Athas> Sure, I was just wondering whether it's (in hindsigt) considered a good idea, for a clean-slate environment.
19:58 <monochrom> Make a poll in the community :)
19:59 <mauke> perl effectively is right biased
19:59 <Athas> I'd never do a Haskell library that didn't follow this convention.
19:59 sobaken joined
20:00 pasukon joined
20:00 loanatic joined
20:00 buglebudabey joined
20:00 <Tuplanolla> > fold [Just "yes", Nothing, Just "no"] -- Would you consider this left-biased too, Athas?
20:00 <lambdabot> Just "yesno"
20:01 <Athas> Well, I meant for functions called "union".
20:01 janos joined
20:01 <Tuplanolla> Yes, but the question is whether the left-bias is somehow more universal or intrinsic to the language.
20:02 insitu joined
20:02 <nitrix> I'd prefer a unionWith.
20:03 <dolio> That exists.
20:03 <nitrix> I meant for his language design.
20:03 <Athas> That's not really an option here. It's for record concatenation, and what happens in the case of duplicate field names.
20:04 wedens joined
20:04 <nitrix> Athas: That sound very dynamically typed.
20:05 <nitrix> If so, maybe you could merge the two fields by creating another object/record that contains the two values under the same key.
20:06 bahtiyar joined
20:06 <nitrix> {a = 1, b = 2} `union` {b = 3, c = 4} == {a = 1, b = [2,3], c = 4}
20:06 TxmszLou joined
20:07 nomotif joined
20:07 <EvanR> i like "extensible records with scoped labels"
20:07 <EvanR> {a = 1, b = 2} union {b = 3, c = 4} ==> {a = 1, b = 2, b = 3, c = 4}
20:08 <nitrix> data Record = Record { a :: Element Int, b :: Element Int }; data Element a = Such a | Many [a]
20:08 <Athas> Ah, but an important use case is for record updates. {a = 1, b = 2} `union` {b = 3} == {a = 1, b = 3}.
20:08 <Athas> This form of concatenation subsumes record updates, which I find elegant.
20:08 <dolio> Why do you think the right side is the update?
20:08 <EvanR> it also loses something
20:09 <mauke> dolio: because I read from left to right, so the left side happens earlier
20:09 <EvanR> theres a different abstraction for talking about updates
20:10 <Athas> mauke: that's a good point. However, in most use cases, the left-hand side will be a record-typed variable: rv `union` {b = 3} == {a = 1, b = 3}.
20:10 chlong__ joined
20:10 <Athas> I find that this reads nicely, and is close to Haskell's own 'rv { b = 3 }' notation.
20:11 Mortenl joined
20:11 <EvanR> union seems to evoke something completely different from updating to me
20:11 <Tuplanolla> The lens order would be `set id new old`, Athas.
20:11 roconnor joined
20:11 gtvmsilva joined
20:11 <EvanR> actually, replacement strategies seem totally off topic for union
20:12 bjz joined
20:12 <EvanR> were talking about record concatenation
20:12 <EvanR> so <>
20:12 <nitrix> Now that I think about it, merging them into a list has no benefits. It makes the language more comlicated and there's no practical use of "keeping both sides" as it's immutable and you can just write "b `union` a" rather than "a `union` b" if that's what you want.
20:12 <* nitrix> still thinkering.
20:12 <EvanR> nitrix: there is a benefit, as described in the paper
20:12 <EvanR> for extensible records and variants
20:13 <Mortenl> I'm trying to create a new Stack project using 'stack new my-project simple', but when I try to build it it fails with "Invalid package ID: "array-0.5.1.1 base-4.9.0.0 binary-0.8.3.0 bytestring-0.10.8.1". Using Ubuntu 16.04, any ideas what's wrong?
20:13 xpika joined
20:13 <dolio> EvanR: That's allowing duplicate fields, though. Not allowing duplicate fields but having the types of fields change if there are duplicates in a union is different (and probably unnecessarily complicated).
20:14 <EvanR> were changin the types of fields?
20:14 <dolio> In nitrix's example, yes.
20:14 <EvanR> agreed
20:14 MP2E joined
20:15 <nitrix> Depends. I corrected myself with an `Element` type that allowed multiple values.
20:15 <nitrix> I'm not too sure where it's headed though.
20:15 <EvanR> rather than duplicate you could think of it as scoped, or temporal
20:15 <monochrom> You need quantum superposition.
20:16 <nitrix> Maybe the field values all have to be monoids :D !?
20:16 Deide joined
20:17 <EvanR> monoid hammer
20:17 Maxou joined
20:17 <monochrom> quantum states form a monoid. mappend is vector addition.
20:17 ompaul joined
20:18 coltfred joined
20:19 crobbins_ joined
20:19 <nitrix> data Record = forall a b. (Monoid a, Monoid b) => Record { a :: a, b :: b }
20:19 <nitrix> Fixed it !
20:19 ludat joined
20:19 <EvanR> semigroup?
20:20 <nitrix> Mhhh... oh yeah.
20:20 <nitrix> I have no clue how practical that'd be but it's fun to think about.
20:21 beanbagula joined
20:22 davezd joined
20:23 <byorgey> that looks... not very practical.
20:23 <byorgey> you can put things in and combine them, as long as you never want the values back out.
20:24 fizruk joined
20:26 <nitrix> EvanR: With a Monoid you could have {} initialize your record, a problem haskell suffers with the record syntax setting all the fields to undefined.
20:27 <nitrix> I think I would've liked that answer until knowing Haskell where magical default values became a big no-no.
20:27 chenyu` joined
20:27 <nitrix> I'd rather have an ADT now.
20:27 ramzifu joined
20:27 albertus1 joined
20:27 peterbecich joined
20:28 vadimich joined
20:29 rgc joined
20:29 umib0zu left
20:30 Maxdamantus joined
20:32 uglyfigurine joined
20:32 owiecc joined
20:33 bjz_ joined
20:33 vektorweg11 joined
20:33 anuxivm joined
20:33 maerwald_mob joined
20:36 twomix joined
20:38 pita joined
20:38 AbstractLion joined
20:38 <Ptival_> does anyone understand how to use NonEmpty in SmallCheck?
20:39 pera_ joined
20:39 coot joined
20:40 ljc joined
20:41 eacameron joined
20:41 raatiniemi joined
20:41 ramzifu joined
20:42 skeuomorf joined
20:42 nakal_ joined
20:42 ragepandemic joined
20:42 vaibhavsagar joined
20:43 argent0 joined
20:45 <zipper> Hey, does anyone here know about the text lib and how it handles or doesn't handle unicode when packing and unpacking?
20:45 <zipper> e.g
20:45 <zipper> Data.Text.unpack $ Data.Text.pack "уч"
20:45 <zipper> > Data.Text.unpack $ Data.Text.pack "уч"
20:45 <lambdabot> error:
20:45 <lambdabot> Not in scope: ‘Data.Text.unpack’
20:45 <lambdabot> No module named ‘Data.Text’ is imported.error:
20:46 <zipper> Anywho that should be isomorphic but doesn't seem to be
20:46 fre joined
20:47 <Tuplanolla> @let import qualified Data.Text as Text
20:47 <lambdabot> Defined.
20:47 <Tuplanolla> > let x = "уч" in Text.unpack (Text.pack x) == x
20:47 <lambdabot> True
20:47 <geekosaur> > T.unpack $ T.pack "уч"
20:47 <lambdabot> error:
20:47 <lambdabot> Not in scope: ‘T.unpack’
20:47 <lambdabot> Perhaps you meant ‘BS.unpack’ (imported from Data.ByteString)
20:47 <geekosaur> of course we couldn't be sensible enough to do that :/
20:48 <zipper> > Text.unpack $ Text.pack "уч"
20:48 <lambdabot> "\1091\1095"
20:48 <zipper> You see
20:48 <Tuplanolla> Nope.
20:48 <zipper> Not isomophic
20:48 <Tuplanolla> > "уч"
20:48 <lambdabot> "\1091\1095"
20:48 <zipper> I just read http://stackoverflow.com/questions/24953125/how-to-convert-unicode-escape-sequence-to-unicode-string-in-haskell
20:48 <zipper> "If you putStrLn or write to any other handle, the result will display the proper unicode string"
20:48 <zipper> hmmmmm
20:49 <geekosaur> > text $ Text.unpack $ Text.pack "уч"
20:49 pasukon joined
20:49 <lambdabot> уч
20:49 <geekosaur> nothing to do with Data.Text; this is Show
20:49 ludat joined
20:49 <geekosaur> on String
20:50 <geekosaur> (pedantically, showList @Char)
20:50 <zipper> hmmmm I didn't know about text
20:50 <monochrom> zipper: It is a great lesson to learn that WYS is not WYG.
20:50 <zipper> :t text
20:50 <lambdabot> String -> Doc
20:50 raycoll joined
20:50 mszczygiel joined
20:50 <zipper> monochrom: WYS? WYG?
20:51 <monochrom> You heard of WYSIWYG?
20:51 <geekosaur> it's a hack, a orettyprinter combinator whose Show instance is literal (violating expectations for Show...)
20:51 <AbstractLion> What you see is not what you get
20:51 Gloomy joined
20:52 <geekosaur> basically Show is expected to produce sometyhing that would be valid Haskell source code from a maximally compatible character set, so pretty much everything above U+007E gets escaped
20:52 CurryWurst joined
20:52 <zipper> Oh yeah
20:53 <geekosaur> (and below U+0020)
20:53 <monochrom> WYSIWYG is something we tell end-users, and we strive to code up things to live up to it, because we want to make things easy for end-users and help them get things done.
20:54 <monochrom> But we programmers deal with crossing abstraction boundaries and differing representations and differing renders and this and that. WYSIWYG is untrue for us.
20:54 fre joined
20:55 <monochrom> If you see two different renderings, it doesn't mean that they have different backing data.
20:55 <monochrom> If you see two same renderings, it still doesn't mean that they have identical backing data.
20:55 <geekosaur> ..and unicode is especially evil there
20:55 <geekosaur> unless you enforce normalization
20:56 BrunoStroszek joined
20:56 zdenal joined
20:57 Philonous joined
20:57 <monochrom> For the backing data, trust only a hex editor.
20:57 FjordPrefect joined
20:57 <zipper> Thinking about how this Doc type will typecheck
20:57 <monochrom> Even REPLs and editors can lie.
20:57 jmelesky joined
20:58 <geekosaur> you don;t need it most likely; we use it in lambdabot because you can't putStr / putStrLn
20:58 <geekosaur> it's a hack
20:58 <monochrom> Well, not lie, but they do various translations that may be convenient for one purpose but unfaithful for all others.
20:58 <zipper> I also don't want to putStrLn because it'll print
20:58 <geekosaur> the only thing you need to do in a program, usually, is avoid use of show on String or Text
20:58 <geekosaur> what areyou doing with the data?
20:59 <geekosaur> more precisely, what are you doing that might make use of show / showsPrec?
20:59 binaryplease joined
20:59 vektorweg1 joined
20:59 <zipper> I want to do something with the string
20:59 <geekosaur> that is a non-answer
20:59 <zipper> geSorry
20:59 <zipper> geekosaur: Sorry
20:59 sellout- joined
20:59 <geekosaur> I think you still are not getting it, you still believe that eithger String or Text is causing this
20:59 <geekosaur> neither is. *Show* is causing it.
20:59 <zipper> I'm I'm fetching HTML page metadata
20:59 <geekosaur> make the Show go away.
21:00 <zipper> I'm not using show
21:00 Jacoby6000 joined
21:00 <zipper> Oh
21:00 <geekosaur> then something you are doing is
21:00 Lord_of_Life joined
21:00 <zipper> Yea the lib tagsoup probably is
21:00 <zipper> https://hackage.haskell.org/package/tagsoup-0.14.1/docs/Text-HTML-TagSoup.html
21:01 mjs2600 joined
21:01 <zipper> `renderTagsOptions renderOptions{optEscape = id} $ parseTags "<title>&& Слу - YouTube</title>"`
21:01 <zipper> It is printing in the repl
21:01 <geekosaur> ghci is using Show behind your back
21:02 <geekosaur> do not trust its output
21:02 <monochrom> <monochrom> Even REPLs and editors can lie.
21:02 <zipper> hmmm in the end the program will end up printing this so it'll use show, right?
21:02 <geekosaur> (specifically, it does `print it` after evaluation --- and print = putStrLn . show
21:02 <geekosaur> only if you use `print` instead of `putStrLn` or whatever
21:03 <monochrom> In the end it's your program and you choose putStr vs print.
21:03 mathk joined
21:03 tomphp joined
21:03 <zipper> monochrom: hmmm
21:03 aarvar joined
21:03 <zipper> It's not a big program
21:03 <zipper> One sec
21:04 <monochrom> Use hPutStr and save it to a file and use a hex editor to examine it.
21:04 <zipper> It's an IRC bot https://github.com/nairobilug/nairobi-bot/blob/master/src/Bot/URL.hs
21:04 <zipper> Some dudes using cyrillic text got so pissed
21:05 <zipper> I'll find out what is using the show
21:05 <monochrom> And the real story gets more complicated that just hPutStr
21:05 <monochrom> Because there is the question of "is it UTF-8 or what?"
21:06 <monochrom> IIRC the text library has a function for "translate Text to UTF-8 bytestring". This is preferred. Send the bytestring to file or stdout.
21:07 <monochrom> Do not even bother with String because String's putStr/hPutStr is locale-dependent and that's a whole can of worm there.
21:07 <zipper> It is utf-8 because we get a unicode codepoint, no?
21:07 <monochrom> No.
21:07 <monochrom> Text is not already utf-8. Text does its own thing.
21:08 <monochrom> I can tell you what it is, but it is only going to harm you.
21:08 <zipper> monochrom: How so?
21:08 <monochrom> Better think of it as abstract and/or "may change arbitrarily tomorrow"
21:08 <zipper> lol ok
21:08 <monochrom> Because it is actually irrelevant to input and output formats.
21:09 <Clint> zipper: do not use Data.ByteString.Char8
21:09 <monochrom> Notice that every I/O function of text is explicitly documented with what format it uses.
21:10 <monochrom> And there is none that says "I use Text's internal storage format verbatim".
21:10 <monochrom> So you may as well not care.
21:10 zdenal joined
21:10 beanbagula joined
21:11 <monochrom> String is the opposite. String tells you the internal storage format (32-bit int per Char) but the I/O format is practically unspecified.
21:11 <monochrom> (Well, "locale-dependent". Does that tell you anything?)
21:11 nilg joined
21:12 cdg joined
21:13 <zipper> Yes it does
21:13 <monochrom> OK, what does that tell you?
21:13 <zipper> If I had set a locale to something, maybe Russian
21:13 <zipper> It would have worked
21:13 <zipper> But mine is en_US
21:14 <monochrom> Which encoding for the Russian? KOI? UTF-8? UTF-16LE?
21:14 steve___ joined
21:14 <Clint> it would not have worked, because you are using Data.ByteString.Char8 to convert to String
21:14 revprez_mirai joined
21:14 <zipper> I tried `Data.ByteString.Char8.unpack $ Data.Text.Encoding.encodeUtf8 $ Text.pack "уч"` nothing
21:15 bitf joined
21:15 <zipper> Although Clint did say not to use Char8
21:15 <Clint> zipper: do not use Data.ByteString.Char8
21:15 <monochrom> Yeah, cut the Char8.
21:15 <zipper> monochrom: idk what encoding it is
21:15 <monochrom> There you go. It doesn't tell you anything.
21:15 <zipper> monochrom: It doesn't help the result though
21:16 <zipper> Dropping the Char8
21:16 <zipper> I think I should take a nap and look at this with fresh eyes
21:16 <monochrom> In fact why unpack at all?
21:16 <bitf> hey guys, i have a question from the book, Learn You a Haskell:
21:16 <zipper> I believe tagsoup is doing soemthing fishy
21:16 <bitf> instance Monad Maybe where
21:16 <bitf> return x = Just x
21:16 <bitf> Nothing >>= f = Nothing
21:16 <bitf> Just x >>= f = f x
21:16 <bitf> fail _ = Nothing
21:16 <bitf> this is in the section on monads
21:17 <bitf> does the just x line make sense
21:17 <monochrom> Do you trust me? If so, screw bytestring unpack, just use Data.ByteString.hPutStr directly.
21:17 <zipper> monochrom: I assumed unpack is the only way it would stop being a bytestring and be a string
21:17 <zipper> monochrom: I sure do trust you
21:17 <bitf> shouldn't it be Just x >>= f = Just f x
21:17 <monochrom> No, screw String altogether, that's what I'm saying and you proved.
21:17 <Sornaensis> bitf: which one
21:17 lavalike joined
21:17 <Sornaensis> :t (>>=)
21:17 <lambdabot> Monad m => m a -> (a -> m b) -> m b
21:18 <Sornaensis> bitf: notice the type of the second parameter
21:18 <bitf> ok
21:18 <zipper> :t Data.ByteString.hPutStr
21:18 <lambdabot> GHC.IO.Handle.Types.Handle -> BSC.ByteString -> IO ()
21:18 f-a joined
21:18 igniting joined
21:19 <bitf> so the Just is implicit in the f...?
21:19 <zipper> I really don't want something that returns a unit
21:19 <zipper> I need this string
21:19 <monochrom> Remember WYS is not WYG? If you go through String and System.IO, you are incurring more of that, not less. You are incurring more mutilating translations.
21:19 <Sornaensis> bitf: f is a function that will return a (Maybe b)
21:19 <Sornaensis> when you give it an a
21:20 <* monochrom> shakes head
21:20 <zipper> monochrom: :) let me take a small break
21:20 <zipper> I'm going to make sense of this scrollback
21:20 <monochrom> You already have the Text version and the ByteString version. If you pass them as parameters to Data.ByteString.hPutStr, it does not mean that you will lose the original Text or the original Bytestring. You understand that?
21:21 <zipper> Oh I see with Data.ByteString.hPutStr I write to the handle and read from it right after
21:21 <zipper> *write to the file
21:21 <zipper> Sounds like it would blow up at scale
21:21 <zipper> file descriptors and all
21:21 mathu joined
21:21 insitu joined
21:21 <zipper> monochrom: I do now
21:22 <monochrom> OK I give up. https://xkcd.com/763/
21:22 <bitf> ah yes i understand now. thanks for help Sornaensis
21:22 nilg joined
21:22 byte512 joined
21:23 nilg` joined
21:24 <zipper> monochrom: LOL I'm kinda sleep deprived
21:24 <zipper> I'll look at it in a few
21:24 ragepandemic joined
21:25 SCHAAP137 joined
21:25 oisdk joined
21:25 <lpaste_> f-a pasted “Could not match type `m` with `m1`” at http://lpaste.net/353191
21:26 <zipper> monochrom: I believe tagsoup forces me to go through String or at least something they call StringLike
21:26 rgc joined
21:26 <zipper> "A class to generalise TagSoup parsing over many types of string-like types. "
21:27 <mauke> f-a: that's a different type
21:27 tommd joined
21:27 <mauke> your signature creates a new type variable 'm'
21:27 <mauke> unrelated to the 'm' in run's type
21:27 erikd joined
21:28 <f-a> thanks mauke. Any way to tell ghc "hey they are the same"?
21:28 <f-a> I can of course omit to write them, but with them it is easier to read the code
21:29 <mauke> look into ScopedTypeVariables
21:29 <geekosaur> f-a, ScopedTypeVariables and use `forall m.` in the signature
21:29 <f-a> mhh I had {-# Language ScopedTypeVariables #-}
21:29 <f-a> not the forall though
21:30 <geekosaur> right, you need the forall to tell it *which* type variables to scope-extend
21:30 <f-a> forall m t i o. (MonadIO m, Integral t) did it
21:30 <f-a> thanks mauke & geekosaur
21:31 initiumdoeslinux joined
21:31 ublubu joined
21:33 cads joined
21:33 d0t joined
21:34 <d0t> ohai. Does intero work with .hsc files?
21:34 fDev2179 joined
21:36 insitu joined
21:36 conal joined
21:37 bjz joined
21:38 louispan joined
21:39 prohobo joined
21:39 <zipper> monochrom: Ok seems to me I could solve this simply by setting locale. However given that it already is set to UTF-8 it should just work. It is utf-8 in that "en_US.UTF-8"
21:40 <Clint> zipper: are you missing that Data.ByteString.Char8 breaks anything but ASCII?
21:40 biglama joined
21:40 <zipper> Ch3ck: I won't use a bytestring
21:40 <zipper> hmmm
21:40 <zipper> I read a bytestring over the network though
21:40 <zipper> FML
21:41 insitu joined
21:41 f-a left
21:41 <Clint> you read a bytestring over the network. you write a bytestring over the network.
21:43 <zipper> Clint: I agree
21:45 binaryplease1 joined
21:45 <Tuplanolla> Can you give a rough estimate for how long `forkIO` takes?
21:46 insitu joined
21:47 uglyfigurine joined
21:48 <Tuplanolla> Three orders of magnitude is an acceptable uncertainty.
21:49 <mauke> I would imagine it to be super fast
21:49 <geekosaur> forkIO does virtually nothing itself except some accounting, so it should be fast
21:49 TxmszLou joined
21:49 eschnett joined
21:51 <Tuplanolla> There's a potential race condition when transferring the ownership of a `Handle` to a new thread, so I'd like to add a just-in-case wait to ensure the other thread can register it before unregistering it on the other side.
21:52 hiratara joined
21:53 <geekosaur> you will likely want to use an MVar or similar, I think
21:53 pera joined
21:53 <monochrom> Yeah, MVar will do the handshake nicely.
21:54 <monochrom> Err, no, not enough.
21:54 mfukar joined
21:55 <geekosaur> forkIO does not actually create or schedule a thread, it creates a "spark" which the runtime will schedule on a thread. you cannot rely on the spark being scheduled on a thread in any timely fashion after forkIO returns; you must use synchronization
21:55 <monochrom> Actually, yes enough if you don't mind a time period of "the old owner no longer uses it, the new owner hasn't started using it"
21:55 Destol joined
21:56 <monochrom> The old owner does a putMVar, then don't use it anymore. The new owner does a takeMVar, then starts using it. putMVar finishes before takeMVar.
21:56 <geekosaur> there's also a question of whether having two registrations or zero registrations is considered the error condition (if the error condition is "both" then you need to rethink this)
21:57 rapn_ joined
21:57 freusque joined
21:57 <Tuplanolla> Then an `MVar` should do.
21:57 <geekosaur> uh, s/both/any state other than exactly one/
21:57 <monochrom> which is, admittedly, slightly different from the dual-pilot protocol, maybe? "I have control" happens before "you have control".
21:58 deepfire joined
22:02 esad joined
22:02 sepp2k joined
22:02 Gurkenglas joined
22:02 maerwald_mob joined
22:03 <Tuplanolla> Well, I just changed a leak to a double free.
22:03 Jacoby6000_ joined
22:03 jophish joined
22:04 <monochrom> haha
22:06 <monochrom> Don't just write free software. Write double-free software!
22:08 MindlessDrone joined
22:09 maerwald_mob joined
22:09 silver_ joined
22:09 <Tuplanolla> I'll have to trust this "a Handle will be automatically closed when the garbage collector detects that it has become unreferenced by the program" remark.
22:10 <monochrom> That sentence can be trusted. But the timing is less predictable.
22:11 <Tuplanolla> That's fine for a failsafe.
22:11 <monochrom> Also a human's skill of determining whether their code unreferences anything.
22:12 Shatnerz0 joined
22:14 Fairy joined
22:17 KarboniteKream joined
22:17 HanlonsRazor joined
22:17 danthemyth joined
22:18 ragepandemic joined
22:21 mmn80 joined
22:23 <voidhorse> Preferred way to write Haskell? IDE, vim, text editor, stone tablet?
22:24 <monochrom> May I lump vim with text editor?
22:26 <APic> Emacs.
22:26 <lyxia> generated from coq
22:26 <Tuplanolla> Correct answer, lyxia.
22:26 <voidhorse> Monochrom Yeah, I just wanted to distinguish from a text editor running in the terminal from one with a standalone ui
22:27 <monochrom> There are two schools.
22:28 <monochrom> One school goes with Leksah, an IDE. It takes some effort to install, and you may or may not like it at the end. If you do, great.
22:28 <monochrom> The other school goes with a text editor of a personal choice.
22:28 <fDev2179> Vim ftw
22:28 <voidhorse> Cool--I tried leksah back two or so years ago--I don't remember liking it too much
22:29 <monochrom> Both schools agree that stone tablets are great for thinking and planning. Or whiteboards.
22:29 <voidhorse> I guess leksah is probably the closest thing to something like an IntelliJ ide for Haskell --from the looks of it
22:30 <voidhorse> Ignoring idea Haskell plugins of course
22:30 <Rembane> emacs and the right plugins seems to be a nice experience for many.
22:31 <dgpratt> if I'm reading something that discusses a "top" type and a "bottom" type in the context of a type lattice, I suppose that "forall a. a" could be the top type and...Void could be the bottom type? my other thought was maybe "exists a. a"?
22:32 srbaker_ joined
22:33 hiratara joined
22:34 <lyxia> I imagine this is about subtyping and something like exists a. a would be at the top, forall a. a at the bottom (isomorphic to Void)
22:36 MrcRjs joined
22:37 Luke joined
22:37 wtetzner joined
22:37 <monochrom> Yeah, forall is at the bottom, exist is at the top.
22:37 <dgpratt> ok, thanks
22:39 takuan joined
22:41 wedens joined
22:41 <dgpratt> I suppose that my misapprehension of "forall a. a" has at least something to do with the fact that I usually encounter it in negative position (he said knowing full well he was risking saying something stupid)
22:43 GlobalAtom joined
22:44 Voldenet joined
22:44 Voldenet joined
22:50 dan_f joined
22:54 mkoenig joined
22:55 nek0 joined
22:55 Textmode joined
22:57 mhagemeister joined
22:57 b4ff3r joined
22:57 skeuomorf joined
22:58 pleax joined
22:58 biglama joined
22:59 <nitrix> Does anyone with an intuition for genetic programming can look at the `moo` library (https://hackage.haskell.org/package/moo-1.0) and tell me how I'd have a fitness function that requires IO?
22:59 <nitrix> (Loading samples from network/disk to train the GA) ?
23:00 <nitrix> `ObjectiveFunction` seems to not have such thing.
23:01 <nitrix> Strangely, StepGA though lets you have a monad `m`.
23:01 <nitrix> I don't know how one would connect to twos.
23:01 shayan_ joined
23:02 <fDev2179> From what I know of optimization algorithms, there is no training.
23:02 Rizy joined
23:02 <nitrix> fDev2179: I'm using a GA to train a NN :P
23:02 <nitrix> Sorry for overlapping the terminology a bit.
23:03 <fDev2179> Fitness function requiring IO, yes.
23:03 <fDev2179> I've done design optimization studies where I used an external analysis code to evaluate the objective function.
23:03 <fDev2179> Then, I have a separate code which drives the optimization.
23:04 <nitrix> I'm thinking the fitness function could take a lazy list of inputs as argument and be partially applied and given to the library, but it solves half the problem :/
23:04 <fDev2179> The analysis code writes results to a file which must be read.
23:04 <nitrix> fDev2179: The issue is having IO with that library in the first place.
23:04 <nitrix> I'm well competent with GA, no worries :)
23:05 jophish_ joined
23:05 <fDev2179> The way I've handled the communication is using files. For example, I write the inputs to a file which the analysis code reads. I'm confused about the question then.
23:06 <nitrix> fDev2179: The fitness function that the framework seems to work with isn't monadic.
23:07 <nitrix> I guess it is from ((->) r) but that wont get me anything usuable. I'd love to have a minimum support for effects of some kind.
23:08 <fDev2179> Ohhhh, I see.
23:08 <nitrix> class ObjectiveFunction f a where evalObjective :: f -> [Genome a] -> Population a
23:08 <nitrix> And the instances leads to nothing.
23:08 <fDev2179> That makes things difficult.
23:08 <Cale> Well, just being in *some* monad doesn't mean much -- control over which monad it is, is what you want :)
23:08 Micamo joined
23:08 <nitrix> StepGA has ehm... m (StepResult (Population a))
23:09 <Cale> Yeah, it only extends as far as population management
23:09 <nitrix> But I'm not sure how I can use this. I think I'd load the dataset in this stepping function between current and next generation and partially apply the fitness function?
23:10 nycs joined
23:10 <nitrix> This way it can run the Genome agaisn't some data set. That _should_ work?
23:11 janos joined
23:13 <Cale> I wouldn't bother with that. Just grab the code and start changing it so that the fitness function is in the same monad m.
23:14 hrumph joined
23:16 mr_sm1th joined
23:16 <Cale> So it becomes something like class ObjectiveFunction m f a where evalObjective :: f -> [Genome a] -> m (Population a)
23:16 <nitrix> Mhm.
23:16 kloppadop joined
23:17 <the|auriscope> hi all. I've been fooling with haskell on and off for a few months, and wanted to say "hi"
23:17 <kloppadop> does anyone know of a nice, clean implementation of a parser for an indentation sensitive language like haskell?
23:17 <c_wraith> hello, the|auriscope
23:17 <kloppadop> the haskell lexer and parser are a complete mindfuck
23:17 <fDev2179> Hi, the|auriscope.
23:18 <nitrix> kloppadop: Languages do get fairly complicated when they grow beyond the pet toy project phase.
23:18 <nitrix> kloppadop: Haskell's parser and lexers are actually very clean and well documented.
23:19 <the|auriscope> does anyone have opinions on books for learning Haskell?
23:19 <kloppadop> nitrix: lol no they arent
23:19 <kloppadop> they are needlessly complex and brittle af
23:19 <kloppadop> https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Parser
23:19 Swizec joined
23:20 max3 joined
23:20 <max3> solution to all of my problems: liftIO all the things!
23:20 mdarse joined
23:20 oisdk_ joined
23:20 magneticduck joined
23:20 <kloppadop> ' if we encounter an error in parsing, we try exiting an indentation context and trying again'
23:20 <kloppadop> kek
23:21 benl23 joined
23:21 <zennist> anyone knows how to hide the imported modules in the prompt inside ghci when inside a multiline block?
23:21 <zennist> this has been annoying...
23:21 <c_wraith> ghc's parser is complicated by all the extensions it supports that add syntax.
23:22 <kloppadop> zennist: :set prompt "\ESC[34mλ> \ESC[m"
23:22 <zennist> kloppadop: yeah but that doesn't hide the list when inside a multiline block started with :{
23:22 <kloppadop> c_wraith: yeah I understand that theres a lot of complexity, thats why im looking for something more minimalistic
23:22 <kloppadop> but with a similar layout
23:23 <zennist> oh got it! :set prompt2 "..."
23:23 <zennist> can't believe no one mentioned it in any blog!
23:24 <kloppadop> purescript seems to have a much cleaner lexer/parser implementation
23:25 insitu joined
23:25 halogenandtoast joined
23:25 Rotaerk joined
23:26 tromp joined
23:26 andrei_chiffa_ joined
23:26 <Tuplanolla> It was added fairly recently, zennist.
23:27 <codedmart> I renamed a file, changed it everywhere in my project but now stack errors `Failed to load interface for 'Lib.Auth'`. I have removed my `.stack-work` dir and rebuild but this error still happens.
23:27 <codedmart> Any ideas what I am missing here. I have never had this happen which leads me to believe it is something stupid I am overlooking since I am tired.
23:27 arkasis joined
23:28 buglebudabey joined
23:28 zero_byte joined
23:28 <kloppadop> codedmart: do you export the module in your .cabal file?
23:28 wraithm joined
23:28 <kloppadop> and does the module name match the path?
23:29 <geekosaur> that sounds like you misunderstood the question tbh
23:29 TxmszLou joined
23:29 <geekosaur> I'd probably be looking for .hi files containing the old name
23:30 <codedmart> @geekosaur wouldn't deleting the .stack-work dir remove those?
23:30 <lambdabot> Unknown command, try @list
23:32 <geekosaur> sometimes? iirc it's a bit more complex than that
23:32 <kloppadop> https://mail.haskell.org/pipermail/haskell-cafe/2009-April/060670.html
23:32 <geekosaur> but you probably want someone who knows more stack internals there
23:32 insitu joined
23:32 <kloppadop> 'the complete offside rule as found in Haskell is almost impossible to get right.'
23:32 <geekosaur> kloppadop, that was fixed in haskell2010
23:33 <kloppadop> geekosaur: what do you mean?
23:33 <geekosaur> although I think I should save that thread pointer for next time the discussion comes up
23:33 <kloppadop> geekosaur: the off-side rules were changed?
23:33 <geekosaur> yes
23:33 <kloppadop> geekosaur: is there somewhere where they are 'formally' documented?
23:33 <geekosaur> someone actually found a case where hugs and ghc produced different valid parses
23:33 <geekosaur> (valid meaning satisfied the haskell98 report)
23:33 <kloppadop> oh hugs, I should look at that parser
23:35 <geekosaur> https://www.haskell.org/onlinereport/haskell2010/haskellch10.html#x17-17800010.3
23:35 <kloppadop> great, thanks geekosaur
23:35 <geekosaur> formal specification of the haskell2010 layout rule
23:36 TxmszLou joined
23:37 humboldt joined
23:37 <geekosaur> also note that ghc does not fully follow it by default, because it enables the NondecreasingIndentation extension by default. another extension affecting it is DoAndIfThenElse.
23:39 <geekosaur> ...wait, did NondecreasingIndentation go away in 8.x?
23:39 jutaro joined
23:39 <kloppadop> I wonder if it would be noticeably simpler only indentation layout was supported, (without curly braces), and the layout rules were more strict
23:40 <kloppadop> if only*
23:40 <geekosaur> first you have to rewire SPJ's brain :p
23:40 <hpc> geekosaur: what was the case that produces different valid parses?
23:40 doomlord joined
23:41 <geekosaur> I don;t recall,t hat's why I want to go through the thread pointed to earlier because I couldn't find it last time I looked and I'm hoping that thread has it
23:42 <geekosaur> it's also possible that it was nhc98 involved instead of hugs
23:42 <geekosaur> except that that late someone would have had a fair amount of work to do to get that working for people to reproduce it :)
23:44 zone117x1 joined
23:44 e_svedang joined
23:45 <dolio> I don't think it's significantly harder to support both indentation and braces than it is to support just indentation.
23:46 fDev2179 left
23:46 <arkasis> hello, I'm new to haskell. How can I post a formated snippet?
23:46 <hpc> @lpaste
23:46 <lambdabot> Haskell pastebin: http://lpaste.net/
23:47 <arkasis> Here is my code;
23:47 <arkasis> data Bit = True | False newtype Byte = (Bit, Bit) main = putStrLn "hi!"
23:47 <monochrom> You will have name clash because of True and False.
23:48 <arkasis> http://lpaste.net/353195
23:48 <monochrom> newtype is wrongly used.
23:49 <arkasis> how is the correct way?
23:49 <monochrom> Need a data constructor.
23:49 <monochrom> Or else do not use newtype.
23:49 austinkeeley joined
23:49 <monochrom> It is ambiguous whether you intend newtype or not.
23:50 <arkasis> I tried type instead and worked, thanks
23:50 <monochrom> But read up very seriously on "data", "newtype", and "type". Choose the one you really mean.
23:50 rperry joined
23:50 systemfault joined
23:51 <monochrom> (Do not guess from "meaningful" names.)
23:52 DryBreadAddict joined
23:52 oisdk joined
23:52 hydraz joined
23:55 nothingnew joined
23:55 Swizec joined
23:57 mhagemeister joined
23:57 mdarse joined
23:57 pickle_ joined
23:57 aarvar joined