<    April 2017    >
Su Mo Tu We Th Fr Sa  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
00:00 phaji_ joined
00:00 <geekosaur> no, it's written in C
00:00 naushadh joined
00:00 <Welkin> why not B?
00:00 suls joined
00:00 <iqubic> Cool. How can I get that rolling?
00:00 caumeslasal joined
00:00 was kicked by monochrom: Welkin
00:00 arctictern joined
00:01 <iqubic> Shall I head over to the #xmonad channel?
00:01 <geekosaur> usually via your package manager
00:02 anuxivm left
00:02 NeverDie joined
00:02 <iqubic> Now how do I add a dzen hook to xmonad?
00:03 Jackoe joined
00:04 filterfish joined
00:05 eacameron joined
00:06 <jayjam124> https://0bin.net/paste/6gWOXN5LTgxi+FVk#T4NprMJ2166hKrcMwtBBDk2x+ebOH3HbTNt8tSV28c1
00:06 <jayjam124> can anyone identify any race conditions in my code?
00:06 <jayjam124> I can't
00:06 conal joined
00:07 <iqubic> Why do you think that there is a race condition in that code?
00:07 <monochrom> I get "404" "Either this paste has expired or this page never existed."
00:07 <jayjam124> sorry here's another
00:07 <jayjam124> https://0bin.net/paste/r37Qdg2gBbvHpbDx#tWfXeUhXJSuwJGQ6FOSZ43f1EfZdRhV8ETRiQSGLKgd
00:07 <jayjam124> and I don't think there does
00:08 <jayjam124> I mean, if there isn't a deadlock, which my code does not have
00:08 <monochrom> Haha "did not seem code, will not colorize"
00:08 <jayjam124> then that means a race condition also can't happen?
00:08 <monochrom> No, race condition and deadlock are orthogonal.
00:09 <monochrom> As in, no, you can't make deductions either way.
00:09 <jayjam124> then I am confused
00:09 <iqubic> How the heck do I get XMonad to use dzen?
00:10 mojjo joined
00:10 yuuray_ joined
00:11 binaryplease joined
00:11 <jayjam124> ok monochrom, can you tell if there is a race condition in there?
00:11 <jayjam124> if not why not?
00:11 <jayjam124> if yes why yes?
00:11 <monochrom> What should your program do? What observation did you see that you consider a race condition?
00:12 <jayjam124> A race condition is an undesirable situation that occurs when a device or system attempts to perform two or more operations at the same time, but because of the nature of the device or system, the operations must be done in the proper sequence to be done correctly.
00:12 <monochrom> Yes, that's a perfect definition.
00:12 <monochrom> So now what is desirable to you and what is undesirable to you?
00:13 <jayjam124> what do you mean|?
00:13 <jayjam124> I mean it's desirable that you don't have a race condition
00:13 <jayjam124> you want your program to be perfect
00:13 <monochrom> OK, that's circular logic.
00:13 <jayjam124> huh?
00:13 <Koterpillar> jayjam124: what do you want your program to do?
00:13 <Koterpillar> if the only thing is "not have race conditions", this suffices: main = return ()
00:13 <jayjam124> I don't want collisions
00:14 <monochrom> May I ask again?
00:14 <monochrom> What should your program do? What observation did you see that you consider a race condition?
00:14 <barrucadu> What do you mean by collisions?
00:14 <jayjam124> when you have data but two or more operations want access to the data
00:15 <jayjam124> and it can mess up the data
00:15 <jayjam124> monochrom so you're asking me what my program does?
00:15 crobbins joined
00:15 <barrucadu> You only have one thread taking from the MVar
00:15 <jayjam124> main yeah
00:16 zcourts_ joined
00:16 <jayjam124> if I only have one thread taking from MVar
00:16 <barrucadu> So there will never be a situation where more than one thread wants "access to" the data, if by "want access to" you mean "reads".
00:16 <jayjam124> then that means that other threads aren't
00:16 <jayjam124> yeah
00:16 <jayjam124> so no race conditions
00:17 <jayjam124> ...right?
00:17 jasondockers joined
00:17 <Tertiary> Can someone tell me a more concise way to write this? I feel like there is something obvious I'm missing, but after playing with it a bit, I can't get anything except this or the do-block version of it to typecheck
00:17 <Tertiary> f x = ask >>= return . someField >>= (\g -> g x)
00:18 <barrucadu> jayjam124: Right.
00:18 cy joined
00:18 cy left
00:19 <jayjam124> barrucadu :) thanks
00:19 <barrucadu> The main thread does "race" with the genThread and userThread, in that the relative order of their execution is not controlled anywhere, but that doesn't appear to be undesirable.
00:19 <Tertiary> someField is just a record field on the state object that that is of type String -> SomeMonad m
00:19 <glguy> f x = ask >>= \y -> someField y x
00:20 <geekosaur> first off, (ask >>= return . someField) is (asks someField)
00:20 <jayjam124> barrucadu makes sense, thanks
00:21 P1RATEZ joined
00:21 P1RATEZ joined
00:21 <barrucadu> jayjam124: But what monochrom was getting at is that whether something is a race condition or not very much depends on what you want your program to do. It doesn't really make much sense to present some code and ask if it has any races, with no explanation of what it *should* do.
00:21 trevorriles joined
00:21 trevorriles_ joined
00:21 <jayjam124> yeah so he's asking what it was doing
00:21 <jayjam124> I understand, I was just confused that's all
00:21 <geekosaur> (\g -> g x) can be written ($ x)
00:23 hydraz joined
00:24 <Tertiary> Thanks geekosaur, I was trying something similar, but just did it slightly wrong
00:25 <trevorriles> \quit
00:26 fizbin joined
00:28 <iqubic> What does hscolor do, and has it been updated to work with GHC8?
00:29 <Koterpillar> iqubic: likely yes: https://www.stackage.org/package/hscolour
00:30 <geekosaur> it outputs colorzied source code, eiteher as html or for terminal display, and as such it likely needs more work if it's not ghc8 compatible because it would need to learn about things like the TypeApplication extension which changes the language syntax
00:32 <iqubic> Is it fine if I get rid of hscolour? What functionality would I be losing?
00:32 andyhuzhill joined
00:32 Rodya_ joined
00:32 <geekosaur> probably hyperlinked and colorized source in locally generated documentation
00:33 nighty-- joined
00:33 cmsmcq_ joined
00:34 LuckyRawApe joined
00:34 <iqubic> I never look at locally generated documentation.
00:34 eacameron joined
00:37 <iqubic> What is Haddock, and why hasn't it been updated to GHC *
00:37 <iqubic> GHC 8
00:37 howdoi joined
00:38 kiltzman joined
00:38 richi235 joined
00:39 <Koterpillar> iqubic: what makes you think it hasn't?
00:39 <iqubic> I misread something.
00:41 JeanCarloMachado joined
00:42 <iqubic> How can I tell which of my packages still relies on an old version of GHC?
00:42 Kundry_Wag joined
00:44 <Koterpillar> try building them with the new one
00:44 <Koterpillar> using stack, for example
00:44 <Koterpillar> or do you mean "packages I created" by "my packages"?
00:44 <iqubic> I mean packages that I have downloaded through the gentoo package manager.
00:45 <iqubic> How do I get stack to work on Gentoo?
00:45 <geekosaur> iirc you don't currently
00:45 <geekosaur> and you also don't get to tell gentoo to use a newer ghc for its packages; you get what it uses
00:46 <iqubic> So I have to live with an outdated version of GHC?
00:46 <geekosaur> that's the problem with distribution packages; you get someone else's configuration, not the one you would prefer
00:46 <Koterpillar> geekosaur: why can't you install Stack on Gentoo?
00:47 <iqubic> Can I just purge all the packages that rely on GHC, and just re-install the ones that I need, when I need then?
00:48 <* geekosaur> is trying to remember
00:48 <geekosaur> iqubic, don't use gentoo's packages if you don't want gentoo's ghc version
00:49 filterfish joined
00:49 <iqubic> Yeah, I got that. Is there any way to get myself out of the hole that I've dug for myself.
00:49 <geekosaur> as I just said, this is what you get when you use a distribution's packages. you get what they package (or in this case what they wrote a port for)
00:49 <geekosaur> you can probably install ghc from the generic binary distribution and then use that to install packages
00:49 filterfish_ joined
00:50 <iqubic> But what do I do with the existing version of GHC.
00:51 <geekosaur> uninstall it
00:51 <geekosaur> either use portage and only portage, or use a separate ghc install and don't use portage for anything haskell related
00:51 <geekosaur> you cannot mix and match
00:51 <geekosaur> (the same is true to varying extents of perl, python, ruby, npm, ...)
00:52 <geekosaur> (and most of the will refuse to support you if you say you are using a distribution installed version; we at least try to help...)
00:52 <iqubic> But If I uninstall it, tons of packages will be without a crucial dependency.
00:52 <geekosaur> re stack on gentoo, http://lpaste.net/6559619481490948096 was the reported issue. I don't know if this has been fixed since then (January) but last I heard people were still having linker issues
00:52 Stanley00 joined
00:53 <geekosaur> iqubic, I already said you have to remove those and reinstall using the new ghc, you CANNOT mix and match
00:53 <iqubic> I'll do that now.
00:53 <geekosaur> distribution packages are not designed for mix and match, they are designed for you to install everything from the distribution
00:54 <geekosaur> so either use everything from the distribution or use nothing from it
00:55 <geekosaur> this is true even of ports-based systems, although tye usually at least try to allow for a little more flexibility, there's no way to be fully flexible and yet provide some guarantee of things working
00:56 <robkennedy> I'm working on a Sudoku solver to practice speeding up Haskell. From all your collective experience, do you think anything will go faster to represent the possible values of a cell than Word16 (with each bit from the right representing if that number is a possibility)? I've tried IntSet and OrdList which were ~ 1.2x and 3x slower
00:56 jmcarthur joined
00:57 conal joined
00:57 GsC_RuL3Z joined
00:59 <dolio> I would be surprised if anything else were faster.
01:00 <geekosaur> there's likely an optimized bitset implementation on hackage that will be faster than a simple bit vector implementation, but otherwise probably not
01:00 <dolio> Aside from packing multiple cells together in a larger size word.
01:00 Rodya_ joined
01:00 <dolio> Although that involves more arithmetic for certain things.
01:01 JeanCarloMachado joined
01:03 sanitypassing joined
01:03 trevorriles joined
01:07 <robkennedy> Yeah. I'd hoped that I could handcraft a `type Possibilities = (Bool,Bool,...,Bool)` type to compete, but the lore I've learned says Bool takes 8 bits
01:08 perlawhirl joined
01:08 <robkennedy> *newtype
01:08 <dolio> Way more than that.
01:09 Netwolf joined
01:10 <iqubic> Just moving over to GHC 8.0.1 now.
01:11 <iqubic> It's a hard proccess, because I'm also moving away from using the Gentoo distribution GHC.
01:12 a3Dman joined
01:12 indi_ joined
01:12 <robkennedy> Okay, on the other side: do you think if I went more granular, and shrunk my functions to Word8 after a number had been solved, I could get a speedup?
01:13 <dolio> No.
01:15 <robkennedy> Yeah, I agree. I'll test it anyway.
01:15 <dolio> Testing it is almost certainly a waste of time.
01:15 <dolio> Both Word8 and Word16 use a machine word internally.
01:16 <iqubic> Alright, how does one install GHC 8 from binary sources.
01:16 <robkennedy> Oh good point
01:16 louispan joined
01:16 <dolio> Unless you're storing them in an unboxed array or something.
01:17 conal joined
01:17 vishnix joined
01:17 <dolio> Just using Word might be faster because it doesn't have to do modular arithmetic at all, if you're doing arithmetic.
01:17 <dolio> But that'd probably be negligible.
01:17 <iqubic> Alright, I think I am now able to update to GHC 8
01:17 peterbec` joined
01:18 dan_f joined
01:18 <robkennedy> For the word16 representation of Possibilities it's mostly hacking against Data.Bits
01:18 <dolio> Yeah. So there'd probably be no difference, then.
01:19 <iqubic> Alright, does it really take two hours to compile GHC 8.0.2 from source?
01:19 <dolio> Depends on your computer.
01:20 <robkennedy> Right now I change my representation by changing `import PossibilitiesWord as Possibilities` to `import PossibilitiesVector as Possibilities`. Can I swap to `class Possibilities a` with no cost if I inline enough?
01:21 <geekosaur> iqubic, if you have the bindist, you "./configure --prefix=/where/you/want/to/install/it" then "make install"
01:21 <kadobanana> If you're just trying to install GHC, you generaly don't have to build it from source, in case you weren't aware. It still takes a while to ... I don't even know it calls it, bootstrap or something, but it's not too terribly long.
01:21 <geekosaur> installing from source requires another ghc to bootstrap and it has to be within 2 versions
01:21 <iqubic> geekosaur: I don't have that. Not sure where to download that.
01:22 <iqubic> geekosaur: Do you run Gentoo?
01:22 <geekosaur> https://www.haskell.org/ghc/download_ghc_8_0_2
01:22 <geekosaur> and no, I don;t run gentoo
01:22 <iqubic> Oh.
01:22 <iqubic> I see
01:23 perlawhirl joined
01:23 <iqubic> So do you recomend trying to compile GHC from source or not?
01:23 path[l] joined
01:24 cschneid_ joined
01:25 <monochrom> No, don't do that, unless you need the heat.
01:25 <monochrom> But wait, gentoo... :)
01:25 cschneid_ joined
01:25 <Koterpillar> I wonder how does it deal with bootstrapping
01:26 <glguy> it downloads a binary to compile with
01:26 <iqubic> monochrom: I can install it with out going through the system's package manager.
01:26 <iqubic> glguy: How do you know that?
01:27 <monochrom> I think it certainly had to address bootstrapping once upon a time, but since then there is no worry. Like GHC.
01:27 filterfish joined
01:27 cschneid_ joined
01:27 <glguy> iqubic: that was a response to the question of boot strapping
01:27 <glguy> I know that because it's the only option
01:27 <Koterpillar> you could build a chain of GHCs all the way back?
01:27 filterfish joined
01:28 <iqubic> glguy: I know that. I was wondering how you knew that Gentoo fetched a binary so that it could compile GHC.
01:28 <iqubic> Is there a list of new features in GHC 8.0.2?
01:28 <iqubic> I'd like to see that.
01:28 <monochrom> iqubic: Yes, I recommend what geekosaur recommended, download the binary tarball and use --prefix for good organization.
01:29 <iqubic> Oh. I'll do that.
01:29 <monochrom> If you do something like --prefix=/usr/local/myghc802, it will mean more hassle with PATH, but it will also mean easy erasure.
01:29 ebzzry joined
01:29 _sras_ joined
01:29 <iqubic> And then will I have to avoid using the Gentoo Package manager when installing Haskell packages.
01:29 <lordcirth> Apparently I am missing something obvious. I am trying to declare a lens, 'player', that goes from a GameState record to a list 'creatures' to it's first element, ie gs^.player == gs^.creatures._head. But player = creatures._head errors
01:29 <monochrom> The GHC User's Guide has a section on new features.
01:30 <_sras_> What is the difference between a Natural Transformation and Just a simple function?
01:30 <iqubic> lordcirth: Do you understand Haskell?
01:30 <lordcirth> iqubic, the basics
01:30 <Koterpillar> lordcirth: what's the error?
01:30 <iqubic> you'd write that like: player = head creatures
01:31 <glguy> iqubic: afaik Gentoo only builds ghc from source if you tell it to
01:31 <iqubic> Oh.
01:31 <Koterpillar> iqubic: that's lenses
01:31 <monochrom> A natural transformation is not just a simple function. In some examples not a function at all.
01:31 <monochrom> And in some examples, an indexed family of functions rather than one single function.
01:31 <iqubic> Koterpillar: I'm just not used to seeing stuff that looks like OOP.
01:31 <monochrom> And that last sentence is already the most boring example.
01:32 <glguy> lordcirth: _head is not a lens
01:32 <lordcirth> https://hackage.haskell.org/package/lens-3.0.1/docs/Data-List-Lens.html
01:32 <lordcirth> https://gist.github.com/lordcirth/a14d3f1974109c3ac2c60ba0a21fd3c3
01:32 MarioBranco joined
01:32 <lordcirth> glguy, so, it being "Simple Lens" is the problem?
01:32 <_sras_> monochrom: What is the difference. How is it different from a function from one monad to another monad. For example a function from Maybe a -> Either String a ?
01:32 <glguy> lordcirth: and that documentation link is out of date, old version
01:33 <monochrom> I will want to emphasize the omitted "forall a" there. forall a. Maybe a -> Either String a.
01:33 <iqubic> Koterpillar: Does his code actually work. That doesn't look like actual Haskell to me.
01:33 edvorg joined
01:33 <monochrom> That is an example of natural transformations.
01:33 darjeeling_ joined
01:34 <monochrom> But that also has one particular example category in mind.
01:34 <Koterpillar> iqubic: it's almost correct, and yes, lenses look very OOP: http://hackage.haskell.org/package/lens
01:34 <glguy> iqubic: haskell has operators. as you learn more of it you'll see lots more of them
01:35 <monochrom> Also you don't need monad. You just need functor.
01:35 <lordcirth> glguy, ok. So what is the proper way? creatures.(ix 0) doesn't work either
01:35 <iqubic> glguy: Yeah, I've seen several of the operators
01:35 <_sras_> monochrom: Isn't a lift a function from one Monad ot another Monad. So what is the difference between a Nat and a Lift?
01:35 <monochrom> I don't understand the question.
01:35 <glguy> lordcirth: use ^? instead of ^.
01:36 <monochrom> Also there are non-lifting natural transformations.
01:36 <jmcarthur> TFL you add lens to a cabal file and have to install 20 or so more packages for it even though you already have a lot of dependencies built.
01:36 <_sras_> monochrom: Ok. But I am trying to see the difference.
01:36 <lordcirth> glguy, ok, but it won't even let me declare the lens function in the first place
01:36 <lordcirth> Or should that be in the definition?
01:37 <monochrom> You're probably restricting yourself to the category of Haskell types and functions, and so natural transformations look just like a special case of polymorphic functions.
01:38 <glguy> lordcirth: you can't define a Lens using _head or ix
01:38 <glguy> you get a Traversal
01:38 <lordcirth> glguy, I see
01:39 <lordcirth> glguy, so, player = creatures.preview ?
01:39 <monochrom> And even worse, natural transformations don't cover all polymorphic Haskell functions.
01:39 <_sras_> monochrom: Does it make sense to have a Nat from a Maybe to an Either?
01:39 <monochrom> No.
01:39 <_sras_> Why is that?
01:40 a3Dman joined
01:40 <monochrom> There is no object "Either Int" for example.
01:41 <monochrom> But you can correct that to: can have a natural transformation from Maybe to Either Int.
01:41 <iqubic> No, but there is Either a Int or Either Int b
01:41 <monochrom> Right, like that.
01:41 chris___ joined
01:42 <iqubic> Both are correct.
01:42 <glguy> lordcirth: no. I'm on my phone, hard to write code out
01:42 <glguy> preview isn't something you compose with a Lens
01:43 Wizek_ joined
01:43 <lordcirth> Apparently I really don't understand Lenses
01:43 Kundry_Wag joined
01:43 <glguy> where I'm taking about (.) as compose
01:43 SimpleL joined
01:44 <lordcirth> I had GameState containing _player :: Player and _monsters :: [Monster] but I changed that to _creatures :: [Creature] where _creatures !! 0 == the player
01:44 <glguy> preview and view are lens * consumers*
01:44 alecbrick joined
01:44 <lordcirth> glguy, like over and set?
01:44 <glguy> yeah
01:46 sophiag joined
01:47 uncertainty joined
01:47 <iqubic> So what even is a lens, and how useful is it really?
01:47 <lordcirth> glguy, so in order to do gs^.player just like I used to, but actually get gs^.creatures !! 0, what does 'player' need to be defined as?
01:47 <lordcirth> iqubic, they are very useful, and I have only the faintest idea what they are XD
01:47 BlueRavenGT joined
01:48 <iqubic> lordcirth: Those seem like contradictory things
01:49 <glguy> lordcirth: You can do: gs ^? player . ix 0
01:49 <Koterpillar> iqubic: type Lens a b = (a -> b, b -> a -> a)
01:49 <Koterpillar> (not the real definition)
01:49 <lordcirth> glguy, but how must 'player' be defined?
01:50 <Koterpillar> iqubic: means you can read that part and set it to another value (like "player" part of the game state in lordcirth's example)
01:50 <Koterpillar> iqubic: now throw a ton of combinators at them - read the examples in Lens hackage - and you've got a very useful tool
01:51 <lordcirth> glguy, did you mean, gs ^? creatures . ix 0 ?
01:51 <jmcarthur> :t maybe (Left Nothing) (left Just) -- feels like something that should be doable with just one or two tokens
01:51 <lambdabot> Maybe (Either a b) -> Either (Maybe a) b
01:51 <glguy> lordcirth: Yeah
01:52 <lordcirth> glguy, ok, so if I want to make 'player' a shorthand for that, what's the correct way to do that?
01:53 <jasondockers> I'm slightly confused by `fib = 1 : 1 : [a+b | (a,b) <- zip fib (tail fib) ]`. what does zip fib (tail fib) evaluate to? would it be (1,1) to begin with, but then fib has [1,1,2]. so how would zip [1,1,2] [2] evaluate?
01:53 <lordcirth> Or do I not do that?
01:53 <glguy> lordcirth: player = creatures . ix 0
01:53 <lordcirth> glguy, oh ok. Makes sense.
01:53 <jmcarthur> I guess it's sequence, but where the applicative focuses on the first type argument of Either instead of the second.
01:53 <glguy> It'll be something like: player :: Traversal' GameState Creature
01:53 <Koterpillar> jasondockers: fib is infinite
01:54 <jasondockers> Koterpillar, okay, so it is only computed as needed?
01:54 Supersonic112_ joined
01:54 <Koterpillar> jasondockers: correct
01:54 <Koterpillar> jasondockers: its tail is also infinite
01:54 <jasondockers> Koterpillar, maybe I should say we perform a "select first 10" on it?
01:54 <lordcirth> glguy, I get the same error. perhaps the type is being inferred wrong because of something elsewhere?
01:54 robertkennedy joined
01:54 <Koterpillar> jasondockers: you can if you want
01:54 <jasondockers> Koterpillar, I'm having trouble imagining how it is computed when needed / how the list expands
01:55 <Koterpillar> jasondockers: everything is lazy, it's not computed until needed
01:55 nulspace joined
01:55 <jasondockers> Koterpillar, yes, when it is needed.
01:55 <Koterpillar> jasondockers: _if_ someone calls fib, they'll first get [1, 1, ...
01:55 <Koterpillar> and then for the third element, what happens?
01:56 <jasondockers> in pseudo code, I guess, "1+1 | (1,1) <- zip [1,1] [1]".. so [1,1,2,...]
01:57 <jasondockers> if someone requires it is computed
01:57 <Koterpillar> correct, except those lists there aren't finite, they are just the same infinite list
01:58 <glguy> lordcirth: did you forget the type signature for player?
01:58 <glguy> or can you just paste the actual code and error so I can look at that?
01:59 <lordcirth> glguy, https://github.com/lordcirth/haskell-rogue/blob/master/src/GameState.hs
02:00 hucksy_ joined
02:00 <jasondockers> Koterpillar, when the fourth element in the list is computed is the sum of the resulting tuple from zip [1,1,2] [2] used?
02:00 <lordcirth> glguy, https://gist.github.com/lordcirth/5af5c34ce22a215a70bc2eac41f74de5
02:01 <Koterpillar> jasondockers: so you have three elements, then fib = [1, 1, 2, ...
02:01 <Koterpillar> jasondockers: therefore, tail fib = [1, 2, ...
02:01 <jasondockers> oh, oops!
02:01 a3Dman joined
02:01 <jasondockers> tail x:xs = xs, so to speak
02:01 <jasondockers> for a moment I thought it was the last element
02:01 <Koterpillar> > tail [1, 2, 3, 4]
02:01 <lambdabot> [2,3,4]
02:01 <Koterpillar> > last [1, 2, 3, 4]
02:02 <lambdabot> 4
02:02 <jasondockers> yeah
02:02 juhp joined
02:02 <Koterpillar> @src tail
02:02 <lambdabot> tail (_:xs) = xs
02:02 <lambdabot> tail [] = error "Prelude.tail: empty list"
02:03 <jasondockers> > [a+b | (a,b) <- zip [1,2,3,4] (tail [1,2,3,4])]
02:03 <lambdabot> [3,5,7]
02:03 <jasondockers> okay, this makes sense now
02:04 <Koterpillar> > let loopy = cycle [1, 2, 3] in take 10 (zip loopy (tail loopy))
02:04 <lambdabot> [(1,2),(2,3),(3,1),(1,2),(2,3),(3,1),(1,2),(2,3),(3,1),(1,2)]
02:04 <jasondockers> granted, 3,5,7 isn't the right sequence, but close enough
02:05 <dolio> > [ a+b | a <- [1..4] | b <- [2..4] ]
02:05 <lambdabot> [3,5,7]
02:05 <jasondockers> Koterpillar, yeah, I follow loopy
02:06 <Koterpillar> jasondockers: note that dolio used an extension that allows parallel iteration
02:07 <Koterpillar> > [a + b | a <- [1..4], b <- [2..4] ]
02:07 <lambdabot> [3,4,5,4,5,6,5,6,7,6,7,8]
02:07 <jasondockers> yeah, I don't recognize that syntax
02:07 <jasondockers> I know about generators and boolean guards in list comprehension, I believe
02:07 <jasondockers> I'm just reading the tutorial
02:07 <Koterpillar> dolio: what's the name?
02:08 louispan joined
02:09 edvorg joined
02:09 <dolio> ParallelListComprehensions? Something like that.
02:10 Kundry_Wag joined
02:10 <glguy> lordcirth: I can't reproduce your problem
02:10 <glguy> lordcirth: Maybe you're loading the wrong version of the file
02:10 <lordcirth> glguy, that's odd
02:11 <lordcirth> glguy, it doesn't compile for you, though, right? There are (and should be) other errors from the ongoing refactor
02:12 <glguy> lordcirth: That GameState.hs loads for me
02:12 <lordcirth> glguy, right, that file by itself. ok.
02:12 conal joined
02:12 Rodya_ joined
02:12 <lordcirth> I will try it by itself
02:13 exferenceBot joined
02:13 <lordcirth> glguy, interesting, if I just do 'stack ghci' in the directory, it compiles GameState then crashes at the rest
02:14 <lordcirth> glguy, is there something that Leksah might be doing that is odd?
02:14 <jasondockers> glguy, are you programming opengl in haskell?
02:15 sleffy joined
02:15 <glguy> jasondockers: Nope.
02:15 <glguy> lordcirth: I couldn't say
02:15 <lordcirth> glguy, what IDE do you use?
02:16 <glguy> vim or macvim
02:16 <lordcirth> ah. I was using vim, but tried leksah today and it's more enjoyable
02:16 hucksy joined
02:16 <lordcirth> except for now, obviously...
02:17 Guest6344 joined
02:18 hexagoxel joined
02:18 peterbec` joined
02:19 safe joined
02:19 steeze joined
02:20 vaibhavsagar joined
02:20 ali_bush joined
02:20 harfangk joined
02:22 patrickmn joined
02:22 infinity0 joined
02:23 <iqubic> What is Leksah? And can I install it on my machine?
02:23 tripped joined
02:23 <kadobanana> It's a haskell IDE that not that many people seem to use
02:24 <iqubic> Isn't it written in Haskell?
02:24 <geekosaur> yes
02:24 <iqubic> What library does it use for GUI stuff?
02:25 <geekosaur> gtk
02:25 etehtsea joined
02:25 <geekosaur> http://leksah.org/
02:25 <iqubic> Ah. Not some native Haskell thing like Fudgets?
02:25 <iqubic> Why does it use GTK?
02:25 <iqubic> Does Leksah support GHC 8.0.2?
02:25 Kundry_Wag joined
02:26 <lordcirth> glguy, I just ran 'cabal configure' in the project directory and relaunched leksah and it fixed it... argg
02:26 <lordcirth> glguy, thanks for all your help with Lens
02:27 <lordcirth> iqubic, as best I understand, it supports whatever your cabal version does
02:28 aarvar joined
02:28 bluepixel joined
02:29 Goplat joined
02:29 pavonia joined
02:30 conal joined
02:30 <glguy> lordcirth: you're welcome.
02:31 <lordcirth> glguy, yeah apparently I / stack upgraded cabal from 1.2.2 to 1.2.4 and it didn't run configure, or something
02:31 infinity0 joined
02:31 edvorg joined
02:32 raycoll joined
02:33 d34df00d joined
02:33 <d34df00d> Hi!
02:34 <d34df00d> https://wandbox.org/permlink/Po2QAbCP5WTuPHSZ why doesn't it typecheck?
02:35 <d34df00d> From what I understand, every usage of `Typ a` implies that `a` is of `TypHolder`, hence `Typ a` should implement Eq.
02:36 infinity0 joined
02:36 <geekosaur> you're telling it that every Typ a is a TypHolder a *if* it has an Eq instance
02:36 Henson joined
02:37 <geekosaur> hm, wait, typoe family
02:37 <geekosaur> type family.my fingers are the typo family :p
02:38 <glguy> d34df00d: TypHolder a implies that Eq (Typ a)
02:38 raycoll joined
02:38 <glguy> but that doesn't mean that any particular Typ a has an Eq constraint on its own
02:39 <glguy> you need the TypHolder a still
02:39 <d34df00d> glguy: yeah, but I cannot use `Typ a` without meaning that `TypHolder a`, can I?
02:39 <iqubic> It looks like Leksah is on hackage, is that right?
02:39 <geekosaur> that was my "hm, wait", yeh
02:39 <geekosaur> iqubic, yes
02:39 <geekosaur> you will likely find you need to install a bunch of C libraries before it will build
02:40 <iqubic> Does that mean I can use Cabal to install leksah on my machine?
02:40 <geekosaur> yes
02:40 <glguy> d34df00d: You actually have to have the constraint to know how Eq is implemented
02:40 <d34df00d> glguy: uhm, why?
02:40 <glguy> the TypHolder a one, if you don't just happen to independently have an Eq (Typ a) around
02:40 <glguy> d34df00d: Because that constraint as the actual method definitions of (==) and (/=) in it
02:41 <glguy> has the*
02:41 ddellacosta joined
02:41 <Henson> is there some idiomatic way to take a list of items, and wherever a certain item appears to segment the list at that point? For example [1,2,3,4,5,3,6,7,8,3,9] when segmenting on 3 would become [[1,2],[4,5],[6,7,8],[9]]. You could optionally have the segmentation "key" be part of the list. I can do it with recursion, but this problem and several others I have encountered call for a functional..
02:41 <d34df00d> glguy: so, in other words, "the TypHolder a one" means that merely using/writing `Typ a` doesn't prove `a` is of TypHolder?
02:41 <iqubic> So when using cabal to install things, am I installing straight from hackage?
02:41 <Henson> tool similar to a fold, but instead of applying the fold function to every item in the list, allows the fold function to determine the remaining items in the list to pass on for further processing.
02:41 <glguy> d34df00d: correct
02:41 <d34df00d> glguy: why? :)
02:42 <d34df00d> Typ is defined in that class, doesn't it automatically imply that class then?
02:42 <Koterpillar> Henson: does Data.List.Split do what you want?
02:42 <iqubic> Is there a way to impose a limit onto takeWhile such that it either takes the first n items that satisfy the boolean, or just the first n items.
02:43 <iqubic> ??
02:43 <glguy> d34df00d: No, just because you wrote Typ a, doesn't mean there's actually a TypHolder a instance around
02:43 <Koterpillar> iqubic: apply it to take n ...
02:43 <glguy> I can ask for the kind of Typ () without the corresponding instance
02:43 <iqubic> Right.
02:44 filterfish joined
02:44 <d34df00d> glguy: but if you're writing that in a context that "requires" a full type?
02:44 <glguy> and given some 'Typ a' I can't tell what a was
02:44 <glguy> I don't know what you mean about the context
02:44 <iqubic> so "take n $ takeWhile bool list"
02:44 <glguy> but you won't be able to talk yourself into a free Eq instance for an arbitrary Typ a
02:45 sleffy joined
02:45 <d34df00d> Ok, I'm probably having XY problem here then.
02:47 <d34df00d> So I have a bunch of mutually recursive data structures (representing some AST, for instance). I'd like to parametrize them to allow carrying around some context, and I guess the context could be different for different node types. What are my best options?
02:47 <glguy> const 42 :: Typ () -> Int. I can write that without it making much sense or having an instance of TypHolder ()
02:47 <d34df00d> I thought about a typeclass with a type family, and then `data Expr a = Expr (Context a (Expr a)) [ChildExpr a]; data ChildExpr a = ChildExpr (Context a (ChildExpr a))` etc.
02:48 xtreak joined
02:48 <d34df00d> But Expr, ChildExpr and a few dozen of other types need to implement Eq, Show, Generic, NFData and some others, and I really don't want to write a few hundred of "deriving instance" by hand.
02:48 <d34df00d> Which kinda prohibits me from going the GADT route and adding the constraint to the ctor.
02:49 atec joined
02:49 <iqubic> What's the difference between "$" and ".:
02:49 <iqubic> Sorry "$" and "."?
02:49 <glguy> $ applies a function to an argument, the other builds a new function out of two functions
02:49 filterfish_ joined
02:50 <Henson> Koterpillar: what I'm looking for is closer to (break (== key) list), but coupled with some fold-like function. I can achieve it with recursion, but wonder if I don't know about a function that I should be using.
02:51 <d34df00d> Or, avoiding type families of kind * -> * and sticking with *, this somewhat illustrates what I'd ideally want: https://wandbox.org/permlink/JZPCh76WiZawkKMB
02:52 edvorg joined
02:53 <geekosaur> iqubic, ($) is just function application with lowest possible precedence (normal application is highest precedence, aside from record updates) so you can sometimes omit parentheses
02:53 filterfish__ joined
02:53 <geekosaur> operationally, in x $ y, y is a value; in x . y, y is a function that requires one or more values
02:54 <geekosaur> (that is something of a lie, but will do for now)
02:54 nomicflux joined
02:55 haiming joined
02:56 <lordcirth> glguy, this player :: Traversal' GameState Creature ; player = creatures . ix 0 ; returns a Maybe Creature. I know that the player will always exist. What's the correct way to assume this in 'player'? 'singular'?
02:57 <glguy> lordcirth: the correct way would be to move player to a separate field on your GameState that always exists so that you don't have to promise that the list is non-empty
02:57 <glguy> or you could use a NonEmpty list type for the list of creatures
02:57 <glguy> otherwise singular is an option
02:58 <lordcirth> glguy, well, the reason I moved it to the list, was so that I could do things like "damage all creatures on this tile" etc
02:58 <d34df00d> Worse than that, with standalone deriving the amount of constraints that needs to be specified manually grows combinatorially: https://wandbox.org/permlink/XhvHdhNN7sakofkX
02:59 <lordcirth> glguy, so where precisely do I put 'singular'? player = creatures . singular . ix 0 ?
02:59 bluepixel joined
02:59 <glguy> http://hackage.haskell.org/package/lens-4.15.1/docs/Control-Lens-Traversal.html#v:singular
03:00 <lordcirth> glguy, yeah, that's where I'm looking
03:02 <glguy> OK, cool. That's the right place
03:02 steeze joined
03:03 ebzzry joined
03:04 <lordcirth> Ok, so leksah keeps giving me confusing type errors that go away when I restart it
03:04 hamishmack joined
03:05 edvorg joined
03:07 louispan joined
03:08 peterbecich joined
03:10 xtreak joined
03:10 cpup joined
03:10 event_null left
03:10 filterfish_ joined
03:11 jmnoz joined
03:12 <iqubic> Alright, If I just want to download GHC 8
03:13 abel-abel joined
03:13 des_ joined
03:13 connrs joined
03:16 <* dmwit> wonders if iqubic is still planning to add a "then" to his "if"
03:17 <Koterpillar> Henson: can you post sample input and output?
03:18 <glguy> dmwit: Maybe it was a question. iqubic, yes, that's alright.
03:18 <iqubic> dmwit: If I just want to download GHC 8 and avoid going through my package manager, can I do that?
03:19 <vaibhavsagar> iqubic: that's what stack and nix do by default
03:19 <dmwit> iqubic: Yes.
03:20 <glguy> iqubic: Sure, that's how lots of us install GHC. You can download the binary distribution from haskell.org http://downloads.haskell.org/~ghc/8.0.2/
03:20 <dmwit> iqubic: GHC is generally careful not to clobber itself, so you can have many versions installed at once with no problem.
03:20 {emptyset} joined
03:20 <Henson> Koterpillar: say a function "cutAt :: a -> [a] -> [[a]]" that works like this: cutAt 3 [1,2,3,4,5,3,6,7,8,3,9] = [[1,2],[4,5],[6,7,8],[9]]
03:21 <dmwit> ?hackage split -- Henson
03:21 <lambdabot> http://hackage.haskell.org/package/split -- Henson
03:21 indi_ joined
03:21 <iqubic> And then would I be able to install the latest version of XMonad, and XMonad-Contribe with out any trouble?
03:21 indi_ joined
03:21 <dmwit> d34df00d: I'm not sure I've understood your question fully yet, but you might like to look at Eq1.
03:21 etehtsea joined
03:21 <dmwit> iqubic: Hm. I think so. What version of GHC are you having trouble with currently?
03:22 <Koterpillar> Henson: that exists in split, what did you refer to about folds?
03:22 <Henson> dmwit: oh my god, that is the best package description I have ever seen.
03:22 <dmwit> byorgey++ for having fun
03:23 <iqubic> dmwit: GHC 8.0.2 is being a pain in the back to install
03:24 <dmwit> iqubic: Well, somebody may be able to help you. But not with *that* problem description. =)
03:24 <Henson> Koterpillar: ok, I didn't know about the split package. As for the fold-like function, it would be nice to have a function that works on a list and an accumulator, like fold, but instead of applying its "worker function" to every item in the list, the worker function itself determines the remaining items to be processed.
03:24 <dmwit> :t unfoldr -- perhaps?
03:24 <lambdabot> (b -> Maybe (a, b)) -> b -> [a]
03:24 pyx joined
03:24 <Koterpillar> looks like
03:25 <dmwit> Henson: What would you want the type of that fold to be?
03:25 felixsch_ joined
03:26 shayan_ joined
03:26 Kundry_Wag joined
03:27 xtreak joined
03:27 alecbrick joined
03:28 platz joined
03:28 platz joined
03:28 <Koterpillar> guessing: (a -> b -> (Maybe a, b)) -> a -> b
03:28 takle joined
03:28 <Koterpillar> (really, a is a list, but it doesn't have to be)
03:29 <* Henson> is thinking
03:29 <Koterpillar> at which point, it might well be a variation of iterate
03:33 edvorg joined
03:33 <Henson> let's call it foldr2 :: ([a] -> b -> ([a],b)) -> b -> [a] -> b. Here the accumulator is b. The "worker function" takes the entire list and the accumulator, then returns as a tuple the rest of the list to be processed and the new accumulator. This would allow the function to take multiple items from [a] in creating the new accumulator.
03:34 raycoll joined
03:35 <d34df00d> dmwit: that's probably slightly different.
03:35 <d34df00d> But I'm not sure how to reformulate my question :(
03:36 <Koterpillar> Henson: that never stops
03:36 <Koterpillar> Henson: and you never use the fact that [a] is a list
03:36 <dmwit> Koterpillar: It could stop. e.g. if the third argument is empty.
03:36 <dmwit> Which would also incidentally address your other complaint. =P
03:36 <Koterpillar> I know, but I don't like that
03:37 <Koterpillar> my signature is better, except I forgot an argument
03:37 <dmwit> :t \f g -> head . dropWhile g . iterate f
03:37 <lambdabot> (c -> c) -> (c -> Bool) -> c -> c
03:37 <dmwit> ?let foldr2' f g = head . dropWhile g . iterate f
03:37 <lambdabot> Defined.
03:38 sleffy joined
03:38 benl23 joined
03:38 <dmwit> :t \f b as -> fst . foldr2' f (null . snd) $ (b, as)
03:38 <lambdabot> Foldable t => ((c, t a) -> (c, t a)) -> c -> t a -> c
03:38 <Henson> ok, consider the break function applied to a list: (break == key) list -> (front,key:rest). This splits the list into items in front of the key, the key, and the rest of the list. To segment the list, you'd just take the front and add that to the accumulator. Then you'd want to feed the "rest" to another invocation of the same thing. This seems amenable to a fold, but you want the worker...
03:39 <Henson> function to decide the remaining items in the list to process, you don't want to apply the worker function to every item in the list.
03:39 <Koterpillar> Henson: so why not fold over the result of break?
03:39 <Henson> the (->) arrow was meant to show the result, not a lambda function.
03:40 <dmwit> :t unfoldr (\xs -> case break (3==) xs of ([], []) -> Nothing; (head, _:tail) -> Just (head, tail))
03:40 <lambdabot> (Num a, Eq a) => [a] -> [[a]]
03:40 <dmwit> Henson: That's an unfoldr.
03:40 ContessaTP joined
03:42 <Henson> dmwit: excellent!
03:42 <Henson> thank you guys for helping me figure out the missing function! I've needed to use this kind of function several times in the past but didn't know it existed, so I always just built a recursive function to do it.
03:43 otto_s joined
03:45 c137 joined
03:46 takle joined
03:49 louispan joined
03:49 robotroll joined
03:50 Eduard_Munteanu joined
03:55 <vaibhavsagar> iqubic: do you have stack installed?
03:56 <vaibhavsagar> if so, you should be able to run `stack setup 8.0.2 --no-system-ghc`
03:56 eklavya joined
03:57 <vaibhavsagar> you'll have to add it to $PATH manually or use `stack exec -- ghc`
03:57 vlatkoB joined
03:58 <kadobanana> That would likely be stack setup --resolver ghc-8.0.2 or something
03:58 <kadobanana> I don't think it understand 8.0.2 by itself
03:58 <monochrom> I think that iqubic is not using stack.
04:00 <vaibhavsagar> I think it is actually `stack setup 8.0.2`
04:00 <vaibhavsagar> https://github.com/vaibhavsagar/prepare-ghcjs/blob/77942c98cec9d0df1090017010bc96f9b59c2cda/.travis.yml#L19
04:00 <vaibhavsagar> but I could be wrong :)
04:01 <kadobanana> Hmm, looks like you're right, I wasn't aware it accepted that
04:03 juhp__ joined
04:03 indi__ joined
04:05 micro__ joined
04:05 earldoug1as joined
04:05 connrs_ joined
04:05 chindy_ joined
04:05 mceier_ joined
04:06 hive-mind joined
04:06 vishnix_ joined
04:06 pera_ joined
04:07 lep_ joined
04:08 uglyfigurine joined
04:08 haasn joined
04:09 isenmann joined
04:09 guampa_ joined
04:09 Mindless- joined
04:10 Edith joined
04:10 takle joined
04:11 keep_learning joined
04:12 vektorweg1 joined
04:12 jophish joined
04:13 suls joined
04:14 JeanCarloMachado joined
04:16 dan_f joined
04:16 icedev joined
04:17 m1dnight_ joined
04:17 ryxai joined
04:17 oneeman joined
04:17 <iqubic> How does one install GHC from source?
04:17 uncertainty joined
04:17 <iqubic> Is there a guide anywhere?
04:17 phaji joined
04:18 <MarcelineVQ> iqubic: https://ghc.haskell.org/trac/ghc/wiki/Building/QuickStart
04:18 Wuzzy joined
04:18 <glguy> iqubic: that's not something you'll likely need to do at this point,
04:19 <iqubic> It isn't?
04:19 <iqubic> Why do you say so?
04:19 <dmwit> Installing GHC from source is quite involved. Why do you think you need to do that?
04:19 <iqubic> Because I can't seem to get my package manager to do it for me.
04:20 _ashbreeze_ joined
04:20 <dmwit> You can install binaries without going through your package manager.
04:20 justan0theruser joined
04:20 <dmwit> "From source" means building the whole compiler yourself, which is usually not needed.
04:20 <iqubic> That's what I want to do. How hard is that?
04:20 <iqubic> I mean the first thing.
04:20 <iqubic> Installing from binary
04:21 <dmwit> It is easy to install binaries. Just grab a tarball from the GHC website, untar it, ./configure, make install.
04:21 <dmwit> Probably sudo make install.
04:21 <iqubic> How do I untar something, and where do I tell it where to install to?
04:22 <dmwit> `tar xf blah.tar.gz` will untar `blah.tar.gz`. You can ask for a specific install directory with `./configure --prefix /path/to/installation`.
04:23 <iqubic> Alright. Where do I go to get the binary?
04:23 <dmwit> https://www.haskell.org/ghc/download_ghc_8_0_2
04:24 <iqubic> That page recomends getting a proper Haskell distribution. Should I do that?
04:24 nshepperd joined
04:24 path[l] joined
04:25 mstruebing joined
04:25 <iqubic> Or is that not needed in my case.
04:25 <dmwit> The "Minimal installers" at that link are a pretty nice bootstrap.
04:25 <iqubic> ??
04:25 <dmwit> Ultimately the decision is yours. There is some discussion of the tradeoffs at the link you mentioned.
04:26 <dmwit> Generally I just install GHC. But I am also relatively experienced with getting whatever else I need as it comes up.
04:26 <dmwit> It should be possible to make good progress no matter which you choose.
04:26 a3Dman joined
04:26 xall joined
04:26 juhp__ joined
04:27 <dmwit> If your goal is xmonad, I would be tempted to recommend avoiding stack, just because I suspect that will make xmonad's "recompile to reconfigure" strategy a bit more difficult.
04:27 Kundry_Wag joined
04:27 <iqubic> No. My goal is a fully fledged Haskell development environment.
04:28 <iqubic> XMonad is just the WM I like to use.
04:28 <Koterpillar> stack is a good choice for dev
04:28 <iqubic> Does Stack run on Gentoo?
04:28 <dmwit> What would prevent stack from running on gentoo??
04:28 <iqubic> I don't know.
04:29 <iqubic> It just never has run on Gentoo for me.
04:29 takle joined
04:29 <Koterpillar> https://docs.haskellstack.org/en/stable/install_and_upgrade/#linux-generic
04:29 <dmwit> Have you found other things that run on most Linuxes but not on Gentoo?
04:29 <iqubic> No.
04:29 <iqubic> Just stack.
04:29 <iqubic> What's the difference between cabal and stack?
04:29 lambdafan joined
04:29 <Koterpillar> iqubic: the instructions there even mention gentoo specially
04:29 <iqubic> They do? Why?
04:30 Destol joined
04:30 _kit_ joined
04:30 <lambdafan> how can I use stack to build my dependencies for profiling?
04:30 <iqubic> Also, where?
04:30 <Koterpillar> iqubic: search for "gentoo"?
04:30 <Koterpillar> on that page
04:30 <iqubic> I don't find it.
04:30 <iqubic> What page are you looking at?
04:30 <Koterpillar> https://docs.haskellstack.org/en/stable/install_and_upgrade/#linux-generic
04:31 <iqubic> I was still looking at the GHC pages.
04:31 <iqubic> So I install Stack first, then get GHC?
04:31 <lambdafan> yep
04:32 darkSeid_ joined
04:32 <iqubic> Why?
04:32 <Koterpillar> https://docs.haskellstack.org/en/stable/README/ <- iqubic
04:32 <Koterpillar> first paragraph
04:32 <MarcelineVQ> lambdafan: most directly you just pass --profile as an option when using a command
04:33 <lambdafan> hmm, I'm getting empty postscrip files when trying to capture heap data
04:33 <lambdafan> I thought it was because I hadn't properly compiled my dependencies
04:33 <Koterpillar> as for the difference, with stack you can have independent build environments with pinned versions, with clever sharing to avoid rebuilding
04:33 <iqubic> Or I could have just gotten my package manager to work.
04:34 eazar001 joined
04:34 <iqubic> But I don't think I did.
04:34 <dmwit> ...whereas with cabal, you can have independent build environments with pinned versions and clever sharing to avoid rebuilding.
04:34 <lambdafan> you shoudn't use your package manage to install haskell libraries
04:34 <iqubic> I shouldn't, why not?
04:34 justicefries joined
04:35 <dmwit> I quail to explain the difference between stack and cabal.
04:35 <lambdafan> because one day you'll just end up having to uninstall and do it thr right way. So save yourself time and just do it the right way first time out.
04:35 <MarcelineVQ> lambdafan: you're following the steps here? https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html#profiling-memory-usage
04:35 <iqubic> I'm actually at the point where I have to uninstall and do it the right way now.
04:35 <dmwit> iqubic: But be careful to read what lambdafan said very carefully. You shouldn't use your package manager to install Haskell *libraries*. Installing GHC itself through the package manager is fine.
04:35 <Koterpillar> dmwit: is there a guide where I can learn about this cabal functionality, so I don't mislead people anymore
04:35 <dmwit> ?where sicp
04:35 <lambdabot> http://mitpress.mit.edu/sicp/ | http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/ | http://www.vex.net/~trebla/haskell/sicp.xhtml -- "Storage and Identification of Cabalized
04:35 <lambdabot> Packages"
04:36 <lambdafan> MarcelineVQ: yes, but I thought maybe I had messed up step 1.
04:36 <dmwit> iqubic: See the second link there for details on why the package manager can be dangerous if you don't know what's going on.
04:36 <MarcelineVQ> lambdafan: I see, I've not used that feature myself so I don't have anything useful to add
04:36 <dmwit> Koterpillar: http://blog.ezyang.com/2016/05/announcing-cabal-new-build-nix-style-local-builds/
04:36 darjeeling_ joined
04:37 <dmwit> iqubic: (I can't count. I meant the last link, not the second one.)
04:37 BartAdv joined
04:38 <lambdafan> stack test --profile --ghc-options "+RTS -h -RTS"
04:38 <lambdafan> ^^ I did that but ended up with an empty postscript file. I mean the graph fram was there, but no plotted graph.
04:39 <lambdafan> it does produce the .prof file fine
04:39 <dmwit> lambdafan: Presumably `+RTS -h -RTS` should go to the test, not to GHC.
04:39 <lambdafan> but I want to make sure I'm using constant memory, and figure the grpah would show me .
04:39 <lambdafan> dmwit: I'm not sure of syntax
04:40 <lambdafan> how do I pass the -h to stack test then?
04:40 <dmwit> Okay. Me neither. But I'm sure `--ghc-options "+RTS -h -RTS"` isn't it.
04:40 <lambdafan> hmm okay I will investigate along those lines and see what I come up with
04:40 <dmwit> Perhaps `stack test` supports the usual GNU convention of `--` to pass arguments to the spawned processes?
04:40 iqubic joined
04:41 <dmwit> Also might be worth staring at `stack test --help` to see if it has some information on passing arguments to the test program.
04:41 <lambdafan> stack test --profile -- -h?
04:41 <dmwit> stack test --profile -- +RTS -h -RTS
04:41 <lambdafan> oops
04:42 buff3r joined
04:42 <lambdafan> no it makes stack think I want a directory names +RTS
04:42 <MarcelineVQ> test is just a --test flag to the build command, so it's quite hard to tell how to pass things along :X
04:42 <lambdafan> stack: Most RTS options are disabled. Link with -rtsopts to enable them.
04:42 <lambdafan> I got that when I tried
04:42 <MarcelineVQ> try --test-arguments=" ..."
04:43 <lambdafan> stack test --profile +RTS -h -RTS
04:43 <Koterpillar> dmwit: thanks. Am I correct in saying that new-build doesn't pin GHC or support Stackage snapshots?
04:43 <dmwit> lambdafan: Indeed, that's definitely not the right syntax either.
04:43 <lambdafan> MarcelineVQ: Your syntax started a test!
04:43 <lambdafan> okay we'll see if I get a plotted graph from this
04:43 <dmwit> Koterpillar: You can pin a GHC version. You can pick a Hackage server, which is what I believe is the essence of Stackage snapshots, right?
04:44 <Koterpillar> dmwit: right, I think they even provide something like that
04:44 <Koterpillar> dmwit: but not out-of-the-box
04:46 cpup joined
04:47 <dmwit> I don't know whether Stackage offers its resolvers in a way that's friendly to cabal's `remote-repo` setting. If not, cabal probably does not support Stackage snapshots. If so, it does.
04:47 louispan joined
04:48 hybrid joined
04:49 a3Dman joined
04:49 <Koterpillar> dmwit: looks like yes: https://www.stackage.org/lts-8.8/cabal.config
04:50 ogrady joined
04:51 newbie83 joined
04:51 <lambdafan> editor- test (suite: editor-test, args: =+RTS -h -RTS +RTS -p -RTS)
04:51 <lambdafan> editor-test: unrecognized option `-h'
04:51 <newbie83> Hi, a quick question. So there's haskell 98 report, 2010 report, when is the next report?
04:51 <lambdafan> Try `editor-test --help' for more information.
04:52 <lambdafan> bash-4.1$ editor-test --help
04:52 <lambdafan> bash: editor-test: command not found
04:52 abel-abel joined
04:52 takle joined
04:52 <glguy> newbie83: no particular schedule
04:52 <dmwit> newbie83: I haven't heard much news from the Haskell' committee recently. It wouldn't surprise me if it has stagnated again indefinitely.
04:52 <Koterpillar> lambdafan: if all else fails, stack has already compiled you that binary, find it and run it manually
04:53 <newbie83> dmwit, thx. I am just curious :)
04:53 <newbie83> also glguy :)
04:54 <lambdafan> Koterpillar: found it :)
04:55 <MarcelineVQ> supicious arg pasing, equals plus? =+RTS
04:55 <Koterpillar> MarcelineVQ: is that from your "--test-arguments="?
04:56 <lambdafan> yeah
04:56 <MarcelineVQ> idk I've never passed things to a test before
04:56 <Koterpillar> lambdafan: try getting that equals sign out of it
04:56 <lambdafan> oh I think
04:57 <lambdafan> I think I see a problem
04:57 <lambdafan> I had a space in between --test-arguments and =
04:57 steeze joined
04:58 <MarcelineVQ> you should be able to use one rts bracket as well: +RTS -h -p -RTS
04:59 <lambdafan> well --profile does +RTS -p -RTS automatically
04:59 <MarcelineVQ> fair enough :D
04:59 <lambdafan> I just wish --profile took arguments
04:59 mzf joined
05:01 Micamo joined
05:01 jgt joined
05:02 a3Dman joined
05:02 piyush-kurur joined
05:03 benzrf joined
05:04 TheInfosphere joined
05:04 niHiggim_ joined
05:07 osa1 joined
05:07 osa1 joined
05:07 <iqubic> Currently installing GHC 8.0.2, after a ton of trouble.
05:14 takle joined
05:15 dec0n joined
05:15 doomlord joined
05:16 JoshS joined
05:16 fakenerd joined
05:17 refold joined
05:19 a3Dman joined
05:19 juliagoda joined
05:24 thunderrd_ joined
05:26 thunderrd_ joined
05:27 loconator joined
05:28 jhrcek joined
05:28 <Tertiary> Is it possible to define a function that is local to a class instance? I can obviously use let or where to define something local to one of the class functions, but I would like to have something be accessible by all of them
05:28 thunderrd_ joined
05:28 Kundry_Wag joined
05:30 andyhuzhill1 joined
05:30 a3Dman joined
05:30 <dmwit> Nope, not possible.
05:30 <EvanR> no, youd have to put it in another module entirely
05:30 juhp__ joined
05:31 <Tertiary> That's too bad
05:31 thunderrd_ joined
05:32 Jackoe joined
05:32 <EvanR> you often have a module entirely for instances anyway
05:33 thunderrd_ joined
05:34 Jackoe joined
05:34 takle joined
05:35 zcourts joined
05:36 thunderrd_ joined
05:36 Coldblackice joined
05:37 Jackoe joined
05:37 loconator joined
05:38 danvet joined
05:39 louispan joined
05:39 Swizec joined
05:39 loconator joined
05:39 brynedwards joined
05:42 mbuf joined
05:42 loconator joined
05:43 abhiroop joined
05:43 loconator joined
05:43 loconator joined
05:46 thunderrd joined
05:47 armyriad joined
05:47 mstruebing joined
05:49 ner0x652 joined
05:51 Kuros joined
05:51 jdeq joined
05:52 yellowj joined
05:52 mpiechotka joined
05:52 Kuros joined
05:53 louispan joined
05:54 meandi_2 joined
05:55 ryxai_ joined
05:55 jdeq left
05:55 takle joined
05:55 SimpleL joined
05:57 DataComputist joined
05:57 cur8or joined
05:58 edsko joined
05:58 perlawhirl left
05:59 oever joined
06:00 Lokathor joined
06:00 <Lokathor> any quick and easy way to make non-ascii characters in a string print out in ghci using their actual character?
06:00 <dmwit> putStrLn -- ?
06:01 opios joined
06:01 <Lokathor> ghci> print $ dexify "gxis"
06:01 <Lokathor> "\285xis"
06:01 <dmwit> s/print/putStrLn/
06:01 <Lokathor> isn't print just putstrln.show ?
06:01 <dmwit> yes?
06:01 <dmwit> and?
06:02 significance joined
06:02 hurkan joined
06:02 <Lokathor> okay, well, i guess that worked, now it just throws an exception :P
06:02 <dmwit> Make sure your terminal and ghci agree on what encoding is appropriate.
06:02 <significance> Is the derived Functor implemenation for ZipList just like that of []?
06:02 <dmwit> yes
06:02 jdeq joined
06:02 <significance> dmwit: thanks!
06:04 <Lokathor> dmwit, it's windows, so i'm sure the terminal doesn't agree with anything at all
06:05 raichoo joined
06:06 cur8or joined
06:06 <MarcelineVQ> the wonders of locale
06:06 Croniamental joined
06:06 <Lokathor> hmm
06:06 badlands joined
06:06 <Lokathor> http://lpaste.net/354356
06:07 mikecaruso joined
06:07 <Lokathor> that is not what i expected
06:07 <Lokathor> am i being too rusty with my pattern matching?
06:07 Netwolf joined
06:08 Guest70746 joined
06:09 <cocreature> Lokathor: I can’t reproduce this
06:10 <cocreature> Lokathor: are you sure you’ve reloaded in ghci?
06:10 <Lokathor> hmm
06:10 <cocreature> the first one results in "\285" and the second in 1
06:10 <Lokathor> oh blast it
06:10 mazeinmaze_ joined
06:10 magthe joined
06:10 <Lokathor> it was another encoding bug!
06:10 path[l] joined
06:11 <Lokathor> the windows terminal lets you *type in* accented letters, showing them as normal letters
06:11 <Lokathor> so i'd typed "ĝx" and it just looked like "gx"; thanks windows
06:12 <pacak> :)
06:12 <Lokathor> alright got that squared away
06:12 <cocreature> let’s go back to ascii and eliminate all the encoding bugs!
06:12 <pacak> I always thought there's just one user of ghc on windows.
06:12 <cocreature> pacak: nah there are several. and at least one is also actively working on improving windows support!
06:14 uncertainty joined
06:14 JeanCarloMachado joined
06:16 <Lokathor> not me!
06:16 <Lokathor> that's one area where Rust is really pulling ahead of Haskell; Windows is a proper citizen of their community
06:16 Gurkenglas joined
06:16 <Lokathor> but no rusti for playing around with :/
06:18 insitu joined
06:19 e_svedang joined
06:19 zeroed joined
06:21 <EvanR> that might make less sense than a C repl
06:23 mfukar joined
06:23 whiteline joined
06:24 sanett joined
06:24 Aruro joined
06:24 <Koterpillar> C REPLs exist
06:25 <MarcelineVQ> cling is p. cool
06:25 DataComputist joined
06:28 <jasondockers> Holy C is a great C-like REPL
06:31 zeroed joined
06:31 zeroed joined
06:32 Kundry_Wag joined
06:34 dni joined
06:36 geekosaur joined
06:37 <Lokathor> i want the (!?) operator for my Data.Map values, but stackage is lettin me down :/
06:38 <Lokathor> EvanR, I'm not sure why rusti would necessarily make any less sense than python or javascript as a REPL
06:38 jgertm joined
06:39 alfredo joined
06:40 <pacak> Lokathor: (!?)?
06:40 <Lokathor> pacak, the newest version of containers added a new infix op for Data.Map, (!?) :: Ord k => Map k a -> k -> Maybe a
06:41 takle joined
06:41 <dmwit> :t M.lookup
06:41 <lambdabot> Ord k => k -> M.Map k a -> Maybe a
06:42 quchen joined
06:43 thc202 joined
06:44 MoALTz joined
06:45 <Lokathor> dmwit, yes
06:45 <Lokathor> but look how many more characters that is when you write it infix
06:45 <Lokathor> so many more
06:45 eklavya joined
06:45 <pacak> Lokathor: (!?) = Map.lookup
06:46 <Lokathor> instead you have to define your own "m !? k = M.lookup k m" deal
06:46 <Lokathor> here i am trying to be grump, and #haskell is just trying to make me not so grump
06:46 <Lokathor> <3
06:46 louispan joined
06:48 <dmwit> I agree, (!?) is more ergonomic in many ways.
06:50 <pacak> Not when you have 2-3 different containers in scope and have to use it qualified. In which case lookup is more readable.
06:50 <vaibhavsagar> Lokathor: what if you specify containers-5.10 as an extra-dep?
06:50 <vaibhavsagar> I tried that the other day and it worked fine for my project
06:51 <vaibhavsagar> involved recompiling half of Stackage though :)
06:51 free_beard joined
06:51 path[l] joined
06:51 orbifx joined
06:53 <Lokathor> yeah i did that on one project that i really needed it for
06:53 Lemmata joined
06:53 <Lokathor> but right now my problem is that String won't let me write out an accented letter, it seems
06:54 mpiechotka joined
06:54 shesek joined
06:55 sanett joined
06:57 keep_learning joined
06:57 Itkovian joined
06:58 <dmwit> I doubt it's String's fault.
06:58 <Lokathor> yes, well, with some further testing, seemingly GHC itself simply unable to process esperanto characters?
06:59 <Lokathor> it gives invalid character problems even with a compiled program and not using ghci
06:59 <dmwit> very much doubt this
07:00 <dmwit> Perhaps you can describe the symptoms in some detail.
07:00 <Lokathor> yes one moment
07:00 <Lokathor> i can push it all back up to git
07:00 <Lokathor> already in "small example" mode really
07:00 <dmwit> :thumbsup:
07:01 <Lokathor> https://github.com/Lokathor/scratch
07:02 <Lokathor> when i run it i get: scratch.EXE: genesis-eo-formatted.txt: commitBuffer: invalid argument (invalid character)
07:02 <Lokathor> now i'm not really a christian, but i think that "commitBuffer" probably wasn't written down in any ancient hebrew books :P
07:03 <cocreature> Lokathor: is your locale set correctly? the behavior of "readFile" depends on that
07:04 <Lokathor> cocreature, it is... whatever windows defaults to
07:04 <cocreature> Lokathor: the hakyll docs seem to suggest that "chcp 65001" works on windows
07:04 <cocreature> don’t ask me what that does :)
07:05 HugoDaniel joined
07:05 <Lokathor> my terminal gives me the cryptic "Active code page: 65001"
07:05 insitu joined
07:05 <Lokathor> it's like i'm really in an adventure game
07:05 <Lokathor> now it works, i guess
07:06 <cocreature> ghc -- the game: fight the type checker, create new types, an infinite amount of values in lists and more!
07:07 <ongy> more like "language support the game. Fight the compiler, fight the terminal and fight anything that has to display it!"
07:08 <Lokathor> https://www.youtube.com/watch?v=4aGDCE6Nrz0
07:08 <ongy> the highest quality animation in ages
07:09 xnyhps joined
07:09 albertid joined
07:09 ubsan_ joined
07:10 Swizec joined
07:11 vlatkoB_ joined
07:11 Swizec joined
07:11 yoneda joined
07:12 Swizec joined
07:12 Swizec joined
07:13 Swizec joined
07:14 azahi joined
07:15 vaibhavsagar joined
07:16 ventonegro joined
07:17 gfixler joined
07:20 manifold joined
07:20 takle joined
07:21 guiben joined
07:21 <Lokathor> it still confuses me that there's no "stack run" command
07:22 raichoo joined
07:22 a3Dman joined
07:22 mattyw joined
07:22 Jackoe joined
07:23 shafox joined
07:25 mszczygiel joined
07:25 <cocreature> Lokathor: https://hackage.haskell.org/package/stack-run
07:26 dan_f joined
07:26 <Lokathor> why is this not a default part of stack
07:26 <cocreature> dunno
07:26 <Lokathor> oh
07:26 <Lokathor> also
07:26 <Lokathor> unix only
07:27 dfeuer joined
07:28 louispan joined
07:28 raichoo joined
07:28 Jackoe joined
07:29 cur8or joined
07:30 edvorg joined
07:30 daniel-s joined
07:30 Salih joined
07:30 nlhdqc joined
07:30 JeanCarloMachado joined
07:32 kritzcreek_ joined
07:32 fizruk joined
07:33 javjarfer joined
07:33 vydd joined
07:33 i-amd3 joined
07:35 guiben joined
07:36 a3Dman joined
07:37 azahi joined
07:39 connrs joined
07:42 mekeor joined
07:42 boxscape joined
07:42 patbecich joined
07:42 richi235 joined
07:44 zero_byte joined
07:44 Itkovian joined
07:44 biglama joined
07:45 abhiroop joined
07:45 jennyrgb joined
07:45 <jennyrgb> tempu: you're in ##haskell
07:46 arctictern joined
07:47 <jennyrgb> "data LL t = Empty | Node t (LL t)". shoplift = Empty
07:48 augur joined
07:48 a3Dman joined
07:48 raichoo joined
07:48 <jennyrgb> how do haskell infere the type of shoplift? I also have a tree that has an 'Empty' contructor. It's ambigious but ghci lets it through.
07:50 Jackoe joined
07:51 TheEpsylon joined
07:52 petrus joined
07:52 mmn80 joined
07:52 <boxscape> jennyrgb: what happens if you do :t Empty?
07:53 NickHu joined
07:53 <jennyrgb> boxscape: it's of the latest defined typeclass
07:53 <jennyrgb> that uses Empty of course
07:54 slacker joined
07:54 <boxscape> is it possible that you simply overwrote the name "Empty" with the new meaning?
07:54 <boxscape> can you still say "Empty :: <first type>" without an error?
07:54 <davean> Was the other type even in scope?
07:55 <davean> Because it isn't reporting any ambiguity
07:56 alecbrick joined
07:56 govg joined
07:56 <jennyrgb> Going to share two lines of code.
07:56 <jennyrgb> Prelude> data Tree t = Node (Tree t) t (Tree t) | Empty
07:57 <jennyrgb> data LL t = Empty | Node t (LL t)
07:57 <jennyrgb> gici did not say anything. Type of empty was 'LL t' after the second definition.
07:58 <jennyrgb> ghci*. It is possible that I have missed something though.
07:59 <boxscape> jennyrgb: but if you write "Empty :: Tree a" you get an error, right?
07:59 <Aruro> jennyrgb: its overridden , thats all
08:00 <Aruro> last definition makes Empty to be just LL type
08:00 shayan_ joined
08:03 <jennyrgb> boxscape: yes, it's already defined
08:03 mstruebing joined
08:03 yuuray_ joined
08:03 igniting joined
08:03 <jennyrgb> how do I make an empty tree then?
08:03 <Aruro> say EmptyLL EmptyTree
08:04 sanett joined
08:04 <Aruro> not same name
08:05 <boxscape> using the same name wouldn't work in actual code anyway, just in ghci, so there's really not much point in doing it
08:05 <jennyrgb> Ok, nice. So they share scope? If I were to compile this instead of using the interactive console, it'd be an error?
08:05 <jennyrgb> oh ok :p
08:05 <boxscape> yes, I'm almost certain
08:07 <jennyrgb> seems like the constructors have the same name scope as everything else?
08:07 <jennyrgb> I mean, functions and "variables"
08:07 <jennyrgb> variables--> functions without parameters
08:08 <kadobanana> Constructors are values, but they're a bit separate because they must start with capital letters, and functions and other values must not
08:08 a3Dman joined
08:09 <boxscape> you can also only define constructors at top level, whereas you can define functions inside other functions
08:09 bhiliyam joined
08:10 <Aruro> :t True
08:10 <lambdabot> Bool
08:10 <Aruro> :t Just
08:10 <lambdabot> a -> Maybe a
08:10 <Aruro> jennyrgb: Just is a function
08:11 <Aruro> so above u defined two constanst with same name (Empty) but different types
08:11 Yuras joined
08:11 OnkelTem joined
08:12 lep-delete joined
08:12 <Aruro> > data F = A | B Int
08:12 <lambdabot> <hint>:1:1: error: parse error on input ‘data’
08:12 <Aruro> > @let data F = A | B Int
08:12 <lambdabot> <hint>:1:1: error: parse error on input ‘@’
08:12 <Aruro> @let data F = A | B Int
08:12 <lambdabot> Defined.
08:12 <Aruro> :t B
08:12 <lambdabot> Int -> F
08:12 <Aruro> :t A
08:12 <lambdabot> F
08:14 mattyw joined
08:15 ccomb joined
08:17 Jackoe joined
08:17 marr joined
08:18 abhiroop joined
08:18 xtreak joined
08:18 dan_f joined
08:19 shrug joined
08:19 takle joined
08:21 migge joined
08:21 redeemed joined
08:23 eacameron joined
08:26 detrumi joined
08:27 salva joined
08:27 govg joined
08:31 ozgura joined
08:32 eacameron joined
08:34 takle joined
08:35 <jennyrgb> anyone else having problems with spammers on github?
08:36 jaspervdj joined
08:36 <jennyrgb> https://github.com/CoralineAda she got my email from my commits and sent me some kind of links and also wanted me to add those files to my project. I have no idea who she is. She wanted me to install a commit filter that removes all "gender assuming pronoun" or something, "he", "she" is offensive or something.
08:36 Xanather joined
08:37 a3Dman joined
08:37 a3Dman joined
08:38 xtreak joined
08:42 Edith joined
08:42 <kadobanana> There's a reason email has filters. Also that doesn't really sound like spam so much as just someone you don't want to deal with, so ... ignore/filter their emails, or tell them you're not interested.
08:44 <otulp> This is Haskell! Doesn't matter if it's a She or He; they all come with nice bottoms.
08:46 soLucien joined
08:46 <jennyrgb> kind of. Shouldn't matter if someone sings old german nationalist songs and cry over the death of hitler, as long as they post proper code. It really hasn't anything to do with the project.
08:47 Ferdirand joined
08:49 <quchen> Is she the toxic person Github saw fit to hire after she destroyed a couple of projects? My advice would be to wave and smile, and keep walking.
08:49 <jennyrgb> quchen: I'm not going to use github anymore https://imgur.com/QC51FZz
08:50 <jennyrgb> quchen: I fear that these people won't give up and you'll end up banned. I'm not okay with that feeling, it stresses me
08:50 azahi joined
08:50 coot joined
08:50 laz joined
08:52 eacameron joined
08:52 fakenerd joined
08:53 oish joined
08:54 <quchen> jennyrgb: Gitlab! :-)
08:54 <Akii> might have to move this one too then, https://github.com/Akii/acme-fucks
08:54 <Akii> oh well
08:54 Mortomes|Work joined
08:54 <Akii> at least it's gender neutral
08:55 <jennyrgb> quchen: I googled gitlab, seems like they have the same problem. https://www.reddit.com/r/KotakuInAction/comments/45mxpt/discussion_which_git_repo_is_the_best_ive_seen/ But I found this: https://gitgud.io/
08:56 <kadobanana> So your problem with github is that someone, who doesn't work at github, sent you an email? I am very confused.
08:56 eacameron joined
08:56 <quchen> No, she’s a Github employee.
08:56 <otulp> jennyrgb: Nice save, changing retards to gits. I'm sure github is not going after that particular word.
08:57 <MarcelineVQ> it's that weird time of the week in #haskell land
08:57 <kadobanana> Oh. I'd still just ignore it.
08:58 <quchen> One way to solve problems with words like »retarded« is also to not build projects that require such language.
08:58 mojjo joined
08:59 <Philonous> As if anything ever _required_ this kind of language
09:00 eacamero_ joined
09:00 <otulp> I'm thinking acme-fucks is a nice example here.
09:00 <otulp> It wouldn't work very well as acme-tootin-darns, would it?
09:01 <Akii> would probably be fun to come up with a political correct version
09:01 <MarcelineVQ> gitgud exists because someone thought pc C++ would be fun and github didn't think so
09:02 etehtsea joined
09:02 <MarcelineVQ> one of the reasons anyway
09:02 <jennyrgb> MarcelineVQ: pc C++?
09:03 <MarcelineVQ> mmhm, C+=
09:03 <jennyrgb> most feminists have balls anyway, they should use them.
09:04 oisdk joined
09:04 xall joined
09:04 <jennyrgb> or not. But don't bleed all over my source code :p
09:04 <Athas> Anyone here in academia and considering submitting to the workshop on high-performance functional programming at ICFP?
09:04 <otulp> jennyrgb: I think you are confused about what that bit of anatomy does.
09:04 <MarcelineVQ> could be, possibly a better discussion for #haskell-offtopic though, the mods here get cranky after too much ot
09:05 takle joined
09:05 azahi joined
09:06 javjarfer joined
09:10 eacameron joined
09:11 rcat joined
09:11 Wizek joined
09:11 Wizek_ joined
09:11 plutoniix joined
09:12 <magthe> I'm working with a rather low-level protocol in Haskell, the only datatype supported by it is UInt16, so 32-bit values are constructed by combining two UInt16... is there a go-to library on Hackage for that sort of combining-num-types-to-bigger-types (ideally also splitting of them :)?
09:13 <jennyrgb> magthe: your own type with two UInt16? haskell isn't really a system programming language
09:13 <jennyrgb> magthe: or just go with Integer or Int (32 or 64-bit) if space isn't an issue.
09:13 eighttt joined
09:14 <Athas> magthe: Data.Word has very easy-to-use unsigned types.
09:14 <jennyrgb> or that
09:14 <magthe> jennyrgb: yeah, I know it isn't... but it is such a nice language :)
09:14 <Athas> You'll need to split them up yourself, though, but that's easily done with the usual bitshifts.
09:14 <Athas> I've done integer-size-sensitive code in Haskell, and it has been quite pleasant. Probably not very fast, though.
09:14 <magthe> Athas: yupp, I was rather hoping someone else had already done that twiddling-of-bits
09:15 plutoniix joined
09:16 <Xandaros> Shift the most significant part by 16 and or in the other?
09:16 <magthe> jennyrgb, Athas: I guess I'll just have to write my own helper functions
09:16 <Athas> That seems a likely fate.
09:17 fendor joined
09:19 Iceland_jack joined
09:24 vikraman joined
09:31 grayhatter joined
09:31 grayhatter joined
09:35 xtreak joined
09:36 locallycompact joined
09:37 augur joined
09:38 vandenoever joined
09:38 vandenoever joined
09:38 jgertm joined
09:39 Destol joined
09:41 bakibour joined
09:41 <bakibour> Hi, im looking for a way to "zip" two lists of key value pairs, so that the resulting list will have empty entries for keys that were not contained in the other.
09:41 <bakibour> It is ment to fill a table so that you get an empty cell for the missing entries in the other list.
09:42 plutoniix joined
09:42 ogrady joined
09:43 eacameron joined
09:43 lithie joined
09:43 <brynedwards> bakibour: This looks like a good place to start https://hackage.haskell.org/package/containers-
09:44 <bakibour> brynedwards: Thanks, checking
09:44 oever joined
09:45 <sshine> bakibour, what are empty entries? and how does an empty entry occur in the input list if they match up? is it only if one is longer than the other?
09:45 ziocroc joined
09:45 <bakibour> The lists are columns in the table but the columns do not necessarily have the same length, they have a key though for the entries.
09:46 <bakibour> So you could have ((a, 0), (b, 1)) and ((a, 5), (c, 3))
09:46 <bakibour> And now i would like to have a list that contains a b and c but the c is empty in the first column and b in the second
09:47 <cocreature> bakibour: what do you mean by “being empty”? should the value be “Nothing”?
09:47 ziocroc2 joined
09:47 <bakibour> Yes
09:48 <bakibour> If i would transform it into a csv file in the end there is just no string, or something like NA or so
09:48 uglyfigurine joined
09:48 <bakibour> Depends on the type for the table in the end, im more interested in what kind of transformation i am looking for.
09:48 <bakibour> I guess something like a more intelligent zip
09:49 <cocreature> I think the merge function brynedwards linked to is exactly what you’re looking for
09:50 beanbagula joined
09:52 Argue joined
09:53 eacameron joined
09:53 KongWubba joined
09:55 <bakibour> cocreature: Thanks i will check that out, did not expect to get an answer thist quick :)
09:55 tlaxkit joined
09:58 <tsahyt> Is anybody here familiar with liquid haskell?
09:59 augur joined
09:59 abhiroop joined
09:59 <cocreature> tsahyt: you’re more likely to get an answer if you ask your actual question :)
09:59 mzf joined
10:00 augur joined
10:00 ozgura joined
10:01 abhiroop joined
10:01 <tsahyt> okay. I'm playing around with it a bit, and my running example is integer factorization. to that end I define what it means to be a divisor of a number (I figured tackling primality is for later), {-@ type Divisor N = { x:Nat | N mod x = 0 } @-}. now I want to write a function that returns the smallest factor (other than 1) of a natural number, i.e. {-@ firstFactor :: {n:Nat | n >= 2} -> Divisor n @-}.
10:01 fotonzade joined
10:02 <tsahyt> such a number must exist of course. but I can't figure out an implementation that actually type checks through liquid haskell
10:02 plutoniix joined
10:02 <tsahyt> from all that I can see this should be correct. firstFactor x = head (filter (\n -> mod n x == 0) [2..x])
10:02 <tsahyt> the list is never empty of course because mod x x == 0.
10:03 plutoniix joined
10:03 <tsahyt> so I guess my question is how I should tackle this then. I've tried unfolding the head+filter construct manually, but ran into issues again
10:04 CurryWurst_ joined
10:06 kuribas joined
10:06 Jackoe joined
10:07 <kuribas> cabal tells me: "ghc-options: -O2' is rarely needed. Check that it is giving a real benefit"
10:07 <kuribas> But I find that important optimizations like inlining are only performend with -O2
10:07 <tsahyt> kuribas: inlining should be performed with -O1 too
10:08 <tsahyt> in general. GHC might be more aggressive with it when using -O2 I think.
10:08 <cocreature> tsahyt: can you lpaste your code? I’m having a hard time parsing it mentally inside your message :)
10:09 <tsahyt> cocreature: okay. should I add the liquid haskell errors in comments?
10:09 <cocreature> tsahyt: sure
10:11 <lpaste> tsahyt pasted “No title” at http://lpaste.net/354358
10:11 juhp__ joined
10:12 <tsahyt> cocreature: ^
10:12 Argue_ joined
10:13 Aeonyx joined
10:13 eacameron joined
10:14 <tsahyt> hmm actually firstFactor' might even be wrong
10:15 mda1 joined
10:15 <tsahyt> and the arguments to mod in firstFactor should be swapped. I'll revise this
10:16 plutoniix joined
10:17 mstruebing joined
10:17 <guillaum2> Hello. Someone can help me prooving the (partial) injectivity of the type level boolean or ?
10:17 <guillaum2> https://gist.github.com/guibou/c58bd9d3952b37bb3b2dc56bae3e083b
10:18 Argue__ joined
10:18 <lpaste> tsahyt revised “No title”: “No title” at http://lpaste.net/354358
10:19 <tsahyt> the problems still persist though
10:19 JeanCarloMachado joined
10:19 merijn joined
10:20 <kuribas> tsahyt: weird, no I get the same performance...
10:20 sohail-ahmed joined
10:21 fizruk joined
10:21 <tsahyt> kuribas: are you sure everything got recompiled when you tried earlier? sometimes it doesn't do that for some reason
10:21 phaji joined
10:21 <kuribas> that maybe it...
10:21 <tsahyt> kuribas: there's value in -O2 though. a lot of the optimizations in the vector package don't trigger with -O1 in my experience.
10:21 mzf joined
10:21 <tsahyt> so when you write vector heavy code, it's usually a good idea to compile with -O2
10:22 <kuribas> tsahyt: it's numerical code, with some vector in there.
10:22 plutoniix joined
10:22 h101010 joined
10:22 <cocreature> tsahyt: hm sorry not sure how to fix that
10:23 <tsahyt> kuribas: I think it should also be possible to use -O2 on a per module basis with pragmas, but I've never tried that
10:23 <tsahyt> cocreature: okay. thanks anyway. I'll just keep trying I guess
10:24 <kuribas> tsahyt: performance is ok now, it's probably not worth the effort to sqeeze every bit of performance out of it...
10:24 eklavya joined
10:25 <tsahyt> kuribas: usually that's the case. once you've exhausted all the low hanging fruits, e.g. switching your vectors to unboxed or storable vectors etc, it's usually not worth going much further unless something's seriously wrong
10:25 <kuribas> tsahyt: It takes the union of 60 circles in 14ms
10:25 <tsahyt> circles as in what?
10:25 <kuribas> cirle paths, using bezier curves
10:26 <tsahyt> hmm. I have no frame of reference to judge whether that's fast or not, but if it's fast enough for your application then I'd say move on. if it becomes a problem later on you can still revisit it
10:27 h101010 joined
10:27 <kuribas> I have ideas for improving it, but they may introduce new bugs...
10:27 <tsahyt> on the topic of performance, I'm already hyped for linear types
10:28 Argue_ joined
10:28 <tsahyt> kuribas: when optimizing, it's always a good idea to set up some regression tests beforehand. Over the years I've broken way too many things while trying to make them fast. numeric code in particular is painful in that regard because the types are often not very helpful
10:29 <kuribas> yeah, right
10:29 <tsahyt> and then there's this whole thing with numeric stability possibly going out the window and so on
10:29 sphinxo joined
10:29 <sphinxo> BinOp vs Binop? ( correct naming )
10:30 <tsahyt> sphinxo: I'd use BinOp
10:30 <sphinxo> thanks
10:30 <kuribas> tsahyt: yeah, most of the bugs hadn't anything to do with the complicated algorithm, but with numerical edge-cases.
10:30 h101010 joined
10:30 <tsahyt> PascalCase for type/data constructors, camelCase for functions etc
10:30 <tsahyt> kuribas: I once spent a month correcting numerical edge cases in a mesh generator. epsilons everywhere. I think I lost a decent chunk of sanity in that time.
10:31 mattafro joined
10:31 <kuribas> tsahyt: haha, so I am not alone :)
10:31 Argue joined
10:31 <merijn> tsahyt: See, this is why I only work with integers... :p
10:32 <tsahyt> in particular it depended on x == 0 type comparisons in a lot of places. so I learned to love the ieee754 package and its AEq class
10:32 <kuribas> merijn: that's just shifting the problem.
10:32 <merijn> Actually, that's not true, I have some stuff using floats, but it's a fixpoint computation so I don't care about accuracy that much :)
10:33 <merijn> kuribas: In what way?
10:33 Argue__ joined
10:33 al-damiri joined
10:33 <tsahyt> the last thing I wrote that made extensive use of floating point was audio processing stuff. inaccuracies don't matter *that* much in that case.
10:33 <kuribas> merijn: how could you find the intersection of a bezier curve with integers?
10:34 <tsahyt> it's not like you can hear a 1.0e-13 difference
10:34 <kuribas> merijn: or the root of a 9th degree polynomial?
10:34 binaryplease joined
10:34 <tsahyt> there was this tool to find numerical problems in code
10:34 <tsahyt> it was on /r/haskell quite a while ago, but I don't remember the name
10:35 <merijn> kuribas: You don't, I wasn't saying it was a solution, just that I avoid attempting to solve said problems :p
10:35 <merijn> tsahyt: I've seen several such tools, yeah. But I forgot the names
10:35 <peddie> tsahyt: herbie?
10:35 <tsahyt> yes that was it
10:35 <kuribas> tsahyt: I think even float is good enough for CAD or audio.
10:36 <tsahyt> kuribas: it is mostly, yes
10:36 <tsahyt> for audio, definitely
10:36 <tsahyt> hmm, the github page for herbie mentions GHC 7.10.{1,2}. I wonder whether it still works with ghc 8
10:36 javjarfer joined
10:38 abhiroop_ joined
10:38 plutoniix joined
10:39 <kuribas> but double and float cost the same, unless you use SIMD
10:39 danvet joined
10:39 <kuribas> or GPUs
10:40 <merijn> Clearly the only solution to performance is float16! ;)
10:40 unK_ joined
10:41 <cocreature> float8!
10:42 sepp2k joined
10:42 eatman joined
10:42 <Athas> kuribas: or are memory bound!
10:42 plutoniix joined
10:42 louispan joined
10:42 <merijn> cocreature: Do those exist?
10:42 <kuribas> Athas: yeah, cache hits matter too.
10:43 <eatman> Hi! can someone tell me what is the meaning of the ! in from of Scalar in the Vector3 data type please?
10:43 <eatman> https://hackage.haskell.org/package/Octree-
10:44 <kuribas> eatman: strict fields
10:44 <eatman> That is? Always evaluated before storage?
10:44 <cocreature> merijn: only in some specialized applications iirc
10:44 <peddie> eatman: it's a strict field, it means the Scalar will be evaluated whenever it's put there
10:44 <eatman> All right, thanks.
10:45 <kuribas> eatman: https://wiki.haskell.org/Performance/Data_types#Strict_fields
10:45 plutoniix joined
10:46 <eatman> All right, I understand now https://hackage.haskell.org/package/AC-Vector-2.3.2/docs/src/Data-Vector-V3.html#Vector3
10:46 <eatman> Thanks!
10:48 xtreak joined
10:49 mtesseract joined
10:51 slomo joined
10:51 slomo joined
10:51 Argue joined
10:54 Yuras joined
10:55 h101010 joined
10:55 Argue_ joined
10:57 HugoDaniel joined
10:57 azahi joined
11:00 ocramz joined
11:00 <* ocramz> just installed `intero`
11:00 <ocramz> works like a charm
11:01 sdothum joined
11:03 nwf joined
11:03 Faucelme joined
11:03 <quchen> Still only in Emacs though, right?
11:04 <brynedwards> I think there are intero plugins for neovim and visual studio code
11:04 plutoniix joined
11:04 <ocramz> quchen I believe so; I never made the switch to Spacemacs et al
11:04 javjarfer joined
11:05 migge1 joined
11:08 Argue__ joined
11:09 shafox joined
11:10 robertkennedy joined
11:13 h101010 left
11:13 h101010 joined
11:13 uncertainty joined
11:17 plutoniix joined
11:18 fendor joined
11:18 silver joined
11:18 bjz joined
11:19 oleks joined
11:22 plutoniix joined
11:23 bennofs joined
11:24 mr_sm1th joined
11:24 <eatman> A bit late but, hey, it's hard to do haskell with vim!
11:26 plutoniix joined
11:26 gregman_ joined
11:28 klottie joined
11:29 sanett joined
11:31 <klottie> I have two values, I need to compare them and assign them to 'left' and 'right', respectively. Is there a better way to this than (left,right) = (min val1 val2, max val1 val2)? It works but there are 2 comparisons in this way where 1 comparison is sufficient.
11:31 <hpc> [left, right] = sort [val1, val2]?
11:31 mekeor joined
11:32 <Taneb> klottie, you could do if val1 < val2 then (val1, val2) else (val2, val1)
11:33 <klottie> hpc: I had thought of that but using sort for just 2 values was unnecessary in my opinion.
11:33 <klottie> Taneb: that's fair enough.
11:33 <klottie> thanks.
11:34 agrif joined
11:36 asthasr joined
11:37 plutoniix joined
11:38 yuuray__ joined
11:39 Itkovian_ joined
11:39 plutoniix joined
11:40 ub joined
11:41 bjz_ joined
11:42 plutoniix joined
11:42 SimpleL joined
11:44 JeanCarloMachado joined
11:45 plutoniix joined
11:45 HoierM joined
11:46 h12121212 joined
11:47 beerdrop joined
11:48 plutoniix joined
11:53 Jackoe joined
11:54 pacak joined
11:55 Croniamental joined
11:58 plutoniix joined
11:58 mzf joined
12:02 ph88^ joined
12:03 swalladge joined
12:05 biglama joined
12:07 cyborg-one joined
12:07 justanotheruser joined
12:08 ericsagnes joined
12:08 ilyaigpetrov joined
12:09 jhrcek joined
12:09 h45565656 joined
12:10 ccomb joined
12:11 h45565656 left
12:11 h87987 joined
12:12 money joined
12:12 Swizec joined
12:12 plutoniix joined
12:14 Argue_ joined
12:14 insitu joined
12:14 <quchen> > let f = join (\(a,b) -> if a <= b then id else swap) in f (1, 2)
12:14 <lambdabot> (1,2)
12:14 <quchen> > let f = join (\(a,b) -> if a <= b then id else swap) in f (2, 1)
12:14 <lambdabot> (1,2)
12:14 mmhat joined
12:15 ebzzry joined
12:16 beanbagula joined
12:17 spatial joined
12:17 <spatial> sum (map (2^) xloc) + sum [2^n | n <- (addVal 512 oloc)]
12:18 exferenceBot joined
12:18 <spatial> xloc and oloc are lists. Assume they have Int '1' each. Do I use the highter order 8 bits for the first 1 and lower order 8 bits for the other 1 ?
12:19 <spatial> Lower order and higher order.
12:20 Argue_ joined
12:20 <spatial> I mean this result 00000001 00000001
12:22 <spatial> addVal i (x:xs) = x * 512: addVal i xs
12:23 nighty-- joined
12:24 plutoniix joined
12:25 zcourts joined
12:26 fendor joined
12:26 sdothum joined
12:26 <spatial> If someone knows lisp then I can show lisp and my haskell conversion.
12:27 juhorp joined
12:27 <quchen> > let f(a,b)|b<a=(b,a);f x=x in f (2,1) -- Any shorter solutions to klottie’s problem? :-)
12:27 <lambdabot> (1,2)
12:28 juhorp joined
12:28 pothepanda joined
12:28 jrp6_ joined
12:30 plutoniix joined
12:30 <eatman> Hey, what type has a # kind?
12:30 <quchen> 1#
12:30 <quchen> Eh, Int#
12:30 <quchen> That is, unboxed types
12:31 <eatman> > :k Int
12:31 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
12:32 <quchen> :k Int
12:32 <eatman> Anyway, this gives me *
12:32 <lambdabot> *
12:32 <eatman> Not #
12:32 <quchen> »Int#« has kind #.
12:32 <quchen> Int has kind *.
12:32 <eatman> :k Int#
12:32 <lambdabot> error:
12:32 <lambdabot> Not in scope: type constructor or class ‘Int#’
12:32 <lambdabot> Perhaps you meant one of these:
12:32 cfricke joined
12:32 obadz joined
12:32 juhorp joined
12:33 <eatman> To be faire I don't know what "unboxed" means (damn second language :-()
12:33 <quchen> data Int = I Int#
12:34 plutoniix joined
12:34 <quchen> »I« is the constructor that takes the primitive (as in lies-in-your-ram-directly-just-as-in-C) value, and puts it in a box.
12:34 <quchen> The Int can be lazy, the Int# is always fully forced.
12:35 <quchen> Unboxed type basically means you can’t have thunks of that type.
12:35 <kuribas> > > let f=over (partsOf each) sort in f(2, 1) -- quchen
12:35 <lambdabot> <hint>:1:1: error: parse error on input ‘>’
12:35 <kuribas> > let f=over (partsOf each) sort in f(2, 1) -- quchen
12:35 <lambdabot> (1,2)
12:35 xtreak joined
12:35 <kuribas> quchen: seems to be longer...
12:36 Alex_____ joined
12:36 <quchen> kuribas: Invoke the power of Lens obfuscation!
12:36 <quchen> > let f=partsOf each%~sort in f(2, 1)
12:36 <lambdabot> (1,2)
12:36 <quchen> > let f(a,b)|b<a=(b,a);f x=x in f (2,1)
12:36 <lambdabot> (1,2)
12:36 <quchen> You win :-)
12:37 <kuribas> yay!
12:37 mkoenig joined
12:37 <eatman> I bet it will be crystal clear in a few days of proactice.
12:38 <kuribas> eatman: don't use that though
12:39 <kuribas> spatial: bring on the lisp :)
12:40 <Alex_____> Hello, what's up
12:41 Itkovian joined
12:42 mofasa joined
12:42 hrehf joined
12:43 <mofasa> When I do 'stack setup' to install GHC, it gets to "Installing GHC ... " but just stops. Nothing happens after 30 minutes.
12:43 <kuribas> spatial: also, your quest is very vague.
12:44 <kuribas> spatial: question
12:45 <spatial> kuribas:http://lpaste.net/354360
12:45 Iceland_jack joined
12:47 <kuribas> spatial: why mix map and list comprehension?
12:48 <spatial> kuribas: Can't justify. Now I have doubt about the logic itself. Tried to print binary.
12:49 <spatial> kuribas: The second loop if lisp multiplies by 512. Believe it tries to use 8 higher order bit and 8 lower order.
12:50 <spatial> kuribas:Raising to the power of 2 shift bits..
12:50 <spatial> shifts bits to the left.
12:51 <quchen> Multiplying with 2 shifts bits.
12:52 <spatial> Yes
12:52 klottie left
12:52 <ski> > map (shift 1) [0 .. 8]
12:52 <lambdabot> [1,2,4,8,16,32,64,128,256]
12:52 <kuribas> spatial: what's the question?
12:54 <spatial> kuribas: What exactly is lisp doing ? Does it use the first 8 bits for list 1 and next 8 for list 2 ?
12:54 <merijn> eatman: Do you happen to know Java?
12:54 mr_sm1th joined
12:54 <kuribas> spatial: wouldn't that be a question for #lisp?
12:55 <merijn> (Or maybe C#? I don't, but I think it's similar enough to Java to help my explanation)
12:55 magneticduck joined
12:55 hucksy_ joined
12:55 <ski> spatial : could you annotate the paste with `addVal' ?
12:56 <spatial> ski:Done
12:56 plutoniix joined
12:57 <spatial> kuribas: I can try lisp forum.
12:57 <ski> hm, so `addVal i xs = map (* 512) xs' (`i' is unused)
12:57 nitrix joined
12:57 <kuribas> spatial: why not sum [512 * 2^n | ...
12:58 <kuribas> or better sum [2^(n+8)]
12:58 <spatial> ski: Mistake.
12:58 <ski> `2^(x * 512)' is probably not what you want to do in the Haskell code, right
12:58 electrostat joined
12:59 <ski> the common lisp code multiplies with `512' after summing .. any reason not to do that in the Haskell version ?
12:59 carlomagno1 joined
12:59 <spatial> ski: That is what I spotted. Another mistake.
13:00 <ski> spatial : could you confirm the bounds of `i' that `(loop for i below 9 ...)' gives you. is it `0' to `8', inclusive-inclusive ?
13:00 <kuribas> also why make an array instead of using 2^n directly, or shift.
13:00 fizbin joined
13:00 eschnett joined
13:01 <kuribas> in the lisp code
13:01 TheEpsylon- joined
13:02 <spatial> ski: Think 0 to 8
13:02 plutoniix joined
13:02 <ski> ok
13:02 <ski> `X-locations' and `Y-locations' will only contain integers between `1' and `9', inclusive-inclusive ?
13:02 fakenerd joined
13:02 <brynedwards> mofasa: try `stack -v setup`
13:03 <sphinxo> Best way to accumulate errors? for say typechecking an ast?
13:03 <spatial> ski: 1 to 9
13:03 <ski> right
13:04 <ski> if you wanted to, you could make an array in Haskell, with indices from `1' to `9' .. `listArray (1,9) [2 ^ i | i <- [1 .. 9]]'
13:04 <peddie> sphinxo: validation applicative?
13:04 <Geekingfrog> sphinxo: there is the either package (from kmett) on hackage
13:04 plutoniix joined
13:04 <merijn> sphinxo: Validation applicative (I recommend the either package)
13:04 <Geekingfrog> sphinxo: it's a bit like Either e a with a monoid constraint on e and it will accumulate the errors
13:05 <Alex_____> Anyone here who got time to look at a problem of mine? (some instance declaration error)
13:06 <mofasa> Alex_____, pastebin it
13:06 <ski> spatial : so .. anything more you're wondering about ?
13:06 ogradyd joined
13:06 <ski> @paste
13:06 <lambdabot> Haskell pastebin: http://lpaste.net/
13:06 plutoniix joined
13:06 robertc joined
13:07 <quchen> data Validation e a = Error e | Success a; instance Applicative Semigroup e => Applicative (Validation e) where pure = Success; Error e <*> Error e' = Error (e <> e'); Success f <*> Success x = Success (f x); Error e <*> _ = Error e; _ <*> Error e = Error e
13:07 mda1 joined
13:07 <quchen> sphinxo: ^
13:07 <merijn> quchen: Yeah, that's the one from edwardk's either.
13:07 <merijn> quchen: Sadly mixing ExceptT/EitherT and Validation is really annoying >.>
13:07 stphrolland joined
13:07 <quchen> Edward’s version is so general I usually roll my own :-/
13:08 iAmerikan joined
13:08 <spatial> ski: Could you elaborate ?
13:08 <Alex_____> mofasa: To you in private or..? I don't want to disturb already ongoing conversations ^^
13:08 <mofasa> just here
13:08 <stphrolland> Hi, in a few words, why use Pipes.Network.TCP.Safe instead of Pipes.Network.TCP. In which way is it safer ?
13:08 <merijn> sphinxo: I ended up using Except for my type checker and writing a custom "checkMany :: Foldable f => (a -> TC ()) -> f a -> TC ()" that replaces Except with Validation to accumulate errors
13:09 <stphrolland> I don't know either ones yet. I'm starting a dummy project to start learning it so as to use it, and I wonder which one is best.
13:09 <ski> spatial : just wondering whether you're ok now, or would like more help ..
13:09 jathan joined
13:10 <Geekingfrog> merijn: What is TC there ?
13:10 <spatial> ski:sum (map (2^) xloc) + ( 512 * sum [2^n | n <- oloc] )
13:10 <ski> Alex_____ : just ask in the channel. if need be, address specific nicks like this
13:10 <ski> spatial : sounds like a plan
13:10 <merijn> Geekingfrog: ReaderT Environment (Except [Doc])
13:10 <ski> <kuribas> spatial: why mix map and list comprehension?
13:10 <merijn> Geekingfrog: So just environment of bindings over Except (i.e. EitherT)
13:11 <spatial> ski: I am not an advanced haskell coder. Just trying the logic. Whatever works first.
13:11 <ski> spatial : otoh .. i need to leave now. perhaps someone else can help you more, if need be. good luck
13:11 <merijn> Geekingfrog: And then internally I have "toValidation :: ReaderT r (Except e) a -> ReaderT r (Validation e) a" and "fromValidation :: ReaderT r (Validation e) a -> ReaderT r (Except e) a"
13:11 <merijn> Geekingfrog: and do "checkMany fun = fromValidation . traverse_ (toValidation . fun)"
13:11 plutoniix joined
13:12 <Geekingfrog> merijn: is Except e = ExceptT e Identity ?
13:12 <ski> spatial : oh, and the brackets around the multiplication there are redundant
13:12 <spatial> ski: Sure.
13:12 Swizec joined
13:13 <merijn> Geekingfrog: It's a newtype for Either (or ExceptT e Identity)
13:13 <Geekingfrog> Ok, I think I get what you did. I had a similar problem recently, but it was small enough that I could get away with validationToEither
13:14 <merijn> Geekingfrog: Because for typechecking I often want to use do notation to "first typecheck this, then that if you don't have an error", but if you want to typecheck, say, a Foldable of bindings you want to aggregate the error for each binding :)
13:14 <Geekingfrog> merijn: there was a really interesting talk at a london haskell meetup recently about exactly that, how to get better error messages
13:14 <Geekingfrog> (from compilers)
13:14 shafox joined
13:17 skeuomorf joined
13:18 abhiroop joined
13:18 beerdrop joined
13:18 robkennedy joined
13:19 dhil joined
13:19 dhil_ joined
13:19 <stphrolland> not sure one seen my question. Is it ok using Pipes.Network.TCP, or Pipes.Network.TCP.Safe is really advised ?
13:19 plutoniix joined
13:19 <stphrolland> i'm starting learning the pipes ecosystem for network use, and wonder which one to start with.
13:21 <merijn> stphrolland: the Safe module makes sure the socket is closed when your pipeline terminates
13:21 plutoniix joined
13:22 <stphrolland> ok so it's busy with managing memory leaks and the likes ?
13:22 <merijn> stphrolland: Well, not so much memory leaks as "socket leaks", but yes
13:22 <merijn> I would recommend using the Safe module
13:22 <merijn> That way you don't have to do that yourself
13:22 <stphrolland> thanks. again thanks for you MyStateT exercise and guidance, it's been a real improvement in my understanding.
13:23 <Alex_____> Okay, I hope I gave enough information for anyone to understand my problem and I am thankful for any help ^^ https://pastebin.com/pECPXRYk
13:23 <merijn> stphrolland: Did you work it out with the hints? :)
13:23 <stphrolland> yep
13:23 <merijn> good :)
13:24 cpennington joined
13:24 <merijn> Alex_____: Line 53
13:24 <merijn> Alex_____: You're implementing Weight for [Char], not Char
13:24 HugoDaniel joined
13:24 plutoniix joined
13:24 asthasr joined
13:25 mizu_no_oto_work joined
13:27 <Alex_____> merijn: But if I want to be able to have 'abc' as a Weight, don't I need to use [Char] and not Char
13:28 <merijn> Alex_____: You're trying to use Char, as indicated by the error, which says "No instance Weight Char"
13:28 <merijn> Also, 'abc' is a syntax error
13:28 <merijn> "abc" is a String (i.e. [Char])
13:28 plutoniix joined
13:28 <merijn> 'c', like you're inserting in the graph, is a Char
13:30 plutoniix joined
13:30 <Alex_____> merijn: I thought I could use [Char] for 'a' and for 'ab', do I need to use Char specifically for 'a' and [Char] for 'ab'?
13:30 <merijn> Alex_____: 'ab' is a syntax error
13:32 <Alex_____> merijn: Sorry, this is my first program in Haskell. What is the correct way to represent a string? "ab" ?
13:32 <merijn> "ab" is a String, yes
13:32 chlong joined
13:32 romeoh joined
13:32 <merijn> Which is the same thing as [Char]
13:32 abhiroop joined
13:33 <merijn> So you can keep your [Char] instance and change all the Chars in your code to be strings if that's what you want
13:34 `^_^v joined
13:34 plutoniix joined
13:35 <Alex_____> merijn: Hmm, I changed the weights to "a" "b" etc but then I get a similar error but it says "No instnace for (Num [Char]) instead
13:36 <merijn> Alex_____: Hard to say what's going without knowing the types of things
13:37 plutoniix joined
13:39 ystael joined
13:39 filterfish joined
13:40 plutoniix joined
13:42 danvet joined
13:42 jao joined
13:43 filterfish_ joined
13:43 plutoniix joined
13:46 revprez_atlanta joined
13:46 plutoniix joined
13:47 jxupte joined
13:48 <mofasa> Alex_____: longestPath relies on 'a' being a num instance. Char has a num instance, but [Char] does not. Either you have to make a Num [Char] instance that makes sense for your program or you have to change the type signature (and probably implementation) of longestPath
13:49 conal joined
13:49 EvilMachine joined
13:50 Argue joined
13:50 migge left
13:51 codesoup joined
13:51 Argue_ joined
13:53 TCZ joined
13:53 plutoniix joined
13:54 ozgura joined
13:56 abhiroop joined
13:57 plutoniix joined
13:58 brezel joined
13:59 <Alex_____> mofasa: Okay, I thought I try make it work with only Char first so I changed the type to that. Do you know how to add the Char's? Since I used '++' when having [Char] and it doesn't work for Char
13:59 mtesseract joined
13:59 <merijn> Well, what does adding Char's mean?
13:59 <mofasa> Alex_____, Depends on what adding chars mean
14:00 meba joined
14:00 filterfish joined
14:00 <mofasa> Alex_____, If you mean adding 'a' + 'b' to "ab" then that's not possible while keeping the result as char because it's [Char]
14:02 <Alex_____> mofasa: Would it be possible to add the value of the Char's?
14:02 conal joined
14:02 sz0 joined
14:02 <mofasa> Alex_____, Yes, convert char to int with 'ord' then sum them, then back to char with 'chr'
14:03 simukis_ joined
14:03 plutoniix joined
14:03 fendor joined
14:05 giovaevale89 joined
14:05 <giovaevale89> ciao
14:06 <shapr> howdy
14:06 darthvorik_ joined
14:06 ryanpcmcquen_ joined
14:07 plutoniix joined
14:07 <giovaevale89> !ciao
14:07 <Alex_____> mofasa: Okay, think I'll try to make it work with strings somehow
14:07 <mofasa> Alex_____, When you have questions like that using hoogle is very useful because you can search for type signatures, e.g. "Char -> Int" for finding a way of converting a CHar to an Int
14:08 Ferdirand joined
14:08 _Adluc_ joined
14:08 angular_mike___ joined
14:08 bbaren_ joined
14:08 <giovaevale89> !list
14:09 iqubic left
14:09 plutoniix joined
14:10 c0smo_ joined
14:10 <Alex_____> mofasa: Ah okay, thanks :)
14:10 tharper_ joined
14:10 flx joined
14:10 CosmicRa` joined
14:11 ssedov joined
14:11 tobhe joined
14:11 dxld_ joined
14:11 myme joined
14:12 squisher joined
14:12 squisher joined
14:12 stephe_ joined
14:12 lopex joined
14:12 Soif[m] joined
14:12 jinblack joined
14:12 lynn_ joined
14:13 Aruro joined
14:13 usr_ joined
14:13 chriswk joined
14:14 plutoniix joined
14:14 arc- joined
14:14 h101010 joined
14:14 asjo joined
14:15 pchiusano joined
14:15 Swizec joined
14:15 gleber_ joined
14:15 bkonkle joined
14:15 seanparsons joined
14:15 skeuomorf joined
14:15 lancetw joined
14:15 carter joined
14:16 siddhu joined
14:16 ohsix joined
14:17 Mon_Ouie joined
14:17 SpaceGazebo joined
14:17 PotatoGim joined
14:18 mr_sm1th joined
14:18 prefork joined
14:18 tarcwynne_ joined
14:18 MorTal1ty joined
14:19 Boomerang joined
14:19 SpaceGazebo joined
14:19 trism joined
14:20 cartwright joined
14:20 Rodya_ joined
14:21 <Sornaensis> @hoogle f -> g -> f
14:21 <lambdabot> Prelude const :: a -> b -> a
14:21 <lambdabot> Data.Function const :: a -> b -> a
14:21 <lambdabot> CorePrelude const :: a -> b -> a
14:21 oisdk joined
14:21 eklavya joined
14:21 coltfred joined
14:22 cschnei__ joined
14:24 plutoniix joined
14:26 ocramz joined
14:27 plutoniix joined
14:28 Ch0c0late joined
14:28 <Sornaensis> @hoogle (Ord a, Enum b) => a -> b -> a
14:28 <lambdabot> Prelude enumFromThenTo :: Enum a => a -> a -> a -> [a]
14:28 <lambdabot> CorePrelude enumFromThenTo :: Enum a => a -> a -> a -> [a]
14:28 <lambdabot> Intro enumFromThenTo :: Enum a => a -> a -> a -> [a]
14:29 <Sornaensis> @hoogle (Ord a, Enum b) => a -> a -> b
14:29 <lambdabot> Prelude enumFromThenTo :: Enum a => a -> a -> a -> [a]
14:29 <lambdabot> CorePrelude enumFromThenTo :: Enum a => a -> a -> a -> [a]
14:29 <lambdabot> Intro enumFromThenTo :: Enum a => a -> a -> a -> [a]
14:29 govg joined
14:29 shutdown_-h_now joined
14:29 crobbins joined
14:30 bennofs joined
14:30 <merijn> so: Please use /msg to query lambdabot
14:30 <merijn> s/so:/Sornaensis:/
14:31 niHiggim joined
14:31 abhiroop joined
14:32 <mtesseract> Hi. I'm playing around with -XDataKinds. Is there any way to have a record data constructor being promoted to the type level in a way that allows referencing its fields by name? e.g., when I have "data Foo = F { field :: Nat }", this makes "F 0" be a valid type (of kind Foo), but not "F { field = 0 }". I think for my application I need the constructor to hold at least seven values — referencing them
14:32 <mtesseract> simply by order seems error prone.
14:32 <merijn> mtesseract: Not really
14:32 plutoniix joined
14:32 <merijn> mtesseract: Honestly, if you find yourself wanting complex stuff using DataKinds, you might want to have a look at Idris
14:33 bodisiw joined
14:35 plutoniix joined
14:35 marsam joined
14:35 etehtsea joined
14:35 <mtesseract> merijn: :-) Probably. At least for experimenting with it and gaining experience with that level of type programming. I am currently trying to implement a Haskell library for modelling physical quantities with their units at the type level. I have something working already for length, time and mass. But according to wikipedia there are nine (I was wrong with the seven, it seems) base units. :-)
14:35 <lyxia> mtesseract: how about data Foo = F Field ; data Field = Field Nat
14:36 <mtesseract> (I meant "dimensions" — but they seem to be with 1:1 correspondence with base units)
14:37 <merijn> mtesseract: There's a reason why the paper on "dependent" Haskell is called Hasochism :)
14:37 <mtesseract> lyxia: Hmmm, that might be a workaround.
14:37 <merijn> mtesseract: Yeah, that's the kinda thing that would be such less hassle in Idris
14:38 <merijn> mtesseract: Honestly, Haskell is kinda terrible at type level programming
14:38 Gurkenglas joined
14:38 <Lokathor> really unfortunate that Num requires a -> a -> a for the math operators
14:38 <merijn> mtesseract: Switching to Idris or Agda will just make you go "oh...wait, this is actually kinda simple..."
14:38 Kundry_Wag joined
14:38 <Lokathor> when you're trying to do things like Length * Length -> Area
14:38 <mtesseract> merijn: I'm not particularly fond of it either.
14:39 <mtesseract> Lokathor: yes.
14:39 <mtesseract> mult :: Qty unit -> Qty unit' -> Qty (Mult unit unit')
14:39 <mtesseract> This is my multiplication function.
14:39 <Lokathor> huh
14:39 Ferdirand joined
14:39 heari joined
14:40 <Lokathor> I did a demo of such a thing in rust without special types, because in rust the Mul trait defaults to RHS = Self, but you can make the RHS be other things as well
14:40 <mniip> 1491489519 [17:38:39] <Lokathor> really unfortunate that Num requires a -> a -> a for the math operators
14:40 <mniip> class Num a b c d e f g h i j
14:40 <mniip> where (+) :: a -> b -> c
14:41 <mniip> (*) :: d -> e -> f
14:41 Itkovian joined
14:41 <mtesseract> Lokathor: I see
14:41 <Lokathor> mniip, doesn't that clash with Num's definitions?
14:42 <mniip> sure dos
14:42 <mniip> does
14:42 <Lokathor> well :/
14:42 <lyxia> I detected sarcasm
14:42 <mtesseract> As an example, the term second "second `mult` second" has type "Qty ('Dim 'LIntZero ('LInt 'Plus ('S 'PosNatOne)) 'LIntZero)", which means it is a quantity whose first and third dimensions (length and mass) are the lifted integer zero, while the second dimension (time) is the lifted integer two => thus, it's time squared. :-)
14:42 <mtesseract> But it is not particularly nice.
14:43 Argue__ joined
14:45 plutoniix joined
14:47 Fairy joined
14:47 <Lokathor> lyxia, i wasn't being sarcastic, if that's what you mean
14:49 <lyxia> I meant mniip.
14:49 taksuyu joined
14:49 eb_ joined
14:49 <lyxia> Lokathor: how much of a problem is clashing with Num if your Num is more general
14:50 <Lokathor> i figured that ghc would complain about a conflicting definition
14:50 plutoniix joined
14:52 <heari> hi guys
14:53 zcourts joined
14:54 fizruk joined
14:54 dbmikus joined
14:55 python476 joined
14:55 abhiroop_ joined
14:56 <lyxia> You can always hide it. But you will need to reimplement the whole ecosystem.
14:57 plutoniix joined
14:59 abhiroop joined
14:59 urodna joined
15:00 coot joined
15:01 fendor joined
15:01 etehtsea joined
15:01 eazar001 joined
15:03 MindlessDrone joined
15:03 plutoniix joined
15:03 insitu joined
15:04 ericsagnes joined
15:04 boombanana joined
15:05 etehtsea joined
15:06 Wuzzy joined
15:06 raichoo joined
15:07 vandenoever joined
15:07 vandenoever joined
15:08 eklavya joined
15:08 sssilver joined
15:09 uglyfigurine joined
15:09 osa1 joined
15:09 osa1 joined
15:09 plutoniix joined
15:11 Kreest__ joined
15:11 SimpleL joined
15:11 steeze joined
15:12 presiden joined
15:13 coot joined
15:13 abhiroop_ joined
15:14 lambdafan joined
15:15 <lambdafan> I remember seeing something on reddit about the downsides of the Prompt monad, but I can't find it. Anyone have a link?
15:15 <Philonous> What was the extension that allowed me to pass type arguments to functions? e.g. id @Int
15:16 <Boomerang> TypeApplications
15:16 <Philonous> Thanks
15:16 avn joined
15:17 oisdk joined
15:17 cschneid_ joined
15:18 _sg joined
15:18 coot_ joined
15:18 Swizec joined
15:19 Fairy joined
15:19 jathan joined
15:21 ericsagnes joined
15:22 cdg joined
15:22 plutoniix joined
15:23 Guest35345 joined
15:23 hackebeilchen joined
15:25 fkurkowski joined
15:25 Guest35345 left
15:27 thimoteus joined
15:27 jmelesky joined
15:28 dsh joined
15:29 abhiroop joined
15:31 richi235 joined
15:33 MindlessDrone joined
15:34 oberstein joined
15:35 plutoniix joined
15:36 Guest35345 joined
15:37 isd joined
15:37 igniting joined
15:37 Nvm joined
15:37 eazar001 joined
15:38 sword865 joined
15:39 dmwit_ joined
15:40 SpaceGazebo joined
15:41 MindlessDrone joined
15:41 mada joined
15:41 SpaceGazebo joined
15:42 fizbin joined
15:43 plutoniix joined
15:44 oberstein joined
15:45 Alex_____ joined
15:46 dfeuer joined
15:47 abhiroop joined
15:48 HugoDaniel joined
15:48 t0by joined
15:49 aminb joined
15:49 aminb joined
15:50 <sphinxo> https://hackage.haskell.org/package/either- vs https://hackage.haskell.org/package/validation ?
15:51 <Iceland_jack> sphinxo: alternatively, https://hackage.haskell.org/package/transformers-
15:51 <Iceland_jack> ;)
15:51 plutoniix joined
15:51 <sphinxo> How would that work Iceland_jack ?
15:52 <sphinxo> oh wait
15:52 <Iceland_jack> Lift (Const e) does what you want
15:52 <Iceland_jack> Monoid m => Applicative (Lift (Const e))
15:52 <sphinxo> oh that's really awesome
15:53 freechips joined
15:54 phyrex1an joined
15:55 saulod2 joined
15:55 plutoniix joined
15:55 oberstein joined
15:56 <mniip> is the 's -> (m a, s)' StateT a monad?
15:58 revprez joined
15:58 plutoniix joined
15:58 <Iceland_jack> sphinxo: If you inline 'Const' into the definition you get: data LiftConst e a = Pure a | Other e
15:58 <Iceland_jack> which, surprise!, is Either
16:00 plutoniix joined
16:03 plutoniix joined
16:04 Sonolin joined
16:05 sophiag joined
16:05 eklavya joined
16:07 henriksod joined
16:07 vlatkoB joined
16:07 plutoniix joined
16:08 t7 joined
16:09 plutoniix joined
16:10 <sphinxo> Iceland_jack: so how best should I actually use this when checking an ast
16:11 cansis joined
16:11 freechips joined
16:11 plutoniix joined
16:11 mkoenig joined
16:11 nesqi joined
16:12 osa1 joined
16:12 osa1 joined
16:13 mkoenig joined
16:15 <mniip> hmm
16:15 <mniip> a lazy insertion sort is just a selection sort
16:16 leshow joined
16:17 iAmerikan joined
16:17 <leshow> What is <*> called, like, if one was going to say it outloud?
16:17 <Alex_____> star or asterix?
16:17 SpinTensor joined
16:18 <barrucadu> "ap", as it's (supposed to be) the same as the `ap` function when your Applicative is also a Monad
16:18 ragepanda joined
16:19 Swizec joined
16:20 featherlessbiped joined
16:20 <leshow> barrucadu, that works
16:20 <leshow> I was calling it mr pointy
16:21 sdothum joined
16:21 cobreadmonster joined
16:21 ludat joined
16:21 <* ski> . o O ( "selection sort = insertion sort" by Graham Hutton at <https://www.youtube.com/watch?v=pcJHkWwjNl4> )
16:21 <mniip> hey dfeuer
16:21 <dfeuer> Hey mniip.
16:21 <mniip> wrt the sorting of Traversable contains
16:22 <dfeuer> Yah? Is there some cool article I should read?
16:22 horrorcheck joined
16:22 <mniip> why do you need such a complex Sort datatype?
16:22 <mniip> wouldn't Compose State State suffice
16:22 <cobreadmonster> man.
16:22 <cobreadmonster> I can't figure out how to parse complex languages.
16:22 joe9 joined
16:23 <dfeuer> mniip: explain? Also, is that actually simpler than Product (State Heap) (Const Heap)?
16:23 <ertes> cobreadmonster: there is an MMORPG where people will write the code for you in exchange for XP
16:23 <ertes> it's called stackoverflow
16:24 <leshow> Is there a way to add a git repo as a dependency to a stack project
16:24 venkat24 joined
16:25 sssilver joined
16:25 <cobreadmonster> ertes: Can I steal that?
16:26 dfeuer joined
16:26 <Alex_____> A bit of a newbie question from a newbie like me https://pastebin.com/kfVV3mN0
16:26 cyborg-one joined
16:26 <sm> leshow: yup, it's in the manual
16:26 <ertes> cobreadmonster: the code generation algorithm? go ahead
16:26 <dfeuer> mniip?
16:26 <mniip> one moment
16:26 <Boomerang> leshow: take a look at https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md
16:27 erisco joined
16:27 <ertes> Alex_____: as a beginner use pattern-matching instead of the 'head' function
16:27 ubsan_ joined
16:28 <dfeuer> As an advanced user, also use pattern-matching instead of the head function.
16:28 <ertes> as an advanced user you can use foldr =)
16:28 <dfeuer> I believe the only good uses I've seen for the head and tail functions are in the implementation of MonadFix []. Which means they should be defined as helpers there.
16:29 <leshow> Boomerang, I did look in there. it says to add a location: git: ... commit: ... under packages, Ive done that and stack says "external packages should typically be treated as extra-deps to avoid spurious test case failures."
16:29 <dfeuer> You can also use tail for processing the results of scanl, but that's because scanl is wrong :-(
16:29 <leshow> No extra-dep setting found for package at URL <..>.git
16:29 <Alex_____> ertes: Yeah, that's what I googled myself to ^^ But if I do that, won't I have to make sure that (x:xs) isnt empty as well?
16:30 <ertes> Alex_____: no, you need to handle the empty case
16:30 <ertes> that's why 'head' should rarely be used
16:30 <Boomerang> leshow: I believe you can add "extra-dep: true" under the location of that package, next to the git and commit
16:31 <dfeuer> x:xs is certainly never empty.
16:31 <Alex_____> Ah okay, thanks guys
16:32 <leshow> Boomerang, oh I see. I thought it was telling me to change the extra-deps: [] entry to true
16:32 <leshow> what is the purpose of the cabal file and the yaml file? why not just one file?
16:33 <Boomerang> leshow: I think adding "extra-dep: true" to the package location is the same as adding the package name to the list of extra-deps
16:33 iAmerikan joined
16:33 <Boomerang> I think stack didn't want to reinvent cabal so it just uses it.
16:34 <lpaste> mniip pasted “Traversable sort” at http://lpaste.net/354367
16:34 <mniip> dfeuer: ^
16:34 <leshow> Boomerang, after the git repo is in the YAML file, the name of the package should also be added to the cabal file?
16:35 vydd joined
16:35 vydd joined
16:35 <Boomerang> leshow: yes! While it might work without (because the package is in the context) your cabal file should definitely reflect the exact dependencies needed
16:36 <Sornaensis> surprise dependencies are the bane of my existence
16:37 <leshow> Boomerang, thanks for your help
16:37 <dfeuer> mniip: how's that going to be easier when trying to use a size-indexed heap to avoid the partial match in pop?
16:37 <dfeuer> Maybe it will be; I don't know.
16:38 theelous3 joined
16:38 sohail-ahmed left
16:39 <mniip> ah so that's the point?
16:39 <dfeuer> Yes, the idea is to make it as "obviously total" as possible, which was the challenge Will Fancher set out.
16:40 <dfeuer> You should also look at his blog post and see if you think the approach he took could go anywhere interesting.
16:40 <dfeuer> I have my doubts, but this whole thing is a bit weird.
16:42 <dfeuer> mniip: next-level challenge: find a way to do this efficiently in Safe Haskell. Some pieces seem likely to be doable with a binomial heap, but other bits seem tricky, so we'll see. We have O(log n) time per element we can use to run proofs if we like.
16:43 <dfeuer> But proving things about binary numbers is tricky.
16:43 ft3 joined
16:43 locallycompact joined
16:44 jasondockers_ joined
16:44 <dfeuer> Everything has to be by structural induction to get the efficiency, which really limits proof options.
16:45 abhiroop joined
16:45 SpaceGazebo joined
16:45 pera joined
16:45 oberstein joined
16:46 <mniip> can I use Data.Void?
16:46 osa1 joined
16:46 osa1 joined
16:46 <mniip> e.g absurd to avoid partiality
16:48 Quimby_ joined
16:48 chindy joined
16:49 Ferdirand joined
16:49 featherlessbiped joined
16:49 ClaudiusMaximus joined
16:50 <mniip> you need to somehow get a result of shape
16:50 raycoll joined
16:50 arctictern joined
16:50 yinn joined
16:50 <mniip> f a -> Either (f Void) (NonEmpty a)
16:50 dqd joined
16:51 alienbot joined
16:51 conal joined
16:51 cpup joined
16:53 <mniip> dfeuer, this reminds me of FreeT (Reader t)
16:53 <mniip> Free (Reader r) rather
16:53 <dfeuer> mniip: you can certainly use Void. What's Free (Reader r) get you exactly?
16:54 <dfeuer> Pure a | Free (Reader r (Free (Reader r) a))?
16:54 <benzrf> Free (Reader r) is a fold, right
16:54 <mniip> yes
16:54 arctictern joined
16:54 <dfeuer> Pure a | Free (r -> Free (Reader r) a) ?
16:54 <mniip> yes
16:55 <mniip> just a thought
16:55 <dfeuer> I guess the free Applicative is reminiscent of that, but certainly not the same.
16:55 arctictern joined
16:56 arctictern joined
16:56 oberstein joined
16:56 a3Dman joined
16:56 a3Dman joined
16:56 arctictern joined
16:57 groscoe joined
16:57 itachi joined
16:57 arctictern joined
16:58 ikke joined
16:59 connrs joined
17:03 <itachi> is there anyway to find nth element in a list using fold?
17:03 <glguy> :t fold -- this one specifically?
17:03 <lambdabot> (Monoid m, Foldable t) => t m -> m
17:04 <itachi> foldl foldr are also fine
17:04 <itachi> : foldr
17:04 <itachi> :t foldr
17:04 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
17:04 <glguy> You can do it with any of them
17:04 <itachi> How?
17:05 <glguy> foldr would be the best to start with
17:05 <ertes> itachi: http://ertes.eu/tutorial/foldr.html#stateful-folds
17:05 <ski> `foldl' wouldn't work on an infinite list
17:06 <itachi> I know how to find the last element but was wondering about how to find a element in the middle
17:06 <Boomerang> > let find n = snd . foldl' (\(i, m) x -> (i + 1, if i == n then Just x else m)) (0, Nothing) in (find 3 [0,1], find 3 [0..10])
17:06 <lambdabot> (Nothing,Just 3)
17:07 <Boomerang> But that goes through the whole list, so not very good
17:07 <* ski> isn't sure whether itachi is looking for a solution, or just want to know whether there is one
17:08 <Boomerang> Also "find" is a poor name, I should have thought that through a bit more
17:08 <ertes> foldl* is wrong
17:08 <itachi> finding element is O(n) in haskell right?
17:08 <ertes> you need fold or foldr
17:08 <ertes> itachi: yes
17:08 <geekosaur> for a linked list type, yes, O(n)
17:08 <ski> indexing into a single-linked list is linear in any language
17:08 <itachi> yup
17:08 <ertes> itachi: it can be O(1) in space for lazy lists, but it's always O(n) in time
17:09 <itachi> lazy lists?
17:09 <ertes> itachi: iterate f s0 !! n -- O(1) space
17:09 xochozomatli joined
17:09 <itachi> k
17:10 abhiroop joined
17:10 <ertes> at least in terms of the number of list elements in memory
17:10 <ertes> the elements themselves might still grow
17:10 oisdk joined
17:12 JuanDaugherty joined
17:12 <ski> @hoogle iterate'
17:12 <lambdabot> Agda.Utils.Function iterate' :: Integral i => i -> (a -> a) -> a -> a
17:14 Swizec joined
17:15 <itachi> Thanks
17:16 path[l] joined
17:16 <cobreadmonster> Is Agda on topic here?
17:17 RegEchse joined
17:18 mando joined
17:18 Destol joined
17:18 conal joined
17:19 oberstein joined
17:19 blu7 joined
17:19 xcouop joined
17:19 RegEchse joined
17:20 Ferdirand joined
17:22 sleffy joined
17:23 jgertm joined
17:23 xtreak joined
17:24 bsmt joined
17:24 robotroll joined
17:24 dylukes joined
17:25 <dylukes> Any suggestions on best practices for working with GLFW/OpenGL within ghci under stack?
17:25 <dylukes> Can't acquire a window on OS X because OS X requires that various things obtained by GLFW be on the main thread.
17:25 <dylukes> Clearly Stack is in some way running ghci on a non-main thread.
17:26 <dylukes> Any way to pass -fno-ghci-sandbox to `stack repl'?
17:28 <dylukes> Seems like `stack repl --ghc-options="-fno-ghci-sandbox"' works as intended, nevermind haha.
17:28 xenog joined
17:28 <dylukes> ghci-options*
17:29 azahi joined
17:30 oberstein joined
17:30 path[l] joined
17:31 raichoo joined
17:33 <cocreature> dylukes: I didn’t know about -fno-ghci-sanbbox, thanks! I’m sure that’ll come in handy at some point
17:34 abhiroop joined
17:34 Micamo joined
17:35 sleffy joined
17:35 aib joined
17:36 replay joined
17:37 uglyfigurine joined
17:38 xtreak joined
17:39 osa1 joined
17:40 uglyfigurine joined
17:41 vektorweg1 joined
17:41 Kundry_Wag joined
17:42 xtreak joined
17:42 Xanather joined
17:43 freechips joined
17:43 locallycompact joined
17:44 abhiroop joined
17:45 warlock joined
17:46 iAmerikan joined
17:47 arctictern joined
17:47 ph88^ joined
17:48 xtreak joined
17:48 raynold joined
17:50 Zialus joined
17:51 Ferdirand joined
17:53 caumeslasal joined
17:56 abhiroop joined
17:57 ft3 joined
17:59 yellowj joined
17:59 jeltsch joined
18:00 thvu joined
18:00 unbalancedparen joined
18:02 Apocalisp joined
18:03 zeroed joined
18:03 zeroed joined
18:03 <ph88^> when i do a readfile "myFile" does that load from the current working directory or the application dir ?
18:03 zero_byte joined
18:03 twanvl joined
18:03 <joe9> Just want to check if anyone uses Language.C library to check for missing free() calls in C programs?
18:03 <ertes> ph88^: current
18:04 xtreak joined
18:04 <ertes> ph88^: would be pretty weird if otherwise
18:04 <Apocalisp> In a free monad (or extensible effects) type of program, I might want to have an algebra to record the time a portion of my program takes. A simple marker won't do, since it would mark the entire continuation of the program, but I want to mark a _delimited_ continuation of the program. How do people solve this in general?
18:05 Swizec joined
18:06 <ertes> Apocalisp: the easy way would be to add a command to get the current time
18:06 BartAdv joined
18:06 troydm joined
18:07 iAmerikan joined
18:08 <ertes> Apocalisp: the ugly way would be to embed a whole action, but then the effect functor is no longer agnostic to the free monad implemention, unless it uses RankNTypes
18:08 meoblast001 joined
18:08 <Apocalisp> you mean rely on something like `MonadFree`?
18:08 thatguy joined
18:09 dcoutts_ joined
18:09 abhiroop joined
18:09 <Apocalisp> The same kind of problem comes up in supervision and concurrency problems
18:11 <ertes> Apocalisp: in general in the effect functor you can only work with "futures"
18:11 dylukes joined
18:11 <ertes> WithStats :: (Stats -> a -> x) -> (forall m. (MonadFree MyF m) => m a) -> MyF x
18:12 ertesx joined
18:12 path[l] joined
18:13 <ertesx> <ertes> Apocalisp: in general in the effect functor you can only work with "futures"
18:13 <ertesx> <ertes> WithStats :: (Stats -> a -> x) -> (forall m. (MonadFree MyF m) => m a) -> MyF x
18:13 <ertesx> <ertes> it's ugly, but i don't think there is another way to delimit
18:13 <Apocalisp> what's `Stats` here?
18:14 vandenoever left
18:14 <ertesx> anything you want
18:14 <ertesx> timing info, memory, etc.
18:14 abhiroop joined
18:15 <Apocalisp> right on
18:16 <ertes> Apocalisp: but if Stats is a group, it's probably better to just introduce a GetStats command
18:16 Berra joined
18:16 <ertes> GetStats :: (Stats -> x) -> MyF x
18:17 <ertes> do t0 <- getStats; c; t1 <- getStats; let { dt = t1 - t0 }; …
18:17 <ertes> you can easily build a function to encapsulate this pattern: withStats :: (MonadFree MyF m) => m a -> m (Stats, a)
18:18 a3Dman joined
18:19 chlong joined
18:20 <Jello_Raptor> hmm, things like modifyMVar' only get the MVar to weak head normal form right? if there's a datastructure, it can still have unforced thunks in it?
18:20 <cocreature> Jello_Raptor: yep
18:20 <Jello_Raptor> cool
18:20 Jan__ joined
18:21 <ertes> Jello_Raptor: you can tell from the type signature
18:21 <ertes> there are no constraints on the content type, so modifyMVar' couldn't evaluate further, even if it wanted to
18:21 <cocreature> Jello_Raptor: if you really want to force evaluation to normal form use the deepseq package. but most of the time there are better solutions
18:22 <Jello_Raptor> right, I don't want any further evaluation, just don't want a stack of function application thunks building up
18:22 <Jello_Raptor> which modifyMVar' takes care of
18:23 iAmerikan joined
18:23 dylukes joined
18:24 Ferdirand joined
18:24 caumeslasal joined
18:26 chaosmasttter joined
18:27 marsam joined
18:27 bennofs joined
18:28 darkSeid_ joined
18:28 conal joined
18:28 troydm joined
18:29 deech joined
18:31 a3Dman joined
18:32 dhil joined
18:32 Rodya_ joined
18:33 agjacome joined
18:34 t0by joined
18:34 t0by joined
18:34 <ph88^> what can i use to validate configuration files?
18:35 <ph88^> when i use php i would use this component https://symfony.com/doc/current/components/config.html
18:35 bbaren joined
18:36 oish joined
18:37 unbalancedparen joined
18:38 mac10688 joined
18:39 iAmerikan joined
18:40 lambdafan joined
18:42 patbecich joined
18:42 Kundry_Wag joined
18:43 <sophiag> could someone familiar with haskell-src-exts help me figure out a case analysis of some (relatively) simple ASTs? here's the code: http://lpaste.net/354370
18:44 govg joined
18:45 <lyxia> sophiag: you're using App sometimes as a binary constructor, sometimes as a ternary one
18:46 <sophiag> i've tried wrapping it in parens, but that doesn't help
18:46 <lyxia> sophiag: http://hackage.haskell.org/package/haskell-src-exts-1.19.1/docs/Language-Haskell-Exts-Syntax.html#t:Exp
18:46 <michalrus> Hey, how can I run `cabal repl` but without loading/building the project?
18:47 <lyxia> sophiag: you're also missing the location field in all of these patterns.
18:48 <sophiag> lyxia: i'm unsure what you mean and i've read through the docs. if i parse just a string of one word it returns "App (Var (UnQual (Ident "foo")))"
18:48 <sophiag> i'm not confused about the types, but rather how to match for them
18:48 merijn joined
18:49 peterbecich joined
18:50 teppic joined
18:50 TheLemonMan joined
18:50 pent joined
18:51 <sophiag> lyxia: parsing "amb foo [1,2,3" returns "App (App (Var (UnQual (Ident "amb"))) (Var (UnQual (Ident "foo")))) (List [Lit (Int 1),Lit (Int 2),Lit (Int 3)])"
18:51 <lyxia> sophiag: App is a constructor, and the docs show it has three fields.
18:52 <sophiag> notice how the ast returns includes a close paren where there is no open one...
18:52 <lyxia> sophiag: or are you perhaps using an older version
18:52 mac10688 joined
18:52 whaletechno joined
18:52 <lyxia> where do you see a close paren where there shouldn't be?
18:53 <sophiag> is import Language.Haskell.Exts.Syntax the newest version?
18:53 locallycompact joined
18:53 uglyfigurine joined
18:53 <lyxia> that's now where you look for the version of the package you are using
18:53 <sophiag> lyxia: in the example i posted it's the 7th close paren
18:54 <lyxia> it's matched with the 1st open parenthesis
18:54 iAmerikan joined
18:54 <lyxia> "amb foo [1,2,3]" is parsed as two applications. (amb foo) [1,2,3]
18:55 <sophiag> oh sorry i was confused by the two Apps
18:55 shane joined
18:56 <sophiag> and also if i do use parens around App in the case analysis it gives me a parse error
18:57 SolitaryCypher joined
18:57 arctictern joined
18:57 <sophiag> hence, back to my original question: clearly i cannot parse asts in the form match for ASTs in the form they're parsed. so how do i?
18:57 <lyxia> App (App (Var (UnQual (Ident "amb"))) (Var (UnQual (Ident "foo")))) (List list)
18:58 <lyxia> show me your error
18:58 <lyxia> and the code of course
18:58 <sophiag> hold on i'm editing it to use your version with two apps
18:59 soLucien joined
18:59 <lyxia> You *must* use two App to match on two applications...
19:00 <lyxia> since a b c gets parsed to App (App a b) c
19:00 coltfred joined
19:01 peterbec` joined
19:02 abhiroop joined
19:03 MarioBranco joined
19:04 pothepanda joined
19:05 jbiesnecker joined
19:05 <merijn> bleh, why do I always manage to write projects that get blocked on issues with other packages, leading to the "fun" "try to get upstream fixed" dance of open source >.<
19:05 Marumarsu joined
19:06 armyriad joined
19:06 marsam joined
19:07 <merijn> Especially since I always seem to pick upstream projects with overloaded/busy maintainers >.>
19:09 Zialus joined
19:10 epsilonhalbe joined
19:10 xochozomatli joined
19:11 cbaines joined
19:13 nick_h joined
19:13 nycs joined
19:17 divVerent joined
19:18 <sophiag> lyxia: sorry for the delay (in an office where i'm the only programmer so keep getting distracted...). i think the matches are working now and i'm just dealing with an unrelated issue on the rhs. thanks for the help :)
19:19 mac10688 joined
19:20 regent joined
19:20 mkoenig joined
19:22 ocramz joined
19:24 abhiroop joined
19:24 SvenG1 joined
19:24 vektorweg1 joined
19:27 pzuck joined
19:28 unK_ joined
19:29 xmonader joined
19:29 Rodya_ joined
19:30 albertus1 joined
19:30 <maerwald> merijn: fork everything
19:31 <merijn> maerwald: That's...not convenient if I want people to use my stuff :p
19:31 albertus1 joined
19:31 <maerwald> well, even with a "simple" haskell project I had to fork 3 libraries, and was able to drop one fork after half a year
19:31 <merijn> I managed to get a whole bunch of useful fixes into xml-conduit, now it's time to see if I can manage to both fix criterion and get the stuff merged by bos. Which is tricky, since he's so busy
19:31 <maerwald> the other I still have to maintain
19:32 <bitemyapp> hmm yeah
19:32 <bitemyapp> It's pretty hard to do something substantive in Haskell without patching the odd library
19:32 oisdk joined
19:32 <bitemyapp> this is partly why I don't feel bad asking to see a Github if someone says they've used Haskell for work
19:32 Itkovian joined
19:32 <merijn> bitemyapp: OTOH, I believe in the compound awesomeness of incremental fixes
19:33 <merijn> bitemyapp: My real issue isn't needing to patch/fix libraries, but rather being in unresponsive limbo wrt your patch actually ever getting merged
19:33 eschnett joined
19:34 <merijn> I understand that bos has a metric crapton of projects he has to maintain/support and likes a personal live too, but given how critical some of his stuff is to the ecosystem I wish there'd be more maintainers to increase responsiveness
19:34 <maerwald> "Github"... "for work"...? errm?
19:35 <cocreature> merijn: you’re not the only one https://github.com/bos/criterion/issues/133
19:35 <merijn> cocreature: Yeah, I saw that
19:35 des_ joined
19:35 <reactormonk[m]> merijn: got some patch merged within 4 days on a smaller project, can't complain
19:35 sdfsdf joined
19:36 <merijn> cocreature: But that still doesn't unblock my current work :) I'm trying to fix/patch criterion locally and then I'll just use a sandbox for now
19:37 <cocreature> merijn: it’s really easy. you just need to hard fork and get everyone to switch over to your fork.
19:37 richi235 joined
19:37 <merijn> cocreature: And then maintain that hard fork >.>
19:37 Itkovian_ joined
19:37 exferenceBot joined
19:37 <cocreature> merijn: then you are the shitty maintainer that doesn’t respond to PRs :)
19:38 <merijn> cocreature: Then slowly become as influential as bos, get overloaded with work, and perpetuate the cycle... :p
19:38 <cocreature> exactly :)
19:38 <merijn> cocreature: Like I said, I don't think he's a shitty maintainer, I just think that extremely crucial/central packages need more than a single person taking care of things to avoid this
19:39 <leshow> When combining monad transformers, I'm confused at how they are combined. For example, StateT takes 3 types variables, s m a, ReaderT takes 3 type variables r m a. Howver when combined I end up with something like
19:39 <leshow> ReaderT Config (StateT Game IO)
19:39 <leshow> where is the third type variable to ReaderT? why is that valid?
19:39 <merijn> leshow: It's a partially applied type
19:39 <merijn> leshow: ReaderT still needs another argument
19:40 <leshow> oh i see
19:40 <cocreature> merijn: yeah I wasn’t referring to him specifically. but I think expecting people to add maintainers if they become unresponsive and the package is used heavily is not that much to ask
19:40 <sbrg_> if you had `type MyType = ReaderT Config (StateT Game IO)` you would be using this type as `foo :: MyType ()`
19:40 <leshow> merijn, I'm not crazy then that's good
19:40 <sbrg_> or `MyType a`
19:40 <merijn> cocreature: And now my cat is trying to sabotage my patching attempts >.<
19:41 <ph88^> how can i validate a toml file ?
19:41 exferenceBot joined
19:41 <cocreature> merijn: punish your cat by making it the maintainer of your fork of criterion
19:41 fizruk joined
19:42 <merijn> cocreature: I think she'd just kick my laptop of my lap in revenge...
19:42 <merijn> For as far as she isn't currently already doing that...
19:42 <bennofs> there is a criterion fork=
19:42 <merijn> bennofs: Where? And fixing what?
19:43 <bennofs> merijn: yeah idk where and what but cocreature said there is?
19:43 Kundry_Wag joined
19:43 <merijn> bennofs: No, he was suggesting I make one
19:43 ft3 joined
19:43 <bennofs> oh
19:43 jgt joined
19:43 Rodya_ joined
19:43 <merijn> As a joke too :p
19:43 <bennofs> that's what I get for only reading a single line
19:43 exferenceBot joined
19:44 exferenceBot joined
19:44 <jgt> Jello_Raptor: are you French?
19:44 MarioBranco joined
19:45 Yuras joined
19:46 theDon joined
19:46 <merijn> cocreature: Thanks to the amazing Haskell type system, this might actually end up being a simple change </famous last words>
19:46 mattyw_ joined
19:46 exferenceBot joined
19:47 bwe joined
19:47 robertkennedy joined
19:47 asdasd joined
19:47 <merijn> cocreature: Maybe bos should just follow edwardk's lead and just give everyone that gets a PR merged commit access to the repo :p
19:48 BlueRavenGT joined
19:48 <cocreature> merijn: seems to work out pretty well for him :)
19:48 <cocreature> cabal started doing that recently as well
19:48 ps-auxw joined
19:50 <merijn> Actually, since criterion exports all it's internals, I think I could roll this functionality myself without patching criterion, but why not save every other poor soul the work...
19:50 <merijn> Actually, that would also involve a reasonable amount of code duplication attracting bugs...
19:51 <h101010> #join archlinux
19:51 <maerwald> no
19:51 h101010 left
19:52 Zialus joined
19:53 oish joined
19:54 Marumarsu joined
19:55 takle joined
19:56 javjarfer joined
19:57 Marumarsu joined
19:58 Luke joined
19:58 fnurglewitz joined
19:58 <mmaruseacph2> what's the problem with criterion? :o
19:59 h101010 joined
19:59 oish joined
20:00 <merijn> mmaruseacph2: 1) "env" does not support a cleanup operation after the corresponding benchmarks finish 2) env doesn't support "per run" environment
20:00 <merijn> I have benchmarks the require per run setup/cleanup
20:01 <mmaruseacph2> oh, makes sense
20:01 h101010 left
20:02 mstruebing joined
20:02 ocramz joined
20:02 Supersonic112 joined
20:02 <merijn> I want to benchmark my Chan implementation, but I'm really unhappy/disappointed with the benchmarks used by, e.g. unagi-chan. But doing proper benchmarks is substantially harder without the ability to have "per run" environment
20:03 <dolio> I ran into the same thing testing vector-algorithms.
20:03 <merijn> dolio: Well, maybe you can help me prod bos to merge it after I finish writing this ;)
20:04 <dolio> I wanted env to initialize a mutable array each time, but it only did it once.
20:04 <dolio> So most of my tests were on sorted arrays.
20:04 <merijn> There's already a PR for "envWithCleanup", but that still only does it once per run
20:04 <merijn> dolio: Would setup/cleanup per Benchmarkable work for your use? Or do you need actual "per run" setup?
20:05 h101010 joined
20:05 h101010 left
20:05 path[l] joined
20:05 lep-delete joined
20:06 <merijn> dolio: Since criterion uses "newtype Benchmarkable = Benchmarkable { runRepeatedly :: Int64 -> IO () }" to run a benchmark repeatedly. Doing setup once for the entire N runs is much easier/less invasive than doing so for every individual run
20:06 hololeap joined
20:06 exferenceBot joined
20:07 <dolio> I wanted it per run. The array needs to be re-initialized every time, and I wanted to not include the time to initialize it int the benchmark time.
20:07 <merijn> That's considerably trickier, I think...
20:08 exferenceBot joined
20:08 <dolio> Yeah, I figured it was kind of fundamental, like you couldn't get good timing for a single benchmark run.
20:08 <merijn> So, in my case of wanting to benchmark, e.g. "putChan" I can easily reuse the same chan across N repeats (which it does for accuracy)
20:08 <dolio> Necessarily.
20:08 takle joined
20:09 exferenceBot joined
20:09 asmyers joined
20:09 takle joined
20:09 hucksy joined
20:09 <dolio> I modified the approach I was taking, and just accepted that I had to have the per-run initialization time included.
20:09 <merijn> dolio: Well, actually I think you might be able to work it?
20:09 <dolio> So I'd have to benchmark that, too, and subtract it.
20:10 insitu joined
20:10 <hololeap> hello everyone. i made a library that uses IntSet and the Enum typeclass to map any Enum to the IntSet implementation. i had to re-write a bunch of functions, and i realized there are only a handfull of patterns that were being used to essentiall unwrap and re-wrap values. i feel like this is a common pattern and i was thinking that maybe there is a type that encapsulates this?
20:10 exferenceBot joined
20:10 ralu joined
20:10 Marumarsu joined
20:11 robkennedy joined
20:11 <hololeap> or any kind of abstraction of this pattern
20:11 veyd joined
20:11 <merijn> dolio: i.e. suppose the Benchmarkable gets called with 10 (as in 10 iterations) you could setup 10 unsorted arrays at once, sort all 10 arrays and finish. That way you could get what you need and still only require setup/cleanup once per Benchmarkable (which, as said, is relatively easy to patch)
20:11 <dolio> It's not a big deal in my case. It just didn't work the way I initially thought.
20:11 <hololeap> would be helpful
20:11 chaosmasttter joined
20:12 <dolio> Oh, that's true.
20:12 <veyd> is there an easy all-in-one IDE thjat includes a GHCi interface? I tried VSCode with Haskell extensions but I have no clue how to get it working to where I can do these Haskell tutorials on ghci
20:12 <merijn> dolio: So as long as your setup/cleanup functions are parametrised over the iterations in the Benchmarkable, it'd work for what I intend to patch
20:12 bollu joined
20:12 <veyd> I also tried installing Leksah but it chokes and fails on Win 10
20:12 <merijn> dolio: In your case you could also do that with the current env setup, I guess
20:12 canta joined
20:12 <merijn> oh, wait, no
20:13 leshow joined
20:13 <dolio> merijn: Yeah, I don't care about the initialization happening in between each benchmark per se.
20:13 <leshow> in this bit of code in RealWorldHaskell
20:13 <leshow> https://github.com/cyga/real-world-haskell/blob/master/ch18/UglyStack.hs#L22
20:13 <merijn> You'd still need a "per benchmarkable" setup, since you don't know in advance how many arrays you need to sort to be accurate enough
20:13 <leshow> what would k look like?
20:13 <leshow> I have a similar problem in my own application where everything copmiles except this argument to runReaderT
20:14 <glguy> leshow: It would be any value that has type App a for any a
20:14 <leshow> glguy, Ok but I don't really understand how to construct that value
20:14 <merijn> leshow: k should be a "ReaderT r m a"
20:15 <glguy> leshow: For example constrainedCount constructs such a value
20:15 <CuriousErnestBro> what's so special about the city Glasgow?
20:15 <merijn> leshow: Note that "App a" is just a synonym of "ReaderT AppConfig (StateT AppState IO)"
20:15 <merijn> eh.. add an 'a' at the end there
20:15 <merijn> CuriousErnestBro: In what sense?
20:15 <CuriousErnestBro> merijn, in the ghci sense
20:15 <leshow> but constrainedCount's type isnt anywhere close to ReaderT AppConfig ...
20:15 <merijn> CuriousErnestBro: The GHC project was started by people at the University of Glasgow
20:16 <glguy> leshow: No, it's quite close to that
20:16 <CuriousErnestBro> ah ok
20:16 pwnz0r joined
20:16 <leshow> Oh i see, the type synonym
20:16 <merijn> CuriousErnestBro: UHC is called the Utrecht Haskell Compiler for similar reasons ;)
20:16 <dolio> merijn: The only issue I forsee is that doing a bunch of initialization at the start conflicts with the idea that having irrelevant stuff in memory (or what have you) could affect the benchmark results, which is one thing that env is for. But it'd be nice to have a trade off for that.
20:17 <merijn> dolio: Well, irrelevant stuff *will* affect your benchmark if it takes long enough to trigger GC, but I don't see any real way around that
20:17 <merijn> Since extra live data == more data to copy by the GC
20:17 alx741 joined
20:17 <dolio> Yeah.
20:18 exferenceBot joined
20:18 alx741 joined
20:18 <merijn> hmmm
20:18 <dolio> I can't benchmark sorting on 16 GB arrays, either. :)
20:18 <merijn> dolio: No? Get a bigger computer!
20:18 <CuriousErnestBro> cool, I have a friend at Utrecht
20:18 <dolio> If it needs to be able to put 10 into memory.
20:19 <merijn> dolio: 10 arrays of 16GB is easy, just get a nice SPARC box with 5TB memory :)
20:19 <ph88^> can someone help me make this code a bit more "haskell powered" ? right now it looks stupid https://bpaste.net/show/1087e1b3b33b
20:19 iAmerikan joined
20:19 <merijn> dolio: Although, tbh, for sorting arrays that big you don't really need criterions accuracy anyway. Who cares about nanoseconds for benchmarking that :p
20:20 cdg joined
20:20 Taren joined
20:20 <bitemyapp> merijn: I don't mind patching. I just want things upstreamed.
20:20 <bitemyapp> merijn: but a lot of programmers consider needing to patch a dependency a Hard No for using a language/ecosystem
20:21 <bitemyapp> so it's worth keeping in mind that it's a mental block for a lot of normies
20:21 <merijn> bitemyapp: Sure, but it's not like other languages got their ecosystems without ever patching things :)
20:21 <orion> bitemyapp: One thing that's annoying about patching dependencies is that you have to pull the entire project in to yours.
20:22 <merijn> orion: No, that's why he said he wants things upstreamed. That means *not* pulling in projects
20:22 <merijn> It means hassling upstream until your patch is included :p
20:22 dni joined
20:22 <merijn> Thus, solving the issue for everyone else too and making the world a better place!
20:23 Deide joined
20:23 <merijn> http://www.reactiongifs.us/wp-content/uploads/2016/06/doing_my_part_starship_troopers-1.gif
20:23 exferenceBot joined
20:24 <ph88^> merijn, what do you call some of bos critical stuff ?
20:24 ericdwhite joined
20:25 eacameron joined
20:25 raichoo joined
20:25 exferenceBot joined
20:25 exferenceBot joined
20:26 iAmerikan joined
20:27 jbiesnecker joined
20:27 exferenceBot joined
20:27 <orion> Does anyone know if basvandijk hangs out here?
20:28 insitu joined
20:28 <merijn> ph88^: criterion, attoparsec, aeson, text, text-icu, mwc-random
20:28 <merijn> orion: If he does, you're unlikely to catch him now, since it's 22:30 :)
20:29 SpaceGazebo joined
20:29 <dolio> merijn: I just wanted to make fancy graphs.
20:29 arpl joined
20:29 <merijn> dolio: Word :)
20:29 <merijn> dolio: Why do you think I'm trying to use criterion? ;)
20:29 <dolio> :)
20:31 chaosmasttter joined
20:31 exferenceBot joined
20:31 <ph88^> merijn, do you have an advice for me what i can do about that code snippet ?
20:32 peterbecich joined
20:32 <merijn> ph88^: Which snippet?
20:32 <ph88^> https://bpaste.net/show/1087e1b3b33b
20:32 <ph88^> it looks stupid
20:32 e_svedang joined
20:34 <merijn> ph88^: Write "String -> Maybe a -> Either String a", use that to lift HL.lookup to a "Either String a" function and then use the monad instance of Either?
20:34 exferenceBot joined
20:36 nshepperd joined
20:36 hybrid joined
20:36 <ph88^> eehh, you mean make those two top functions into one function ?
20:36 Miranda joined
20:37 moth joined
20:38 lambdamu joined
20:40 ChaiTRex joined
20:40 <merijn> ph88^: No, wrap HL.lookup to return an Either and then use do notation to handle failures
20:40 <Miranda> Hi. I'm unable to declare class Foo f where fooA :: f -> (); fooB :: ()
20:40 <ph88^> ooh
20:41 darjeeling_ joined
20:41 <Miranda> fooB produces an error saying the type variable `f` is ambiguous. Any insight as why that's a problem?
20:42 doomlord joined
20:42 <jle`> Miranda: how would you expect fooB to work?
20:42 <Miranda> I'm almost sure that the call site has enough information to infer the `f` because calls to `fooA` also happens.
20:42 <Miranda> So why is it bugging me about this `fooB` ?
20:42 ocramz joined
20:42 <jle`> there is no way the call site would have enough information to infer fooB
20:42 <jle`> to infer the instance that fooB uses, that is
20:43 <jle`> Miranda: if i just had `fooB :: ()`, how would you know what f's instance is being used?
20:43 <jle`> it could be an instance for Int...or for Bool....or for String...
20:43 unbalancedparen joined
20:43 mekeor joined
20:44 <Miranda> That would be a problem if it was used alone, but given (fooA something) and (fooB something), wouldn't the type inference correctly infer `something`?
20:44 <Miranda> And thus work out fooA and fooB are legal?
20:44 <jle`> Miranda: 'fooB something' is a type error
20:44 <jle`> fooB :: (), not a function
20:44 <Miranda> jle`: Err, sorry. Oh wait. That's why it can't figure it out :/
20:45 <jle`> if you have ghc 8.0, you can turn on AllowAmbiguousTypes, and provide the instance using type applications
20:45 chenyu joined
20:45 <jle`> but the traditional way is to have fooB take an argument that lets ghc infer the type
20:45 <jle`> fooB :: forall p. p f -> ()
20:45 <chenyu> hello! Will someone kindly answer this questions? http://stackoverflow.com/questions/43265198/will-stack-over-flow-error-occur-in-haskell-why
20:46 <jle`> that way is a bit more normal-haskell
20:46 Sh4rPEYE joined
20:46 <jle`> then you could call `fooB (Proxy :: Proxy Int) :: ()`
20:46 <jle`> chenyu:
20:46 <jle`> oh, sorry, pressed enter too soon
20:46 <Miranda> jle`: Okay, let me play a little and see if I can figure it out with the new information.
20:46 <Miranda> jle`: Appreciated :)
20:46 <jle`> no problem!
20:46 <chenyu> :)
20:47 daGrevis joined
20:48 skeuomorf joined
20:48 <Sh4rPEYE> Let's say I have the following code. How can I write some QC tests for it? I was thinking mainly about encode->decode = original equality, but it seems impossible when Maybes are involved. What's the right way to do it?
20:48 <Sh4rPEYE> http://lpaste.net/448485359836200960
20:49 msks joined
20:49 daGrevis left
20:50 Marumarsu joined
20:51 <koala_man> Sh4rPEYE: the fact that Maybe is involved just means that the test would additionally express that the operation should succeed
20:51 <monochrom> (toRoman x >>= fromRoman) == Just x
20:52 <monochrom> There is a fmap version too.
20:52 <ph88^> merijn, like this? https://bpaste.net/show/fc0d86439270
20:52 <Sh4rPEYE> monochrom That won't work; let x = (-1), then in would be Nothing == Just (-1)
20:52 DataComputist joined
20:52 <monochrom> Oh OK, I was thinking of non-neg x.
20:53 <Sh4rPEYE> monochrom: I have actually no idea how to specify what Ints QC passes. If I could choose that, it would solve this problem
20:53 <monochrom> I don't know the details of QC, but I think you know how to say "this is for non-neg x"
20:53 <Sh4rPEYE> (I just started with QC)
20:53 <mmaruseacph2> Sh4rPEYE: https://hackage.haskell.org/package/QuickCheck-2.9.2/docs/Test-QuickCheck-Modifiers.html
20:54 <mmaruseacph2> Positive Int instead of Int
20:54 <merijn> ph88^: Why have separate "tableLookup" and "nodeLookup"? Aren't they basically the same?
20:54 <Sh4rPEYE> Thanks
20:55 SpaceGazebo joined
20:55 peterbec` joined
20:56 <ph88^> merijn, yes basically, except for the 3rd argument (TO.VTable table)
20:57 <ph88^> oh ye i refactered that
20:57 SpaceGazebo joined
20:57 silver joined
20:58 napping joined
20:58 arpl left
20:58 <Sh4rPEYE> Little followup: Where should I put my tests in the source code? Should I just define the properties, so they can be checked from GHCi, or should I make some form of main function and check for them myself in the source?
20:59 vektorweg11 joined
21:00 <jle`> Sh4rPEYE: for a haskell project, tests can be integrated into cabal
21:00 <ph88^> merijn, now i have this https://bpaste.net/show/f15dc955f7ce
21:00 <jle`> test suites are usually implemented as exeutables in a test/ directory
21:00 SpaceGazebo joined
21:00 <Sh4rPEYE> jle`: It is rather a simple one-module exercise, so it'd be mabye good to have them at a glance
21:00 <jle`> some people also like doctests right in their documentation
21:01 bjz joined
21:01 <jle`> Sh4rPEYE: if it's for a one-module exercise then you can put them wherever you want :)
21:01 <Sh4rPEYE> I mean - how should I do it, though.
21:02 Ferdirand joined
21:02 <Sh4rPEYE> Now I have a defined property, which should hold true for a given input. But I have no idea what to do now.
21:02 <jle`> i don't think there's any standard. whatever works for your workflow
21:02 <jle`> you can write an IO () that tests all our properties if you want
21:06 nshepperd joined
21:07 <Sh4rPEYE> jle`: Good idea. Thanks :-)
21:07 <ph88^> merijn, i think normally you just define types and write generic function on top for this, no? or use lens ?
21:08 Itkovian joined
21:08 warlock joined
21:08 <merijn> ph88^: Yes, no, maybe?
21:09 <mmaruseacph2> Sh4rPEYE: if you use stack then stack new name-of-project tasty-travis should get you settled
21:11 MarioBranco joined
21:11 chlong joined
21:11 <Zemyla> Oh, I figured out a way for an Integer library (which can't use anything like error or undefined) to throw an exception rather than crash the runtime if called on invalid arguments.
21:11 <merijn> Is there, like, a mix of <* and >>= ?
21:12 <merijn> i.e. pass the result of an action to the next, then return the original result?
21:12 <Zemyla> Using only operations from GHC.Prim:
21:13 <Zemyla> undefined = case atomically# (atomically# (\s -> (# s, let x = x in x #))) realWorld# of { (# _, x #) -> x }
21:13 ystael joined
21:13 romildo joined
21:14 marsam joined
21:14 <jle`> merijn: x <*= f = x >>= (liftA2 (<$) f) i suppose heh
21:14 <jle`> i don't think there's a built-in way
21:14 ericdwhite joined
21:15 piyush-k` joined
21:15 tel joined
21:16 <romildo> Does anybody know if the function (\test x list -> if test then x : list else list) is already available in some library?
21:16 <romildo> If not, what would be a good name for it?
21:16 <ph88^> merijn, dunno i figured you could point my in the right direction to polish this up ^^
21:17 MarioBranco joined
21:17 <ChaiTRex> @src if'
21:17 <lambdabot> Source not found.
21:17 <monochrom> cons_if is a good name.
21:17 govg joined
21:18 <monochrom> condcons is a good pun but...
21:18 <ChaiTRex> You're one of those evil non-camelcasers, aren't you?
21:18 <monochrom> No, I am one of those benevolent non-camelcasers.
21:18 <MarcelineVQ> pCons :>
21:20 gk_1wm_su joined
21:20 nak joined
21:21 <romildo> With the help of a version of ($) with the same precedence of (:) and want to write expressions like 1 : 2 : consIf True 3 $: 4 : 5 : []
21:22 Faucelme_ joined
21:22 ocramz joined
21:23 <nak> i'm trying to understand monad transformers better. given transformer (MyMonadT Maybe), what is the expected return type of >>= ? Am I expected to return MyMonad(Maybe a) or only (Maybe a) ?
21:23 louispan joined
21:23 ccomb joined
21:23 Claudius1aximus joined
21:24 path[l] joined
21:25 <glguy> :t (>>=)
21:25 <lambdabot> Monad m => m a -> (a -> m b) -> m b
21:25 <glguy> If you're making an instance Monad (MyMonadT Maybe), then m is MyMonadT Maybe
21:25 <nak> ah
21:25 <glguy> so (>>=) :: MyMonadT Maybe a -> (a -> MyMonadT Maybe b) -> MyMonadT Maybe b
21:26 <nak> <3
21:26 Itkovian joined
21:26 <nak> thank you glguy
21:26 <nak> :t return
21:26 <lambdabot> Monad m => a -> m a
21:26 <nak> parfait
21:26 `^_^v joined
21:27 <nak> return :: a -> MyMonadT Maybe a
21:27 <nak> glguy: yes ?
21:28 <Zemyla> :t maybe (const id) (const const) . guard -- ChaiTRex: This is a point-free definition of if'
21:28 <lambdabot> Bool -> a -> a -> a
21:28 detrumi joined
21:28 <nak> glguy: i'm seeing things like runEitherT and runContT. is this a sort of standard interface for getting at the inner monad then ?
21:28 ClaudiusMaximus joined
21:28 niteria joined
21:28 <nak> glguy: ie, should MyMonadT have a runMyMonadT field ?
21:29 sleffy joined
21:29 <glguy> nak: Yes, that return type is fine. Having a runMyMonadT field is one way to consume them, fairly common. my original instance line was off, you'd typically want to write: instance Monad m => Monad (MyMonadT m) if you were making a "transformer"
21:30 <nak> :t runEitherT
21:30 <lambdabot> error:
21:30 <lambdabot> • Variable not in scope: runEitherT
21:30 <lambdabot> • Perhaps you meant ‘runWriterT’ (imported from Control.Monad.Writer)
21:30 <nak> :t runStateT
21:30 <lambdabot> StateT s m a -> s -> m (a, s)
21:31 <nak> ah ok, so the outer is run and it spits out the inner monad
21:31 <nak> :t runContT
21:31 <lambdabot> forall k a (m :: k -> *) (r :: k). ContT r m a -> (a -> m r) -> m r
21:31 <glguy> If it's appropriate to provide that as a field selector will depend on what your transformer is and if you intend to expose the actual implementation to the consumer of your transformer
21:31 <Zemyla> nak: It should have some way of taking it out. It depends on how much access to the internal state you want the user to have.
21:31 phaji joined
21:31 <nak> ok thanks ^_^
21:32 <nak> i'll keep poking at this
21:33 muesli4 joined
21:33 Faucelme joined
21:33 ClaudiusMaximus joined
21:34 hive-mind joined
21:34 Ferdirand joined
21:36 <merijn> Right, so how do people to decide where in, e.g., criterion to put all the INLINE annotations, etc.? How do I check I didn't horrifically break criterion's performance/accuracy?
21:36 louispan joined
21:41 <bitemyapp> orion: huh? I use git dependencies in the `stack.yaml`
21:41 <bitemyapp> I rarely have to vendor-as-in-inline-the-library
21:41 <bitemyapp> actually, never. That never happens. Git fork suffices.
21:42 <bitemyapp> merijn: I hear you, but it means you have to be aware of who's ideally situated to adopt the language and who might need to adjust their expectations and level up a bit first.
21:43 <bitemyapp> Jumping into a less developed ecosystem is a great way to mature quickly as a programmer but some people recoil at it.
21:43 govg joined
21:44 futuristic joined
21:45 Kundry_Wag joined
21:46 phaji joined
21:46 freechips joined
21:48 <nak> glguy: so say I have MyMonad (Maybe a)? is there a way to lift/convert that to MyMonadT Maybe a ?
21:48 bjz joined
21:48 <napping> Can a Parsec ByteString parser capture the slice of input that some sub-parser matched?
21:49 <glguy> nak: Only if you write one and whatever MyMonad/MyMonadT are supports that operation
21:50 magneticduck joined
21:52 <nak> ok ^^
21:52 lithie joined
21:52 hiratara joined
21:54 Faucelme_ joined
21:55 <Taren> Hey!
21:55 <Taren> This comment says "Experiments suggested that a separate top-level helper is more efficient than a local worker."https://hackage.haskell.org/package/base- any idea why?
21:55 skeuomorf joined
21:56 <Miranda> nak: Small note, MyMonad would be misnamed if you're able to define an instance for (Maybe a). `Maybe a` has the wrong kind to be a monad.
21:56 <napping> Taren: that's surprising. Do you know how old the comment is?
21:57 dni joined
21:57 <napping> I haven't tested it, but I'd expect it to compile exactly the same if that function was in a where clause
21:58 <napping> You don't have a checkout you could run 'git blame' on, do you?
21:59 govg joined
21:59 <Taren> not sure how to reblame on github https://github.com/ghc/ghc/commit/3daf0023d2dcf7caf85d61f2dc177f8e9421b2fd#diff-97ab0fb27f76ef26f95ad7052d83f4e8R437
21:59 <Taren> but older than three years
21:59 <Taren> and yeah, no checkout
21:59 jmcarthur joined
21:59 <napping> ah, and that commit looks like it's just renaming the file also
22:00 mbw joined
22:00 <napping> If they made a worker that closed over "sep" instead of taking it as an argument, maybe it could have been more expensive
22:01 <napping> I'm pretty sure a where-clause function that doesn't actually close over any variables has basically been lifted to the top for a long time
22:01 peterbec` joined
22:02 ocramz joined
22:02 <Miranda> jle`: I ended up using a Proxy. I tried to simplify it as much as I could, with `class (Foo f) where foo :: Something f` and a phantom `data Something f = Something { ... }`, but didn't like where it was headed.
22:02 takuan joined
22:03 <Miranda> jle`: I might come back to it again. Using proxy certainly feels dirty/unecessary.
22:04 Miranda left
22:04 path[l] joined
22:05 mkoenig joined
22:05 Ferdirand joined
22:05 gpampara joined
22:06 codygman_ joined
22:06 <mbw> I have a question about the following code: http://lpaste.net/354384 . In here, I tried to implement a filter function on vectors, which could possibly be parallelized. It consists of a map, a scan, and a conventional for loop. In the for loop, each element of a mutable result vector is modified only once. Is there a way to rewrite it to make it more explicit? I'm not a great fan of the "for each element of
22:06 <mbw> this iteration space, perform these side effects" kind of thing, for obvious reasons...
22:07 iqubic joined
22:07 <iqubic> Well, I finally updated to GHC 8.0.2
22:09 <iqubic> Now, what do curry and uncurry do? And are they useful?
22:10 <hpc> they translate between functions of tuples and functions of multiple arguments
22:10 <hpc> (or functions that produce functions if we're being precise)
22:10 <hpc> :t uncurry
22:10 <lambdabot> (a -> b -> c) -> (a, b) -> c
22:10 <hpc> :t curry
22:10 <lambdabot> ((a, b) -> c) -> a -> b -> c
22:10 nshepperd joined
22:10 <hpc> or if you insert parens:
22:11 <hpc> uncurry :: (a -> b -> c) -> ((a, b) -> c)
22:11 <hpc> curry :: ((a, b) -> c) -> (a -> b -> c)
22:11 dcoutts joined
22:11 <hpc> they're occasionally handy, but not that often
22:11 dawehner joined
22:11 uglyfigurine joined
22:11 <iqubic> What does that do? Unpack a tuple and shove the values into a fuction?
22:12 <hpc> curry takes a function that takes a tuple
22:12 <hpc> and produces a function that takes two arguments instead
22:12 <hpc> the implementation is that it takes two arguments, puts them in a tuple, and passes that to the function it gets
22:12 <hpc> @src curry
22:12 <lambdabot> curry f x y = f (x, y)
22:13 <hpc> uncurry does the reverse
22:13 HugoDaniel joined
22:13 <iqubic> So uncurry f (x, y) = f x y?
22:13 lyxia joined
22:13 <hpc> @src uncurry
22:13 <lambdabot> uncurry f p = f (fst p) (snd p)
22:13 <hpc> pretty much
22:13 <dfeuer> @djinn ((a, b) -> c) -> a -> b -> c
22:13 <lambdabot> f a b c = a (b, c)
22:14 <dfeuer> Those are some lousy variable names from djinn.
22:14 <hpc> as for usefulness, you'll know it when you see it
22:14 <dfeuer> @djinn (a -> b -> c) -> (a, b) -> c
22:14 <lambdabot> f a (b, c) = a b c
22:14 Koterpillar joined
22:14 <hpc> pretty much when you have an inconvenient tuple somewhere in your types, that's where curry and uncurry start to matter
22:15 sleblanc joined
22:16 <iqubic> Ah.
22:16 <iqubic> I don't see the point of tuples
22:16 ljhms joined
22:16 <hpc> it doesn't come up often
22:17 <hpc> maybe in arrow-heavy code
22:17 <iqubic> Tuples, or curry and uncurry?
22:17 <hpc> yes
22:17 <iqubic> Which one?
22:17 Luke joined
22:18 <dfeuer> Also in code using the Strong from profunctors.
22:18 <dfeuer> But you can write a version of Strong with no tuples too.
22:18 <joe9> can someone please fix the module url's for this package? https://hackage.haskell.org/package/text-generic-pretty
22:18 <iqubic> How is it wrong?
22:19 <iqubic> What's the latest version of cabal?
22:19 <dfeuer> class Profunctor p => Strong p where lensical :: (s -> a) -> (s -> b -> t) -> p a b -> p s t
22:20 <iqubic> I have a question, how does one run cabal?
22:20 <hpc> ah yes
22:20 <joe9> iqubic: Was that question for me? the modules are not hyperlinked
22:20 <hpc> the pabst functor
22:20 <iqubic> Ah.
22:20 dni joined
22:21 <iqubic> How does one run cabal? Is that a command line application?
22:21 <iqubic> Also, do I need both cabal and stack?
22:21 <iqubic> Or will just stack be enough?
22:21 <Sonolin> I think you need both
22:22 <Sonolin> I think stack is just a front for cabal + ghc
22:22 <iqubic> How do I install cabal?
22:22 <iqubic> From my command line?
22:22 <Koterpillar> if you have stack, you don't need cabal the tool
22:22 <Sonolin> *insert your package manager here*
22:22 <hpc> you'll likely want stack
22:22 <iqubic> hpc, I have stack.
22:22 <hpc> stack is a reproducible build tool
22:22 <iqubic> And not cabal.
22:23 <hpc> it manages its own versions of cabal and ghc, in order to maintain precise control over the versions of things
22:23 <iqubic> Is that fine? Too have just stack and not cabal.
22:23 <hpc> (which is part of reproducibility)
22:23 <hpc> yeah
22:23 <iqubic> Also, how do I get hoogle as a command line tool.
22:23 <mmaruseacph2> stack/cabal install hoogle?
22:23 <iqubic> I remember that I had that before I upgraded to GHC 8.0.2
22:26 <iqubic> Looks like I had to run stack setup first.
22:27 <iqubic> So, what is stack good for?
22:27 hamishmack joined
22:28 <hpc> it's a reproducible build tool
22:28 leothrix joined
22:28 <Sornaensis> stack is good for building and running things
22:28 <iqubic> What does that mean?
22:28 <hpc> you have a very high degree of control over what the state of the system doing the build is
22:28 <hpc> and given a configuration from someone else, you can reproduce their build
22:28 <hpc> it makes parts of development much easier
22:29 <iqubic> And it also let's me install an manage libraries, right?
22:29 chenyu joined
22:30 orbifx joined
22:30 <monochrom> I am skeptic about the "manage" part. But I say this not just about stack, but also cabal.
22:30 <hpc> stack is primarily a build tool
22:31 <iqubic> So how come I can do things like "stack install hoogle"?
22:31 hiratara joined
22:31 <monochrom> That's install. I didn't doubt the install part.
22:31 pwnz0r joined
22:31 zero_byte joined
22:32 <iqubic> why do you doubt the "manage" part?
22:32 <monochrom> Because stack and cabal don't provide management commands.
22:32 <iqubic> Oh.
22:33 <iqubic> Why does Hoogle take a while to install?
22:33 bjz joined
22:33 path[l] joined
22:33 <Sonolin> aren't you on Gentoo? Doesn't everything?
22:34 <Sonolin> and anyway I'm sure there's lots of dependencies since you're on a fresh install
22:35 <iqubic> sonolin, you're absolutly right.
22:36 <iqubic> Sonolin, actually what I've asked my computer to rebuild each library with GHC 8.0.2 support.
22:39 qzo joined
22:41 steshaw joined
22:42 orbifx joined
22:42 ocramz joined
22:44 nbro joined
22:45 winny left
22:46 <iqubic> What's wrong my hoogle install.
22:46 Kundry_Wag joined
22:47 <iqubic> After running any hoogle command I get the following line printed twice: "hoogle: unable to decommit memory: Invalid argument"
22:47 louispan joined
22:48 <monochrom> That's bizarre.
22:48 <monochrom> But I don't know what's wrong.
22:48 sleffy joined
22:49 <iqubic> Actually, that error only shows up sometimes.
22:50 conal joined
22:50 <geekosaur> that's the new memory manager, and presumably whether it shows up depends on how much memory and how it allocated it, such that it might or might not have a full page to decommit
22:50 <iqubic> Ah.
22:51 nbro joined
22:51 <iqubic> How can I give hoogle more memory?
22:51 <geekosaur> er?
22:51 <geekosaur> that's not the issue
22:51 <iqubic> What is the issue?
22:51 <Sornaensis> gotta set up swap
22:51 ericsagnes joined
22:51 <geekosaur> sigh
22:51 bjz joined
22:51 <iqubic> I do have swap.
22:52 <iqubic> I know that I have swap.
22:52 JeanCarloMachado joined
22:52 <geekosaur> the question is whether it was able to compact in-use memory enough to have a full page available to decommit. it's not a question fo whether you have enough memory, but how it's using the memory it has
22:52 <geekosaur> adding swap or whatever won';t affect this at all
22:53 <iqubic> So is hoogle just built incorrectly?
22:53 ubsan_ joined
22:53 <geekosaur> this is not something abouytu hoogle, it is something about the ghc runtime.
22:53 <iqubic> Is there a way to fix this issue than?
22:53 <geekosaur> I would just ignore the message, unless you want to get into debugging madvise calls
22:54 stevenxl joined
22:54 <iqubic> But it looks so ugly in my terminal.
22:54 <geekosaur> especially if it's happening just before exit since the process exiting will decommit the memory anyway
22:54 <stevenxl> hi folks. Haskell newbie here. Trying to understanding IO, but I don't understand why I am getting an error with teh following code: https://gist.github.com/StevenXL/2f88850645dfbc6313f5b9b929c19cc7
22:55 <stevenxl> The compiler says that I might need a let in a do block, which I can certainly do, but I don't understand the problem itself.
22:55 ego joined
22:55 epsilonhalbe left
22:55 <geekosaur> stevenxl, you should include the full error message
22:55 <geekosaur> but, from what I see here, my guess is you wanted == on line 23
22:56 <stevenxl> sure
22:56 <Koterpillar> stevenxl: ==
22:56 <dfeuer> Anyone have any tips and tricks for formal proofs involving binary numbers? Best practices for defining addition and the like?
22:56 <Koterpillar> stevenxl: second last line
22:56 <geekosaur> 'str = yes = main' is not valid. you probably wanted comparison, str == value
22:56 <stevenxl> ugh
22:56 <stevenxl> lol
22:56 <stevenxl> thank you geekosaur that was it!
22:56 <stevenxl> thanks Koterpillar
22:56 Robin_Jadoul joined
22:56 ebzzry joined
22:56 jdt joined
22:56 <iqubic> So is my version of GHC just borked?
22:56 safe joined
22:57 <iqubic> Is that why I'm getting weird messages when running Hoogle?
22:57 <dfeuer> geekosaur: is that something you know about, or should I ask glguy or someone?
22:57 conal joined
22:57 jdt_ joined
22:57 <geekosaur> dfeuer, I don;t know a whole lot about it, sorry
22:57 <geekosaur> iqubic, if you conider that message bad then "it's broken"
22:58 <geekosaur> the page-based memory manager is still new and there are some known glitches, most of which are just likely-unnecessary messages
22:59 <iqubic> I'll just deal with it then
22:59 <Cale> dfeuer: While I'm sure there's some way to do everything directly, it may be easiest in some cases to lift proofs about unary natural numbers.
23:00 <dfeuer> Cale: that's a non-option. My insane goal is to make proofs that run in logarithmic time :-)
23:00 <Cale> ah
23:01 <iqubic> Alright, when doing a shell escape from ghci, to run hoogle, I get no memory errors at all.
23:01 <iqubic> Wait, yes I do.
23:01 <iqubic> And I don't even get any output.
23:02 <iqubic> alright, I can run hoogle "a -> a" from command line.
23:03 peterbec` joined
23:03 alunduil joined
23:03 falconasr joined
23:04 <iqubic> Is there a way to run hoogle from inside ghci?
23:04 <iqubic> Alright, I can run hoogle from inside ghci.
23:04 <iqubic> But some things just don't work
23:05 coeus joined
23:07 <falconasr> how to auto dim brightness upon switchin to battery power?
23:07 path[l] joined
23:07 <iqubic> falconasr: This is not the right channel for that.
23:07 <dyreshark> probably by using IO
23:07 jbiesnecker joined
23:07 <falconasr> sorry can you refer the channel
23:08 <iqubic> What OS are you using?
23:08 <Koterpillar> falconasr: use the channel for your operating system, probably
23:08 peterbecich joined
23:08 <falconasr> Ubuntu 16.04
23:08 <Koterpillar> #ubuntu then
23:08 nbro joined
23:08 louispan joined
23:08 <iqubic> Alright, I got hoogle to work.
23:09 <falconasr> thanks
23:09 <iqubic> The pager memory system is still giving me lots of stupid prints, but I'll ignore those for now.
23:10 <iqubic> Is that a thing that other people are experiencing as well?
23:10 bean_jd joined
23:10 <iqubic> Or is it just me?
23:11 JoshS joined
23:11 falconasr left
23:12 <geekosaur> there are lots of variables involved including kernel version
23:12 <iqubic> Really?
23:13 Marumarsu joined
23:13 bean_jd left
23:13 <iqubic> I'm using kernel 4.4.26
23:13 <geekosaur> yes, it's using a fairly recently added kernel facility, if it's not there then it tries a fallback which can lead to spurious messages, and conceivably some early kernels with the new mechanism might have bugs
23:13 jbiesnecker joined
23:13 <geekosaur> but I don;t know when the new stuff was added exactly
23:13 fizbin joined
23:14 cpup joined
23:14 theDon_ joined
23:15 aarvar joined
23:16 eh_eff joined
23:17 JeanCarloMachado joined
23:18 sellout- joined
23:18 ericshortcut joined
23:18 markus1209 joined
23:18 nakal_ joined
23:19 markus1219 joined
23:19 stevenxl_ joined
23:22 theDon_ joined
23:22 ocramz joined
23:25 jeltsch joined
23:26 soLucien joined
23:28 <fizbin> Can someone explain to me how stack space is used up in haskell?
23:28 engil1 joined
23:29 strykerkkd joined
23:30 <fizbin> Specifically, I have a program that's blowing up from a Stack space overflow and the trace points to a function that's just a call to foldl'
23:31 <Cale> The stack will usually consist pretty much entirely of case expressions or other forms of pattern matches
23:31 <Cale> As such it's not really a call stack
23:32 <Cale> When you pattern match on some expression, before the match can proceed, that expression needs to be sufficiently evaluated to match a constructor. The case expression waits on the stack while its scrutinee is evaluated.
23:33 <Cale> The only other case is where a function application waits on the stack for the *function* to be sufficiently evaluated to apply.
23:36 a3Dman joined
23:36 <Cale> fizbin: So, *typically* the problem is that foldl or something will build up a large expression composed of strict functions (i.e. those which need to pattern match their arguments) in the accumulating parameter, and then the resulting pattern matches blow up the stack. foldl' tries to avoid this by hinting to the compiler that the accumulating parameter should be evaluated on each step, but it's only evaluated up to the point where
23:36 <Cale> the topmost data constructor can be determined
23:37 <Cale> So if you're accumulating something like a pair, that might not be enough evaluation and you may wish to add some annotations to ensure that the two components of the pair also get evaluated.
23:37 <fizbin> Hrm.
23:38 <Cale> e.g. foldl' (\(u,v) x -> u `seq` v `seq` ...)
23:38 bjz joined
23:39 bennofs joined
23:39 <Cale> fizbin: If you put your program on lpaste.net or something, I can take a quick peek. I have to work soon though.
23:39 <fizbin> Okay. Let me try making it more strict.
23:39 mib joined
23:40 <fizbin> The function having issues is (foldl' (flip G.insNode) g vs) , where "G" is Data.Graph.Inductive.Graph
23:41 <fizbin> Now, G.insNode here should be https://hackage.haskell.org/package/fgl-
23:42 <fizbin> And in theory, that's strict in various parts.
23:43 <fizbin> Though, it's not using Data.IntMap.Strict.
23:43 vektorweg1 joined
23:43 aarvar joined
23:44 cschneid_ joined
23:44 <Cale> Well, it's using insert rather than something like insertWith, so not too much to worry about htere
23:44 <Cale> there*
23:45 <Cale> Well, fastInsNode is...
23:45 <Cale> fastInsEdge is using adjust, which is a little more potentially interesting
23:46 hybrid joined
23:46 nbro joined
23:47 MP2E joined
23:47 <Jello_Raptor> hmm, I'd like some advice on how to structure an interface.
23:48 filterfish joined
23:48 <Jello_Raptor> So, I'm playing around with propagator networks, and MonadFix is a great interface for describing them.
23:48 chenyu joined
23:49 <Jello_Raptor> I can get arbitrary finite graphs out, once there's an operator to unify two values.
23:49 pwnz0r joined
23:50 Uneliasmarsu joined
23:50 <Jello_Raptor> I can also instantiate the networks lazily, so if I ever ask for a single value in the network, post quiesence, I can only actually allocate and work on the subset of the network that is capable of influencing it.
23:50 <Cale> fizbin: I think I can imagine a situation in which more and more occurrences of addLists build up as edges get inserted, if nothing has the occasion to evaluate the parts of those triples.
23:51 <Cale> fizbin: You'd have to be adding lots of edges to the same vertex -- a very large number if you're actually going to cause a stack overflow that way, and that's assuming that GHC's strictness analyser isn't catching this.
23:53 <Cale> Jello_Raptor: Functor-style FRP systems tend to use MonadFix that way as well.
23:53 <Jello_Raptor> The problem is if I want something like an infinite propagator network, my monadfix interface requires that I know, at any point, all the possible edges into a particular vertex. The issue comes when I've got any operator that results in more than one input edge to a vertex. I can't figure out a way to constrain that interface so that it is something I can instantiate lazily :/ (I can't use the default interface since I provably
23:53 <Jello_Raptor> have to know the entire graph to get multiple edges into a vertex.)
23:54 <monochrom> fizbin: It looks like you will want Data.IntMap.Strict instead.
23:54 r2t2 joined
23:54 <Cale> Well, it's really hard for me to say what's causing the stack overflow without having seen the code.
23:54 <Cale> The stack overflow might very well be unrelated to this.
23:54 <fizbin> Yeah, but that stuff is all in a third party library.
23:55 <Jello_Raptor> and there's a lot of uses for an infinte propagator network, since it lets you effectively model recursion and the like, lazy evaluation is super nice, since I can hoist any function into the network and with unsafeInterleaveIO only ever look at the vertices the function asks for :/
23:57 jbiesnecker joined
23:58 <Jello_Raptor> (yes there's some issues with deadlocks, but one can get around those)
23:59 eacameron joined