<    March 2017    >
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 _2_4 25  
26 27 28 29 30 31
00:01 sobaken joined
00:01 earldouglas joined
00:02 bind1 joined
00:03 markus1209 joined
00:03 markus1219 joined
00:04 doomlord joined
00:07 jbiesnecker joined
00:08 sid_fules joined
00:08 plutoniix joined
00:09 sz0 joined
00:09 jbiesnecker joined
00:10 lambda-11235 joined
00:11 theDon_ joined
00:13 earldouglas joined
00:15 <dmwit> sdrodge: (A day late, but...) looks nice!
00:15 <sdrodge> dmwit: Thanks :)
00:16 aarvar joined
00:17 ericsagnes joined
00:18 bigos joined
00:21 defaultnick joined
00:22 aarvar joined
00:24 defaultnick__ joined
00:24 jbiesnecker joined
00:25 karls joined
00:27 JeanCarloMachado joined
00:27 yaiyan joined
00:29 nakal_ joined
00:30 coltfred joined
00:31 pantsman_ joined
00:31 jbiesnecker joined
00:31 andrei_chifa joined
00:32 andyhuzhill joined
00:32 aarvar joined
00:33 carlomagno joined
00:33 eazar001 joined
00:34 markasoftware joined
00:36 nighty joined
00:36 Brionne joined
00:36 ramzifu joined
00:36 <ertes> how do i express the empty constraint?
00:36 eacameron joined
00:37 johnmendonca joined
00:37 <ertes> nevermind
00:37 <glguy> ()
00:39 harfangk joined
00:39 bjz joined
00:39 <ertes> yeah, i tried that, and it didn't work, but my error was elsewhere
00:41 fetter_oml joined
00:42 defaultnick___ joined
00:43 <fetter_oml> would someone know a nice way to build a unity vector (e.g. unityVector 5 3 would be [0,0,1,0,0]) with vector in the sense of the Numeric.LinearAlgebra.Data package?
00:44 watabou joined
00:45 Player123 joined
00:45 dan_f joined
00:45 <fetter_oml> my current approach is building one with generate in the Data.Vector sense (which is ugly enough), then calling Data.Vector.toList on it and throwing the result into Numerical.LinearAlgebra.fromList
00:45 <fetter_oml> which is ridiculous.
00:45 Player123 left
00:47 ronnik joined
00:48 conal joined
00:50 <lyxia> do you mean the hmatrix package?
00:52 jbiesnecker joined
00:53 <lyxia> fetter_oml: the Vector is actually of the Storable kind if you want to go that way
00:54 JeanCarloMachado joined
00:55 <fetter_oml> lyxia: yes, it seems it is the hmatrix package
00:55 <lyxia> fetter_oml: but Numeric.LinearAlgebra.Data.assoc seems to be a way which better respects abstraction boundaries
00:55 defaultnick__ joined
00:55 <fetter_oml> it also says in the description that "1D arrays are storable vectors directly reexported from the vector package.", so I thought it should be easier
00:56 <lyxia> Yes, these are the vectors from Data.Vector.Storable
00:59 ystael joined
00:59 mdarse joined
00:59 <fetter_oml> lyxia: yes, assoc seems like it should work
01:00 <fetter_oml> i will try getting it done with that one
01:01 <jle`> fetter_oml: i've called those one hots
01:01 <jle`> i think i've done those before in hmatrix, let me see if i can pull up some code
01:01 <fetter_oml> (whilst still thinking that a unity vector creation command might not be too luxurious)
01:01 fDev2179 left
01:02 <jle`> they're also called canonical basis vectors too in a linear algebra sense
01:02 <jle`> (if you're looking for things to google)
01:03 <jle`> fetter_oml: if you need all of them at the same time, you can just slice the identity matrix
01:03 <jle`> but Data.Vector.Storable.gen might be the best way yeah.
01:03 <jle`> s/gen/generate
01:04 Rotaerk joined
01:04 <jle`> oh, hmatrix exports generate as 'build'
01:04 <fetter_oml> slicing ident was my first attempt too, but I dont really see how I should morph a (n,1)-dim matrix to a vector
01:04 <jle`> build 5 (\i -> if i == 3 then 1 else 0)
01:05 <lyxia> nice
01:05 <jle`> build is hmatrix's re-export of generate
01:05 <lyxia> The hmatrix docs look quite daunting, I'm not sure why.
01:05 aarvar joined
01:06 sobaken joined
01:07 sobaken_ joined
01:07 <jle`> it's organization is kinda funky
01:07 <lyxia> the functions seem properly categorized at a glance
01:07 <jle`> maybe it's just that there are so many functions
01:08 <fetter_oml> not enough, as one can see :)
01:08 <fetter_oml> thanks lyxia and jle`, the build command should suit perfectly
01:09 lowryder joined
01:09 <fetter_oml> thats another (but not the last) hurdle out of the way of some neuronal-network-fun
01:09 <jle`> let me know how it goes :)
01:09 bob3434 joined
01:09 <jle`> sounds like a fun project
01:12 defaultnick_ joined
01:12 cmdd joined
01:12 sh0rug0ru joined
01:17 <fetter_oml> so far nothing major, just trying to fiddle with the hnn-package to learn from the mnist-database (http://yann.lecun.com/exdb/mnist/)
01:18 defaultnick_ joined
01:18 <fetter_oml> but as my last line of haskell code is about 3-5 behind, the work is going rather slow :)
01:18 eacameron joined
01:18 skeuomorf joined
01:19 <fetter_oml> 3-5 years*. also, its quite late, goodnight.
01:19 louispan joined
01:19 sveit joined
01:20 petervaro joined
01:21 defaultnick_ joined
01:22 <robertkennedy> :t diff
01:22 <lambdabot> error:
01:22 <lambdabot> • Variable not in scope: diff
01:22 <lambdabot> • Perhaps you meant ‘dff’ (imported from Data.Graph)
01:23 JeanCarloMachado joined
01:23 halogenandtoast joined
01:23 alpounet joined
01:27 sobaken joined
01:27 xcmw joined
01:29 fDev2179 joined
01:29 animated joined
01:31 <jchia> I have a module that defines a data and an instance just for its own consumption that I don't want it to export. I think there's no "export hiding". Explicitly listing everything I don't want to hide is verbose. Wrapping the module in another module that re-exports hiding the data and instance seems ugly. Any other ways?
01:31 niteria joined
01:32 gugah joined
01:33 defaultnick_ joined
01:33 sobaken joined
01:34 juhp joined
01:35 <jchia> I suppose I could put those things I want to hide from export in a nested 'Internal' module.
01:35 doodlehaus joined
01:38 <Koterpillar> jchia: you can just list everything else you want to export
01:38 fDev2179 left
01:38 <Koterpillar> if I understand you right...
01:39 <Koterpillar> e.g. if you define DataType and someFunction, why not make it: module Module (someFunction) where...
01:39 <jchia> Koterpillar, yeah, and that's quite verbose. E.g. if I have a list of 20 things out of which I want to hide 2. So, I have to explicitly export 18 things.
01:39 <jchia> I think I'm going to use an 'Internal' module
01:39 xcmw joined
01:40 <jle`> it's not an ideal solution, but yeah, it's something i've done too
01:40 <Koterpillar> oh, sorry, I missed that part in your question. I would still do that, though, because there might be more things you don't want to export
01:40 <jle`> but usually i write explicit export lists
01:41 <jchia> I'll probably have an explicit export list when the code is more stable
01:42 defaultnick_ joined
01:43 jbiesnecker joined
01:45 peterbecich joined
01:45 peterbec` joined
01:46 watabou joined
01:48 defaultnick__ joined
01:49 deepfire joined
01:50 randomclown joined
01:51 defaultnick_ joined
01:52 systemfault joined
01:52 ramzifu joined
01:52 <johnw> jchia: if you use ghc -ddump-minimal-imports Foo.hs, it'll probably get you where you want to be
01:55 maybefbi joined
01:56 <Profpatsch> edwardk: I want to hit you https://hackage.haskell.org/package/trifecta-
01:56 FreeBirdLjj joined
01:57 xcmw joined
01:57 <maybefbi> the GHC output is merely a STG interpreter correct? the haskell runtime included with each executable merely shuffles the STG tree around
01:57 <maybefbi> am i correct in saying this?
01:58 <benzrf> maybefbi: idk if i'd put it that way
01:58 <maybefbi> how would you put it?
01:59 <benzrf> well - my understanding is that the reduction process isn't "external" to some graph
01:59 <benzrf> rather, the nodes of the graph contain code to be jumped to
01:59 <benzrf> or something like that!
01:59 <maybefbi> woah hmm
01:59 <benzrf> it's a bit like church encoding, i think
01:59 <benzrf> (this might be way off, though)
02:00 ystael joined
02:00 defaultnick_ joined
02:01 <benzrf> er, maybe rather a pointer to the code you wanna jump to
02:01 <benzrf> i believe the actual expressions appearing in the code get compiled to static routines
02:02 <benzrf> so if you write something like `case f x of Just n -> n + 1; Nothing -> 0' then part of the output will be a procedure doing... that
02:02 <maybefbi> i dont think modern processors allow self modifying code, so im sure we cannot have thunks written in machine code
02:02 <maybefbi> so in some sense it has to be an interpreter if it reduces thunks into normal forms
02:03 <benzrf> kind of
02:03 <benzrf> iirc, a thunk is an allocated object which has a pointer to the code for forcing it - then once forced, it gets modified to isntead be the result value
02:04 <benzrf> so we do have a graph of thunks, but the logic of reducing any thunk is directly compiled
02:04 <maybefbi> hah thats clever
02:04 <benzrf> the nice part is that any given thunk will be the result of an expression physically in the code, so you already know all of the things you'll need to compile
02:05 <maybefbi> yeah
02:05 <maybefbi> so the runtime is just the bit that converts thunks to point to either the code or the data in non-executable heap
02:05 <maybefbi> ?
02:06 <maybefbi> also im assuming the garbage collection is also done by the runtime
02:06 <benzrf> well, i don't know if i'd call that a "runtime"
02:06 <benzrf> the garbage collection, yes
02:06 <maybefbi> what is it officially called instead of the runtime
02:06 latro`a joined
02:06 <benzrf> well, maybe it is called the runtime... i don't know the terminology that well
02:06 michael1 joined
02:06 defaultnick___ joined
02:06 <maybefbi> copy that
02:07 <benzrf> but the logic for allocating new thunks and so on could perfectly well be inlined into the compiled expressions
02:07 serendependy joined
02:08 <benzrf> so even if that logic is in a fixed set of functions added to the compiled code, it doesn't precisely feel like "a runtime" to me - maybe i just don't have a good grasp of what the word means
02:08 oisdk joined
02:09 <maybefbi> im trying to imagine how much work went into eta, the ghc compatible haskell for the jvm. i think they just implemented a STG shuffler but i could be wrong
02:09 louispan joined
02:09 <benzrf> o:
02:09 sibi joined
02:09 <benzrf> i think 'STG' actually refers to the thing i was describing where you have pointers to the reduction code
02:10 <benzrf> (again - i may very well be wrong)
02:10 <maybefbi> ok
02:11 andrei joined
02:12 <Profpatsch> Hm, what’s with parsers drawing in attoparsec AND parsec?
02:12 <Profpatsch> That means trifecta always pulls in everything.
02:12 <Profpatsch> Also, lenses.
02:12 <Profpatsch> That’s a lot of dependencies.
02:12 <andrei> Hi, I'd like to submit a package to Stackage but it has an external dependency. What's the way to do this?
02:12 <andrei> A non-haskell dependency, so tests will fail
02:12 roconnor joined
02:15 Guest69206 joined
02:17 cschneid_ joined
02:17 <deepfire> what tricks people use to visualise type family reduction steps?
02:17 Koterpillar joined
02:18 jtcs joined
02:18 <maybefbi> :kind!
02:19 steeze joined
02:19 alx741 joined
02:19 <robertkennedy> Mine is `:t undefined :: T A B`
02:22 Guest4533 joined
02:23 manlet joined
02:23 <jle`> huh, does that really work?
02:24 <jle`> i always just use :kind! ... i don't consider that a trick, though
02:24 <jle`> it's the documented way to do it, but it doesn't show reductino steps step-by-step, admittedly
02:25 jedi1 joined
02:26 bigos joined
02:27 alx741 joined
02:28 alx741 joined
02:31 <lyxia> andrei: it seems you just disable the tests/mark them as expected failures
02:32 <lyxia> andrei: https://github.com/fpco/stackage/issues/811 for example
02:33 defaultnick_ joined
02:33 Destol joined
02:33 oisdk joined
02:34 robertkennedy joined
02:35 texasmynsted joined
02:36 ramzifu joined
02:38 tommd joined
02:38 FreeBirdLjj joined
02:41 <andrei> lyxia: Thanks! I just found that I can request some debian packages to be included in the stackage environment. That should do nicely
02:43 <lyxia> oh, that's nice then
02:44 nomotif joined
02:44 MP2E joined
02:45 louispan joined
02:46 Rainb joined
02:47 watabou joined
02:49 dosequis joined
02:50 <dosequis> hey all - I'm running a QuickCheck test in ghci and wondering if it's possible to get the test data where it failed so that I can play around with it and see what happened - is this possible?
02:52 <deepfire> thanks everyone!
02:54 robkennedy joined
02:54 robertkennedy joined
02:54 cmdd_ joined
02:55 robkennedy joined
02:56 robkennedy joined
02:56 robkennedy joined
02:58 robertmkennedy joined
02:58 oisdk_ joined
02:59 conal joined
02:59 <lyxia> dosequis: doesn't it print the generated counterexample?
02:59 <dosequis> lyxia: hey thanks for answering. Yes it does. Ideally though, I would want to bind it to a variable somehow, and then manually run some tests on it in the console
02:59 <lyxia> there should also be a way to get the seed/size combination out
03:00 <dosequis> lyxia: ok yes I saw that in the Result
03:00 hucksy_ joined
03:00 <dosequis> lyxia: so if I have seen/size, then presumably I can re-generate the data that caused the failure
03:00 ystael joined
03:01 sh0rug0ru joined
03:01 <lyxia> Right.
03:01 <dosequis> ok thanks! this helps
03:01 <lyxia> I think there is an open issue about a better api
03:01 <lyxia> the problem is it's not clear how that would work
03:02 <dosequis> yeah I mean I'm not sure how to proceed
03:02 <lyxia> dosequis: https://github.com/nick8325/quickcheck/issues/117
03:02 sw4n joined
03:02 <dosequis> lyxia: thanks for the link!
03:03 <lyxia> oh I had forgotten there's an actual solution
03:04 Uakh joined
03:04 shurick joined
03:07 <dosequis> lyxia: yes, I found http://hackage.haskell.org/package/quickcheck-with-counterexamples. Very helpful thanks again!
03:07 Uakh joined
03:09 peterbec` joined
03:10 latro`a_ joined
03:12 skeet70 joined
03:13 <lyxia> yw
03:14 louispan joined
03:15 chlong_ joined
03:16 takle joined
03:16 Jacoby6000__ joined
03:23 xtreak joined
03:23 watabou joined
03:23 robertkennedy joined
03:23 FreeBirdLjj joined
03:24 defaultnick_ joined
03:25 dsantiago joined
03:26 louispan joined
03:28 robkennedy joined
03:30 TxmszLou joined
03:30 defaultnick joined
03:30 takle joined
03:33 bjz joined
03:33 sellout- joined
03:34 robertkennedy joined
03:34 ddere joined
03:35 robkennedy joined
03:36 robertkennedy joined
03:38 xcmw joined
03:38 sh0rug0ru joined
03:39 tommd joined
03:40 jsgrant- joined
03:40 takle joined
03:41 FreeBirdLjj joined
03:44 <johnw> I'm reading http://bentnib.org/interleaving.html, and I'm wondering, how is this not just what FreeT does? (or, rather, an equivalent FixT)
03:44 Jacoby6000__ joined
03:45 defaultnick_ joined
03:46 takle joined
03:48 defaultnick joined
03:48 <Cale> johnw: I don't really understand the question -- they talk about the construction of free monads in that paper.
03:49 bjz joined
03:50 fabianhu joined
03:52 <monochrom> Perhaps the abstract is better rewritten as "FreeT has been in use by practical people for a while. This paper aims to introduce this concept to theorists." :)
03:52 ramzifu joined
03:52 <monochrom> (Afterall, functional programmers regularly reading JFP?! Are you kidding me?)
03:53 haskull joined
03:53 louispan joined
03:53 <Cale> Heh, looks like that to me, yeah
03:54 takle joined
03:54 <Cale> Also, it's from 2015 -- when did FreeT appear independently?
03:55 <Cale> Oh, I guess that would have been a few years earlier
03:55 <monochrom> free-0.1.0 was Feb 2011 on hackage.
03:56 <monochrom> "initial free"
03:56 <haskull> the state monad has 2 args, a value and a state. is it bad to use the state as a separate value, or do i somehow use 2 state monads at the same time? or am i doing something wrong and need to restructure the code?
03:57 <monochrom> I don't understand "the state monad has 2 args".
03:57 defaultnick joined
03:57 <haskull> i dont know what they're called.. like State Int Int, for example.
03:57 exferenceBot joined
03:57 <peddie> "s" and "a"
03:57 <Cale> haskull: The first is the type of the state which is manipulated during the computation, and the second is the type of the result of the action.
03:57 <monochrom> OK, the State type.
03:58 Chobbes joined
03:58 chirpsalot joined
03:58 xall_ joined
03:58 <Cale> So what do you mean by "use the state as a separate value"?
03:58 <Cale> Perhaps it would help if we could see what your code looks like
03:59 <monochrom> Next, I don't understand "use the state as a separate value". But the bottomline is, if your code compiles and gives the right answer, you are doing it right.
03:59 <Cale> Note that you can choose any type at all that you like to be the type of state being manipulated, so in particular, it might be a record consisting of a bunch of independent things
03:59 <monochrom> Actually maybe I only mean the converse. If your code has a type error or gives the wrong answer, then you have wrong concept.
04:00 FreeBirdLjj joined
04:00 Zekka joined
04:00 <monochrom> If you mean, "I will use 'get' all the time and 'put' never", OK it is legal, but then you're better off with Reader.
04:01 <haskull> I'm reading from a string, and based on the words in it I want to modify the content of 2 lists.
04:01 lspitzner joined
04:01 hexagoxel joined
04:01 ystael joined
04:01 <haskull> i'm having trouble clarifying as i hardly understand what i'm doing :/
04:02 <Cale> haskull: I would usually recommend trying to just write your function without any State monad first, so that you *do* understand it that way, and then if you ended up with a lot of functions of the form s -> (s,a), where you're tupling the result of the function with a new intermediate state, consider using a State monad to clean it up.
04:03 defaultnick__ joined
04:03 <haskull> alright, thanks.
04:03 <Cale> From that description, it shouldn't be too hard to imagine using State, but it also might not improve things much, depending on the details
04:03 ericsagnes joined
04:03 <Cale> You could have a pair of lists as the 's' type
04:04 sobaken_ joined
04:04 <Cale> But then again, you might just be able to write a function which takes those two lists being manipulated as arguments, and which applies itself to new arguments according to how the lists are to be updated.
04:04 <Cale> (does that make sense?)
04:05 takle joined
04:05 <Cale> The main way in which variables vary is to be bound to new things when a function is applied to new arguments.
04:05 FreeBirdLjj joined
04:06 <haskull> the part about tupling the 2 lists makes sense
04:06 <haskull> i think it'd work
04:06 sobaken joined
04:07 <Cale> > let f xs ys [] = (xs,ys); f xs ys (u:us) = if even u then f (u:xs) ys us else f xs (u:ys) us in f [] [] [1..10]
04:07 <lambdabot> ([10,8,6,4,2],[9,7,5,3,1])
04:08 subttle joined
04:08 <Cale> ^^ have a look at how that thing manipulates the lists xs and ys, adding the next element to be processed to one or the other depending on whether it's even.
04:08 robkennedy joined
04:09 <haskull> i see. thanks, i think i can figure it out now.
04:09 buttons840 joined
04:09 FreeBirdLjj joined
04:10 gcross_ joined
04:11 path[l] joined
04:12 enitiz joined
04:13 robertkennedy joined
04:13 lambda-11235 joined
04:14 pavonia joined
04:14 drostie-m joined
04:16 augur joined
04:16 otto_s joined
04:16 <Ptival> DuplicateRecordFields is weird http://paste.awesom.eu/2GTa
04:17 <johnw> Cale: what I mean is, in 2015 what is it adding?
04:17 Goplat joined
04:17 <Ptival> the reason given in the wiki ("we do not infer the type of the argument to determine the datatype, or have any way of deferring the choice to the constraint solver") is disappointing
04:17 <johnw> Cale: or is it just clarifying the intersection between FreeT constructions and f-and-m-algebras?
04:21 vwker joined
04:21 takle joined
04:21 nemorichard joined
04:25 Jesin joined
04:30 tommd joined
04:31 monkey joined
04:32 jmcarthur joined
04:33 vwker` joined
04:33 brynedwards joined
04:35 path[l] joined
04:36 defaultnick joined
04:36 ramzifu joined
04:38 takle joined
04:39 cris_ joined
04:40 <cris_> hi, i write up some code on dates, could you check if any could be improved? https://github.com/szehk/Haskell-Carbonara-Library/tree/master/src/Data/Carbonara
04:42 <EvanR> dayToUnixTime can be done without magic numbers, using Data.Time conversion functions
04:43 <cris_> thanks EvanR, let me check
04:43 <EvanR> and unixtimeToDay
04:43 Shatnerz joined
04:44 travula joined
04:44 <EvanR> posixSecondsToUTCTime :: POSIXTime -> UTCTime
04:46 <EvanR> POSIXTime is a fractional number of seconds, UTCTime is a Day paired with length of time past midnight
04:47 <cris_> thanks EvanR, i ll change it soon , I 'll go to lunch now and reply you guys later
04:47 <EvanR> Integer -> POSIXTime is fromInteger, UTCTime -> Day is utctDay
04:48 wtetzner joined
04:49 jsgrant joined
04:50 hexagoxel joined
04:51 FreeBirdLjj joined
04:54 defaultnick__ joined
04:55 bjz joined
04:57 defaultnick joined
04:57 eacameron joined
04:59 Swizec joined
05:00 takle joined
05:01 andrei_chifa joined
05:02 ystael joined
05:03 defaultnick__ joined
05:03 coltfred joined
05:04 igniting joined
05:04 cschnei__ joined
05:05 sssilver joined
05:06 cris2 joined
05:06 <sssilver> Hey guys, I have this problem where I am a Haskell programmer, I know the language pretty well, have shipped production code in it, can leverage the various language features and all Haskell programs make sense to me
05:07 <Cale> Cool problem
05:07 <sssilver> however, whenever people start talking about the mathematical aspects of the type system and everything, that stuff just completely flies over my head; I get dazed and confused
05:07 <Cale> ah
05:07 <pacak> Keep getting dazed and confused, eventually you'll get used to it :)
05:08 <Cale> @remember sssilver Hey guys, I have this problem where I am a Haskell programmer, I know the language pretty well, have shipped production code in it, can leverage the various language features and all Haskell programs make sense to me
05:08 <lambdabot> I will never forget.
05:08 takle joined
05:08 <monochrom> Haha.
05:08 <Cale> sssilver: (sorry, that was too perfect, had to take it out of context)
05:09 <monochrom> But you are probably just missing some background knowledge.
05:09 <Cale> You might try Benjamin Pierce's "Types and Programming Languages" as a start
05:09 <sssilver> yes monochrom so I complained about this to a friend who's building compilers at Intel, and he advised I read this book called "Concrete Mathematics"
05:10 <subttle> sssilver: Bartosz Milewski has a great video lecture series (still in progress) if that is more your thing..
05:10 <Cale> (As a somewhat gentle intro to type theory proper)
05:10 <subttle> https://www.youtube.com/playlist?list=PLbgaMIhjbmEnaH_LTkxLI7FMa2HsnawM_
05:10 <sssilver> so I started reading it, but every paragraph makes me go "why dafuk am I doing this to myself??" in bewilderment and self loathing
05:11 <monochrom> Concrete Mathematics is going to make you an expert in determining whether a certain algorithm's running time is "n^2 + 4n arithmetic operations", and only that.
05:11 doodlehaus joined
05:12 <monochrom> It still won't tell you about types or catamorphisms.
05:13 <monochrom> "But it's a pretty thick book!" you may say. I know right?
05:13 <sssilver> the question is, do I really need to understand all of it in order to earn the moral right to feel like an accomplished programmer, when commuting from work to home?
05:13 <solrize> sssilver, concrete mathematics is kind of a streamlined and easier version of the stuff in knuth vol 1
05:14 <solrize> yes it's a very good book
05:14 <monochrom> Well, considering the fact that the typical CS student chose CS because "I flunked highschool algebra and I'm proud of it", you do need a thick book to just reteach highschool algebra (for the purpose of algebraic expressions of running times, but still.)
05:14 <solrize> very well worth reading, even if you decide that you won't get much benefit from working thru all the details
05:14 <solrize> monochrom, no it's not a rehash of hs algebra :)
05:15 defaultnick joined
05:15 conal joined
05:15 <solrize> those concrete running time calculations are usually done with generating functions
05:15 <solrize> it was an eye opener
05:16 <solrize> he analyze the running time of "find the maximum" (i.e. the obvious linear algorithm) that way
05:16 <solrize> at least in taocp vol 1, not sure if that's also in cm
05:16 <monochrom> That might be an overkill.
05:16 <solrize> well he used it to show the technique, not to find the running time of find the maximum ;)
05:18 <monochrom> P.S. Though I said "types" and "catamorphisms" together, do not think that I meant they were covered by the same book. No, they are yet two different books.
05:19 <sssilver> how did you guys come to know and understand all this stuff!
05:19 louispan joined
05:19 <solrize> hmm dunno
05:19 <sssilver> you can push a LOT of JSON through TCP using Haskell and still not have to touch any of it
05:19 <subttle> sssilver: https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/
05:19 <monochrom> "types" being covered by Types and Programming Languages as said (though I wonder if Practical Foundations for Programming Languages is shorter and cheaper). (Also you don't need to finish the whole book.)
05:20 <solrize> PFPL is online for free
05:20 <solrize> i liked it
05:20 <solrize> it was much less detailed than TAPL, but TAPL has a lot of material on subtype systems
05:20 <monochrom> "catamorphism" there are some papers and there are other books with category theory inclinations.
05:20 <conal> sssilver: I can't tell why you want to learn the math/theory stuff. Maybe it's out of reach because you don't have an intrinsic motivation.
05:20 <solrize> which i thought were unstylish around here
05:21 <monochrom> Yeah TAPL is big because subtypes.
05:21 defaultnick joined
05:21 <sssilver> conal yes it bores me to death :(( but I consciously understand that I should be interested in it
05:21 eacameron joined
05:21 <solrize> i first saw catamorphism in a program derivation (i.e. bird) context i think
05:21 <monochrom> But you don't need subtypes for Haskell. And you kind of learn that subtyping is really difficult, so it might be not such a good idea to use it.
05:22 <solrize> sssilver, what kind of theory?
05:22 hexagoxel joined
05:22 <monochrom> Yeah but Bird has a category theory inclination.
05:22 <solrize> yeah
05:22 <monochrom> The most extreme being Algebra of Programming (now hard to find and expensive). But many Bird papers are not that extreme.
05:22 <solrize> for very basic intro the haskell wikibook page about categories is really nice
05:23 <solrize> does't say anything about catamorphisms though :)
05:23 <conal> sssilver: maybe it's not true that you should be interested. especially if it's for status or self-image ("the moral right to feel like an accomplished programmer"). it doesn't sound fun to learn without a genuine interest.
05:23 <monochrom> Ah yea the wikibook is good.
05:23 mac10688 joined
05:23 <solrize> the only way to gain the moral right to feel like an accomplished programmer is to write some really good code. then you'll have accomplished something as a programmer and can feel like you've done that
05:24 xtreak joined
05:24 <solrize> you don't need a ton of theory to write good code
05:24 <solrize> but it helps to not be totally ignorant
05:24 <solrize> know some theory
05:24 <solrize> not necessarily a lot
05:24 defaultnick joined
05:24 <solrize> see antirez recent blog
05:24 <solrize> http://antirez.com/news/112
05:26 takle joined
05:26 Boney joined
05:26 <conal> i suspect that most people who are good at math / theory got good at it because they genuinely delight in it, not for status.
05:27 <monochrom> I don't worry about people learning useless academic stuff. I do that all the time. I was learning linear algebra (specifically the kind for quantum bits). I am planning to learn Lagrangian and Hamiltonian mechanics soon. Useful for my career? No way. Rabit holes? Yes a multiverse of rabbit holes. It's a hobby, I know that.
05:27 <conal> ... and there are a lot of other things to enjoy.
05:27 Boney left
05:28 <sssilver> :(
05:29 <monochrom> Sure. I just enjoyed The Lego Batman Musical today. Nothing to do with Hermitian matrices, which I also enjoy.
05:30 takle_ joined
05:31 <monochrom> ObHaskell: I did code up some matrix operations (backed by Data.Vector) (naive algorithms) so I didn't always have to multiply matrices by hand.
05:31 Koterpillar joined
05:32 Rainb joined
05:34 spatial joined
05:34 bjz joined
05:35 <spatial> http://pastebin.com/zWZxXiam After the case the varialbles go out of scope
05:36 takle joined
05:36 Xanather joined
05:36 <monochrom> Look at the indentation shown in the paste. It completely explains why.
05:39 <haskull> execute :: Operation -> StateT ParseState IO (); cmds :: [Operation]; why can't I do execStateT (do fmap execute cmds) (..)?
05:39 <Koterpillar> haskull: you need sequence
05:40 augur_ joined
05:41 xall_ joined
05:42 augur__ joined
05:42 fragamus joined
05:43 <fragamus> hey so what language is all that hacking code written in?
05:43 <fragamus> In my imagination it is badass haskell code
05:44 <Koterpillar> fragamus: much as you'd want it to, people's toasters aren't that fast on compiling GHC
05:45 cschneid_ joined
05:45 <fragamus> wait they can hack my toaster damn
05:46 <fragamus> what secrets lie in the crumbs at the bottom of my toaster
05:46 takle joined
05:47 gcross_ joined
05:48 steeze joined
05:48 <haskull> if i keep smashing my head with haskell will i eventually get it, or should i find the patience to read a book?
05:48 vwker joined
05:48 defaultnick_ joined
05:48 cur8or joined
05:49 wtetzner joined
05:49 <Koterpillar> haskull: both are good techniques, try combining them
05:50 <CoconutSnail> find a book and smash one's head with it?
05:50 osa1 joined
05:50 xall joined
05:50 <c_wraith> haskull: semi-passive learning was the most effective technique I used. Hang out here for hours, and whenever a topic came up that interested me, become less passive and ask questions.
05:51 <Koterpillar> ^
05:51 Jacoby6000__ joined
05:51 cmdd joined
05:51 vwker joined
05:52 arawack joined
05:52 ramzifu joined
05:53 thewickedaxe joined
05:54 Mortomes|Train joined
05:56 hydroacoustic joined
05:56 justanotheruser joined
05:56 path[l] joined
05:57 defaultnick__ joined
05:58 robotroll joined
05:59 juhp joined
06:01 Jicoss joined
06:03 ystael joined
06:03 defaultnick_ joined
06:04 <haskull> is "Please report this as a GHC bug" a big deal or can i just ignore it?
06:05 pantsman_ joined
06:05 <Koterpillar> it'll be nice to report if you can minimize the test case
06:05 takle joined
06:05 <Koterpillar> (or maybe it's a known bug, but still)
06:06 <haskull> i'll try tomorrow, gonna sleep for now.
06:06 <haskull> bye, and thanks
06:10 <qmm> When using something like Scotty, what is a common way to setup a database connection for the entire app?
06:11 <qmm> maybe the question is, how do i pass a reference to a database around
06:12 <Koterpillar> no experience with Scotty in particular, but you usually put it inside your base monad
06:13 <Koterpillar> aha, same thing, use Web.Scotty.Trans
06:14 vlatkoB joined
06:14 fizruk joined
06:15 plutoniix joined
06:15 defaultnick__ joined
06:16 plutoniix joined
06:16 jhrcek joined
06:17 plutoniix joined
06:19 _sras_ joined
06:19 plutoniix joined
06:21 plutoniix joined
06:21 <_sras_> Is there a program that can convert and HTML string into format of a Lucid template?
06:21 <_sras_> s/and/an
06:22 ramatevish joined
06:23 rkazak joined
06:25 hexagoxel joined
06:27 howdoi joined
06:31 dec0n joined
06:33 defaultnick___ joined
06:34 thc202 joined
06:34 eacameron joined
06:35 <srhb> _sras_: Don't think so.
06:35 <spatial> http://pastebin.com/637shj0t Where should that return actually be placed ?
06:35 <spatial> Indented
06:36 <spatial> parse error on input `return'
06:36 <srhb> spatial: It's easier if you rewrite without re-indenting on every line
06:36 <Koterpillar> with do notation, you don't have to use 'let .. in'
06:37 <spatial> do notation - What ?
06:37 <Koterpillar> also, why is this return needed? Could probably have the same function without the Monad constraint
06:37 <Koterpillar> spatial: what is the type of this function?
06:38 <spatial> nextstate :: Player -> BoardState -> Int -> BoardState
06:38 <srhb> spatial: I don't understand what you're actually trying to do, but here the indentation is fixed at least: http://lpaste.net/1567422115374694400
06:38 <Koterpillar> spatial: what is the type of 'return'?
06:38 <Koterpillar> spatial: forget about return, you don't need it
06:38 <spatial> data BoardState = BoardState { xloc :: [Int], oloc :: [Int], index :: Int } deriving (Show)
06:39 <Koterpillar> :t return
06:39 <lambdabot> Monad m => a -> m a
06:39 <spatial> Oh what is :t return
06:40 <Koterpillar> spatial: return is a function, which you currently don't need
06:40 <Koterpillar> spatial: I think this will be a good start: http://lpaste.net/353299
06:40 <athan> Is there a way to `cancel` an `async` thread, from within the thread itself?
06:40 <athan> like an anonymous cancel?
06:41 <spatial> Right.
06:41 <Koterpillar> spatial: I suspect you are trying to write your function as, "let's assign X to Y, then let's assign some f(Y) back to Y"
06:42 <spatial> Ya OCaml syntax
06:42 <Koterpillar> spatial: it helps if you think of it instead as: "The next state of the game (?), if the previous state is this and the move is that, _is_ ..."
06:42 <spatial> Converting lisp. Right
06:43 <spatial> So return is needed in what situations ?
06:43 <spatial> Never ?
06:43 <Koterpillar> when you are using monad typeclass, and even then in modern GHC you have 'pure'
06:45 dogweath_ joined
06:46 Big_G joined
06:47 nick_h joined
06:47 piyush-kurur left
06:47 <Rotaerk> athan, I haven't really used async in haskell so I'm not sure if my response applies, but I've used something similar in C#...
06:48 louispan joined
06:48 t_h joined
06:48 <Rotaerk> athan, why can't the async thread just end?
06:49 <Rotaerk> if you're at a point of execution within that thread where you want to cancel, simply return
06:49 castlelore joined
06:50 <athan> hmm, well Control.Concurrent has myThreadId
06:50 <athan> I might just use that and killThread
06:50 <athan> (I think async just builds on top of it)
06:50 edsko joined
06:50 <athan> my only issue is I also used `forever` Rotaerk
06:50 <Rotaerk> I don't understand why you would kill *this thread* though
06:51 <Rotaerk> can you replace forever with a condition that changes when ready to end?
06:51 <athan> not really :\
06:51 <Rotaerk> can you paste?
06:52 <athan> foo = async $ forever $ do { ... when bar $ killThread =<< myThreadId }
06:52 <athan> I think that should work
06:52 <athan> `async` I think intents to be more... structural or osmething
06:53 <EvanR> async provides a lot of tedious checks and exception propogation which really streamline the task
06:53 <athan> ahh hm
06:53 t0by joined
06:54 <EvanR> async lets you directly cancel a task
06:54 defaultnick joined
06:54 <EvanR> if you wait for a result and the thread crashes you get the exception
06:54 <EvanR> when the thead is spawned, weird asynchronous exception possibilities are handled
06:54 <Rotaerk> sounds like the way tasks and await work in C#... you don't get the exception until you wait for the task, even if it actually is thrown long before you await it
06:55 <Rotaerk> it just seems unnecessary to me to ... cancel a task from within itself
06:55 <Rotaerk> instead just return from it cleanly
06:55 <EvanR> killThread throws a ThreadKilled exception to a thread
06:56 <athan> :x
06:56 <EvanR> so killing yourself is the same thing (or intuitively is the same) as just thowing an exception
06:57 <EvanR> throwIO (userError "I'm dead")
06:58 <athan> but... async will ignore it unless they are `link`ed... right?
06:59 takle joined
06:59 <EvanR> what, if you throw an exception, youre not going to be continuing
06:59 <EvanR> :t throwIO
06:59 <lambdabot> Exception e => e -> IO a
06:59 <EvanR> it returns an "a"
07:00 <EvanR> its illogical to continue
07:00 takuan joined
07:00 fjisgashgs joined
07:00 xcmw joined
07:01 <athan> crud, thanks EvanR
07:01 <EvanR> no one may ever know you are dead, but thats another story
07:02 <EvanR> but if no one is listening, who cares
07:03 defaultnick joined
07:03 certainty joined
07:04 ystael joined
07:04 LiaoTao joined
07:07 vlatkoB_ joined
07:07 FreeBirdLjj joined
07:11 SiCC joined
07:11 fjisgashgs left
07:11 castlelore joined
07:11 castlelore joined
07:11 coltfred joined
07:11 shafox joined
07:12 rcsole joined
07:12 aglorei joined
07:13 Unhammer joined
07:13 castlelore joined
07:13 castlelore joined
07:13 tomboy64 joined
07:14 aarvar joined
07:14 mda1 joined
07:16 quchen joined
07:16 h joined
07:17 calincru joined
07:17 <wizard1337> is there a name for the problem of being able to transform imperative code into functional and/or vice versa? how do i find some thoughtful articles on the topic
07:17 takle joined
07:18 <Cale> There is a name for the programs which do that sort of work, they're called compilers :)
07:18 <peddie> wizard1337: you could start with https://pdfs.semanticscholar.org/7cb9/0be27017772fa441981d3d362741056efd57.pdf
07:18 Mortomes|Work joined
07:20 aces joined
07:20 Jacoby6000__ joined
07:21 hdeshev joined
07:22 solrize joined
07:22 insitu joined
07:23 <aces> Hi, complete beginner here, have almost no programming experience. I read that haskell is a great language to start out with and wanted to start with functional programming from scratch. Can anyone point me to a tutorial that is beginner friendly?
07:24 <wizard1337> aces: my best advice (as a newb myself) is start writing code and forget about learning more than little bits of the language
07:24 defaultnick_ joined
07:24 <wizard1337> aces: then grow those bits with time
07:24 <aces> wizard1337: I don't know much about the basics as of yet. I still need to learn the concepts prior to writing code.
07:25 <peddie> @where nicta -- aces
07:25 <lambdabot> https://github.com/nicta/course
07:25 juhp joined
07:25 cinimod joined
07:25 <peddie> @where cis194 -- aces
07:25 <lambdabot> http://www.seas.upenn.edu/~cis194/spring13/
07:25 plutoniix joined
07:26 plutoniix joined
07:27 defaultnick_ joined
07:27 <wizard1337> omg ghci has tab completion :D
07:27 <aces> Thank you peddie , having a look.
07:27 rgr joined
07:27 plutoniix joined
07:28 <wizard1337> and use stack, not cabal
07:28 <peddie> aces: good luck and have fun
07:28 dan_f joined
07:29 raichoo joined
07:29 hazmat__ joined
07:29 raycoll joined
07:30 FreeBirdLjj joined
07:30 raycoll joined
07:30 conal joined
07:30 defaultnick__ joined
07:32 takle joined
07:33 n1 joined
07:33 nemorichard joined
07:34 FreeBirdLjj joined
07:34 nshepperd joined
07:35 conal joined
07:36 owiecc joined
07:37 bjz joined
07:37 andrei_chifa joined
07:38 TxmszLou joined
07:38 FreeBirdLjj joined
07:39 xtreak joined
07:40 v0id joined
07:41 ragepandemic joined
07:42 defaultnick joined
07:45 caumeslasal joined
07:47 cschneid_ joined
07:48 unK_ joined
07:48 Nerterologist joined
07:50 angelos joined
07:51 <wizard1337> why does reid barton work on ghc
07:51 FreeBirdLjj joined
07:52 rgr joined
07:53 coot joined
07:55 FreeBirdLjj joined
07:58 <cocreature> why shouldn’t he?
07:58 yogsototh joined
07:58 <wizard1337> seems like a bit of a jump from pure math
07:59 <cocreature> some people have multiple interests :)
07:59 TheEpsylon` joined
07:59 Miroboru joined
08:00 <wizard1337> is there any relation to his experience at rentech?
08:00 <wizard1337> and is he paid to work on ghc?
08:00 ynyounuo joined
08:00 FreeBirdLjj joined
08:01 baldrick joined
08:01 <ezyang> "because it's fun and intellectually stimulating"
08:02 wtetzner joined
08:02 eklavya joined
08:02 Jicoss joined
08:03 <n1> 'pure math' is a matter of perspective!
08:04 <wizard1337> what are the major sources of funding for ghc?
08:04 FreeBirdLjj joined
08:04 ystael joined
08:04 BartAdv joined
08:05 FreeBirdLjj joined
08:06 jutaro joined
08:07 t_h joined
08:08 zar joined
08:08 coup_de_shitlord joined
08:09 RouxTheDay joined
08:09 <Cale> wizard1337: Well, it's an open source project, but I suppose you could have a look at the places that the developers are working.
08:09 <wizard1337> so do people who are actually good with haskell get snapped up
08:10 <wizard1337> or is it what i have read, which is that there are tons of people who are great with haskell who are desperate to find a position anywhere
08:10 refold joined
08:10 albertid joined
08:10 <Cale> It's a bit of both.
08:10 Beetny joined
08:10 <wizard1337> *and are
08:10 <wizard1337> those are sorta mutually exclusive
08:10 zar joined
08:10 <n1> I believe SPJ works on ghc for microsoft research
08:10 rgc joined
08:10 <wizard1337> right, so that would be 1 job
08:11 <Cale> wizard1337: Well, there are a fair number of us who are employed and spend our day jobs writing Haskell
08:11 <wizard1337> i guess it's appropriate to respond with an existence proof?
08:11 <wizard1337> ;-P
08:11 <Cale> I'm one of them :)
08:12 <wizard1337> right,... but it's not like there are agencies which will be absorbing pretty much anybody who is tall enough to ride the roller coaster
08:12 <wizard1337> or are there...?
08:12 guiben joined
08:12 <Cale> There's Takt, they've been snapping up lots of people lately :)
08:12 xall joined
08:13 SpinTensor joined
08:13 <Cale> (They're a startup, but they have quite a lot of funding from what it seems)
08:13 <wizard1337> lol ive worked at startups with about 30 times that in funding :)
08:14 patbecich joined
08:14 <wizard1337> 30 m is significant but not remarkable
08:14 FreeBirdLjj joined
08:14 magneticduck joined
08:14 <Cale> Well, it's enough to hire a bunch of people and to do a bunch of business with the other Haskell development companies
08:15 <Cale> The entire community is only so large to begin with.
08:15 <wizard1337> i see
08:15 <ezyang> GHC dev is basically MSR + Well Typed + Army of PhDs
08:15 FreeBirdLjj joined
08:15 <ezyang> with MSR and other industrial people funding the Well Typed committment
08:16 Jacoby6000__ joined
08:16 <Cale> A couple people at Obsidian also have been getting into it a bit lately, if a bit in anger :)
08:16 <wizard1337> carmack likes haskell
08:17 <wizard1337> said that he started a project in it
08:17 <wizard1337> but other people working on it stormed his office and said "what the hell is a monad?"
08:18 <Cale> Monads are not a big deal. It's just a mathematical name for a pattern that's been showing up in functional programming for much longer than we had a name for it.
08:18 <wizard1337> yeah, i'm not saying these people had the right idea
08:20 <Cale> The harder part of learning to program in Haskell is usually going to have more to do with the change in mindset required regarding programming with immutable data structures most of the time.
08:21 <wizard1337> yaeh
08:22 travula joined
08:22 fetter_oml joined
08:23 CurryWurst joined
08:24 patbecich joined
08:24 wedify joined
08:27 FreeBirdLjj joined
08:27 <Cale> wizard1337: Also, when it comes to IO, the fact that IO is a monad, though it seems to be what people often fixate on, is not usually going to be any kind of a problem -- it just means we have a certain API for sticking these things together. The weird part that takes some getting used to is that IO is a type at all, and that we have a type of values which represent effectful programs, and their execution is a separate process from
08:27 <Cale> evaluation of expressions.
08:28 <wizard1337> i don't fully understand monads but everything i've seen about them so far isn't troublesome
08:28 <wizard1337> containing state is a very sensible thing
08:28 <Cale> You basically learn a bunch of examples of them
08:28 <wizard1337> i did that naturally when i wrote imperative code
08:29 <wizard1337> purity, totality, state containment,...
08:29 <Cale> and gradually get a good sense that way for what kinds of things to usually expect
08:29 markus1189 joined
08:29 Sampuka joined
08:30 ramzifu joined
08:30 <maerwald> what's a nice xml parser in haskell without lens, TH or other complexity I don't care about
08:30 <wizard1337> lol
08:30 <wizard1337> if you don't like complexity, why are you using xml
08:31 gregman_ joined
08:31 <maerwald> because it's the input
08:31 <Cale> maerwald: What do you need it for? hexpat-pickle is old, but it might be good.
08:31 <cocreature> maerwald: I’ve used xml-conduit and found it quite nice
08:31 <maerwald> Cale: parsing the capec database
08:31 <cocreature> you don’t need to use conduit for it to be useful
08:33 FreeBirdLjj joined
08:33 <wizard1337> use kaggle and hire someone to train a neural net to parse xml
08:33 ralu joined
08:34 louispan joined
08:34 markus1199 joined
08:35 FreeBirdLjj joined
08:35 <rom1504> great idea
08:35 fizruk joined
08:36 shafox joined
08:36 defaultnick_ joined
08:36 path[l] joined
08:36 nemorichard joined
08:38 Detrumi joined
08:40 zero_byte joined
08:40 jophish_ joined
08:41 <wizard1337> oh, it's the gghc
08:41 <wizard1337> not ghc
08:42 Iskarlar joined
08:42 ericsagnes joined
08:43 systadmin joined
08:43 insitu_ joined
08:44 takle joined
08:45 t_h joined
08:45 defaultnick_ joined
08:46 nick_h joined
08:47 _sg joined
08:48 nemorichard joined
08:48 doomlord joined
08:48 dtornabene joined
08:49 connrs joined
08:50 unK_ joined
08:50 ilja_kuklic joined
08:50 govg joined
08:51 takle joined
08:53 fendor joined
08:54 Iskarlar joined
08:54 araujo joined
08:57 mmn80 joined
08:57 Iskarlar joined
08:59 shafox joined
08:59 <Cale> wizard1337: ??
09:00 oish joined
09:00 <Cale> oh, Glorious Glasgow Haskell Compiler? :)
09:00 errorondefault_ joined
09:01 <errorondefault_> Hi everyone I'm doing a challange for a jobinterview and got stuck on level04 can I ask here for help?
09:01 nick_h joined
09:02 rixile joined
09:02 <wizard1337> will you pay us part of your salary?
09:02 <Cale> lol, "I only want 7%"
09:02 <wizard1337> and are you using gghc or ghc?
09:02 <errorondefault_> haha nice one :D its a job as working student so it probably will be barely enough to pay for rent through college :D
09:02 marr joined
09:03 <wizard1337> are you using the gghc compiler or ghc?
09:03 <Cale> What are you stuck on?
09:03 <errorondefault_> but its in infosec and thats where I want to go so I really want this job
09:03 <errorondefault_> well I probably need to start from the beginning
09:03 <Cale> wizard1337: Are you joking about the Glorious bit?
09:03 <wizard1337> because you want a pole dancer girlfriend?
09:04 <errorondefault_> so via email I get a link to this challenge cant share it because I have my personal login and Im sure they check
09:04 <errorondefault_> so lets say its www.web.com. On there it says: Intro Welcome Continue with Level00 Rules: Use your brain NO DoS, NO bruteforce. Level00 is a link to www.web.com/level00
09:04 xall joined
09:05 <wizard1337> can i use neural nets?
09:05 ystael joined
09:05 <Cale> Do you have an actual Haskell question though?
09:05 <errorondefault_> no
09:06 <cocreature> if you can’t share the question then maybe the point of the challenge is that you figure out the solution yourself
09:06 <Cale> This channel is for discussion of Haskell...
09:06 <errorondefault_> right now I think its related to php and just figuering out this riddle
09:06 <wizard1337> but he has an actual potential haskell job
09:06 defaultnick_ joined
09:06 <errorondefault_> and i really want this job :D
09:07 nick_h joined
09:07 <wizard1337> that's code for "i'm not qualified"
09:07 <wizard1337> seriously though asking other people about job interview questions is really bad,
09:07 <errorondefault_> well im not :D Im second semester but Im eager to learn ;)
09:07 <Cale> anyway, if you have questions regarding the programming language Haskell, I'm sure people here would be happy to help
09:07 <wizard1337> because if you advance to the next step,
09:07 <Cale> Otherwise, it's not really the right place
09:08 <wizard1337> you'll waste their time in that step
09:08 <wizard1337> rather than now
09:08 <errorondefault_> ok youre right sorry about that
09:08 baweaver joined
09:08 <wizard1337> and subsequent steps often involve actually interviewing at a whiteboard etc
09:08 <Cale> wizard1337: pls
09:08 <errorondefault_> thanks anyways guys
09:08 ub joined
09:09 <wizard1337> no etquiette allowed? even functional etiquiette?
09:09 <wizard1337> i resolved his "haskell question"
09:09 biglama joined
09:09 ramzifu joined
09:10 danvet joined
09:10 errorondefault_ left
09:11 <biglama> hi guys, I would like to use HStringTemplate with a custom datatype
09:11 tippenein joined
09:11 <biglama> but one of the field of my datatype is another datatype and I would like to have a custom show for this field
09:11 Einwq joined
09:11 <biglama> I've tried to instantiate ToSElem and Show but it still resort to the default show
09:11 p_q joined
09:11 p_q joined
09:12 alanb99 joined
09:12 maninalift joined
09:12 alanb99 left
09:12 srbaker_ joined
09:13 hazmat_ joined
09:16 eacameron joined
09:16 byte512 joined
09:18 kritzcreek_ joined
09:19 petermw joined
09:20 govg joined
09:21 FreeBirdLjj joined
09:21 freusque joined
09:22 <Cale> biglama: Well, what does toSElem produce for your type?
09:23 balor joined
09:24 tomphp joined
09:24 <lpaste_> biglama pasted “Custom formatting with HStringTemplate” at http://lpaste.net/5642642439081558016
09:24 <biglama> Cale: it returns a string
09:24 takle joined
09:24 <biglama> Cale: I've pasted the code as it may be clearer
09:25 patbecich joined
09:25 takle_ joined
09:25 <lpaste_> biglama revised “Custom formatting with HStringTemplate”: “Custom formatting with HStringTemplate” at http://lpaste.net/5642642439081558016
09:26 <dxtr> Good morning, fellow youngsters
09:26 quchen_ joined
09:27 <Cale> biglama: If you remove the Show instance for Children (you shouldn't need it after all), does it complain?
09:27 grizwako joined
09:28 <biglama> Cale: it does not complain but it does not change the output. Instancing show does not help either !
09:28 <Cale> Well, if it doesn't complain about the lack of an instance of Show, then writing one can't possibly help anything.
09:28 <biglama> I'm a bit confused
09:29 <Cale> oh, what's this GenericStandard business?
09:30 <Cale> Remove all the Data instances too
09:30 <Cale> Just to be sure it's not using those
09:30 defaultnick_ joined
09:30 <biglama> Cale: GenericStandard avoid to define ToSElem instances actually. But then I would have to define a ToSElem instance for person too ?
09:31 <Cale> Possibly, yes
09:31 <brynedwards> The StringTemplate docs have "class Show a => StringTemplateShows a where"
09:32 <brynedwards> Which takes and optional format string, and its default is show. Have you tried instantiating that?
09:32 <Cale> ah, you'd be using the ToSElem instance for Person as it stands
09:33 <Cale> Since you're doing setAttribute with a Person value
09:33 <biglama> brynedwards: I've tried but I'm a bit confused between ToSElem and StringTemplateShows
09:33 <Cale> So if that instance is just based on the Data.Data generic representation entirely, it won't do what you want.
09:33 <biglama> I do not need the format string so I though instantiang ToSElem would be enough
09:34 <Cale> Try just writing a ToSElem instance for Person
09:34 <brynedwards> Yeah but it says the format string is optional so maybe it uses it regardless
09:35 andrei_chifa joined
09:35 <Cale> You're not actually using the ToSElem instance for Children at all, iiuc
09:35 <Cale> (you should be able to comment out / delete that instance and still have the program build if I'm right)
09:37 <Cale> Personally, I avoid libraries like this. Usually it's easy enough just to concatenate strings together the way you want, and do whatever formatting is necessary in-place with whatever functions are appropriate.
09:38 systadmin joined
09:38 <Cale> (Though, I couldn't help writing one of them anyway ;) https://hackage.haskell.org/package/category-printf
09:38 Levex joined
09:39 defaultnick__ joined
09:39 xtreak joined
09:39 <biglama> Cale: here is a trimmed-down example with juste an instance of ToSElem, but it does not work
09:39 <biglama> Cale: http://lpaste.net/6884328818773852160
09:39 whaletechno joined
09:40 <biglama> I'm trying with an instance of StringTemplateShows now
09:40 <Cale> What happens? You get a complaint that the name and children fields aren't present?
09:40 <biglama> Cale: well, I wanted something clean :)
09:40 <biglama> Cale: the code runs but the output is empty for the field, as in
09:40 <biglama> "Your full name is , children = ."
09:40 <Cale> nice
09:41 <Cale> I suspect that's what the SMap constructor is for
09:41 louispan joined
09:41 <Cale> Actually, I would throw this library out on the spot for producing that output rather than an error of some sort.
09:42 <biglama> :)
09:42 halogenandtoast joined
09:42 <biglama> How would SMap play a role here ? I'm looking at the code but don't see where it's used
09:42 <Cale> Well, where you're currently producing a STR
09:42 Wizek_ joined
09:43 <Cale> You want the person thing to have some named subfields which you refer to in your template
09:43 <Cale> So, presumably there's some way to define what those expand to
09:43 <Cale> and if you look at the SElem type
09:44 <Cale> The only thing which looks like it could be doing that job is the SM constructor which takes an "SMap a"
09:44 <Cale> and apparently type SMap a = Map String (SElem a)
09:44 Iskarlar joined
09:44 <Cale> So I'd expect that to be a Map from the "field names" to how to format them.
09:45 defaultnick_ joined
09:46 <Cale> So try something like toSElem x = SM $ Map.fromList [("name", STR $ name x), ("children", STR $ "lol")]
09:46 <biglama> So brynedwards is right, I should instantiate StringTemplateShows instead ?
09:46 <Cale> and I think you can leave out the toSElemList
09:46 <Cale> The default instance for that should do
09:47 tsdh joined
09:48 FreeBirdLjj joined
09:48 <biglama> Cale: your solution works !
09:48 HaskellLord69 joined
09:49 <biglama> I find it a bit cumbersome though
09:49 <Cale> I do too. It's certainly much worse than just writing what you mean
09:49 rcsole joined
09:50 FreeBird_ joined
09:50 <Cale> displayPerson :: Person -> String; displayPerson x = "Your full name is " <> name x <> ", children = lol."
09:50 <biglama> yeah
09:51 <Cale> Ah I suppose you can use ++ for String
09:51 <Cale> I would usually use Text these days :)
09:51 nick_h joined
09:51 rcsole joined
09:51 <biglama> I wanted a generic solution for very large datatype, where you would only have to instantiante show
09:52 <Cale> Also, generally you should try to make show x produce valid source code for constructing x
09:52 <Cale> (or something close to it)
09:53 <Unhammer> if we had no list fusion, would it be right to assume "map (a.b) l" to be more performant than "map a$map b l" ?
09:53 FreeBirdLjj joined
09:53 <Cale> Unhammer: yes
09:53 fendor joined
09:53 <Unhammer> ok, cool
09:53 <Cale> Though I reserve the right to wince at "more performant than"
09:54 <biglama> Cale: can you give me an example ?
09:54 <biglama> of "producing source code"
09:54 <Cale> > show [1,2,3,4,5]
09:54 <lambdabot> "[1,2,3,4,5]"
09:55 <Unhammer> Cale, sorry, "more performanter from"
09:55 <* Unhammer> ducks
09:55 <biglama> oh right
09:55 <Cale> > M.fromList [(1,"hello"), (2,"world")] -- Data.Map tries its best as well
09:55 <osa1> sometimes I wish we had let/letrec distinction in Haskell
09:55 <lambdabot> fromList [(1,"hello"),(2,"world")]
09:55 animated joined
09:56 <biglama> Cale: thanks a bunch anyway, it was very interesting, even though not very productive :)
09:56 <Cale> biglama: What does your overall program do?
09:56 <Cale> What are you using the templates for?
09:56 <Cale> osa1: So you can get away with confusing shadowing?
09:56 <Cale> :)
09:57 FreeBirdLjj joined
09:57 FullyFunctional joined
09:57 <biglama> Cale: I'm generating configuration files randomly and then call an executable
09:57 <biglama> unit testing by hand
09:57 defaultnick_ joined
09:59 <biglama> my configurations files are in the INI format
09:59 andjjj23 joined
09:59 <Cale> Unhammer: hehe, I just feel that whenever someone uses the word "performant" it's because they haven't actually done enough work to justify whatever claim it is that they're about to make -- otherwise they'd talk directly about what kind of performance they meant
10:00 janos__ joined
10:00 defaultnick_ joined
10:01 djellemah joined
10:02 <Unhammer> Cale, yeah … I haven't done any work to measure :) I just got a suggestion from hlint, and started wondering if that was a "pure style" thing, or there were some deeper reason.
10:02 <Cale> It will use less time because it does fewer allocations.
10:02 <Cale> It may use slightly less space, but not significantly less, in isolation.
10:03 defaultnick__ joined
10:04 mpsag joined
10:04 <Cale> (because the cons cells of the intermediate list will immediately become garbage the moment they're created)
10:04 <Unhammer> Even without measuring, experienced coders do kind of write more performant code "by default", pattern-matching on previous experiences or whatnot. My early emacs-lisp was full of tail-recursion because I simply didn't know that .el doesn't TCO, now I'd never think about doing that without good reason.
10:05 spatial_ joined
10:05 <SpinTensor> Hi, started learning Haskell. As exercise i wanted to rewrite the elem function. I get a compile error and I don't know why: http://pastebin.com/c6jJpQnh
10:05 Ch3ck joined
10:05 <spatial_> do val <- value a index return ( BoardState xloc oloc index) val is an IO Int. So there is an error.
10:05 <Cale> "Tail calls" are kind of a weird thing in Haskell as well. There's no need for tail call optimisation because there's nothing which really corresponds to an ordinary call stack to begin with.
10:05 <Cale> (at least in GHC)
10:06 <SpinTensor> (n==x) returns a bool, so why does the compiler want a type (Eq a) somewhere?
10:06 Jacoby6000__ joined
10:06 <spatial_> IO Int will become Int. When ?
10:06 ystael joined
10:06 <Unhammer> yeah … I pretty much don't manually recurse in haskell =P
10:06 <Cale> spatial_: I'm having trouble parsing that
10:06 danza joined
10:07 <Unhammer> spatial_, you can't really escape IO
10:07 <Cale> spatial_: What's the type of value a index?
10:07 FreeBirdLjj joined
10:07 <Cale> Is it IO (IO Int) somehow?
10:07 dan64 joined
10:07 dramforever joined
10:07 <Cale> I'm assuming the triple space there is a newline
10:08 <Cale> Wait, do you use val at all?
10:08 <spatial_> http://pastebin.com/5V3uzVUq val isn't used now. It will be.
10:08 xall joined
10:09 <Cale> Well, this clearly doesn't have the type you've given it
10:09 defaultnick__ joined
10:09 <Cale> You're constructing an IO action which, when executed, is going to give a BoardState
10:09 sid_fules joined
10:09 <mniip> SpinTensor, what are the types of n and x
10:09 freusque joined
10:09 <Cale> So this has type IOArray Int Int -> BoardState -> IO BoardState
10:09 Glooomy joined
10:10 <spatial_> Intention was to get Int from val which is IO Int and use it
10:10 <Cale> If you want to read an IOArray, you'll need to be executing an IO action, you can't do that elsewhere.
10:10 datajerk joined
10:10 <mniip> SpinTensor, you're saying that elem' can be applied to a value of any type and a list of values of that type
10:10 <Cale> Where's the definition of value?
10:11 <mniip> SpinTensor, and then you proceed to use == on those types, but == doesn't work on all types
10:11 <spatial_> value :: ( IOArray Int Int) -> Int -> IO Int value a index = liftIO (runReaderT (readvalue index ) a)
10:11 oish joined
10:11 <mniip> only those that are Eq, hence the type error
10:11 <SpinTensor> it should not matter what they are, right?
10:11 <Cale> mniip: thanks for answering SpinTensor's question btw :)
10:11 <mniip> SpinTensor, of course it does matter
10:11 <mniip> not all types can be =='d
10:11 <SpinTensor> mniip: oh. so I need to write elem' for specific types when using pattern matching?
10:12 mdarse joined
10:12 <Cale> spatial_: whaaaaa
10:12 <mniip> SpinTensor, no
10:12 <mniip> SpinTensor, you just have to specify that 'a' in your type signature should be a type that supports being =='d
10:12 <Cale> spatial_: Are you sure you don't just want value = readArray ?
10:12 insitu joined
10:12 fendor joined
10:12 <mniip> see:
10:12 <mniip> :t (==)
10:12 <SpinTensor> mniip: how do i do that?
10:12 <lambdabot> Eq a => a -> a -> Bool
10:13 <Cale> spatial_: What's the ReaderT shenanigans about?
10:13 <mniip> that 'Eq a' is telling you that 'a' should be an instance of Eq in order to use ==
10:13 <Cale> and that liftIO is definitely unnecessary and does nothing
10:13 <Cale> liftIO :: IO a -> IO a doesn't do anything
10:13 <mniip> you should put a similar 'Eq a =>' context on your type sig
10:13 <Cale> It's only interesting when you're converting an IO action into an action of some other monad
10:14 <SpinTensor> mniip: thanks that did it. its kind of complicated to get your head around all this type stuff
10:15 <mniip> there is actually way to figure out that type signature programmatically, and that's what GHC would have done if you had omitted the type signature,
10:15 <mniip> but you should learn to see it conceptually
10:15 <Cale> SpinTensor: However, note that this advice is exactly what the compiler suggested you do (it doesn't always provide good advice, but it managed to be right in this case!)
10:16 oisdk joined
10:16 <Cale> However, it didn't actually show you the change it wanted you to make, and only described it with technical language :/
10:16 <mniip> Cale, I wouldn't expect a beginner to know what "context" means
10:16 <Cale> yeah
10:16 <mniip> yeah
10:16 <SpinTensor> cale: I saw the (Eq a) in the error, but I had no idea where to include it. I tried something like elem' :: (Eq a) -> a -> Bool but that got different errors with constraint types.
10:17 <spatial_> Cale: That is separate piece to read and write arrays. That piece works.
10:17 <Cale> yeah, needs to be =>
10:17 <spatial_> Just trying to use the value read from the array.
10:17 <* mniip> . o O ( how confusing would it be to beginners if we had Constraint ~ * )
10:18 baldrick joined
10:18 danthemyth joined
10:18 <SpinTensor> Thanks for your help guys. Hope i understood it.
10:18 <Cale> spatial_: So, in a do-block for an IO action, you can indeed read the array
10:18 <Cale> spatial_: But that entire do-expression will be an IO action, and will have type IO t for some type t
10:19 <Cale> spatial_: This is unavoidable -- if you want to read an IOArray, you can't do it from evaluation, you must do it from execution of an IO action.
10:19 <spatial_> Oh. How do I separate IO and non-IO ?
10:19 hazmat_ joined
10:19 arcanine joined
10:20 <Cale> Do you need to interleave writes and reads here, or are you done with writing?
10:20 <Cale> You might want to 'freeze' the IOArray into another array type that is immutable and has operations to read it that aren't IO actions.
10:20 <mniip> SpinTensor, btw I think you defined elem pretty much how it is in Prelude
10:21 <mniip> ...unless it's something like foldr . (==)
10:21 <spatial_> Reads and writes are there here.
10:21 MitchW joined
10:21 <spatial_> I am going back to Java :-)
10:21 <Cale> spatial_: So, if you want to stick with using IOArray, you have no choice but to work with IO actions.
10:21 <SpinTensor> mniip: cool. the version from the book uses guards, but i refused to look at the solution.
10:22 <Cale> There are lots of other data structures you could consider using instead, if you want to avoid IO
10:22 balor joined
10:22 <Cale> I would strongly consider Map, most of the time
10:22 <Cale> (Or IntMap, given that your indices are Int values here)
10:23 <spatial_> But these are very large arrays for Machine Learning.
10:23 eklavya joined
10:23 <mniip> elem _ [] = False
10:23 <mniip> elem x (y:ys) = x==y || elem x ys
10:23 <mniip> --GHC.List
10:23 <Cale> and you're reading and writing them randomly?
10:23 <spatial_> Yes
10:24 datajerk joined
10:24 <mniip> you could use an unboxed array (I mean a library that implements arrays using one)
10:24 <Cale> Okay, then just stick with IO, and either IOArray or perhaps MVector
10:25 <Cale> Oh, and yeah, IOUArray would be more compact
10:25 <SpinTensor> mniip: i pack everything in () because I'm not at the chapter with operator priorities yet.
10:25 <spatial_> Any function that reads or writes an IOArray cannot return a non-IO state ?
10:25 <Cale> Your IOArray Int Int will be an array of pointers to code which construct Int values.
10:25 <mniip> SpinTensor, that's not an issue
10:25 <mniip> as long as it's readable
10:26 <mniip> Cale, is that a fancy way to say that it's lazy?
10:26 <Cale> spatial_: Yeah, because it might produce a different thing every time. The function itself will always produce the same IO action, but the result of that IO action will depend on when you run it.
10:26 <Cale> mniip: yeah
10:26 patbecich joined
10:26 <mniip> you can make it strict can't you
10:26 <Cale> mniip: and that it's boxed
10:27 <Cale> It's boxed for polymorphism's sake regardless
10:27 <mniip> right
10:27 <Cale> IOUArray sidesteps that by only working for particular types
10:27 defaultnick___ joined
10:28 <spatial_> So I need to move all these smaller functions into a larger one.
10:28 <spatial_> And manage it
10:28 <Cale> spatial_: You don't necessarily have to -- IO actions can be broken up into smaller parts as well if you like
10:28 <mniip> MVector sounds cool
10:28 <mniip> looks like it works with ST
10:28 <Cale> But perhaps start with a big lump of code and decide how to carve it up later
10:28 ramzifu joined
10:28 <mniip> which is a nice thing in this context
10:29 <Cale> Oh, and yeah, there's STArray if you want to compute something using mutable arrays and end up with a pure function in the end.
10:29 janos__ joined
10:29 sidei joined
10:29 xall joined
10:29 <Cale> But stick with IOArray for the time being until you get the hang of that
10:29 <mniip> STArray is eh
10:29 <mniip> I was more hinting at STVector
10:30 <Cale> Well, it's similar
10:30 halogenandtoast joined
10:30 travula joined
10:30 cloudhead joined
10:30 phaji joined
10:31 contiver joined
10:31 cyphase joined
10:32 <Cale> spatial_: Just for reference, the Vector library we're referring to is this thing: https://hackage.haskell.org/package/vector
10:33 FreeBirdLjj joined
10:33 bjz joined
10:33 <Cale> It has Data.Vector.Mutable, which is not so different from IOArray or STArray, except that the single type can be used as either one.
10:35 animated joined
10:35 tlaxkit joined
10:36 henriksod joined
10:36 silver joined
10:40 sohail-ahmed joined
10:41 lspitzner joined
10:41 caumeslasal joined
10:41 yogsototh joined
10:42 OnkelTem joined
10:42 defaultnick joined
10:42 fizruk joined
10:44 kuribas joined
10:45 <kuribas> I tested this: https://www.reddit.com/r/haskell/comments/1rcc8t/performance_of_the_st_monad_over_the_state_monad/
10:45 halogenandtoast joined
10:45 <kuribas> I get the same performance, the St monad being slightly slower.
10:46 featherlessbiped joined
10:46 nick_h joined
10:46 oish_ joined
10:46 takle joined
10:47 ericsagnes joined
10:47 <kuribas> I guess ghc (and base) made a lot of progress in 4 years...
10:48 <spatial_> Cale: Let me look at it. Now I have to go back to the drawing board :-)
10:49 swalladge joined
10:50 Yttrill joined
10:50 <Yttrill> hi, i have a question about the gc and threads: am i correct assuming the shared heap collection requires a world stop?
10:51 netheranthem joined
10:51 augur joined
10:51 pleax joined
10:51 halogenandtoast joined
10:52 marfoldi joined
10:53 ramzifu joined
10:53 lithie joined
10:53 <Cale> Yttrill: Yeah, GHC's GC is parallel but stops the world. I seem to recall at some point that they tried a variant which didn't stop the world, and its throughput was much worse. I could be imagining that though.
10:53 <Yttrill> do you know how they stop the threads?
10:53 harfangk joined
10:54 <Yttrill> it's OS dependent of course assuming native threads
10:54 <Yttrill> Linux has a signal but I still don't see how the top of stack can be found
10:55 <ongy> the RTS schedules more threads than it has OS threads either way, it can take over on every heap allocation a thread does
10:55 doodlehaus joined
10:56 Nerterologist joined
10:56 <Yttrill> hang on you said two things: second, it has control on an allocation, my GC stops the world that way also
10:56 revtintin joined
10:56 <Cale> http://simonmar.github.io/bib/papers/parallel-gc.pdf -- I think this paper is still relevant
10:56 <Yttrill> which is not very nice if you're running something long that doesn't do any allocation ;(
10:57 <Yttrill> Yeah i read that paper, but it explains how the GC operates not how it stops the threads
10:57 defaultnick joined
10:57 <Cale> Yeah, it looks like it just describes what takes place immediately following that bit of synchronization
10:58 sagax joined
10:58 <Yttrill> i have a suspicion that there is a per thread local heap that can be collected without a world stop
10:58 <Cale> yes, there is
10:58 <Yttrill> but a stop is still required, i'm curious how to organise the stop
10:58 oish joined
10:59 norotartagen joined
10:59 <Yttrill> the Boehm collector using OS hacks eg SIGSTOP on Linux
10:59 <Yttrill> but i have no idea how that helps find the stack top
10:59 <Yttrill> i know there's a way to do this on Windows
11:00 <Yttrill> so non-Linux unix and OSX remain a mystery :)
11:00 <Cale> Or at least, I think that's right... but I'm now less certain :)
11:01 <Yttrill> the paper is old so there may be improvements
11:01 <Yttrill> if the world stop is done on allocation it makes sense
11:01 augur joined
11:02 <Yttrill> it means Haskell will have to have its own mutex, condition variables etc
11:02 <Yttrill> ones that time out often enough to check for a world stop
11:03 <Cale> Well, GHC's runtime has its own n:m thread scheduler anyway
11:03 <Yttrill> but what happens if a thread is multiplying two matrices? its a long wait until the next allocation
11:04 janos__ joined
11:04 <Yttrill> how does the RTS do that? it would have to capture timer interrupts or make allocations reschedule points ..
11:05 <Cale> oh, right, I was thinking of this version of the GC: http://simonmar.github.io/bib/papers/local-gc.pdf
11:05 <Cale> I'm not sure the version described in that paper is what actually made it
11:05 _sras_ joined
11:06 <_sras_> Does template haskell have a function of type [Dec] -> String ?
11:06 <Cale> _sras_: Which gives you the text of the declarations? That would be nice, but it doesn't.
11:06 animated joined
11:07 ystael joined
11:07 <Cale> _sras_: You can get close (sort of) using -ddump-to-file -ddump-splices
11:07 <Cale> Assuming you just want to look at the generated code
11:07 <Yttrill> that second paper is 2011 which is a bit later
11:08 halogenandtoast joined
11:09 <Cale> The person to talk to about this kind of thing would be Simon Marlow, who is sometimes around as JaffaCake on IRC, but he usually hangs out in #ghc moreso than #haskell
11:09 <Yttrill> ok second paper mentions "spark pool" which i believe from docs is in there
11:10 <Yttrill> ok
11:10 <Cale> The spark pool is part of the mechanism for pure parallelism, rather than for concurrency in general.
11:10 <Yttrill> ok thanks for that info
11:10 dhil joined
11:11 <Yttrill> i'm just learning Haskell but i am also a compiler writer and language designer so curious about some deeper issues
11:11 phaji joined
11:11 jaspervdj joined
11:11 <Cale> When you evaluate par x y, the expression x gets "sparked" which means it's added to a queue of work that can be stolen from by the various Haskell execution contexts if they have nothing better to do.
11:11 Iskarlar joined
11:12 <Yttrill> ok, sort of like a thread pool
11:12 <Cale> (and the result of the evaluation is y)
11:12 <kuribas> Cale: does it run on another core, or just another thread?
11:13 <Cale> Usually it will be another HEC, which is probably running on another core
11:13 <Yttrill> i would guess it depends on tuning parameters
11:13 <Cale> But there's no guarantee that it'll be evaluated on another core
11:14 <Cale> and if you end up needing it too soon, your thread just evaluates it as normal
11:14 takle joined
11:15 <kuribas> Why does is stop the world when it runs in parallel? Does that mean some parts run in parallel, and other stop the world?
11:15 <Cale> There is a window of a couple cycles during which the main thread and some other thread can both begin to evaluate x, and that is just allowed to happen, since they will both produce the same result anyway, and the extra mechanisms required to prevent that are more costly on average than the occasional extremely unlikely duplication
11:15 cfricke joined
11:16 <Cale> It means that it stops the world, and then all the capabilities help to collect garbage at the same time
11:16 <Yttrill> yeah, that was proposed in the 2008 paper for the GC as well
11:16 benl23 joined
11:17 freusque joined
11:17 <_sras_> Cale: Yes. Can you take a look the the fullTableText function here ( https://github.com/folsen/opaleye-gen/blob/14938df0081187539f23f8547fb1b7762e286ac3/src/Generate.hs) and see if it could work?
11:17 <Yttrill> kuribas: the usual reason to stop the world is to find all the roots, which are usually all the thread stacks
11:18 <kuribas> Does it prevent real-time code?
11:18 <Yttrill> there's some kind of new development in the GC world I believe
11:18 <kuribas> (if the stops are long)
11:19 <Yttrill> kuribas: there are collectors which are incremental
11:19 <kuribas> and ght?
11:19 <Yttrill> dunno if the Haskell one is
11:19 xtreak joined
11:19 <Yttrill> actually the design would appear to support the possibility
11:20 <Yttrill> a traditional copying collector copies all live stuff from one huge memory block to another so it cannot be incremental
11:21 <Yttrill> but the GHC one uses blocks and copies old to new with blocks, even the same block
11:21 <Cale> Yttrill: From what I understand, the current collector is a generational hybrid of a copy collector and mark/sweep
11:21 <Yttrill> so it can probably just give up collecting any time
11:22 CurryWurst joined
11:22 troydm joined
11:22 bjz joined
11:23 <Yttrill> mark/sweep can be incremental because you just delete garbage so you can give up any time you like
11:23 <Cale> (and most of the time, it uses the copy collector)
11:24 srbaker_ joined
11:24 <Yttrill> yeah but it uses blocks for copying
11:25 <Yttrill> it looks like it could just give up the collection part way through
11:25 <Yttrill> so you could just run the collector more often and give up after a fixed period, which would make the collector suitable for real time
11:25 <Cale> https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC -- this looks like it might be helpful
11:25 <Yttrill> the problem is more likelyt that Haskell is not suitable for real time :)
11:26 <Yttrill> yeah that looks good if its up to date thanks Cale
11:27 <Cale> In the threaded RTS, there is one nursery per Capability, as each Capability allocates independently into its own allocation area. Nurseries are therefore stored in an array nurseries[], indexed by Capability number.
11:27 <Cale> aha
11:27 <Cale> So we were right about that :)
11:27 Rainb joined
11:28 <Yttrill> well that article says "last modified 6 years ago" :)
11:28 <Cale> haha
11:28 <Yttrill> which is 2011 when the PJ/SM paper was done
11:29 <Cale> Yeah, I don't recall hearing about anything too major going on with the GC since that time though
11:29 <Cale> I could be wrong though
11:29 Gloomy joined
11:33 rixile joined
11:34 lukaramu joined
11:38 Gurkenglas_ joined
11:38 <Yttrill> http://www.cs.utexas.edu/users/speedway/DaCapo/papers/immix-pldi-2008.pdf
11:39 <Yttrill> something has happened recently: Ocaml is going multicore, and that is because only now is there a suitable GC available
11:39 surelyourejoking joined
11:39 <Yttrill> but that's all i know at the moment
11:40 <Yttrill> different performance needs from Haskell though
11:43 Iskarlar joined
11:46 Iskarlar joined
11:47 mrijkeboer joined
11:48 JeanCarloMachado joined
11:49 <Axman6> bgamari: Hey, I just have your wkt package a go and it's not liking my input, seems to not like numbers which don't have a decimal point
11:49 <Axman6> gave*
11:50 sarkin joined
11:50 dramforever joined
11:51 defaultnick_ joined
11:52 AndreasK joined
11:53 skapazzo joined
11:54 zar joined
11:54 defaultnick_ joined
11:55 JagaJaga joined
11:56 <surelyourejoking> I'm doing the Learn You a Haskell tutorials, and I don't understand the syntax for `groupBy`
11:56 <surelyourejoking> e.g groupBy (\x y -> (x > 0) == (y > 0)) values
11:57 sh0rug0ru joined
11:57 <surelyourejoking> where values is a list of some positive and negative floats
11:57 tommd joined
11:58 <Axman6> which part do you not understand?
11:58 <surelyourejoking> I suppose the lambda
11:58 <surelyourejoking> (\x y -> (x>0) == (y>0))
11:58 <Axman6> (\x y -> (x > 0) == (y > 0)) is a lambda function which takes two argument named x and y and returns the expression (x > 0) == (y > 0)
11:58 bennofs joined
11:59 pickle_ joined
11:59 <surelyourejoking> what does the right hand side evaluate to
11:59 <Axman6> > (\x y -> (x > 0) == (y > 0)) 1 1
11:59 <lambdabot> mueval-core: Time limit exceeded
11:59 <int-e> > let x = 1; y = -1 in ((x > 0), (y > 0), (x > 0) == (y > 0))
11:59 <lambdabot> (True,False,False)
11:59 <Axman6> uh, come on lambdabot
11:59 <surelyourejoking> so it's true if x and y are positive
11:59 guardianJ left
11:59 <Ferdirand> or if x and y are not positive
12:00 fweth joined
12:00 <Axman6> it's true if x and y have the same sign (roughly)
12:00 mkoenig joined
12:00 dramforever joined
12:00 defaultnick joined
12:00 <Axman6> (assuming 0 is negative =) )
12:00 maninalift joined
12:00 maybefbi joined
12:01 k0001 joined
12:01 <surelyourejoking> ok it's an XNOR logic gate then.
12:01 <surelyourejoking> right I understand the lambda function then
12:01 oish joined
12:01 <Axman6> looks like a nice way to find groups of increasing or decreasing runs... but that's not actually what it'll do sadly, because groupBy's behaviour is a surprising
12:02 <Axman6> > groupBy (\x y -> (x > 0) == (y > 0)) [1,2,3,2,1,0,-1,-2,-3,-2,-1]
12:02 <lambdabot> mueval-core: Time limit exceeded
12:02 <Axman6> what are you doing lambdabot!
12:02 <int-e> Axman6: the given relation is symmetric, so groupBy should not produce any surprises.
12:02 <int-e> @undef
12:02 <lambdabot> Undefined.
12:02 <int-e> > groupBy (\x y -> (x > 0) == (y > 0)) [1,2,3,2,1,0,-1,-2,-3,-2,-1]
12:02 <Axman6> > groupBy (\x y -> (x > 0) == (y > 0)) [1,2,3,2,1,0,-1,-2,-3,-2,-1]
12:02 <lambdabot> [[1,2,3,2,1],[0,-1,-2,-3,-2,-1]]
12:02 <lambdabot> [[1,2,3,2,1],[0,-1,-2,-3,-2,-1]]
12:02 <surelyourejoking> so let me clarify, whenever the equality condition is met, groupBy causes a split in the list?
12:03 Snircle joined
12:03 <surelyourejoking> sorry for the appaling terminology.
12:03 <surelyourejoking> *appalling.
12:03 <fweth> is there a built-in function like f::Just a->Just a->Just a; f(x)_=Just x; f(Nothing)(Just y)=Just y; f(Nothing)(Nothing)=Nothing ?
12:03 <brynedwards> :t groupBy
12:03 <lambdabot> (a -> a -> Bool) -> [a] -> [[a]]
12:04 <brynedwards> I'd say groupBy groups a list into multiple lists ;)
12:04 harfangk_ joined
12:04 <int-e> surelyourejoking: no, it's the oppisite, a split happens when the first element of the current group is not in relation with the list element being processed
12:04 <fweth> Sorry, I mean f::Just a->Just a->Just a; f(Just x)_=Just x; f(Nothing)(Just y)=Just y; f(Nothing)(Nothing)=Nothing ?
12:04 lavalike joined
12:04 <jle`> fweth: looks like <|>
12:04 <Axman6> int-e: many people are surprised that the comparison isn't make on consequtive elements, so groupBy (>) would produce lists of increasing runs. I also think the current definition is useful, but both versions would have the same type and neither convey their behaviour
12:04 <jle`> fweth: or mplus
12:04 <fweth> thanks!
12:04 <jle`> no problem!
12:05 harfangk__ joined
12:05 <int-e> > groupBy (<) [3,6,4,0,6,3,-1,-2,-3]
12:05 <lambdabot> [[3,6,4],[0,6,3],[-1],[-2],[-3]]
12:05 <jle`> it's also the behavior that a lot of people want for <>/mappend for Maybe
12:05 <jle`> but we do not live in that world
12:05 <jle`> can u imagine tho
12:06 <int-e> Axman6: right, actually I should have used the term "equivalence relation" because symmetry alone is not enough to avoid such surprises.
12:06 <Axman6> > groupBy (>)[1,100,2,300,2,0,1,2]
12:06 <lambdabot> [[1],[100,2],[300,2,0,1,2]]
12:06 janos__ joined
12:06 <Axman6> uh should've been (<) (or (<=)) obviously
12:06 <Axman6> > groupBy (<)[1,100,2,300,2,0,1,2]
12:07 <Hafydd> groupBy shouldn't be used without an equivalence relation.
12:07 <lambdabot> [[1,100,2,300,2],[0,1,2]]
12:07 ystael joined
12:08 <int-e> Axman6: the "surprise" really only comes up when you start thinking about how groupBy could be implemented and then see that one of the possible implementations would be useful to produce increasing runs of a sequence.
12:08 <int-e> and then you find out that the actual implementation is not the one that allows this trick.
12:10 Sonderblade joined
12:10 Iskarlar joined
12:12 valkyr2e joined
12:13 bob3434 joined
12:13 mpsag joined
12:14 Adios joined
12:14 <surelyourejoking> ok what on earth does `groupBy (>) xs` do
12:14 <surelyourejoking> I see that it makes sublists of increasing length
12:14 <surelyourejoking> but why
12:15 <kuribas> If (m1,m2) = Data.Map.Split x is O(log n), then is Data.Map.Union m1 m2 also O(log n)?
12:15 ramzifu joined
12:15 <int-e> surelyourejoking: it doesn't.
12:15 <int-e> surelyourejoking: basically forget that you ever saw this and stick to "groupBy shouldn't be used without an equivalence relation"
12:16 <surelyourejoking> ok I'm very happy to do so.
12:16 <int-e> surelyourejoking: (the sublists that it does produce have the property that the first element is the smallest. I can't think of a case where this is useful.)
12:16 <surelyourejoking> So one more time, groupBy looks at elements of a list two at a time, and makes a split when the equality condition between those two items is not met?
12:17 <dramforever> Sounds pretty deterministic to me, actually
12:18 defaultnick joined
12:18 oish joined
12:18 <int-e> surelyourejoking: No, it always compares the next element to the first element of the current group. But if the relation is an equivalence relation then your model produces the same results.
12:18 danthemyth joined
12:18 deepfire joined
12:21 <surelyourejoking> and as you've said, I should stick to equivalence relations.Thank you for the help!
12:22 guardianJ joined
12:23 oish joined
12:24 sablib_ joined
12:25 doodlehaus joined
12:26 fendoer joined
12:26 alfredo joined
12:28 Iskarlar joined
12:28 lep-delete joined
12:29 merijn joined
12:36 fendor joined
12:36 rgr joined
12:38 bob3434 joined
12:38 guardianJ joined
12:38 zar joined
12:38 certainty joined
12:39 defaultnick__ joined
12:42 djellemah_ joined
12:43 hoppfull joined
12:43 wlemuel joined
12:44 janos__ joined
12:44 caumeslasal joined
12:45 k0001_ joined
12:46 cschneid_ joined
12:47 sdothum joined
12:47 <hoppfull> Hello! I would like to create a "random" function that is pure. I need it for a simulation so that I get "random" behaviour but I can easily reproduce a situation with the same starting seed. However I seem to be having trouble finding what I'm looking for. If it rings a bell do you think you could help me by pointing me in the right direction? Is there a formal term for what I am looking for?
12:49 <pacak> :t random
12:49 <lambdabot> (Random a, RandomGen g) => g -> (a, g)
12:49 <pacak> :t mkStdGen
12:49 <lambdabot> Int -> StdGen
12:50 <pacak> > fst (random (mkStdGen 10)) :: Int
12:50 <lambdabot> mueval-core: Time limit exceeded
12:50 <kuribas> hoppfull: https://xkcd.com/221/
12:50 <pacak> lambdabot: WAT?
12:51 <kuribas> > take 20 $ randomRs (0, 1) (mkStdGen 0)
12:51 <unclechu> hey guys, is registration on hackage working? it tells me that confirmation email sent but i don't see in my inbox anything, also in smap directory
12:51 <lambdabot> [1,1,1,0,0,1,1,1,1,0,1,0,0,0,0,1,0,1,1,0]
12:51 <pacak> hoppfull: Anyway, look at System.Random
12:52 <hoppfull> Thanks guys
12:53 <kuribas> > take 20 $ (randomRs (0, 1) (mkStdGen 0)) :: [Double]
12:53 <lambdabot> [0.9871468153391151,6.761085639865827e-2,5.591622274642816e-2,0.621389914632...
12:53 systadmin joined
12:53 xaviergmail joined
12:54 _sg joined
12:55 phaji_ joined
12:56 <Cale> unclechu: you might want to email admin@hackage.haskell.org with that
12:56 fendor joined
12:59 fendor joined
13:00 sword865 joined
13:03 phaji__ joined
13:04 <kuribas> There should be an unSplit in Data.Map, the reverse of split...
13:04 <kuribas> or unSplitUnsafe.
13:05 fendor joined
13:05 <Hafydd> There should be a safePerformIO, which is the inverse of unSafePerformIO.
13:05 line joined
13:06 shookees joined
13:06 shookees joined
13:07 janos__ joined
13:07 <magthe> In emacs I apparently have flycheck configured to use ghc to warn me of issues in my code (my flycheck-checker is set to haskell-stack-ghc), given that I read elisp *really* badly I searched online for how this might have been down... I managed to find nothing. Anyone in here who can offer some pointers on this? (I'd like to see if I can use something similar in my git pre-commit hook)
13:07 <magthe> s/down/done
13:07 fendor joined
13:08 schjetne joined
13:08 ystael joined
13:08 <cocreature> Hafydd: that’s call "pure"
13:08 defaultnick joined
13:09 <cocreature> *called
13:10 <kuribas> or id?
13:10 bezirg joined
13:10 <kuribas> :t id putStrLn
13:10 <lambdabot> String -> IO ()
13:10 michael1 joined
13:10 <kuribas> magthe: try #haskell-emacs
13:11 <Hafydd> But it doesn't have the property that safePerformIO . unSafePerformIO = id. It can't recover the nondeterminism from the result of unSafePerformIO.
13:13 <hpc> safeUnPerformIO
13:13 <Hafydd> The function it produces is interesting, though... IO a -> IO a, which freezes one result in time and makes it pure.
13:14 <merijn> Hafydd: Eh, isn't this a rather indirect way of trying to reinvent ST?
13:14 <pacak> counsafePerformIO maybe...
13:14 <Tuplanolla> :t safeUnperformIO
13:14 <lambdabot> a -> IO a
13:15 <Hafydd> Ah, there we go.
13:15 <Hafydd> merijn: I don't think so. Not even ST allows you to recover an action from its result.
13:15 zcourts joined
13:17 janos__ joined
13:17 andrei_chifa joined
13:17 <Hafydd> This is possible in the extremely powerful and esoteric Const Monad, though.
13:17 <merijn> Const isn't a monad
13:17 <merijn> Did you mean Cont?
13:17 Nicnux joined
13:18 cinimod joined
13:18 insitu joined
13:18 spatial joined
13:18 <spatial> http://pastebin.com/AN9S7YLW if loop standard is this ?
13:19 <Hafydd> Oh, whoops, I mean Identity.
13:19 <spatial> I mean indentation has a slight problem.
13:20 <Hafydd> It's so powerful and esoteric that I sometimes forget its name.
13:20 animated joined
13:20 systadmin joined
13:21 defaultnick_ joined
13:22 osa1 joined
13:22 osa1 joined
13:23 binaryplease joined
13:24 defaultnick_ joined
13:24 eacameron joined
13:24 surelyourejoking joined
13:26 ramzifu joined
13:26 <kuribas> There should be a way to delete a range from a Map in O(log n).
13:26 AndroUser joined
13:26 <merijn> kuribas: Isn't dfeuer working on that kinda thing?
13:27 <kuribas> merijn: that would be great.
13:27 AndroUser joined
13:28 <Ferdirand> assuming the number of elements covered by the range is << n ?
13:28 <maerwald> any useful xml package with xpath support?`the 'xml' package doesn't seem to have it and hxt is just useless complexity
13:28 <Ferdirand> or do you ignore the average gc cost ?
13:29 caumeslasal joined
13:29 <kuribas> Ferdirand: I don't think GC is linear in garbage collected.
13:29 <kuribas> ghc likes garbage.
13:30 <quchen_> It’s copying, so shouldn’t it be linear in the garbage *not* collected?
13:31 <spatial> http://pastebin.com/C3Fp7MAx This has the indentation problem.
13:31 <quchen_> … up to linear factors ;-)
13:32 <kuribas> quchen_: it doesn't copy the hole heap, does it?
13:32 cloudhead joined
13:32 dhil joined
13:32 <quchen_> kuribas: Nope, it’s generational
13:33 ramzifu joined
13:33 <quchen_> spatial: There is no »else«
13:33 <spatial> I thought that is acceptable
13:33 lukaramu_ joined
13:34 <merijn> maerwald: xml-conduit?
13:35 <quchen_> spatial: No, every »if« must have both »then« and »else« in Haskell.
13:35 <merijn> quchen_: Correct
13:35 <merijn> GHC's GC is linear in the amount of live data
13:35 ub joined
13:35 <quchen_> merijn: I know my ifs! ;-)
13:35 coot joined
13:35 <quchen_> Oh, the GC thing. Yes that too.
13:35 <merijn> quchen_: I meant the GC :p
13:35 <spatial> http://stackoverflow.com/questions/15256471/nested-control-structure-in-haskell
13:35 <kuribas> spatial: what should it return if the condition is false?
13:36 shafox joined
13:36 <spatial> No return. Only state changes.
13:36 defaultnick joined
13:36 <kuribas> :t when
13:36 <lambdabot> Applicative f => Bool -> f () -> f ()
13:36 <kuribas> spatial: perhaps you want "when"
13:36 <merijn> Basically, GHC's GC is optimised for high-throughput workloads with a, preferably, not too excessive resident set
13:37 AndroUser joined
13:37 <spatial> kuribas: haven't seen when
13:37 doodlehaus joined
13:37 <quchen_> ?src when
13:37 <lambdabot> when p s = if p then s else return ()
13:38 freusque joined
13:38 <maerwald> merijn: where does it have xpath support?
13:38 <merijn> maerwald: Not direct xpath support, but the combinators are modelled after xpath
13:38 <kuribas> spatial: look at lambdabots output
13:38 <maerwald> merijn: that's pretty limited, xpath is a language
13:38 <merijn> maerwald: So most (all?) XPath queries should be fairly trivial to write
13:39 Aruro joined
13:39 mada joined
13:39 <maerwald> not interested in that kind of oddity
13:39 <quchen_> spatial: It’s basically single-branch »if«, as long as you’re in an Applicative context.
13:39 <Aruro> is brew install ghc a trap? takes hours to compile.
13:39 <merijn> Aruro: Why are you compiling? Why aren't you installing a binary distribution?
13:40 <spatial> But this is a simple 'if'
13:40 <Aruro> i just did brew install ghc
13:40 <merijn> Aruro: In short, yes that's a trap
13:40 harfangk joined
13:40 <Aruro> wanted to be SMART.
13:40 <merijn> Aruro: I don't use brew, so I dunno wtf they do
13:40 <spatial> I have no idea what Applicative is.
13:40 cris_ joined
13:40 <Aruro> they have 8.0.2 compiling from source
13:40 <quchen_> spatial: Oh. Well, IO is an example of one. In IO, you can use »when«.
13:40 <merijn> Aruro: There's https://ghcformacosx.github.io/ but that's 7.10
13:40 <maerwald> guess this is another case of: try to find a useful library in haskell, realize there are only two options: 1. libraries that lack almost all required functionality to do a real-world project, 2. libraries that are just DSLs with a sh*tload of complexity, requiring you to invest more time than is useful
13:41 <quchen_> spatial: Hold on a second.
13:41 <Aruro> which takes more than 3 hours, im getting ready for 8 hours compiling
13:41 <kuribas> spatial: it's more general as Monad. You can substitue Monad for it.
13:41 <merijn> Aruro: There's also stack (never used it), or just manually installing the GHC bindist from the GHC website
13:41 doodlehaus joined
13:41 <merijn> Aruro: Compiling a release GHC is slow, yes. It needs to bootstrap
13:41 <Aruro> merijn: perhaps i had to install via stack, there is haskell-stack formula
13:41 <spatial> But even if loops are Monads in Haskell :-)
13:41 <Aruro> so 4 hours in i give up? :)
13:41 <cris_> hi , i write up a library an upload to git , but i am not sure if the structure is right, as i could not import all of them in ghci, see https://github.com/szehk/Haskell-Carbonara-Library/blob/master/src/Data/Carbonara.hs
13:42 <quchen_> spatial: Loops aren’t monads. (I don’t think the statement makes much sense.)
13:42 <cris_> i intended to use /src/Data/Carbonara.hs to load all the other modules, not sure if this file is correct
13:42 osa1 joined
13:42 osa1 joined
13:42 <quchen_> spatial: In IO, you have a value that just does nothing: »pure ()«.
13:43 <quchen_> It’s a NOOP that does nothing but return »()«.
13:43 <quchen_> You can use that to do nothing.
13:43 <spatial> Yes
13:43 <quchen_> Sooo: if a == 0 then putStrLn "hello" else pure ()
13:43 <quchen_> This will print if a is 0, and do nothing otherwise.
13:43 <spatial> () should be in else ?
13:44 <quchen_> »when« is a convenience definition for this,
13:44 <cris_> my system is Slackware 14.2 + nixpkgs
13:44 <quchen_> when (a == 0) (putStrLn "hello")
13:44 fendor joined
13:44 <spatial> So this if loop is wrong ?
13:44 <quchen_> If loop?
13:44 cpennington joined
13:45 <spatial> http://pastebin.com/C3Fp7MAx
13:46 Guest4561 joined
13:46 Guest4561 left
13:46 whiteline joined
13:46 <quchen_> Yes, it’s wrong. But you can fix it by adding »else« branches to all »if«.
13:46 <spatial> Let me try
13:47 <quchen_> And if you don’t want to do anything in the else branch, let it evaluate »pure ()«.
13:48 <kuribas> spatial: in C an if statement isn't an expression, it doesn't need to return anything. But in haskell it does.
13:48 <cris_> when i type ghci> :m + Data.Carbonara
13:48 <kuribas> spatial: without "else", haskell doesn't know what to return.
13:48 <cris_> this error msg appears: error: Could not find module `Data.Carbonara' It is a member of the hidden package `carbonara-0.0.1@carbonara-0.0.1-9mRaHjrFnefKzrLX1w1WSO'. Prelude>
13:49 line joined
13:49 <spatial> http://pastebin.com/bdKJ3Gr3 Like this ?
13:50 <quchen_> spatial: There’s still another else missing.
13:50 doomlord joined
13:50 <quchen_> 3 ifs, only 2 else
13:51 <Unhammer> wtf do I do with bimodal criterion graphs :-S
13:51 JoshS joined
13:52 Jacoby6000__ joined
13:52 xektor joined
13:53 andrei_chifa joined
13:54 fendor joined
13:54 dsh joined
13:54 <cocreature> Unhammer: run your benchmarks again and hope one mode disappears :)
13:55 fendor joined
13:55 lak joined
13:55 <spatial> quchen_:() is »pure ()« ?
13:56 <spatial> newnextstate :: ( IOArray Int Int) -> BoardState-> IO () That is the type
13:56 <Unhammer> cocreature, now they're trimodal! haha I should probably check top …
13:56 <dramforever> no, literal 'pure ()'
13:56 <quchen_> No, () is the (single possible) value of the () type (pronounced »unit«). »pure ()« is the »pure« function applied to it.
13:56 <dramforever> letter p, letter u, letter r, letter e, space, open paren, close paren
13:56 <quchen_> pure () :: () -> IO ()
13:57 <dramforever> you mean pure :: () -> IO ()
13:57 surelyourejoking joined
13:57 <spatial> Thanks. All this for a if loop :-)
13:58 tommd joined
13:58 Itkovian joined
13:58 <Logio> spatial: what should your code be doing with the IOArray it's given?
13:58 <dramforever> well, that's what you get by writing haskell programs like that :(
13:58 <Itkovian> how do I tell ghc that libgmp.a is not in the expected location?
13:59 <Logio> spatial: because right now it seems to me that the parameter a is not used at all, but instead shadowed by a <- readvalue index
13:59 <spatial> It works with all your help
13:59 <kuribas> spatial: or with multiway if http://lpaste.net/353306
13:59 <spatial> Login: Fixed that
14:00 <spatial> Logio: Fixed
14:00 fendoer joined
14:00 geekosaur joined
14:00 <kuribas> spatial: it looks very imperative
14:00 <Itkovian> ok nvm, -L should not have a space behind it :/
14:01 <spatial> kuribas: That is more legible.
14:01 <quchen_> spatial: There are no »if loops«. Ifs don’t loop. At best, you could argue »if« to be a loop that is run 0 to 1 times. But then you’d also have to say »statement loop« for things that run exactly once.
14:01 ystael joined
14:01 cpennington joined
14:01 <kuribas> quchen_: maybe he want multiway if, like lisp COND
14:02 <quchen_> Yes, a multi-if would be useful here.
14:02 bodisiw joined
14:02 <spatial> I got 'when' now
14:03 defaultnick__ joined
14:05 vektorweg1 joined
14:05 Dasio joined
14:08 <Dasio> Hello, could someoen help me how to Group list by equivalence relation, I tried something like this http://pastebin.com/JdH1J0K4
14:08 eacameron joined
14:09 janos joined
14:10 <c_wraith> Dasio: group only groups *consecutive* elements by an equivalence relation
14:11 Glooomy joined
14:11 wlemuel joined
14:12 <Dasio> c_wraith: I found this http://stackoverflow.com/questions/8262179/group-list-by-equivalence-relation, so i have to somehow sort it ? but idk how
14:12 <c_wraith> sort is one approach, but it's not the only one
14:13 <Dasio> is there any simpler solution ?
14:14 <c_wraith> You could repeatedly use partition
14:14 <c_wraith> well, partitionBy
14:14 <c_wraith> Err, no. partition is the one that takes a predicate
14:14 hazmat_ joined
14:16 Iskarlar joined
14:17 jan_path joined
14:18 Ch3ck joined
14:19 echo-area joined
14:19 andrei_chifa joined
14:21 schjetne joined
14:21 defaultnick joined
14:22 eliasr joined
14:24 dbmikus joined
14:24 jdnavarro joined
14:26 ub joined
14:27 tsmish joined
14:27 dfeuer joined
14:28 mathk joined
14:29 <mathk> Hi, Anyone can show me some example of use of `Monad ((,) a)` ?
14:29 acarrico joined
14:29 <mauke> > return 42 :: (String, Integer)
14:29 <lambdabot> ("",42)
14:30 <c_wraith> mathk: It's exactly the same thing as the Writer monad, if that helps
14:31 danthemyth joined
14:31 alx741 joined
14:31 <mathk> I see thanks
14:31 defaultnick joined
14:31 sellout- joined
14:33 refold joined
14:33 sw4n joined
14:36 codesoup joined
14:37 <mathk> c_wraith: Because of the Monoid constrain, should I understand that not only it is a Writer but it also collect the different write ?
14:38 mohsen_ joined
14:38 <c_wraith> Writer has the same Monoid constraint
14:38 <mathk> ok
14:38 defaultnick joined
14:39 steeze joined
14:40 takle joined
14:42 skeuomorf joined
14:43 jan_path joined
14:44 thewickedaxe joined
14:45 <unclechu> hi guys, does anyone know how to specify 'cabal' version for Travis-CI config?
14:45 travula joined
14:46 <cris_> hi, could you check if my "personal libraries" section are correct? thanks in advance https://hastebin.com/ijeviqoqit.rb
14:47 <cris_> this is my ~/.nixpkgs/config.nix
14:47 <Aruro> is it possible to run servant in sate monad? so the server can print its own log?
14:48 <cris_> i want to install my own library into nix ; i search over google and come up with above , but it still not working anot working
14:48 janos joined
14:48 <cris_> after i run $ nix-env -iA nixpkgs.myHaskellEnv
14:49 cdg joined
14:49 <bennofs> cris_: it should look like https://hastebin.com/ilujoqaxif.m
14:49 chlong_ joined
14:50 <bennofs> cris_: also if you want to have carbonara in the env, you should add to the list of packages in the ghcWithPackages call
14:50 <bennofs> cris_: like https://hastebin.com/hutepuxeqi.m
14:50 <bezirg> hello, I have a type erro: ambiguous type, with only one potential instance. Can I force ghc to pick that instance, even if that means that the open world assumption of type classes will be broken?
14:51 FjordPrefect joined
14:52 afarmer joined
14:52 v0id_NULL joined
14:52 <jan_path> bezirg: Is an explicit type signature an option?
14:54 <Aruro> does cabal have option of installing all libraries with prefix ? like : cabal install lens*
14:54 <cris_> thanks bennofs
14:54 <bezirg> jan_path: nope
14:55 someone_ joined
14:55 mrijkeboer joined
14:56 `^_^v joined
14:56 <lyxia> bezirg: can you show us the instance and the use site
14:56 <cris_> bennofs: i got this error $ nix-env -iA nixpkgs.myHaskellEnv error: value is a set while an integer was expected, at /home/hp/.nixpkgs/config.nix:4:18
14:57 cereal_killer_ joined
14:58 janos joined
14:58 mizu_no_oto_work joined
14:58 rgr joined
14:58 <bennofs> cris_: try https://hastebin.com/ayutuyibif.m, nix does not support ~ i believe
14:59 phynite[Alex] joined
14:59 <lpaste_> bezirg pasted “A subtyping ambiguity error” at http://lpaste.net/353312
14:59 janos__ joined
15:00 <bezirg> I lpasted it, I use an explicit subtyping function. I wish it was semi-explicit (no need to resolve the ambiguity) than explict (having to add type signatures)
15:02 <bezirg> btw, I_ is a subtype of I in that code
15:02 <bezirg> it is a contrived example
15:03 <lyxia> bezirg: will I ever be a subtype of something else
15:03 rekahsoft joined
15:03 <bezirg> lyxia: no, let's assume closed world
15:03 <lyxia> this question sound weird if taken out of context
15:03 <cris_> hi bennofs , i have changed the path to hard path , but no luck , still see the same error ... h
15:03 tsahyt joined
15:04 <lyxia> bezirg: then you can rewrite the instance Sub I I to instance I ~ b => Sub I b
15:04 <lyxia> bezirg: it says exactly that I is only a subtype of itself, and helps type inference.
15:05 <bennofs> cris_: oh also try removing the slash at the end of the path
15:06 <bezirg> lyxia: thank you, this indeed helped
15:06 <bezirg> lyxia: however, how can I say the same for I_ ? that I_ is a subtype of itself
15:06 <tsahyt> hello! is there a type that represents floating point numbers between 0 and 1 only?
15:06 <bezirg> lyxia: if I use the same EqualityConstraints pattern, it leads to another ambiguity
15:06 <tsahyt> including both endpoints
15:07 drostie joined
15:07 <lyxia> bezirg: well it's false for I_. I_ is not only a subtype of itself.
15:07 <cris_> hi bennofs, it works this time!!
15:07 <byorgey> tsahyt: no
15:07 <tsahyt> byorgey: not even in some library?
15:08 <bezirg> lyxia: indeed
15:08 <byorgey> tsahyt: I don't know, there might be one in some library somewhere, who knows
15:08 <lyxia> bezirg: you end up with an instance overlapping with Sub I_ I, so this doesn't help.
15:08 <bezirg> lyxia: OverlappingInstances will not do the job you think?
15:08 <lyxia> bezirg: you maybe it is only a super type of itself, then you could have instance a ~ I_ => Sub a I_
15:08 <byorgey> tsahyt: it depends what these numbers should represent and what kind of operations they should support.
15:09 <tsahyt> byorgey: seems easy enough to provide a wrapper around Double with smart constructors and numeric instances implementing either some form of modular or saturating arithmetic. but that seems like wasting a lot of the possible range of Double
15:09 defaultnick joined
15:09 <tsahyt> well I want to write a function [0,1] -> a, representing the (interpolated) frequency domain of a signal
15:09 <tsahyt> so really querying it would be enough I suppose
15:10 <byorgey> tsahyt: sure, it's pretty easy, which is probably why there's no standard library for it (and because there are lots of choices one could make for the operations and no obvious "right" choice)
15:10 <tsahyt> fair enough
15:10 <cris_> hi bennofs , i believe i should have installed my carbonara library to my nix ; when i enter ghci and type this ghci> :m + Data.Carbonara , then this error msg shows: Could not find module `Data.Carbonara' It is a member of the hidden package `carbonara-0.0.1@carbonara-0.0.1-9mRaHjrFnefKzrLX1w1WSO'.
15:10 <tsahyt> I'll think about whether this is a smart idea and possibly implement my own if it makes sense
15:10 <byorgey> tsahyt: who cares about wasting the range of Double? If you really care about memory usage, then use Float instead of Double
15:10 <jan_path> bezirg: Would a functional dependency do: class Sub a b | a -> b. So any type can only be subtype of at most one supertype?
15:10 <bezirg> lyxia: I added instance (a ~ I_) => Sub a I_ where up = id , but it didn't work
15:10 <lyxia> bezirg: it won't. Let's say you had instance {-# OVERLAPPABLE #-} b ~ I_ => Sub I_ b, but also instance Sub I_ I, then the first instance will never be selected as long as b is unknown
15:11 <lyxia> because it overlaps with the second.
15:11 <tsahyt> byorgey: well I could have better precision within the same number of bits. not that it really matters in practice I guess
15:11 <byorgey> tsahyt: sure, you just have to decide what you care about.
15:11 <lyxia> bezirg: it will only be selected if you know in advance that b ~ I_, which defeats the whole point of the trick.
15:11 <tsahyt> first I need to figure out how to interpolate the spectrum in the first place
15:11 max3 joined
15:12 gcross_ joined
15:12 janos joined
15:12 <tsahyt> this is simultaneously an attempt at learning more about DSP, so I'm writing this code as I go and discover the concepts.
15:12 <byorgey> sounds like fun
15:12 <tsahyt> it's been quite entertaining so far. I have no idea how well my code would run in the real world yet and there are quite a few challenges to be solved still to make this actually usable
15:13 <bezirg> lyxia: y, you are right
15:14 <bezirg> jan_path: I don't think functional dependency works, because there is not a single mapping from a to b. There may be many a's mapping to different b's
15:14 <lyxia> bezirg: Oh I didn't realize instance a ~ I_ => Sub a I_ overlaps with the previous one, that's pretty bad.
15:14 <bezirg> lyxia: I also tried ClosedTypeFamilies, AllowAmbiguityTypes but it didn't work
15:15 nwf joined
15:15 jmcarthur joined
15:16 <lyxia> I can't see how these extensions would help
15:17 shaal joined
15:17 shaal left
15:17 <bezirg> lyxia: I thought maybe I can close somehow the Sub typeclass through ClosedTypeFamilies, but it didn't work. AllowAmbiguityTypes can be used to "delay?" ambiguity resolution to the call site. Also didn't work
15:18 <bgamari> Axman6, hi
15:18 <bgamari> Axman6, did you work it out?
15:19 defaultnick joined
15:19 wraithm joined
15:19 fosskers joined
15:20 <lyxia> bezirg: you don't have definitions with ambiguous types though. The ambiguity is only at the call site.
15:20 thewickedaxe left
15:20 <bezirg> lyxia: I thought maybe "default" could help here, but that is restricted to single parameter type classes of Eq,Ord,Num,Show
15:20 ystael joined
15:20 <lyxia> bezirg: This kind of explicit subtyping relation looks like an antipattern, because of this kind of issues and hacks involved.
15:21 govg joined
15:21 <bezirg> lyxia: y definitely it is an antipattern. Standard Haskell does not support subtyping
15:21 <lyxia> But, maybe you have other good reasons. *shrugs*
15:21 <bezirg> lyxia: y indeed
15:21 <merijn> lyxia: No ambiguous definitions is only true without extensions :)
15:22 JuanDaugherty joined
15:22 wraithm joined
15:22 simukis__ joined
15:22 <merijn> Higher rank types don't have a unique most general type, so there types can be ambiguous even at the definition
15:24 lithie joined
15:25 KarboniteKream joined
15:25 Xanather joined
15:28 xuinkrbin joined
15:30 defaultnick joined
15:31 Kreest__ joined
15:32 dan_f joined
15:33 <cris_> bennofs: I have resolved the issue, it was due to my old version of carbonara still lie in the system, which interfere with my current version; i just $ ghc-pkg unregister ...
15:33 janos joined
15:33 <cris_> bennofs: thanks v much for your help
15:33 Aune joined
15:34 revprez_atlanta joined
15:34 HarveyPwca joined
15:34 benl23 joined
15:35 <bezirg> lyxia: what about IncoherentInstances?
15:36 sepp2k joined
15:36 dsub joined
15:37 Rotaerk joined
15:37 osa1 joined
15:37 <lyxia> Don't use this.
15:38 nilof_ joined
15:38 nilof joined
15:38 nilof__ joined
15:39 <merijn> IncoherentInstances secretly enables -XILikePainAndHateMyself
15:40 Luke joined
15:41 oisdk joined
15:41 pasukon joined
15:44 <bezirg> lyxia: I understand it is bad, but do you think it will lead to false positives (programs with concrete subtyping errors compiling correctly)? I can only think that it will lead to false negatives
15:44 owiecc joined
15:45 <lyxia> You might end up picking instances you did not intend to.
15:45 coltfred joined
15:45 defaultnick joined
15:45 fizruk joined
15:45 robkennedy joined
15:47 Itkovian_ joined
15:48 <nilof> If I define a typeclass that extends another, how do I declare default implementations of the second in terms of the first?
15:49 <lyxia> nilof: DefaultSignatures
15:49 <nilof> Like say fmap from return & bind, or in my case, foldl in terms of heap pop
15:49 <nilof> ah
15:49 Denommus joined
15:50 theelous3 joined
15:51 <lyxia> it's cleaner to define your default implementation separately and let users use it explicitly, like with Functor/Applicative/Monad in base.
15:53 <zipper> In https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md#data-types the writer says "Additionally, unpacking simple fields often improves performance and reduces memory usage"
15:53 <zipper> What does that even mean?
15:53 <zipper> What does unpacking mean?
15:55 <zipper> LOL tibbe is in this chan, what did you mean?
15:55 <lyxia> zipper: The record "Point Double Double" is represented as a struct with two pointers to Double
15:56 <lyxia> unpacking avoids the indirection and directly puts the doubles in the fields of the struct
15:56 janos joined
15:57 <zipper> hmmm been so long since I looked at C++
15:57 <zipper> Can't remember structs clearly
15:57 NeverDie joined
15:57 janos joined
15:58 jutaro joined
15:58 tommd joined
15:58 ramzifu joined
16:01 <lyxia> zipper: in memory this is the difference between two pointers and two actual values.
16:02 robbym joined
16:02 janos__ joined
16:02 boombanana joined
16:03 <ertes> nilof: if (class (A a) => B a), then you don't need DefaultSignatures
16:03 insitu joined
16:04 <ertes> you can refer to the members of A regularly
16:04 vwker joined
16:04 ChristopherBurg joined
16:04 geekosaur joined
16:05 <unclechu> hey guys, could someone explain me why my Travis-CI tests fail on `cabal install`? https://travis-ci.org/unclechu/haskell-qm-interpolated-string/jobs/209019272
16:05 jophish_ joined
16:05 sword865 joined
16:05 <unclechu> I'd generated `.travis.yml` file using this tool: https://github.com/hvr/multi-ghc-travis
16:05 <unclechu> I also tried to write it by my bare hands in different ways but without any success
16:06 BlueRavenGT joined
16:06 wraithm joined
16:06 mizu_no_oto_work joined
16:07 <lyxia> unclechu: haskell-src-exts failed to install. You can then see that it complains about not finding happy.
16:07 mattyw joined
16:08 cdg joined
16:08 <unclechu> lyxia: I should specify `happy` dependency in my `.cabal` file?
16:08 <lyxia> I don't think so, but I don't have a solution yet.
16:08 cschneid_ joined
16:09 <osa1> unclechu: add `build-tools: happy`
16:09 smotr0n joined
16:09 <lyxia> if you're not directly depending on it you shouldn't do that
16:10 ludat joined
16:10 <lyxia> apparently you need to tell travis to install it https://github.com/haskell-suite/haskell-src-exts/blob/master/.travis.yml#L18
16:10 <nilof> I'm implementing a heap typeclass, is there a way to ensure that the parameter of my heap type is always Ord?
16:10 afarmer joined
16:11 jsgrant- joined
16:11 janos joined
16:11 urodna joined
16:12 KarboniteKream joined
16:12 <lyxia> Add the constraint on all methods class Heap heap where .... insert :: Ord a => a -> heap a -> heap a ...
16:13 FransWillem joined
16:13 <bezirg> A silly question: does an (id x) can be optimized to x? or this breaks the lazy semantics?
16:13 <lyxia> nilof: though if you can't add them I'm not sure you can
16:13 janos joined
16:13 mikecaruso joined
16:13 <nilof> right, the problem is when I try to extend foldable
16:14 <mauke> bezirg: looks valid to me
16:14 pasukon joined
16:14 <nilof> I can add ord a in front of my own methods, but I'm running into issues because my foldl relies on my pop method
16:15 <nilof> and foldl as declared in Foldable doesn't require Ord
16:15 rgc joined
16:15 <nilof> so I get a type error
16:15 <lyxia> then it's not a valid implementation of Foldable
16:15 <bezirg> mauke: thanks
16:16 PennyNeko joined
16:16 oish joined
16:17 wagle joined
16:17 <lyxia> nilof: you could technically add the Ord constraint into your heap datatype
16:17 <SpinTensor> Hi, here are two functions (http://pastebin.com/wNyMVPj3) and I thought the type def of both would mean the same, but they are not. why? First one works, second one gives compile error.
16:17 <osa1> nilof: why not add a`Ord` constraint to your instance declaration?
16:18 <lyxia> SpinTensor: Num is a type class, it's not a type.
16:18 <osa1> nilof: instance Ord a => Heap (HeapImpl a) where ...
16:18 <SpinTensor> lyxia: so i can't use a type class but i can say a is part of the type class and then use a?
16:18 <unclechu> lyxia: thanks, will try
16:19 <mauke> SpinTensor: well, an instance of the class. it's not really part of it
16:19 <osa1> nilof: similarly, instance Ord a => Foldable (HeapImpl a)
16:19 gienah_ joined
16:19 <SpinTensor> mauke: ah, ok. good to know. thanks. that actually explains a lot.
16:20 <lyxia> osa1: Foldable has kind (* -> *) -> Constraint
16:20 sssilver joined
16:20 dustmote_ joined
16:20 <osa1> ops
16:20 <lyxia> MonoFoldable would work though
16:20 simendsjo joined
16:21 sh3ll0ck joined
16:21 sh3ll0ck left
16:21 ystael joined
16:22 serendependy joined
16:22 skeet70 joined
16:22 <tsahyt> how comes that GHC can prove that (41 :: Nat) does not unify with (2 * n), but it can't infer KnownNat n from the context KnownNat (2 * n)?
16:25 ublubu joined
16:25 <geekosaur> seems to me that if it only knows that latter context and nothing else, it can't prove the former can't occur (which would make (KnownNat n) false)?
16:25 <geekosaur> also the machinery is not especially smart; there are plugins that improve it
16:26 <delYsid> Hmm, is there a recommended (because quite feature-complete) dbus client package?
16:26 <tsahyt> what do you mean with "the former can't occur"?
16:26 jathan joined
16:27 <geekosaur> if it doesn't know n, it can't prove n is even
16:28 igniting joined
16:28 fresheyeball joined
16:29 <max3> why does stack fail on a warning? http://pastebin.com/dq0abVPw
16:29 <tsahyt> hmm
16:29 <max3> is there a way to get it to soldier on?
16:29 <tsahyt> what if I introduced a constraint n ~ 2 * m
16:29 cereal_killer_ joined
16:29 <geekosaur> you might be interested in the ghc-typelits-* plugin packages btw
16:30 <shapr> max3: did you read /home/databrary/src/.stack-work/logs/blaze-markup- ?
16:30 <tsahyt> http://hackage.haskell.org/package/ghc-typelits-knownnat
16:30 <geekosaur> they make ghc a bit smarter about this stuff
16:30 <tsahyt> this looks interesting
16:30 <max3> shapr, it's exactly that warning
16:30 NeverDie joined
16:30 <geekosaur> ghc-typelits-natnormalize also comes highly recommended for this kind of thing
16:30 <max3> shapr, http://pastebin.com/HDkgBcUq
16:31 <tsahyt> geekosaur: since I've never used a ghc plugin before, can I handle this properly with cabal? e.g. I want to use this in a library, can I somehow put this into the cabal file and automate the process of installing and loading the plugin for the build?
16:31 rekahsoft joined
16:31 <geekosaur> that I don't know, Ive not used plugins either
16:31 <tsahyt> ok. thanks for the suggestion!
16:31 shauryab98 joined
16:32 michi7x7 joined
16:32 <geekosaur> max3, can you pastebin that log file shapr mentioned?
16:32 <geekosaur> ExitFailure (-11) can in some cases mean something segfaulted
16:32 <max3> geekosaur, i did http://pastebin.com/HDkgBcUq
16:32 <geekosaur> in which case the warnings may be a red herring
16:33 Copperis joined
16:33 rperry joined
16:33 <shapr> max3: yeah, there's something else going on
16:33 <geekosaur> that's all of it? :( might make a segfault even more likely
16:33 wraithm joined
16:34 <max3> and how can i figure out what exactly is going on?
16:35 <geekosaur> painfully :/ if I suspected a segfault and couldn't find anything logged for it I'd probably haul out strace (or check syslog but linux doesn't log them as usefully as e.g. freebsd does...)
16:36 <max3> ghc[16725]: segfault at 7eff09fd6640 ip 00007eff08cfe6bb sp 00007ffe0a06f870 error 4 in libHSrts_thr-ghc7.10.3.so[7eff08ce4000+67000]
16:36 <max3> in dmesg
16:36 <shapr> max3: or you could grab the source from git and try to build that repo separately?
16:36 <max3> this is the most brittle thing ever
16:36 <shapr> no u
16:37 <shapr> I mean, I think it could be the legacy code you've inherited, rather than Haskell itself.
16:37 <max3> mime-mail had a bug and snoyberg fixed it and bumped the version number
16:37 <shapr> for example, I'm able to use stack to install blaze-builder here on my work laptop
16:37 <max3> so this has nothing to do with my code
16:38 <max3> and this segfault is on stack build --only-dependencies
16:38 <shapr> I got the same version, blaze-markup
16:38 jmcarthur joined
16:38 refold joined
16:38 <max3> and it does work for me too - if i hit stack build --only-dependencies like 3 times
16:39 jomg joined
16:39 <shapr> max3: wait what?
16:39 defaultnick joined
16:39 <max3> shapr, if i rerun eventually it all builds
16:40 <shapr> max3: that sounds like it could be memory errors or possible disk corruption
16:40 <max3> it's in a docker
16:40 <drostie> sounds like a fun new feature, ghc --give-up-after=3
16:40 <max3> lol
16:41 <drostie> "ok fine you WANT that binary, you GOT that binary, don't say I didn't warn you!"
16:41 <MarcelineVQ> max3: the issue where you have to build multiple times to get the dependencies built was resolved for me by upgrading stack to 1.4.* stack upgrade --git --source-only
16:41 <shapr> MarcelineVQ: what was that issue?
16:42 <MarcelineVQ> I'm not sure it was reported directly, but the newer stack handles custom build options better so it seemed to have fixed it by proxy
16:42 <MarcelineVQ> most commonly when it happened was with cairo and gtk2hs
16:43 <nilof> Ah, another question: I'm trying to specialize a method using (buildheap xs) :: Ord a => ImplHeap a, but I get a type error where the compiler doesn't want to match t a1 with t a
16:43 <shapr> I sort of want to see the results of "stack dot --depth 2 --external" for databrary, but I'm afraid
16:43 rcsole joined
16:43 <max3> MarcelineVQ, what does the --source-only flag do?
16:44 <geekosaur> nilof, lpaste the full code and full error message?
16:44 <geekosaur> @paste
16:44 <lambdabot> Haskell pastebin: http://lpaste.net/
16:44 mfukar joined
16:44 insitu joined
16:45 <nilof> http://lpaste.net/353317
16:45 <MarcelineVQ> It's builds things locally instead of grabbing pre-built stack binaries, probably not neccesary here since --git should have a newer version number but if it didn't it may just grab binaries instead of actually fetching from git iirc
16:45 <max3> MarcelineVQ, this doesn't upgrade to nightly but the latest release right?
16:46 <MarcelineVQ> it upgrades to the current master branch of the stack git repo https://github.com/commercialhaskell/stack
16:46 pera joined
16:47 <nshepperd> nilof: you may need ScopedTypeVariables there
16:48 mmn80 joined
16:48 <max3> MarcelineVQ, is master stable? i don't understand their workflow (i'm used to gitflow where master is always a release)
16:48 certainty joined
16:49 <geekosaur> nilof, yes, you'd need ScopedTypeVariables *and* prefix the type signature of heapsort with "forall a."
16:49 <nshepperd> nilof: by default, type variables are contained to their type signature, so that the a in 'heapsort :: (Ord a, Foldable t) => t a -> [a]' is different to the a in '(buildheap xs) :: Ord a => LeftHeap a'
16:49 <geekosaur> you expliitly told it *not* to typecheck; the "a" in your type ascription has nothing to do with the one in the signature, and effectively tells ghc it doesn't know the type
16:50 <max3> haha upgrading stack failed too
16:50 raycoll joined
16:50 <max3> ghc: internal error: evacuate: strange closure type -129660600
16:50 <unclechu> lyxia: https://travis-ci.org/unclechu/haskell-qm-interpolated-string/jobs/209032172
16:50 <unclechu> now i added `happy` to install in `.travis.yml` https://github.com/unclechu/haskell-qm-interpolated-string/blob/feature/travis-ci-testing/.travis.yml but still have this error
16:50 <geekosaur> max3, you have a hardware issue most likely
16:50 tommd joined
16:50 <geekosaur> or your docker is really broken
16:50 <max3> really? you think?
16:50 <geekosaur> and corrupting the memory image in the container
16:51 machbio joined
16:51 defaultnick_ joined
16:51 <MarcelineVQ> max3: not sure, I don't upgrade often unless I have issues, it has been stable for me in usage. nominally there is a branch called stable that I imagine is for releases, it won't have the update that fixed the depdendency issue for me
16:52 insitu joined
16:52 <lyxia> unclechu: it seems you're missing the equivalent of this line https://github.com/haskell-suite/haskell-src-exts/blob/master/.travis.yml#L35
16:52 <geekosaur> basically "strange closure type" means one of: (a) you're using a buggy ghc prerelease (b) you have FFI and some *really* wild pointers (c) you have general memory corruption
16:53 iomonad joined
16:54 <kadoban> max3: Can you run memtest86 or something like that without much trouble? That's usually where I start when impossible things are happening that suggest hardware failure.
16:54 <unclechu> lyxia: thanks again
16:54 <max3> kadoban, lemme see if reinstall docker helps
16:55 <nshepperd> if you suspect your machine might have faulty ram, you should reboot into memtest86+ and test it asap, because faulty ram tends to stomp all over your hard disk and destroy your data
16:55 <kadoban> That's usually where I end as well, since every time it's found a problem :-/ It always seems to be RAM failure. Though it's few data points, so that may not be representative.
16:55 <nshepperd> (also I hope you have backups)
16:56 <max3> i'll be shocked if it's corrupted memory
16:57 tlaxkit joined
16:59 insitu joined
17:00 <* geekosaur> hs had enough issues (and talked with enough other people who have) with docker that he'd check that first. neat idea, but the "move fast, break stuff" model tends strongly toward the latter
17:01 sidei joined
17:02 ortmage joined
17:04 <sidei> @help
17:04 <lambdabot> help <command>. Ask for help for <command>. Try 'list' for all commands
17:04 <sidei> @list
17:04 <lambdabot> What module? Try @listmodules for some ideas.
17:04 <max3> geekosaur, certainly it's not beyond the realm of possibility; after all golang is no haskell :)
17:04 <unclechu> lyxia: https://travis-ci.org/unclechu/haskell-qm-interpolated-string/jobs/209041415 kinda same story https://github.com/unclechu/haskell-qm-interpolated-string/blob/feature/travis-ci-testing/.travis.yml
17:05 <sidei> @help list
17:05 <lambdabot> list [module|command]. Show commands for [module] or the module providing [command].
17:05 jmelesky joined
17:05 rixile joined
17:05 <sidei> @pl f a b = (a+b)/2
17:05 <lambdabot> f = flip flip 2 . ((/) .) . (+)
17:05 baldrick1 joined
17:06 Iskarlar joined
17:06 <geekosaur> don't think the implementation langaueg matters here. too much low level stuff and types can;t save you (unless you go full Agda and I suspect *nobody* wants to write the proofs for page tables)
17:06 NeverDie joined
17:06 _sras_ joined
17:06 <lyxia> unclechu: we made progress, haskell-src-exts was built
17:06 Berra joined
17:06 xtreak joined
17:06 cdg_ joined
17:06 <lyxia> unclechu: your version of cabal is too old
17:06 <_sras_> How can you output something like this `<div>Click <a href='#'>Here</a><div>` using lucid?
17:07 <lyxia> unclechu: "The package requires Cabal library version -any && >=1.18"
17:07 Sonolin joined
17:07 twopoint718 joined
17:08 Glooomy joined
17:09 <suppi> div_ $ a_ [ href_ "#" ] "Here" -- maybe?
17:09 <unclechu> lyxia: yep, now some another ghc versions passed
17:09 <unclechu> first good news
17:09 <suppi> i'm not in front of a computer
17:10 Jacoby6000__ joined
17:12 sellout- joined
17:12 trism joined
17:12 andrei_chifa joined
17:13 epsilonhalbe joined
17:14 alanb99 joined
17:15 defaultnick__ joined
17:17 afarmer joined
17:18 electrostat joined
17:18 <max3> geekosaur, indeed it was docker
17:19 <max3> actually i take that it back it hasn't gone all the way through yet
17:19 conal joined
17:19 rkazak_ joined
17:21 tag joined
17:21 defaultnick_ joined
17:22 ystael joined
17:23 alanb99 left
17:23 <twopoint718> I’m attempting to use `runResourceT` (`resourcet` pkg) in combination with `createPool` (`resource-pool` pkg) and things are starting to feel a little funky. Am I duplicating behavior here? Should I be using one or the other? In particular, I’m planning on setting up a connection to Neo4J using `haskell-neo4j-client`‘s `newConnection` function which just returns an `IO Connection`. My idea was to get the connection with that function,
17:23 <twopoint718> then use `createPool` to manage the opening/closing for me. The issue arises when I want to close the connection. https://www.stackage.org/haddock/lts-6.11/haskell-neo4j-client- suggests that I use `runResourceT` to manually close the connection, but it would seem that I need a “primitive” close function to be able to `allocate` a ResourceT. I feel a little like I’m going in circles, any
17:23 <twopoint718> ideas?
17:24 <twopoint718> (sorry for the long question. tl;dr has anyone used ResourceT in combination with resource-pool?)
17:24 TxmszLou joined
17:26 <max3> geekosaur, yup docker
17:26 <max3> interesting
17:26 cereal_killer_ joined
17:26 rekahsoft joined
17:27 xaviergmail joined
17:27 <geekosaur> not surprising. it's doing its own page table management for the container; even tiny bugs in that lead to seriously weird behavior
17:27 sobaken joined
17:28 gcross_ joined
17:29 <brynedwards> twopoint718: it looks like the neo4j client uses http-conduit for connections, so it might to use http-conduit sessions instead
17:29 mattyw joined
17:31 Lord_of_Life joined
17:31 <unclechu> guys, how i can write condition for ghc version for preprocessing?
17:31 doomlord joined
17:32 <twopoint718> brynedwards: could you elaborate a bit, I'm not sure I follow
17:32 <brynedwards> twopoint718: You can see here, a connection is just a http-conduit Manager and connection details https://hackage.haskell.org/package/haskell-neo4j-client-
17:32 mekeor joined
17:32 <brynedwards> Specifically, this https://hackage.haskell.org/package/http-conduit-
17:33 <unclechu> i guess i found it: http://stackoverflow.com/questions/28292476/ghc-version-check-in-code#28292585
17:34 skapazzo joined
17:34 fizruk joined
17:34 <brynedwards> As it says under manager, "If possible, you should share a single Manager between multiple threads and requests.
17:35 <brynedwards> I don't know if it's any different for neo4j, and the library doesn't seem to let you pass your manager
17:35 guiben joined
17:35 <brynedwards> Basically, I don't know, sorry =(
17:36 <geekosaur> unclechu, https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/phases.html#standard-cpp-macros
17:36 someone_ joined
17:37 <twopoint718> brynedwards: well thanks for the pointer that does help, even if it tells me I have to reconsider what I was trying. Thanks!
17:38 eklavya joined
17:41 danza joined
17:41 osa1 joined
17:42 Denommus` joined
17:42 <EvanR> so
17:43 samgd joined
17:43 michi7x7 joined
17:46 replay joined
17:47 pantsman_ joined
17:48 farao joined
17:49 joneshf-laptop joined
17:50 suica joined
17:50 rcsole joined
17:51 Xyliton joined
17:51 <suica> how can I do something to the effect of `map 3 [(+1), (+2), ..]`? I figured it out yesterday but now I can't remember
17:51 uwap joined
17:51 <osa1> > map ($ 3) [(+ 1)]
17:51 <lambdabot> [4]
17:51 rekahsoft joined
17:51 <suica> sweet, thanks
17:52 <farao> hi, I just started with haskell and am doing some exercises and I'm wondering how to split a list into two parts. I found "split" and "splitWhen" but they split the whole list. I am rather looking for an equivalent of: let part1 = takeWhile myFun xs; part2 = dropWhile myFun xs in ...
17:52 <glguy> :t span
17:52 <lambdabot> (a -> Bool) -> [a] -> ([a], [a])
17:52 <farao> cool, thanks! :-)
17:53 t7 joined
17:53 <byorgey> farao: span, break, splitAt
17:53 <byorgey> also partition
17:53 <farao> :t break
17:53 <lambdabot> (a -> Bool) -> [a] -> ([a], [a])
17:54 ertesx joined
17:54 <byorgey> break is just the negation of span
17:54 <farao> ah ok! yeah, span is the one I'm looking for :-)
17:55 <shapr> max3: do you get consistent builds after reinstalling docker?
17:55 <max3> if 1 is enough to qualify as consistent then yes
17:55 sternmull joined
17:56 <suica> :t [1,2] >>= (flip map) [(+1), (+2)] . (flip $)
17:56 <lambdabot> (Num (a1 -> (a -> a) -> c), Num a) => [a1 -> c]
17:56 nadirs joined
17:56 Swizec joined
17:57 <MarcelineVQ> that's quite the Num instance
17:57 skeuomorf joined
17:57 <suica> I kind of expect that to give `[2, 3, 3, 4]`
17:57 oleksiyp joined
17:59 Jacoby6000 joined
17:59 HarveyPwca joined
17:59 <glguy> > [1,2] >>= (flip map) [(+1), (+2)] . (flip ($))
18:00 <glguy> so close
18:00 <lambdabot> mueval-core: Time limit exceeded
18:00 <glguy> [2,3,3,4]
18:00 <glguy> ?undefine
18:00 <lambdabot> Undefined.
18:00 <glguy> > [1,2] >>= (flip map) [(+1), (+2)] . (flip ($))
18:00 <lambdabot> [2,3,3,4]
18:02 mdtusz joined
18:02 cloudhead joined
18:02 <Xyliton> How do I iterate over the pixels in images generated by friday and/or juicypixels?
18:03 oleksiyp joined
18:03 michi7x7_ joined
18:03 defaultnick___ joined
18:03 <MarcelineVQ> juicypixels has pixelMap iirc
18:04 <suica> glguy: thanks
18:04 pleax joined
18:04 <suica> i should probably just stick with map and concat
18:04 danza joined
18:06 <MarcelineVQ> suica: you can also name your value for clarity [1,2] >>= \x -> map ($ x) [(+1), (+2)]
18:06 connrs joined
18:06 KarboniteKream joined
18:06 phyrex1an joined
18:06 Luke joined
18:07 asmyers joined
18:08 michbad joined
18:08 <Xyliton> MarcelineVQ: I don't want to modify the image though
18:09 defaultnick___ joined
18:09 balor joined
18:09 Varis joined
18:10 ragepandemic joined
18:10 initiumdoeslinux joined
18:11 srbaker_ joined
18:12 wraithm joined
18:12 pandeiro joined
18:13 insitu joined
18:14 TxmszLou joined
18:16 hazmat__ joined
18:18 thatguy joined
18:18 <thatguy> if I need to randomly resort my list often, is it better to use arrays?
18:19 wagqwgwe joined
18:19 al-damiri joined
18:20 coot joined
18:20 Xyliton left
18:20 Xyliton joined
18:21 skapazzo joined
18:23 owiecc joined
18:23 <kadoban> thatguy: What does "randomly resort" mean? Is it always sorting by the same comparison function, or?
18:23 <_sras_> What is the best way to read some multiline content from stdin, like contents of a text file piped to the program?
18:24 danza joined
18:25 ystael joined
18:25 mr_sm1th joined
18:26 dfeuer joined
18:26 rkazak_ joined
18:29 ner0x652 joined
18:30 NeverDie joined
18:31 Jicoss joined
18:32 bennofs joined
18:35 sssilver joined
18:35 xall joined
18:35 meba joined
18:36 ragepandemic joined
18:37 insitu joined
18:40 ertes joined
18:40 pleax joined
18:40 rixile joined
18:41 ertes joined
18:42 jomg joined
18:42 defaultnick_ joined
18:43 Swizec joined
18:43 sobaken joined
18:46 connrs joined
18:47 raynold joined
18:48 coltfred joined
18:48 revprez joined
18:48 epsilonhalbe joined
18:49 janos joined
18:49 Tesseraction joined
18:51 AbelianGrape joined
18:52 robotrafficcop joined
18:53 <robotrafficcop> Hey all, I'm getting this weird error on "stack build" on a VPS I just spun up. It says that it can't get a file from S3. Maybe related to the recent outage? https://gist.github.com/wyager/e18f5832e2ed29c1f9ba3b197c52432f
18:53 <thatguy> kadoban: I meant a random shuffle but I found what I needed
18:54 chlong_ joined
18:54 tjbp joined
18:54 doomlord joined
18:58 mdtusz joined
18:58 Zaesur joined
18:58 <glguy> robotrafficcop: If your VPS can't resolve that hostname it's probably just misconfigured
19:01 <robotrafficcop> glguy: It resolves s3.amazonaws.com just fine. nslookup and ping both work
19:01 <robotrafficcop> Which makes me think it might be an issue with something on the Stack end
19:01 grumble joined
19:02 sssilver joined
19:02 netheranthem joined
19:03 xall joined
19:03 ziocroc joined
19:03 xcmw joined
19:03 Noldorin joined
19:04 maninalift joined
19:06 FullyFunctional left
19:07 <robotrafficcop> Well, I tried rebooting, and that seemed to fix it. Typical! No particular reason that should have done anything. Thanks for the suggestion!
19:08 robotrafficcop joined
19:08 marekw2143 joined
19:08 <robotrafficcop> Spoke too soon, still broken. Looks like it's doing a request in the background and it's timing out later in the build process
19:09 <marekw2143> hi, here: https://bitbucket.org/chessRepo/c7/src/a41bb7d3c99f1dfb1267ec633f898c35b585585e/main.hs?at=master&fileviewer=file-view-default#main.hs-168
19:09 <marekw2143> why there's need to be if - else in 168'th line, and not just simply let .. in ?
19:10 Dagnabit joined
19:10 a3Dman joined
19:10 zero_byte joined
19:10 sssilver joined
19:12 ptvirgo joined
19:12 oisdk joined
19:15 prohobo joined
19:15 sellout- joined
19:16 asmyers joined
19:17 ub joined
19:17 Guest42583 joined
19:18 rixile joined
19:18 TheEpsylon joined
19:18 sid_fules joined
19:19 rcsole joined
19:19 marekw2143 joined
19:20 freusque joined
19:21 osa1 joined
19:21 osa1 joined
19:21 janos joined
19:22 twanvl joined
19:22 janos__ joined
19:23 twopoint718 joined
19:24 janos joined
19:24 <twopoint718> brynedwards: Thanks for the help. I was able to figure out a solution to my above problem. Briefly, I was able to extract the connection `Manager` inside the Neo4j `Connection` type. This has a `closeManager` function available that worked for being able to satisfy `createPool`. The slight catch is that closeManager is deprecated, but it'll work for my immediate issue.
19:25 janos joined
19:25 <Geekingfrog> I'm having a weird HandshakeFailed error using Req to query www.youtube.com: http://lpaste.net/353322 (using arch-linux, stack and req-0.2.0). Any idea ?
19:25 ystael joined
19:26 cyborg-one joined
19:26 Luke joined
19:28 janos__ joined
19:28 _sg joined
19:28 janos joined
19:29 path[l] joined
19:29 xcmw joined
19:30 plutoniix joined
19:31 plutoniix joined
19:31 defaultnick__ joined
19:31 dcoutts_ joined
19:33 connrs joined
19:33 bb4242 joined
19:33 xall joined
19:34 bb4242 left
19:34 ragepandemic joined
19:35 t0by joined
19:36 andrei_chifa joined
19:37 ilja_kuklic joined
19:38 tag joined
19:39 Miroboru joined
19:39 johnmendonca joined
19:40 zar joined
19:41 felko joined
19:41 <felko> how can i partially apply a parametrized type alias ?
19:42 biglama joined
19:42 <felko> for some types it is ok to type (F a) even if F a has not a * kind, but in case it doesn't work for some reason i don't know (paste incoming)
19:42 Unhammer joined
19:42 <Tuplanolla> Can't, felko.
19:42 meoblast001 joined
19:43 <Tuplanolla> If the parameter is present in the definition, it must also be present in application.
19:43 <felko> is there a specific reason for that ?
19:44 <Tuplanolla> Yes, but I don't remember it.
19:45 hvr joined
19:45 hvr joined
19:46 Unhammer joined
19:46 insitu joined
19:47 <felko> Tuplanolla: ok it doesn't matter anyway, i can do what i want without, thanks
19:49 augur joined
19:49 hiThisIsMe joined
19:49 <Tuplanolla> I recall it's there to keep type-level lambdas out of the system.
19:49 byte512 joined
19:50 <Tuplanolla> Those would have troublesome computability properties.
19:52 <felko> Tuplanolla: why ?
19:52 <Tuplanolla> Lambda calculus is Turing complete.
19:52 FullyFunctional joined
19:53 <felko> i agree that a type-level lambda calculus could lead to haskell black magic but is it problematic ?
19:54 <Tuplanolla> That depends on your view of problematic. It certainly is if you want to keep compilation decidable.
19:54 tjbp joined
19:55 <felko> ok i understand, thanks
19:56 steeze joined
19:56 srbaker_ joined
19:57 tjbp joined
19:59 sssilver joined
20:00 lak joined
20:01 mattyw joined
20:01 max3 joined
20:03 thatguy joined
20:05 <unclechu> lyxia: thanks a lot for the help! now everything is green and i'm happy because i have completed everything i'd planned for today: https://hackage.haskell.org/package/qm-interpolated-string
20:05 muesli4 joined
20:05 Luke joined
20:05 cdg joined
20:05 maksim__ joined
20:05 <lyxia> unclechu: nice! you're welcome!
20:06 marfoldi joined
20:07 bodisiw joined
20:07 <lyxia> I'm pretty sure we already have Turing-completeness in types.
20:07 <monochrom> What does "qm" stand for there?
20:07 <lyxia> At least we have UndecidableInstances
20:07 Deide joined
20:08 nomotif joined
20:09 defaultnick__ joined
20:09 bodisiw joined
20:11 cdg joined
20:11 mattyw joined
20:12 cdg joined
20:13 cdg_ joined
20:13 prohobo left
20:14 cdg_ joined
20:14 defaultnick joined
20:15 mattyw joined
20:16 revprez joined
20:16 coltfred joined
20:17 cdg joined
20:17 cdg_ joined
20:18 baldrick1 joined
20:18 <byorgey> monochrom: from the readme: 'm' in 'qm' means 'multiline'.
20:19 petervaro joined
20:19 <byorgey> presumably the 'q' stands for 'quote' or 'quasiquote' or something like that
20:20 lspitzner joined
20:21 Luke joined
20:21 albertus1 joined
20:21 asmyers joined
20:22 mthek joined
20:23 dmiles joined
20:24 tjbp joined
20:25 hackebeilchen joined
20:25 tjbp joined
20:26 KarboniteKream joined
20:26 ystael joined
20:26 rcsole joined
20:27 tjbp joined
20:28 hololeap joined
20:29 chlong_ joined
20:29 mattyw joined
20:31 Sh4pe joined
20:32 takle joined
20:34 coup_de_shitlor- joined
20:34 ltielen joined
20:34 thatguy joined
20:35 xcmw joined
20:36 louispan joined
20:36 keltvek joined
20:37 jsgrant joined
20:38 ramzifu joined
20:38 Luke joined
20:43 meoblast joined
20:44 insitu_ joined
20:46 plutoniix joined
20:46 mattyw joined
20:49 insitu joined
20:50 <kuribas> How do I force return () to be evaluated every time in "trace errStr (return ())"?
20:50 fweth joined
20:53 <monochrom> That "return()" is evaluated iff the whole "trace errStr (return())" is evaluated.
20:53 <ski> perhaps you want `errStr' outputted whenever this action is *executed* (not evaluated) ?
20:53 `Guest00000 joined
20:54 tag joined
20:54 <kuribas> ski: yes
20:54 <kuribas> ski: it's not IO though, it's a State monad.
20:54 jmcarthur joined
20:55 <ski> `State MyStateType' ?
20:55 paolino joined
20:55 <kuribas> yes
20:55 <monochrom> My iff sentence is still true for s/evaluate/execute/
20:55 mthek joined
20:56 <kuribas> :t unsafePerformIO
20:56 <lambdabot> error: Variable not in scope: unsafePerformIO
20:57 epsilonhalbe left
20:57 <* ski> was thinking of something along the same lines as `evaluate'
20:58 zcourts joined
20:58 TheEpsylon- joined
20:58 <ski> @type evaluate
20:58 <lambdabot> a -> IO a
20:58 tomboy64 joined
20:59 <ski> (but presumably the difference doesn't make any difference in your case, in which case what monochrom said)
20:59 Ch3ck joined
20:59 sid_fules joined
21:00 Itkovian joined
21:00 <kuribas> or maybe const (return ()) var, where var is a variable in the monad?
21:01 <ski> whatever `var' is, that is equal to just `return ()'
21:01 phaji joined
21:01 Aruro joined
21:01 <ski> (not sure what you mean by "a variable in the monad")
21:01 <monochrom> That "return()" is evaluated iff the whole "const (return()) var" is evaluated. Similarly, executed.
21:02 <kuribas> ski: A variable that is only evaluated when the monad is executed.
21:02 <monochrom> Also, the var is ignored in all 4 cases.
21:02 <ski> monads are not run-time things, that can be executed or not
21:02 <ski> monadic actions can be executed, though
21:03 <ski> `var' is not evaluated when `const (return ()) var' is evaluated
21:04 plutoniix joined
21:04 <kuribas> ski: I don't care about var.
21:04 cdg joined
21:04 insitu joined
21:05 <kuribas> or "trace (const msg var) (return ())"?
21:05 <ski> i'm not sure why you mentioned `const' ..
21:05 maninalift joined
21:05 yyyyy joined
21:06 <kuribas> I want to trick ghc into evaluating it...
21:07 janos joined
21:07 Luke joined
21:07 rixile joined
21:07 <kuribas> Doesn't work if it inlines it to msg...
21:08 janos joined
21:09 <ski> `const msg var' won't evaluate `var', regardless of inlining or not
21:09 <kuribas> ski: but it may evaluate the expression if var has changed...
21:10 bodisiw joined
21:11 <monochrom> No, const tricks GHC into not evaluating things.
21:12 <kuribas> ski: if const where a black box, it would try to evaluate it.
21:12 <monochrom> Why are you not talking about seq which does trick GHC into evaluating things?
21:12 <kuribas> monochrom: var `seq` trace msg (return ())?
21:13 <monochrom> var does not change, and const is not a black box.
21:13 <monochrom> I'm going to be blunt and ask "what are you smoking?"
21:13 <monochrom> That will evaluate var iff the whole thing is evaluated.
21:14 <lyxia> Show some code!
21:14 cdg_ joined
21:15 <ski> kuribas : even if `const' was in a library that was only loaded at run-time, `var' would still not be evaluated in `const (return ()) var'
21:15 kakashiAL joined
21:15 <kuribas> ski: I only want the trace...
21:16 <kuribas> ski: ghc would try evaluating it, because it doesn't know var doesn't get evaluated.
21:16 animated joined
21:17 <lyxia> kuribas: trace is already marked NOINLINE so it won't do funny things with inlining.
21:18 fizruk joined
21:18 thatguy joined
21:18 <ski> kuribas : no, it would not
21:19 fnurglewitz joined
21:19 <Aruro> is lense-like library should be part of haskell syntax?
21:19 peterbecich joined
21:20 <kuribas> lyxia: this is just a part of my code: http://lpaste.net/353329
21:20 <ski> unless we're talking about speculative evaluation of some sort, the traditional way to implement non-strict semantics is to *not* have argument expressions reduced before calling the function. instead the body of the function (or perhaps even what the caller decides to do with the result of the function) will determine when and if the arguments are reduced
21:21 <dolio> Note: GHC doesn't do speculative evaluation. :)
21:21 peterbecich joined
21:21 <monochrom> Yes, the evaluator expands the function body first. If the body doesn't mention a parameter, that parameter is ignored afterall.
21:21 MindlessDrone joined
21:22 <monochrom> This is why const is not going to be a black box like you think some imported C function is.
21:22 fizruk joined
21:22 <monochrom> The evaluator will look inside.
21:22 Xyliton joined
21:23 <ski> in a sense, `const' is (or could as well be) "black-box", but it would still not have the operational semantics you were thinking
21:23 <kuribas> ski: const msg var, isn't a constant expression, when var is free...
21:23 <kuribas> ski: only after inlining.
21:24 <monochrom> This is not about inlining.
21:24 <kuribas> if const were a black box function, the evalutor wouldn't know it is constant.
21:24 <kuribas> So it would have to evaluate it.
21:25 <ski> no
21:25 <ski> it passes `msg' and `var', *unevaluated*, to `const'
21:25 <monochrom> There are many experiments you can perform to refute that hypothesis.
21:25 <ski> `const' then decides which of the arguments to evaluate
21:25 <kuribas> ski: now you are admitting it will evaluate const?
21:26 Dagnabit joined
21:26 <ski> `const' itself (whose value is a function) will be evaluated, since it's the function expression in a function call
21:26 <monochrom> We have always asserted that "const" is evaluated. First.
21:26 <monochrom> Does not imply that the 2nd parameter will be evaluated. Ever.
21:27 <kuribas> monochrom: I don't care about the 2nd parameter...
21:27 <ski> `const' must be evaluated in order to determine the function body (with actual parameter expressions substituted for formal parameters) to continue evaluation at
21:27 <monochrom> You can define your own const-like function and turn off optimization and what-not. Everything we said will still hold.
21:27 ystael joined
21:27 <monochrom> OK, what do you care?
21:28 <kuribas> monochrom: that the debug trace gets outputted.
21:28 <monochrom> OK, it works for me. What's the problem?
21:28 <* ski> doesn't see a `const' in the paste
21:28 <ski> (if `DEBUG' isn't defined, then `debug' is equal to `flip const', however)
21:28 kakashiAL joined
21:28 <kuribas> monochrom: well, const get inlined, so it isn't a black box...
21:29 <ski> even if it doesn't get inlined, it will still behave exactly the same
21:29 <monochrom> I don't see the relevance.
21:29 <kuribas> ok, I'll try...
21:29 coltfred joined
21:29 <ski> `const msg (error "boom !")' won't evaluate the `error' call, e.g.
21:29 mszczygiel joined
21:29 Snircle joined
21:30 litwol joined
21:30 litwol left
21:32 <monochrom> You have an experiment I can reproduce to unambiguously refute what I said?
21:32 janos joined
21:32 phaji joined
21:34 replay joined
21:34 wraithm joined
21:35 fDev2179 joined
21:35 bjz joined
21:35 fDev2179 left
21:36 <kuribas> monochrom: right, I tested it. With (const msg freshVar), I see the trace, without only once.
21:37 <kuribas> monochrom: how would ghc now it cannot subsitute that with msg?
21:37 <nilof> Ah, you can't have several modules in the same file?
21:37 Sh4pe joined
21:37 <kuribas> monochrom: does it know there is an trace or unsafePerformIO function?
21:37 schjetne joined
21:37 <Tuplanolla> Your thought process is really difficult to follow, kuribas.
21:38 Koterpillar joined
21:38 <jle`> nilof: correct
21:38 <kuribas> Tuplanolla: well, if I have 'debugM "mesg"', I see the trace only once. If I use 'debugM (const "msg" freshvar)', I see it every time it is executed.
21:39 <kuribas> Tuplanolla: what keeps ghc from inlining const, and rewriting the second into the first?
21:39 zar joined
21:39 michi7x7_ joined
21:40 <Tuplanolla> Is this from `hslogger`?
21:40 xcmw joined
21:40 <Sh4pe> Hi folks! Quick question: I import Data.ByteString.Char8 as C. Then, the statement `newtype Foo = C.ByteString` causes this error: `Qualified name in binding position: C.ByteString`. I don't understand why and I can't find a fix myself
21:40 <lyxia> this would be so much easier if we had a minimal example.
21:40 <cocreature> Sh4pe: you need to give a name to the constructor of your newtype
21:40 <cocreature> "newtype Foo = Foo C.ByteString" will work
21:41 <Sh4pe> cocreature: Ah - I see. Thanks!
21:41 <kuribas> Tuplanolla: no...
21:42 <monochrom> kuribas, I still do not know how to reproduce your experiment. How do I reproduce your experiment?
21:42 mszczygiel joined
21:42 cereal_killer_ joined
21:43 <monochrom> Hell, how do I do so with little effort? (Too lazy to even "stack install stuff")
21:43 janos joined
21:43 <kuribas> > traverse_ [1..4] $ \i -> trace "debug message" $ return ()
21:44 <lambdabot> error:
21:44 <lambdabot> • Couldn't match expected type ‘a0 -> f b0’
21:44 <lambdabot> with actual type ‘[Integer]’
21:44 <Itkovian> any idea why stack --compiler ghc-8.0.2 --stack-root=/usr/local/vpw/haskell/stack --extra-lib-dirs /usr/local/vpw/lib/ install split fails with a symbol from libgmp not foudn (which resides in /usr/local/vpw/lib/libgmp.a)
21:44 <Itkovian> it seems like the extra lib is not passed to ghc
21:44 phaji_ joined
21:45 <Itkovian> however, when just running the stack ... ghc -- --make main.hs, it is found
21:45 <ezyang> Man, accelerate-llvm really is not easy to build
21:47 <nilof> So stupid question: how do I import a module in a file that is in the same directory?
21:47 <monochrom> Just do it.
21:47 <monochrom> But mind filename cases (upper or lower).
21:48 TxmszLou joined
21:49 <Athas> ezyang: if you manage to get it work with the LLVM-based GPU backend too, please let me know!
21:49 <ezyang> lol
21:49 <ezyang> I got to a GHC panic and then gave up
21:51 <nilof> ah, my ghci directory was set to the wrong directory, now everything works
21:51 atomi joined
21:51 <kuribas> monochrom: try this: http://lpaste.net/2846700419663527936
21:51 <monochrom> ghci has a ":cd" command
21:51 <davean> ezyang: I feel accelerate has never been well maintained, I've never managed to actually use it
21:52 <kuribas> monochrom: behaviour is different compiled from in ghci...
21:52 benl23 joined
21:53 hiratara joined
21:54 tomphp joined
21:54 <kuribas> monochrom: the second gives 4 times "debug message", the first only once.
21:54 Rodya_ joined
21:55 <monochrom> kuribas, I am in ghci, version 8.0.2, both give me 4 messages.
21:56 <kuribas> monochrom: try compiling it
21:56 <monochrom> OK. -O0? -O1? -O2?
21:56 <kuribas> -O2
21:56 ystael joined
21:56 <kuribas> ghc 8.0.1
21:57 <monochrom> OK, reproduced.
21:57 baldrick1 joined
21:58 <kuribas> I would think ghc will inline const, and make the two equivalent.
21:58 bjacobowski joined
21:58 danthemy_ joined
21:59 <monochrom> But there are other moving parts. How do you know, for example, that optimizations didn't do something to traverse_ and affected this experiment too?
21:59 Tourist joined
21:59 Tourist joined
21:59 <monochrom> Or even [1..4]
21:59 contiver joined
22:00 <monochrom> Or the way (\i -> trace whatever) is optimzied or not optimized.
22:01 roboguy` joined
22:01 <kuribas> @src trace
22:01 <lambdabot> trace string expr = unsafePerformIO $ do
22:01 <lambdabot> hPutStrLn stderr string
22:01 <lambdabot> return expr
22:01 <monochrom> I mean, of course, "const" is the most visible difference syntactically, but you probably need to cross this with some other things too for a real difference to be manifested.
22:01 peterbecich joined
22:02 <monochrom> I don't think you can trust @src anymore. Look at Debug.Trace actual source code.
22:03 rperry joined
22:04 wtetzner joined
22:04 <kuribas> well, at least I have my trace messages :)
22:05 insitu joined
22:05 rgr joined
22:05 yyyyy joined
22:05 <monochrom> You will want to look at the Core code.
22:05 zar joined
22:05 <codedmart> Anyone familiar with Pool here? I use it with RethinkDB. Which in most cases it works fine, but I have one instance `Changes` where it is a blocking operation. Basically it just sits and waits for an answer https://github.com/AtnNn/haskell-rethinkdb/blob/c7df4f219f1e7251629a9e90280f1ebdfed9ec8c/Database/RethinkDB/Network.hs#L407-L413. The problem is I get
22:05 <codedmart> this error `Left thread blocked indefinitely in an MVar operation` over and over. I have a hacky way around this by using `forkFinally` to just restart it, but that is not an optimal solution. Any thoughts/ideas? I am actually not sure if this is even a Pool problem. I assumed it had something to do with reaping
22:05 <codedmart> https://github.com/bos/pool/blob/master/Data/Pool.hs#L203, but I haven't used MVar's yet so could be way off base.
22:06 pleax joined
22:07 zar joined
22:12 janos joined
22:13 Copperis joined
22:14 AndreasK joined
22:17 lep-delete joined
22:18 Edith joined
22:19 Denthir joined
22:19 eschnett joined
22:20 jophish_ joined
22:22 janos joined
22:23 <monochrom> kuribas: "const is inlined or not" does not fully explain it, because in the Core code, there is no longer const or mention of i, it is always 'trace "debug message"'.
22:23 <kuribas> monochrom: right
22:24 moth joined
22:24 <kuribas> monochrom: so ghc is keeping track of the fresh variable i, and makes sure the expression is evaluated every time...
22:24 rgc left
22:24 janos__ joined
22:24 xaviergmail joined
22:24 peterbecich joined
22:25 Xyliton left
22:25 <kuribas> monochrom: or something else to do with unsafePerformIO...
22:25 taktoa joined
22:26 <monochrom> But it is true and I don't know why that in the no-const version, a top level CAF "xxx = trace "debug message" (return ())" is introduced, then reused by the loop. Whereas in the has-const version, the trace is not a CAF, it is re-created every iteration.
22:28 snowalpaca joined
22:28 jophish_ left
22:28 <kuribas> Does unsafePerformIO even have clear semantics?
22:28 <monochrom> Yes for GHC.
22:29 <jophish> Hi folks
22:29 khanage joined
22:29 tristero joined
22:29 lowryder joined
22:30 augur joined
22:30 soLucien joined
22:30 <monochrom> I consider it unlikely that unsafePerformIO caused the difference.
22:31 hiratara joined
22:31 <jophish> When do people find it appropriate to curry constraints to functions? i.e. `foo :: Eq a => Num a => a -> a -> a` instead of `foo = (Eq a, Num a) => a -> a -> a`
22:32 <monochrom> I consider it far more likely that the order of optimization stages caused the difference. Namely, my hypothesis: First looking for what you can factor out as CAFs, and only after perform simplication and discovering data independence.
22:32 peterbecich joined
22:32 <jophish> I have an intuition for where this is a nice thing to do, but am having trouble formalising it
22:32 atomi joined
22:32 cads joined
22:33 <monochrom> So, for the no-const version: i is not mentioned anywhere syntactically, so factor out trace "dm" (return ()) as its own CAF first, call it xxx, now proceed to compile (\i -> xxx).
22:34 <monochrom> And for the has-const version: "Oh nothing to factor out as CAF". Only later to simplify const "dm" i to "dm".
22:34 <lyxia> jophish: what's an example where this is useful?
22:34 <monochrom> (And so no dependence on i after all, but the factoring ship has sailed.)
22:35 <jophish> lyxia: for example I might pass in a bunch of KnownNat constraints to a function after reifying them in a function taking a bunch of Naturals
22:36 <jophish> it's nice to highlight the similarities between these two functions by replacing the ->s with =>s
22:36 <jophish> admittedly this is a niche case, I'll try and think of a more compelling one
22:36 <kuribas> monochrom: this has the same bevaviour: http://lpaste.net/2846700419663527936
22:37 <jophish> These kind of signatures most often appear in the parts of our codebase which do a lot of type level computation and term -> type doohickery
22:38 <monochrom> Well yeah I'm just referring to the trace expression and whether it syntactically involves i or not.
22:39 <monochrom> No one will factor out "trace dm (return ()) >> return i" but the "trace dm (return ())" part can always be factored out.
22:40 <kuribas> but the inliner runs in many stages.
22:40 FullyFunctional left
22:40 louispan joined
22:40 <monochrom> Yes, my hypothesis still has a lot of holes.
22:41 <kuribas> anyway idk, I am not a ghc expert...
22:41 <monochrom> But a lot other hypotheses are clearly worse.
22:41 <kuribas> I guess trace, unsafePerformIO, etc... will be always unpredictable.
22:41 <kuribas> It's isn't even the same in ghci and compiled.
22:42 <kuribas> In my case it's only for debugging, so that's fine.
22:42 louispan joined
22:42 <monochrom> To some extent, trace is intended to expose compiler mutilations.
22:42 snowalpaca joined
22:43 <monochrom> It does not advertise itself as "I will show you what happens when faithfully following the vanilla naive lazy evaluation strategy".
22:44 <monochrom> It totally intends to show "what did the compiler decide to actually do"
22:44 zar joined
22:44 <monochrom> But "compiler" does vary along the axis of ghci -> O0 -> O1 -> O2.
22:44 Voldenet joined
22:44 Voldenet joined
22:44 <bennofs> monochrom: doesn't trace inhibit at least some floating out optimization?
22:45 <monochrom> In fact, not just "compiler", also "run time system", at which point turning on or off profiling may matter, too.
22:46 <monochrom> I don't know. But it didn't inhibit this one.
22:47 <hpc> don't forget the llvm and javascript backends too
22:50 <monochrom> kuribas: Observe what happens when -fno-full-laziness
22:51 defaultnick___ joined
22:51 tommd joined
22:53 petervaro joined
22:53 infinity0 joined
22:54 gugah joined
22:55 ramzifu joined
22:56 ungolobol joined
22:57 freusque joined
22:57 ungolobol left
22:57 djellemah joined
22:57 fotonzade joined
22:58 <Axman6> bgamari: hey, no I didn't. I might have a look at how the parser can be changed, seems the use of `double` might be more strict than the WKT language allows
22:58 defaultnick_ joined
22:59 suls joined
22:59 <bgamari> Axman6, oh dear
23:00 <bgamari> Axman6, WKT isn't exactly the best-specified format I've written a parser for
23:00 <bgamari> so please do submit PRs
23:00 <bgamari> ideally I would start collecting some examples for a testsuite
23:03 defaultnick_ joined
23:03 izacht13 joined
23:06 defaultnick_ joined
23:08 gcross_ joined
23:09 _ashbreeze_ joined
23:10 coot joined
23:12 BlueRavenGT joined
23:12 refold joined
23:20 xcmw joined
23:20 bernouli joined
23:20 NeverDie joined
23:22 <lpaste_> robkennedy revised “Classes on Functions - Why won't this typecheck?”: “Classes on Functions - Why won't this typecheck?” at http://lpaste.net/699260116473479168
23:23 <robkennedy> If anyone could look at that it'd help a lot
23:24 defaultnick___ joined
23:25 anuxivm joined
23:25 sid_fules joined
23:25 cloudhead joined
23:27 <robkennedy> In particular it's seeming to not unify `forall a. a -> o` where o is free
23:27 geekosaur joined
23:29 rperry joined
23:29 freusque joined
23:29 tromp joined
23:31 jao joined
23:32 bernouli joined
23:33 <lpaste_> robkennedy revised “Classes on Functions - Why won't this typecheck?”: “Classes on Functions - Why won't this typecheck?” at http://lpaste.net/699260116473479168
23:33 orion joined
23:33 orion joined
23:34 TxmszLou joined
23:34 rick_rustled joined
23:35 anuxivm joined
23:36 <rick_rustled> i can't for the life of me see how "seperating syntactic analysis from execution" makes any difference in terms of SICP's metaevaluator
23:36 <rick_rustled> https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-26.html#%_sec_4.1.7
23:36 ramzifu joined
23:36 <rick_rustled> i see no gain in efficiency whatsoever
23:36 <rick_rustled> it seems like the same thing is happening either way; seperating analysis from execution seems inconsequential to me (i'm obviously missing something here)
23:40 zar joined
23:40 izacht13 joined
23:40 rkazak_ joined
23:42 louispan joined
23:42 <EvanR> syntactic analysis doesnt seem to have anything to do with execution to me
23:43 <EvanR> especially in the haskell channel, where even evaluation has nothing to do with execution
23:43 <hpc> the lexical syntax of comments, though?
23:43 <hpc> definitely execution
23:45 <lpaste_> glguy annotated “Classes on Functions - Why won't this typecheck?” with “Classes on Functions - Why won't this typecheck? (annotation)” at http://lpaste.net/699260116473479168#a7876565830081708032
23:46 <glguy> robkennedy: When you're making this much of a mess, mixing rank-n types in is easiest to manage under a newtype
23:46 botolhejo joined
23:46 <glguy> (that version loads)
23:47 mattyw joined
23:47 mtncoder joined
23:47 meck joined
23:48 dan_f joined
23:49 randomclown joined
23:49 sphinxo joined
23:50 geekosaur joined
23:50 <sphinxo> So i'd like to make a version of State, where get and put take an additional param
23:50 <sphinxo> so example usage would be {put True 10; put False 20} and then doing get 15 yields True, but get 25 would yield Fals
23:50 Rainb joined
23:50 <Koterpillar> sphinxo: why not use a State over Map Int Bool?
23:51 defaultnick joined
23:51 <sphinxo> or (Ord a) Map a b ?
23:52 <Koterpillar> whatever suits you
23:52 <Koterpillar> then you can have convenience functions putKey :: k -> v -> State (Map k v) (), getKey :: k -> State (Map k v) (Maybe v)
23:53 <sphinxo> I'm not sure that's what I want
23:53 <Koterpillar> then what do you want?
23:53 <sphinxo> I want like a time traveling k/v store
23:54 <sphinxo> so for example put <k> <v> timestamp
23:54 <sphinxo> so for example put <k> <v> timestamp + 5
23:54 <sphinxo> and then get <k> timestamp + 3 would give me the first v
23:55 <Koterpillar> all of this is still a State over some structure
23:55 <sphinxo> actually yeah
23:55 <Koterpillar> not necessarily a Map, but you get to reuse the State instance
23:55 sid_fules joined
23:57 <sphinxo> but say it's not a Map, say I want to set the state to be x and <timestamp> and then set it to y at <timestamp + 5> and then get it at timestamp + 3, which should give me x
23:57 <sphinxo> to be x *at <timestamp>
23:57 <Koterpillar> right, so that's a data structure you can have
23:57 <Koterpillar> ...actually, still map
23:57 <Koterpillar> it has a "get the first key that's lower than X"
23:58 <sphinxo> ahh ok
23:58 <robkennedy> glguy: thanks. Don't understand how that fixed it
23:58 <sphinxo> Koterpillar: what's the name of that function?
23:59 <Koterpillar> sphinxo: lookupLT
23:59 <Koterpillar> (LE/GE/etc.)
23:59 <sphinxo> ahh wonderful