<    March 2017    >
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 24 25  
26 27 28 29 30 31
00:00 <ertes> note that rendering numbers to String and writing them to a file should be pretty fast
00:01 <Enzyme> Is it possible to return a tuple where one of the members is a function?
00:01 vishnix joined
00:01 <lyxia> :t (id, id)
00:01 <lambdabot> (a1 -> a1, a -> a)
00:01 <Koterpillar> :t (1, id)
00:01 <lambdabot> Num t => (t, a -> a)
00:02 <Enzyme> Hm?
00:02 <monochrom> The answer is yes.
00:03 <tobiasBora> dmwit: Well I though that this package would align paragraphs
00:03 <tobiasBora> like nested paragraph, or inside boxes...
00:03 <Koterpillar> > let (a, b) = (("y" ++), "es") in a b
00:03 <lambdabot> "yes"
00:03 aeroxam_ joined
00:04 <Welkin> lambdabot: will you marry me?
00:04 <Welkin> > "yes"
00:04 <lambdabot> "yes"
00:04 <Welkin> :D
00:04 <jle`> Enzyme: functions are just normal values in haskell
00:04 rekahsoft joined
00:04 zcourts joined
00:04 <jle`> so they can be used anywhere you expect any value
00:05 <jle`> you can have lists of functions, io actions that return functions, etc.
00:05 tromp joined
00:05 <Enzyme> jle`: yea, I thought it would be that easy, can't figure out how to write a type signature to say I'm returning a tuple with a function in it.
00:05 <Welkin> jle`: you got your functions in my functions!
00:06 <jle`> Enzyme: `(String, Int -> Bool)` is a tuple whose first item is a string, and whose second item is an Int -> Bool function
00:06 <Welkin> (a -> b, b)
00:06 <Enzyme> So, no generic way to say "a function"?
00:06 <dmwit> tobiasBora: In the future, if somebody suggests a package to you, I suggest you at a minimum read a bit of the documentation before discarding their suggestion.
00:06 <jle`> what do you mean, as a type?
00:07 <monochrom> How generic do you need?
00:07 <jle`> Enzyme: any X -> Y, where X and Y are types, is the type of a function
00:07 <Welkin> Enzyme: a
00:07 <Welkin> you have no idea what `a` is though
00:07 Jacoby6000 joined
00:07 <monochrom> Welkin, unlikely that more type variables will help.
00:08 halogenandtoast joined
00:08 <Enzyme> Generic in the sense of "could be 1-3 args" but all return String.
00:08 <Enzyme> And yea, it's really all just taking 1 function, and I get currying.
00:08 <Enzyme> 1 arg*
00:08 <tobiasBora> dmwit: Yes sure. In my head I though I have already meet it, but in fact I was thinking to another package meet in Ocaml world
00:09 <Koterpillar> Enzyme: maaaaybe a typeclass
00:09 <dmwit> There is not a convenient type for functions that "take 1-3 args".
00:09 <Koterpillar> Enzyme: but what are you using it for?
00:09 <jle`> Enzyme: from that perspective you're thinking about functions that can take things of different types
00:09 <jle`> but
00:09 <dmwit> I suggest you rethink your needs, given the expertise level you are projecting, and ignore people who suggest solutions.
00:09 <tobiasBora> dmwit: so yes, this Box package is indeed interesting, thank you
00:09 Rizy joined
00:09 <ertes> Enzyme: functions don't really have much of a special role in haskell
00:10 <jle`> you have to sort of think more about what you really want before you can start thinking about a type for it
00:10 <dmwit> tobiasBora: Ah, yeah, I've gotten confused across languages before, too. Easily done. =)
00:10 <ertes> Enzyme: if something can be "a type", it can also be a function type
00:10 <Enzyme> Trying to implement a way of taking an input command like "r file" or "i 3" "l 15 5" and returning a tuple with a function and a list of args.
00:10 fizbin joined
00:10 <jle`> why not take a list of commands instaed
00:11 <jle`> ["r file"] or ["i 3", "l 15 5"]
00:11 <jle`> but also why are your commands strings, heh
00:11 <monochrom> Eliminating the tuple. Apply the function to the arguments right away.
00:11 <dmwit> Why are you returning a function and a list of args? Is that more useful than just applying the function, for some reason? If so, why?
00:11 <Enzyme> I also need to get my head around the state monad.
00:12 <Enzyme> I'm trying to implement a cryptanalysis tool.
00:12 <Welkin> State monad is just a nicer way of dealing with manually passing around a state object
00:12 <Enzyme> Take a ciphertext and apply functions on the text based on input.
00:12 <jle`> sounds like function composition?
00:13 <monochrom> Do you have partially complete current code to show us?
00:13 <Enzyme> Well, like "s R s" to replace 'R' with 's', and then being able to see the result after that.
00:14 <Enzyme> monochrom: I do, might just check into a gist.
00:15 <Enzyme> Or into github
00:15 umib0zu joined
00:17 s4kashya3 joined
00:17 <Enzyme> https://github.com/ramblingenzyme/krypto
00:18 JeanCarloMachado joined
00:19 zcourts_ joined
00:19 louispan joined
00:19 <Enzyme> In Main.hs
00:20 nakal joined
00:20 <ertes> Enzyme: i'm using lenses for cryptanalysis live-coding
00:21 <ertes> Enzyme: but they are an advanced topic
00:22 <Enzyme> Neat, I'll give them a look.
00:22 Nicmavr joined
00:22 vishnix left
00:23 cpup joined
00:23 <Welkin> ertes: where is your stream?
00:26 <ertes> Welkin: there is none… you have to come to stuttgart ;)
00:27 Rotaerk joined
00:27 a3Dman joined
00:28 tomboy64 joined
00:29 strykerkkd joined
00:30 Apocalisp joined
00:31 plutoniix joined
00:31 andyhuzhill joined
00:31 dfeuer joined
00:33 justicefries left
00:34 Goplat joined
00:37 <tobiasBora> I'd like to know, let's imagine I have a class X that allow me to implement another class Y, how can I say "for all instances of X, the way that Y is implemented is ..."
00:39 <ertes> > (listFiltered isAlpha . blocks 3 . ix 0 . letter +~ 13) "Hello World!"
00:39 <lambdabot> "Uelyo Wbrlq!"
00:39 <dmwit> Enzyme: Even if you could do what you say, you can't (practically) print functions. So `putStrLn action` certainly ain't gonna work. What are you *actually* planning to do with `action`?
00:39 <ertes> Enzyme: ^ rotate every first letter in every 3-block of letters by 13
00:40 <ertes> > (blocks 3 %~ reverse) "Hello World!"
00:40 <lambdabot> "leH olroW!dl"
00:40 <ertes> reverse every 3-block of characters
00:40 <ertes> > (listFiltered isAlpha . blocks 3 %~ reverse) "Hello World!" -- reverse every 3-block of *letters*
00:40 <lambdabot> "leHWo llrod!"
00:40 <ertes> stuff like that is super-easy with lenses
00:40 <ertes> but they have a learning curve
00:41 <Koterpillar> tobiasBora: default implementations?
00:41 <pacak> tobiasBora: That is probably not a very good idea.
00:41 <pacak> ertes: More like a learning cliff.
00:41 conal joined
00:42 <pacak> tobiasBora: Once you do that - there's no way of writing instances of class Y manually
00:42 <ertes> in my live-coding i basically use a state monad with an initial text and apply more and more transformations to it
00:43 <tobiasBora> Koterpillar: Well, kind of, I'd like for example to express that all animals can be convertir as a string using their name and their age...
00:43 <dmwit> tobiasBora: http://stackoverflow.com/q/31600470/791604 possibly
00:44 snowalpaca joined
00:44 safe joined
00:44 <tobiasBora> dmwit: Does it also work when Subclass already exists (like "Show" for example)?
00:45 dfeuer joined
00:45 <ertes> > flip execState "This is a secret message." $ do zoom (blocks 3) (do ix 0 . letter += 5; ix 1 . letter += 8; ix 2 . letter += 17); blocks 4 %= reverse
00:45 <lambdabot> "xzpY xz va ryvzhajd vofj."
00:45 <dmwit> Which direction does subclass go again? Doesn't "already exist" preclude "subclass of my class"?
00:45 markus1199 joined
00:45 markus1219 joined
00:46 <ertes> Enzyme: ^ first apply vigenere with key [5, 8, 17], then reverse each 4-block
00:46 <dmwit> At any rate, no, you cannot retroactively define a default implementation for `show`.
00:46 dpren joined
00:46 <dmwit> You can, of course, define `showForAnimals :: Animal a => a -> String` and use that in the `Show` instance for any animals you cook up.
00:47 <ertes> (it's quite readable, if you have that on multiple lines and with proper layout)
00:47 <dmwit> (And for which it's appropriate, of course.)
00:47 hvn0413 joined
00:48 fizbin joined
00:48 dylukes joined
00:49 Rizy joined
00:49 serendependy joined
00:51 dawehner joined
00:51 nirvagold joined
00:52 <nirvagold> wristle
00:53 nirvagold joined
00:54 theDon_ joined
00:54 ddere joined
00:57 takle joined
00:58 peterbecich joined
01:00 path[l] joined
01:03 systadmin joined
01:07 calvertvl left
01:07 <tobiasBora> dmwit: yes that's exactly what I want, I'd like to automatiquely use the showForAnimals function in the show instance, but I don't know how to do that
01:07 gugah joined
01:08 <robkennedy> Is there a quickish way to define a function for parsing in scope functions? Ie `f :: String -> Maybe (String ->Int)` so that `f "\x -> length (show x)" <$> "foo" == Just 3`
01:08 eacameron joined
01:08 takle joined
01:09 fizbin joined
01:09 fizbin joined
01:09 nachoman joined
01:10 <dmwit> robkennedy: Take a look at the GHC API, and its spinoffs mueval and hint.
01:10 <robkennedy> Ty
01:10 NeverDie joined
01:11 plugin joined
01:14 umib0zu joined
01:15 Jeanne-Kamikaze joined
01:15 Rodya_ joined
01:16 takle joined
01:16 MarioBranco joined
01:18 peterbecich joined
01:19 augur joined
01:20 Apocalisp joined
01:20 ramzifu joined
01:26 <robkennedy> How do you interact with Text/String values which are enumerable, but do not follow Haskell casing? Right now I use Read/Show for Haskell and handspun classes like ToJSON, FromXmlAttributeValue. Is that the best we've got ATM?
01:27 tromp joined
01:28 benl23 joined
01:29 augur joined
01:30 <Welkin> ...what?
01:30 merijn joined
01:31 takle joined
01:32 JeanCarloMachado joined
01:32 systadmin joined
01:33 peterbecich joined
01:34 peterbecich joined
01:35 <jle`> what is haskell casing?
01:35 <jle`> and enumerable in what way?
01:35 peterbecich joined
01:35 chin-tastic joined
01:36 peterbecich joined
01:36 <geekosaur> I'm guessing either escaping, or they want text-icu for different collations?
01:36 <ezyang> you mean, you want a constructor that is lower case?
01:36 <geekosaur> or possibly both
01:36 <Koterpillar> my guess: you want to use Read and Show for outside interaction, don't do that
01:37 peterbecich joined
01:40 Lazersmoke joined
01:42 wtetzner joined
01:42 fizbin joined
01:46 robertkennedy joined
01:46 zv joined
01:46 takle joined
01:48 fizbin joined
01:49 halogenandtoast joined
01:49 eSVG joined
01:52 FreeBirdLjj joined
01:52 Stanley00 joined
01:52 acidjnk22 joined
01:53 <robertkennedy> You're correct: I'm embedding an XML schema, and there's a single lower case option. Is knownSymbol just the best way to play this?
01:54 <robertkennedy> I'm all for using knownSymbol if that's normal.
01:54 marcopullo joined
01:55 <robertkennedy> Enumerable like I'm reading an XML spec from NASDAQ
01:55 <lyxia> knownSymbol? Do you mean KnownSymbol as in type-level strings?
01:57 <robertkennedy> Yes
01:58 <robertkennedy> From GHC.TypeLits
01:58 fizbin joined
01:58 <lyxia> I can't imagine this being useful here.
02:01 crobbins_ joined
02:02 <robertkennedy> I'm trying to reduce memory footprints for medium datasets. I want to write functions where values which are currently `type Foo = Text` to `data Foo = Bar | Baz | somethingElse` and have ~ 2 bits in memory per item
02:02 louispan joined
02:02 TRManderson left
02:03 <monochrom> "data Foo = Bar | Baz" takes 32 bits or 64 bits. Just to surprise you more.
02:03 <robertkennedy> Don't crush my dreams :-0
02:03 <monochrom> My idea of learning is dream-crushing.
02:04 <monochrom> At any rate, Symbol is not normal.
02:04 <suzu> it takes 32 or 64?
02:04 <suzu> what decides what?
02:04 <Welkin> lol
02:04 <suzu> is this documented somewhere?
02:04 <Welkin> they are boxed values
02:04 <monochrom> Normal means you stick to Haskell 2010.
02:04 <lyxia> We sold too much of the idea that types are eraseable.
02:05 <robertkennedy> But seriously you have to be fake news'ing me. Are you saying `data Bool = True | False`, or that `data Foo = Bar | Baz` is not the same as Bool?
02:05 <monochrom> suzu: https://github.com/takenobu-hs/haskell-ghc-illustrated is a good start.
02:06 <monochrom> Bool is the same story. 32 or 64 bits.
02:06 <monochrom> My "or" is because I don't know whether you're using 32-bit GHC or 64-bit GHC.
02:07 <Welkin> monochrom: great link!
02:07 <monochrom> I could and should just say "pointer size" or "machine word".
02:07 <Welkin> robertkennedy: you can use unboxed values, but only for primitive types
02:07 <Welkin> `bool` in c++ is still 32/64-bits
02:08 takle joined
02:08 nachoman joined
02:08 Argue_ joined
02:09 <monochrom> Still, one machine word is better than "Foo", which is 6 machine words if String, 4 machine words if Text.
02:09 systadmin joined
02:10 watabou joined
02:11 anuxivm left
02:11 <robertkennedy> monochrom: are you saying `data BoolU = !True | !False` doesn't optimize such that `type Int' = (!BoolU, ... , !BoolU)` is not the same as `!Int` (with the right tuple size)?
02:11 sanett joined
02:11 <monochrom> "data BoolU = !True | !False" is a syntax error.
02:12 <monochrom> (I guess it gets optimized to 0 bits therefore?)
02:12 eazar001 joined
02:13 <monochrom> After a while, the right question to ask is "where did you get all these great ideas you currently have?!"
02:13 Rodya_ joined
02:13 <monochrom> I mean, if you wrote your own compiler, sure, I trust you that you would totally do what you said.
02:13 <monochrom> But you didn't write GHC. So, where did you hear all your great ideas from?
02:14 sanett joined
02:14 fizbin joined
02:14 <robertkennedy> Sorry, I didn't mean to impugn GHC.
02:15 juhp joined
02:15 path[l] joined
02:15 <MarcelineVQ> oh you're allowed to do that, I don't think that was his point :>
02:15 cultofmetatron joined
02:15 <monochrom> Yeah, my point is: Are you scientifically minded? Do you check evidence, or do you just presume?
02:15 sanett joined
02:16 <robertkennedy> > map GHC.Generics.to ([minBound..maxBound] :: [Bool])
02:16 <lambdabot> error:
02:16 <lambdabot> Not in scope: ‘GHC.Generics.to’
02:16 <lambdabot> No module named ‘GHC.Generics’ is imported.
02:17 louispan joined
02:18 sanett joined
02:18 infinity0_ joined
02:18 infinity0_ joined
02:19 ubsan_ joined
02:20 danthemyth joined
02:20 boccato joined
02:21 infinity0 joined
02:21 <robertkennedy> > map from ([minBound..maxBound] :: [Bool])
02:21 <lambdabot> error:
02:21 <lambdabot> • Couldn't match type ‘Bool’
02:21 <lambdabot> with ‘Control.Lens.Internal.Iso.Exchange a b a (Identit...
02:22 <robertkennedy> Well, the moral is that I got my idea from GHV
02:22 <robertkennedy> GHC
02:23 <lyxia> data Foo = Bar | Baz parse "bar" = Bar ; parse "baz" = Baz done.
02:23 infinity0 joined
02:24 takle joined
02:25 <monochrom> Presumably there is a longer input to parse. Still, any parser suffices to get you to the data constructors you want.
02:26 infinity0 joined
02:27 Rodya_ joined
02:28 fizbin joined
02:28 tromp joined
02:28 msko joined
02:29 infinity0 joined
02:29 marcopullo joined
02:30 <robertkennedy> Would be nice if I could do `type Foo = "baz" | "bar"`, but it's close. Ty.
02:31 <nshepperd> robertkennedy: if you want to store a large list of items in a memory efficient way, you probably want unboxed vectors
02:31 <nshepperd> Data.Vector.Storable supports any data type with a Storable definition, which lets you choose your own representation
02:32 <nshepperd> I think it's still minimum 1 byte per element though
02:32 infinity0 joined
02:32 <nshepperd> unless you want to do the bit packing manually
02:32 Apocalisp joined
02:33 <monochrom> It probably really has the byte-wise assumption. Because size :: a -> Int is not happy with fractions.
02:33 ADG joined
02:33 JoshS joined
02:34 <suzu> 32 bits for a bool hhhwhtf
02:35 sanett joined
02:35 takle joined
02:35 <robertkennedy> nshepperd: what is the next step up? 1 byte/element is (as monochrom noted) still OOM improvements. Do you ever break that abstraction?
02:36 Rainb joined
02:36 <robertkennedy> But seriously 64 bits for Bool sounds like fake news
02:36 justicefries joined
02:36 <lyxia> You're free to compress it when storing it but a CPU is going to be faster by handling everything uniformly.
02:37 raycoll joined
02:38 <pacak> robertkennedy: That's how it is. ghc uses lower bits of pointer to tag stuff.
02:38 Rodya_ joined
02:38 <pacak> evaluated/thunk and 1st or 2nd constructor
02:38 boccato joined
02:39 <nshepperd> (could you not use 'fake news' as a blanket term for anything that annoys you?)
02:39 boccato joined
02:40 govg joined
02:40 boccato joined
02:40 <lyxia> feel free to use "paradoxical" instead
02:41 boccato joined
02:41 <nshepperd> you can make your own vector type wrapping a plain array of bytes, and indexing manually into it with bit packing
02:42 fizbin joined
02:42 boccato joined
02:42 <nshepperd> if you just need a bitvector, you could use one of the existing implementations of that
02:42 <nshepperd> eg. the bit-vector package
02:42 alam joined
02:42 <robertkennedy> nshepperd: Meant to be read as exactly vacuously as POTUS uses it ;-)
02:43 peterbecich joined
02:43 YongJoon joined
02:44 <robertkennedy> Ty for bit-vector. Will look. But, that seems like quick the complexity to implement an efficient `inToBits`, ie
02:44 takle joined
02:44 <robertkennedy> *quite
02:45 shayan_ joined
02:45 louispan joined
02:46 <robertkennedy> *intToBits
02:46 aarvar joined
02:46 sdothum joined
02:47 <alam> http://rextester.com/GVWK23668 How come f2 is considered wrong by the compiler? :S
02:47 <nshepperd> well, maybe you don't actually want intToBits
02:48 <nshepperd> whatever that is
02:49 <Koterpillar> alam: only the part to the left of '=' is considered when pattern matching
02:49 <alam> I think f2 makes it much clearer than f1 that f2 returns a function, but for some reason it is considered wrong
02:49 <alam> is there a way to use f2's syntax such that it stays clear that it returns a function?
02:50 ljhms joined
02:50 <Koterpillar> alam: f3 0 = \y -> y; f3 x = \y -> x
02:50 <pacak> > toListOf bits (5 :: Word16)
02:50 <lambdabot> [True,False,True,False,False,False,False,False,False,False,False,False,False...
02:50 <Koterpillar> > length it
02:50 <pacak> robertkennedy: You might not need intToBits
02:50 <lambdabot> error:
02:50 <lambdabot> • Variable not in scope: it :: [a0]
02:50 <lambdabot> • Perhaps you meant one of these:
02:50 <lyxia> alam: you're pattern matching on 0 so use "case".
02:51 <alam> ah right... should've known that :P thanks! :)
02:51 <robertkennedy> nshepperd: I'm sure you could imagine `intToBits`. But I'm also willing to admit I don't know when a byte vs a bit bytes ( ;-} ) me. Do you have literature/a problem set to develop that intuition?
02:51 <lyxia> alam: what you wrote defines f2 twice, rather than a function with two clauses.
02:52 <lyxia> as for f1 being less clear that you are defining a function... we get used to it.
02:54 julienchurch joined
02:54 <lyxia> After writing lambdas for a while you figure that sometimes they're just noise.
02:54 <robertkennedy> pacak: True in the case I initially described. However, I have needed intToBits before (project Euler). Of course, generally you only would call `intToBits` once in those cases. You're right that this particular function doesn't suffer too much.
02:54 <alam> I guess if I would want to be consistent, I would also have to call f3 like: (f3 5) 6... agree?
02:55 conal joined
02:55 tom7942 joined
02:55 takle joined
02:56 <lyxia> (f3 5) 6 is the same as f3 5 6
02:56 cultofmetatron joined
02:56 FreeBirdLjj joined
02:56 <alam> yeah I know, but I mean to make it extra clear that it's a function that returns a function
02:56 <alam> maybe even (f3 5) (6) :P
02:57 <robertkennedy> Is encoding small enumerable data types minimally​ not a general problem?
02:57 <alam> but's that would be overdoing it i guess :P
02:57 emmanuel_erc joined
02:57 tokik joined
02:58 fizbin joined
02:58 leothrix joined
02:58 <lyxia> Be consistently minimal.
02:59 FreeBirdLjj joined
03:00 hucksy joined
03:00 c173 joined
03:01 takle joined
03:03 <nshepperd> robertkennedy: normally the output 'encoding' of something like 'toListOf bits :: Int32 -> [Bool]' shouldn't matter
03:03 takle_ joined
03:03 peterbec` joined
03:03 <nshepperd> you're just going to immediate consume the list anyway, and probably your whole expression will fuse together and the list will optimize away
03:03 c173 left
03:05 <nshepperd> if you only have one Int, storing its bits in a bitvector is _definitely_ pointless, because an Int already is such a bitvector
03:06 shafox joined
03:06 <alam> what would the pattern matching syntax of f4::(Int->Int)->Int->Int look like?
03:07 systadmin joined
03:07 <Koterpillar> alam: f4 a b c = ...
03:07 <Koterpillar> oh, sorry, miscounted
03:08 <Koterpillar> alam: f4 a b = ... -- possible implementation: f4 a b = a b
03:08 <alam> and with lambda's?
03:08 fizbin joined
03:08 <Koterpillar> there's nothing special about that argument type
03:09 <Koterpillar> if you already know how to pattern match in g: Int -> Int -> Int, it's the same for g': (Int -> Int) -> Int -> Int
03:10 takle joined
03:11 <alam> I'm afraid I don't fully understand how to pattern match g as well
03:11 <alam> ah never mind I figured it out :D
03:13 Unhammer joined
03:14 <okeuday_bak> control.exception try use isn't entirely clear, if I want to handle two separate types of exceptions using try, don't I need to use two try wrappers?
03:14 tomboy64 joined
03:14 <robertkennedy> nshepperd: I do see what you're saying ... but you could maybe see why something like `isPower2 = isSingleton . filter id . intToBits` seems nice in toy problems. Do you trust GHC to optimize this? I'll attempt the recommended optimizations tomorrow, I'd definitely believe they are enough.
03:15 cultofmetatron joined
03:15 mizu_no_oto joined
03:15 <lyxia> okeuday_bak: yes
03:15 <okeuday_bak> lyxia: k, thanks
03:16 {emptyset} joined
03:16 _sras_ joined
03:17 sanett joined
03:17 ajaXHorseman joined
03:18 sanett joined
03:18 jsgrant- joined
03:19 fizbin joined
03:19 <nshepperd> robertkennedy: simply due to laziness, that won't build the whole list of bits at any point. it amounts to a loop (and might even have all allocations optimized out, if these functions are good producers/consumers)
03:19 <nshepperd> robertkennedy: there's no reason to worry about memory usage here
03:19 pavonia joined
03:20 dylukes joined
03:22 xtreak joined
03:23 <nshepperd> robertkennedy: although, of course, it would be faster if you used popCount from Data.Bits, or one of those bit wizardry expressions for testing power-of-2-ness
03:23 <nshepperd> 'x .&. (x - 1) == 0' iirc
03:25 louispan joined
03:27 takle joined
03:29 e14 joined
03:31 dawehner joined
03:34 JavaSucksMan joined
03:34 takle joined
03:35 <JavaSucksMan> How can I search for instance of a class either in packages installed on my system, or in Hackage
03:36 <JavaSucksMan> errr, instance
03:36 <JavaSucksMan> damn... bad typing day... instances
03:36 <Koterpillar> hoogle?
03:37 <JavaSucksMan> I tried, but couldnt guess how
03:37 <robertkennedy> nshepperd: amazing. I thought this had the `get` and `put` API, which I've not yet understood. That memory may have been my fault. Thanks.
03:38 nomotif joined
03:38 raycoll joined
03:39 FreeBird_ joined
03:40 <JavaSucksMan> > "Lambdabot.... are you here?"
03:40 <lambdabot> "Lambdabot.... are you here?"
03:40 <JavaSucksMan> @hoogle Show
03:40 <lambdabot> Prelude class Show a
03:40 <lambdabot> module Text.Show
03:40 <lambdabot> Text.Show class Show a
03:40 <JavaSucksMan> @hoogle Show instance
03:40 <lambdabot> Agda.Interaction.BasicOps UseShowInstance :: ComputeMode
03:40 <lambdabot> Database.Groundhog.TH.CodeGen mkKeyEqShowInstances :: THEntityDef -> Q [Dec]
03:40 <lambdabot> package text-show-instances
03:40 <JavaSucksMan> Wow... Agda... Cool
03:42 exferenceBot joined
03:42 kagcc joined
03:42 <Welkin> Agda O.o
03:43 <Welkin> is Agda written in haskell?
03:43 <Welkin> yeah, it is
03:43 <Welkin> just like Idris
03:44 takle joined
03:44 <JavaSucksMan> apparently so is hoogle (or lambdabot)
03:44 <Welkin> yes, but thise are not languages
03:44 <Welkin> those*
03:44 <JavaSucksMan> err, rather hoogle uses Agda... mind mind is not so good today... I has the dumb
03:45 <Welkin> elm is written in haskell too, but unfortunately it sucks
03:45 <Welkin> too many languages are written in haskell :D
03:45 <Koterpillar> too few languages are written in haskell
03:45 <JavaSucksMan> Well, lambdabot coughed up some Agda when I tried to use it to search for instances of a class, which I still dont know how to do.
03:45 <Welkin> just search in your browser
03:46 <Koterpillar> JavaSucksMan: you searched for "show instance" and it found a matching function in an Agda *interop* library
03:46 <JavaSucksMan> I'm working on a Smalltalk written in Haskell
03:46 <Koterpillar> which class are you looking for instances of?
03:46 <lispy> JavaSucksMan: How's it going?
03:46 <Welkin> @hoogle instance Show Bool
03:46 <lambdabot> No results found
03:47 <lispy> JavaSucksMan: have you seen smallworld? https://github.com/russellallen/SmallWorld
03:47 <Koterpillar> @hoogle trace show id
03:47 <lambdabot> Debug.Trace traceShowId :: (Show a) => a -> a
03:47 <lambdabot> Debug.Trace.Compat traceShowId :: Show a => a -> a
03:47 <lambdabot> BasePrelude traceShowId :: Show a => a -> a
03:47 <JavaSucksMan> Well, I was trying to find instances of Show... for example
03:47 hexagoxel joined
03:47 <lispy> It uses some clever java stuff, but given how small it is, it might make a nice reference
03:47 <Koterpillar> JavaSucksMan: that's... most of every library
03:47 xor^ joined
03:48 conal joined
03:49 andyhuzhill joined
03:49 <JavaSucksMan> Fine... then how about instances of Monad... it doesn;t matter which class... I want to know how to search
03:49 tom7942 joined
03:49 louispan joined
03:49 FreeBirdLjj joined
03:49 <Welkin> lol
03:50 <Koterpillar> JavaSucksMan: http://stackoverflow.com/a/32975529/288201
03:50 blakeembrey joined
03:50 <JavaSucksMan> lispy: I know about Timothy Budd's Little Smalltalk... but I hadn't seen SmallWorld...
03:51 <geekosaur> not sure hoogle is up to this. I think hayoo is, or would be if it were giving me results (I seem to get a lot of missing doc pages. Not updated for newer haddock, I suspect.)
03:51 Rodya_ joined
03:51 <JavaSucksMan> maybe I did. but the unfortunate musical association blocked it from my brain
03:51 <suzu> Westworld is a better show
03:51 <suzu> ;)
03:52 tripped joined
03:53 <JavaSucksMan> lispy: I have his book... but it's in a storage locker :-(
03:56 nicknicknick joined
03:56 <JavaSucksMan> suzu: Unfortunately you can't do "Hello, World" in Westworld... only "Goodbye. World"?
03:57 <lispy> JavaSucksMan: smallworld was originally by Budd, but the github version is maintained by someone else
03:57 <JavaSucksMan> yeah... I know about it, but haven't seen Little Smalltalk since before git existed
03:58 <JavaSucksMan> Got's to get my CS books out of storage
03:59 windsing joined
04:00 FreeBird_ joined
04:01 <robertkennedy> Does `:i Show` in ghci not give what you want?
04:01 xochozomatli joined
04:02 <Koterpillar> if the right modules are loaded, I suppose
04:03 takle joined
04:04 <geekosaur> @help instances-importing
04:04 <lambdabot> instances-importing [<module> [<module> [<module...]]] <typeclass>. Fetch the instances of a typeclass, importing specified modules first.
04:04 <geekosaur> the problem being that few of the modules you'd want to check are likely to be accessible to lambdabot
04:05 suls joined
04:05 <JavaSucksMan> lispy: in Smallworld only [0..9] are unboxed... now THAT'S small
04:06 justanotheruser joined
04:07 plugin joined
04:07 kvda joined
04:08 <JavaSucksMan> yeah, after I find the module, I can verify something is an instance of a class with :i... but how do I search for what to load?
04:09 <lispy> JavaSucksMan: you might have mildly better luck with hoogle: https://www.haskell.org/hoogle/
04:09 <lispy> IIRC, it indexes a bit more than lambdabot
04:09 <Koterpillar> JavaSucksMan: did you see that SO answer?
04:09 <JavaSucksMan> I tried... don't know the syntax to do what I want
04:09 <JavaSucksMan> yeah.... I did... bummer
04:10 <JavaSucksMan> I guess there is always grep ;-)
04:10 <JavaSucksMan> @hoogle Monad
04:10 <lambdabot> Prelude class Applicative m => Monad m
04:10 <lambdabot> module Control.Monad
04:10 <lambdabot> Control.Monad class Applicative m => Monad m
04:11 <JavaSucksMan> yeah... thanks lambdabot... already knew that part.
04:12 <JavaSucksMan> afk
04:15 <_sras_> How can I add a logger monad to Servant that write to a file. Basically I want a tell function that write to a file instead of accumilating in memory.
04:20 Rainb joined
04:22 takle joined
04:23 BartAdv joined
04:24 falafel joined
04:25 tomboy64 joined
04:25 Unhammer joined
04:28 tromp joined
04:29 <jle`> _sras_: the monad-logger package is nice for that
04:29 Ranhir joined
04:31 Edith joined
04:31 <geekosaur> lambdabot's hoogle is not very useful. use the website (either of them; hoogle.haskell.org is newer but that version of hoogle is still a bit broken)
04:31 takle joined
04:32 <jle`> i wonder if neil is still working on hoogle
04:32 sanett joined
04:32 <jle`> not that i'm complaining
04:34 <geekosaur> I'm not sure if it's that, or nobody updsting hoogle.haskell.org's version, or both
04:34 <geekosaur> but as I'm not paying for either of them and they're both overloaded, also not pushing any buttons over it
04:35 <geekosaur> (devs that is)
04:35 dylukes joined
04:37 xtreak joined
04:40 <jle`> the new hoogle is just fine for me more or less
04:43 Fylwind joined
04:44 <Rotaerk> what's "the new hoogle"?
04:44 systemfault joined
04:44 tromp joined
04:46 tom7942 joined
04:47 <geekosaur> http://hoogle.haskell.org (as opposed to http://www.haskell.org/hoogle)
04:48 <geekosaur> and, iirc hoogle 5 vs. 4?
04:48 <geekosaur> (yes)
04:48 halogenandtoast joined
04:48 <geekosaur> also ndm released 5.0.9 in January, so clearly still working on it
04:49 tromp joined
04:50 bungoman_ joined
04:50 <halogenandtoast> Hello friends
04:51 FreeBirdLjj joined
04:52 <dfeuer> @tell bitemyapp If you have any questions or concerns about GHC proposals #41 or #42, please get in touch.
04:52 <lambdabot> Consider it noted.
04:52 cultofmetatron joined
04:53 felixsch_ joined
04:55 brynedwardz joined
04:58 kagcc joined
04:59 uglyfigurine joined
05:02 <okeuday_bak> is there anything you can't derive Typeable for? (ignoring undefined)
05:02 plugin joined
05:03 mexisme2 joined
05:03 carlosdagos joined
05:03 <cocreature> okeuday_bak: I don’t think so
05:03 takle joined
05:04 <okeuday_bak> cocreature: k, good
05:04 <cocreature> okeuday_bak: also you derive things for types not avalues, so undefined is not relevant here
05:04 peterbec` joined
05:04 <okeuday_bak> cocreature: k, since undefined has no type?
05:05 <cocreature> okeuday_bak: exactly the opposite "undefined" has the most polymorphic type possible
05:05 <cocreature> :t undefined
05:05 <lambdabot> a
05:05 <cocreature> it’s typeable instance depends on the type you give it
05:05 <dfeuer> @tell mpickering In your blog post about inlining and specialization, you caution users not to put INLINE pragmas on loop breakers. This doesn't seem to be very practical advice, because users don't generally know which bindings are loop breakers.
05:05 <lambdabot> Consider it noted.
05:06 <okeuday_bak> cocreature: k, thanks
05:06 mexisme joined
05:09 <qmm> what can haskell do that typical languages can't or can't do it as easily?
05:09 takle joined
05:10 {emptyset} joined
05:11 Tharbakim joined
05:14 tromp joined
05:17 <qmm> maybe this is what i am looking for: https://wiki.haskell.org/Why_Haskell_matters
05:17 takle joined
05:18 <qmm> i like this: "You could argue that Haskell has a much better form of duck typing. If a value walks and talks like a duck, then it will be considered a duck through type inference, but unlike Python the compiler will also catch errors if later on it tries to bray like a donkey!"
05:19 hamishmack joined
05:19 CurryWurst joined
05:20 connrs joined
05:20 <halogenandtoast> cocreature: my favorite revalation about `undefined` having the type a is that a could be (b -> c) or (b -> c -> d) etc.
05:21 indi_ joined
05:21 Micamo joined
05:21 ramzifu joined
05:21 CurryWurst joined
05:21 <cocreature> halogenandtoast: the power of polymorphism :)
05:21 <halogenandtoast> qmm: One thing Haskell can do that many others can't is tell you when a function has side effects just by looking at the type signature
05:21 <halogenandtoast> this is unbelievable useful
05:22 <halogenandtoast> *unbelievably
05:22 isenmann joined
05:22 <qmm> halogenandtoast: that's a great point!
05:23 <halogenandtoast> qmm: I work in ruby mostly and it's a huge pain when someone writes a function name that seems obvious, but then does something in the database.
05:23 <qmm> this is a nice answer with regards to why haskell might be ideally suited for writing compilers: https://www.quora.com/What-does-Haskell-do-better-than-other-functional-programming-multi-paradigm-languages
05:23 <halogenandtoast> Which happens way more often than it should.
05:25 takle joined
05:28 Sh4rPEYE joined
05:29 eduardm joined
05:30 <Sh4rPEYE> Hello. I found a great question and answer on SO about the Haskell progression path... According to the comments, it is probably outdated though. And the thread is locked, so the only way to update it is to edit. Would somebody here be able to do it? It contains some great info and it would be awesome if it could be used as a reliable recource...
05:30 <Sh4rPEYE> The thread in question: http://stackoverflow.com/questions/1012573/getting-started-with-haskell
05:31 ninegrid joined
05:31 <halogenandtoast> This is me being a little condescending, but I really don't think SO is a good resource for anything anymore.
05:31 <cocreature> given that I wouldn’t be able to get anything done without SO I disagree :)
05:32 <halogenandtoast> cocreature: I see some hyperbole there.
05:32 <halogenandtoast> :p
05:32 <Sh4rPEYE> Well, what resource would you reccomend?
05:32 <Sh4rPEYE> I'm just a beginner nevertheless, so SO might be just sufficient enough :D
05:32 <cocreature> halogenandtoast: sure, but it definitely saves me an awful lot of time
05:33 <halogenandtoast> Sh4rPEYE: To be honest, when I was first learning, the best resource was making friends with people who already knew Haskell.
05:33 <Axman6> well, you guys havce already found one of the best haskell resources, IRC
05:33 <cocreature> Sh4rPEYE: https://github.com/bitemyapp/learnhaskell/ is pretty good as a meta-resource
05:33 <halogenandtoast> Sh4rPEYE: But SO is an "alright" resource, it sometimes influences people to cargo cult too much, but that's more a problem with people and not SO itself per say.
05:34 <halogenandtoast> And I agree with Axman6, the irc channel is the best resource.
05:35 <halogenandtoast> The other day we spent 2 hours trying to explain function composition to someone the other day.
05:39 juliench1rch joined
05:40 <Sh4rPEYE> The problem with me is that I usually can't think of anything I want to ask... I'd rather passively read whatever I can about the topic and retrospectively find what wasn't clear to me... If that makes sense
05:42 hexagoxel joined
05:42 <halogenandtoast> Sh4rPEYE: Differnet things work for different people. I of course believe you should just find a small problem, try to solve it, and ask questions along the way.
05:43 peterbecich joined
05:43 <halogenandtoast> Solving problems this way helps with information recall
05:43 koodailar joined
05:44 aarvar joined
05:44 zcourts joined
05:45 <halogenandtoast> I find that just reading how the lowest effecting memory recall rate, unless you read it in bizarre fonts or with bizarre foreground/background colors.
05:45 <halogenandtoast> s/lowest effecting/lowest effective/
05:45 _sras_ joined
05:47 cultofmetatron joined
05:47 <Sh4rPEYE> Sure. I have a book about Haskell and I keep doing the excercises. So far I don't have problems, but I haven't yet reached monads or any other advanced topic... I'm really looking forward to that 😃 If I'll have questions then, I'll come here.
05:47 <halogenandtoast> I've forgotten the terms now, but basically the brain has two modes for dealing with information, one basically uses pattern recognition (which we use during reading) and it doesn't create a lot of new connections
05:48 <halogenandtoast> the second is when we can't use pattern recognition and it creates more connections.
05:48 g1h3s joined
05:49 electrostat joined
05:49 <g1h3s> shit
05:49 <Sh4rPEYE> One last question before I leave to school: What IRC client shuld I use on MacOS/iOS?
05:49 <halogenandtoast> Sh4rPEYE: I just use irssi in my terminal
05:49 <g1h3s> heyy
05:50 <halogenandtoast> I used to use Colloquy, but maybe no one else uses that anymore.
05:50 <systemfault> Textual is my favorite
05:50 <Sh4rPEYE> I'm not a terminal guy... Maybe it's time to change
05:51 <halogenandtoast> Sh4rPEYE: it's good for some people. I try to do as much as I can in the terminal
05:51 <halogenandtoast> but I know it's not the path for everyone
05:52 arawack joined
05:52 <_sras_> What is the best way to make sure the logs upto that point are not lost (if I am using something like Monad logger), when a thread crash (Due to a incomplete pattern or something like that)?
05:52 xtreak joined
05:52 Rainb joined
05:55 koodailar joined
05:56 Vaelatern joined
05:56 <cocreature> _sras_: what kind of logs are we talking about here? are you just writing to a file?
05:57 shafox joined
05:58 fizruk joined
05:58 elvisren joined
05:58 <_sras_> cocreature: Web application. Need to log reqeusts, route handler execution times, query execution times, and any unexpected situtations that the code comes across...
05:58 <jle`> LoggerT does streaming logging i believe, if that's what you're using
05:58 <cocreature> if you just write out your logs directly, then crashing at a later point shouldn’t cause problems.
05:58 fiddlerwoaroof joined
05:59 <cocreature> if you care about data loss if your computer crashes, you need "fsync" or something like that
05:59 <_sras_> jle`: But the thing is, I want to group logs by request. So I want some thing to collect logs until the end of the request OR the thread crashes..
05:59 <jle`> do you want to not write the log until the request is finished ...?
06:00 <cocreature> you can always throw in a `finally` that dumps the logs
06:00 <_sras_> jle`: yes. Because I want to group logs for a single request.
06:00 <jle`> by group, do you mean batch their writes?
06:00 <jle`> or like, group them on the filesystem
06:01 <_sras_> jle`: I want logs for a certain request as a single block, and not interleaved with logs from other requests....
06:01 Sgeo joined
06:01 <jle`> ah so one big log stream, but for all of the log outputs from a single request to come all at once instead of being interleaved
06:02 <_sras_> jle`: Yes
06:03 codesoup joined
06:04 carlosdagos joined
06:05 elvisren joined
06:06 dec0n joined
06:08 <halogenandtoast> Why not just interleave them and write a program to parse them later on?
06:08 dan_f_ joined
06:09 plutoniix joined
06:09 <_sras_> halogenandtoast: That would require some kind of id to link all those logs, right?
06:09 dminuoso joined
06:09 certainty joined
06:10 plutoniix joined
06:10 <_sras_> halogenandtoast: and would certainly be a pain, if you want to grep through the logs...
06:10 marcopullo joined
06:11 <jle`> hm, it looks like monad-logger comes built-in with a logger that writes to a different thread
06:11 <jle`> so you could have a thread that processes incoming requests and batches their writes
06:11 plutoniix joined
06:12 <jle`> oh actually it lets you be pretty flexible with your logging
06:12 <jle`> all you have to do is provide a callback on what to do with each log item emitted
06:12 Rainb joined
06:13 Wizek joined
06:13 <jle`> monad-logger's LoggerT doesn't do any accumulation of logs, so it doesn't really "lose" logs in the sense that you mentioned earlier
06:13 <_sras_> jle`: Sounds great.
06:13 plutoniix joined
06:14 <_sras_> jle`: this one right? https://hackage.haskell.org/package/monad-logger-0.3.21/docs/Control-Monad-Logger.html
06:14 <jle`> yes
06:14 <jle`> if you want, you can spawn a thread that waits on a Chan, and accumulates the input until it gets some signal that it's ready to write
06:14 <jle`> and have your logging callback write to that Chan
06:15 plutoniix joined
06:15 <jle`> and maybe use 'finally' or osmething to trigger a dump if the request thread crashes
06:16 <jle`> not sure how easy it is to integrate into your web framework though
06:16 plutoniix joined
06:17 skeuomorf joined
06:18 plutoniix joined
06:18 cfricke joined
06:19 Rainb joined
06:19 <_sras_> jle`: What all kind of erros can be caught at run time. Can a fromJust Nothing or a Non exhaustive pattern match be caught?
06:21 uglyfigurine joined
06:22 <jle`> if you use 'bracket', then you can have something be run no matter if the thread crashed or completed succesfully
06:22 <jle`> but yes you can catch those exceptions in IO
06:23 <jle`> i recommend reading simon marlow's chapter about exceptions in haskell, in the free online book Parallell and Concurrent Programming in Haskell
06:23 <jle`> there is http://hackage.haskell.org/package/base-4.9.1.0/docs/Control-Exception.html if you want a quick API reference too
06:23 takle joined
06:24 Rainb joined
06:24 <jle`> 'bracket' might be useful; the resource acquisition would be spawning the new thread and Chan, the resource releasing would be flushing the thread's accumulated logs, and the bracked action would be whatever you want to execute w/ logging
06:24 dan_f joined
06:24 <jle`> but this workflow would require a separate 'runLoggerT' on every request
06:25 <jle`> so logging wouldn't be "global", it'd be something that was spun up from scratch on every request
06:25 <jle`> it feels a bit weird to me but it might be the simplest way to batch logs like you want
06:26 <jle`> i feel like having the logs all interleaved, with unique id's, isn't too bad, but
06:27 <_sras_> jle`: Yes.
06:27 <_sras_> jle`: But how will you grep through an interleaved logs, how will you see the context for a certain log item?
06:28 <jle`> it depends on what you're looking for
06:28 <jle`> but you can grep by id
06:28 <_sras_> jle`: Yes..it is possible.
06:29 Rainb joined
06:29 <jle`> what would be the work flow if you had them batched...?
06:29 <jle`> just scroll up and down?
06:29 takle joined
06:30 <jle`> grep -n20, instead of grep {id} ?
06:31 <_sras_> jle`: yes.
06:31 Rainb joined
06:33 <cocreature> you can always write your logs to a database instead of to a file and then you can nicely query by id :)
06:33 pera joined
06:33 danvet joined
06:35 <_sras_> cocreature: Yes. that is another option. But appending to a file might be a lot faster, right?
06:35 <davean> _sras_: or a lot slower
06:35 <cocreature> depends
06:35 <cocreature> but is logging performance really the bottleneck in your application?
06:35 infinity0 joined
06:37 <_sras_> cocreature: no. Because there is no application yet. In the process of building it. I am just trying to make sensible choices....
06:37 <cocreature> _sras_: I would expect that a database is more than fast enough (and as davean mentioned can even be faster) for almost all logging usecases
06:37 takle joined
06:38 <jle`> what's that quote again? premature optimization is the root of all something something
06:38 <cocreature> evil :)
06:38 <ezyang> a pinch of prevention is worth a pound of cure
06:39 <cocreature> I’m not a big fan of that quote however. people tend to use it as an excuse to write slow code :)
06:39 <_sras_> jle`: Yes. But don't want to be too reckless..there is also a quote about having everything in moderation...
06:39 mgu joined
06:39 sanett joined
06:39 <ezyang> the moral of premature optimization is not that early optimization is bad (it's really the only way to get things fast) but that usually you don't actually need it fast
06:41 <cocreature> in the end it’s a tradeoff: do the benefits of having fast code outweigh the costs of making it fast?
06:41 <jle`> yeah; you end up optimizing something that is like 0.001% of your actual execution time, down to 0.0009%
06:41 Rainb joined
06:41 iomonad joined
06:42 <davean> or you make your program slower by optimizing one piece, moving complexity to places that can less afford it <-- seen that one a fair bit
06:42 <pacak> jle`: That's what I'm doing right now btw. Maybe a bit more than 0.001% and to make it slightly more faster. In some situations it makes perfect sense to do that.
06:42 <jle`> or you can make your program slower by taking two months to write it instead of two weeks
06:42 <jle`> a program you can run is faster than an incomplete program
06:43 <ezyang> as with all life matters, Wisdom and Courage
06:43 <davean> jle`: I don't know about that, I have some VERY fast incomplete programs. Not doing the calculations does amazing things for execution time.
06:43 <ezyang> "http://groups.csail.mit.edu/cag/codeperf/"
06:44 <jle`> ezyang: touche
06:45 <jle`> in this specific case, writing an entire multi-threaded abstraction system for logging is probably not worth any plausible difference in execution time over using a database
06:45 skeet70_ joined
06:46 <davean> jle`: well, then clearly its the thing to do.
06:46 <davean> jle`: its always the most fun to work on the things that matter the least
06:46 sanett joined
06:46 Bashmetim joined
06:46 takle joined
06:47 <jle`> i cannot think of a reasonable argument against that
06:47 orion joined
06:47 orion joined
06:48 meandi_2 joined
06:48 <ezyang> TBF, it's pretty easy to setup a logging thread
06:48 Rainb joined
06:50 ThomasLocke joined
06:50 ThomasLocke joined
06:50 RayNbow`TU joined
06:51 plugin joined
06:56 Rizy joined
06:56 Rainb joined
06:57 featherlessbiped joined
06:58 falafel joined
06:59 aib joined
07:00 liangzan joined
07:02 Rainb joined
07:02 mexisme2 joined
07:02 featherlessbiped joined
07:03 takle joined
07:04 ogrady joined
07:04 carlosdagos joined
07:05 <liangzan> sorry, i’ve hit a wall in haskell
07:05 <liangzan> http://lpaste.net/353765
07:05 <liangzan> i’m using mysql-simple. but i can’t get a query function to compile
07:05 peterbec` joined
07:05 <liangzan> any idea what i should do?
07:06 <jle`> liangzan: it looks like you need to specify what type you want
07:06 <jle`> there's really no way to infer, from the code you wrote
07:06 ali_bush joined
07:06 ali_bush joined
07:06 <liangzan> yup, but how?
07:06 <jle`> you can add a type annotatio somewhere, maybe
07:06 <jle`> what should the type of xs be?
07:07 <liangzan> it should be a list of tuples
07:07 <jle`> tuples of what
07:07 <liangzan> a 54 arg tuple
07:07 <liangzan> with strings, ints, etc
07:07 <jle`> do you know what the type of the thing you want is
07:07 Sampuka joined
07:07 <jle`> then you can provide an annotation
07:07 <liangzan> i just hope to match for empty lists
07:07 <jle`> case xs :: [(Int, Bool)] of ...
07:08 <liangzan> ah har
07:08 <liangzan> but i have a 54 arg tuple
07:08 <jle`> why in the world do you have a 54-tuple lol
07:08 <liangzan> well, its a select sql statement
07:08 <jle`> try selecting less things
07:08 <jle`> well, i'm not really sure how mysql-simple works exactly
07:09 <liangzan> alright, thanks jie`!
07:09 <pavonia> If you only want to check foe empty results, you can just select the ID
07:09 <liangzan> i don’t want to touch the sql if need be
07:09 zaquest joined
07:10 <liste> :t (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) -- 54 is almost pushing the limits anyway
07:10 <lambdabot> error:
07:10 <lambdabot> A 96-tuple is too large for GHC
07:10 <lambdabot> (max size is 62)
07:10 raichoo joined
07:10 osa1 joined
07:10 osa1 joined
07:11 watabou joined
07:11 nomotif joined
07:11 mexisme joined
07:12 dawehner joined
07:12 xdfreak22 joined
07:13 <xdfreak22> hey
07:13 <xdfreak22> anyone home
07:13 doomlord joined
07:13 <jle`> liangzan: it looks like the library needs to know what types you want, because the types you expect determine how it parses the result
07:14 <xdfreak22> whats up
07:14 <jle`> liangzan: but, i wonder if you can just expect [()]
07:14 <xdfreak22> anyone use freebsd?
07:14 <liangzan> let me try
07:14 <jle`> xdfreak22: if your question is related to haskell, just ask it :)
07:14 doomlord joined
07:14 <oz3n> this is my first time on an irc chat
07:15 <oz3n> well my first time on irc
07:15 <oz3n> I just wanted to try it out.
07:15 <jle`> welcome :)
07:15 Mortomes|Work joined
07:15 <oz3n> thanks
07:15 <jle`> if you have a question about haskell or want to discuss it you can ask here
07:15 doomlord joined
07:15 <jle`> but if your question is about freebsd, you might want to ask in a more relevant channel
07:15 <oz3n> If anyone knows anything about freebsd
07:15 <oz3n> such as?
07:16 <jle`> like #freebsd
07:16 <oz3n> What do u typically discuss in haskell?
07:16 tromp joined
07:16 <oz3n> thanks
07:16 doomlord joined
07:16 <jle`> um people ask questions about their haskell programs, or discuss things about haskell the programming language
07:16 <oz3n> oh okay
07:16 <jle`> like current events or connecting with other programms and fun stuff like that :)
07:16 xtreak joined
07:17 <jle`> *programmers
07:17 FreeBirdLjj joined
07:17 doomlord joined
07:17 <oz3n> In that case, your thoughts on Trump/
07:17 <oz3n> ?
07:17 kylefang joined
07:17 <jle`> that would probably be a clear-cut off-topic
07:17 <oz3n> okay
07:17 <kylefang> hey guys, quick question. how can I make something like this point free? `\x -> x ++ ".md"`
07:17 <jle`> i meant current events about haskell, heh
07:17 <oz3n> ill try another channel
07:18 <oz3n> thanks
07:18 <jle`> kylefang: (++".md") would be the direct translation
07:18 <pacak> > (++".md") "foo"
07:18 <lambdabot> "foo.md"
07:18 eduardm joined
07:18 <jle`> but if you're working with a filepath then you can use (<.> "md") as well, from the filepath library
07:18 mda1 joined
07:18 <kylefang> jle`: awesome,.. thanks
07:19 JagaJaga joined
07:19 <jle`> no problem
07:19 <jle`> for the record there's @pl if you want to try it out in private chat with lambdabot
07:19 <jle`> @pl \x -> x ++ ".md"
07:19 <lambdabot> (++ ".md")
07:20 dfeuer joined
07:20 <kylefang> wow
07:20 <kylefang> that's amazing, thanks @jle`
07:20 connrs joined
07:20 <jle`> np!
07:21 sanett joined
07:21 Yuras joined
07:21 <jle`> but yeah, if you're working with filepaths, it's nice to work with them abstractly instead of as strings, because of differences in posix/windows, normalization, etc.
07:22 ner0x652 joined
07:22 <jle`> <.> has some extra logic to make sure that the result makes sense
07:22 <liangzan> @jie` xs :: [Char] works
07:22 <lambdabot> Unknown command, try @list
07:23 <jle`> liangzan: nice :)
07:23 <liangzan> but its not representing the actual type. but i only want to match empty lists, so...
07:23 <jle`> i'm not sure what sort of behavior mysql-simple defines for that
07:23 <jle`> you should probably check the result to make sure it does what you want
07:23 <liangzan> Char for 54-tuple for now
07:23 <liangzan> yup
07:23 <jle`> does it return a string representation of the 54-tuple?
07:24 <jle`> fun stuff
07:24 freusque joined
07:24 <JavaSucksMan> what was that @pl thing... it looked cool
07:24 <boxscape> JavaSucksMan: returns a version of the code you give it without variables
07:24 <jle`> it's called pointless; it tries its best to make functions point-free
07:25 <JavaSucksMan> cool... let me try
07:25 <jle`> @pl \xs -> foldr (+) 0 xs
07:25 <lambdabot> foldr (+) 0
07:25 <jle`> so you can rewrite the function without having to name any variables
07:25 <boxscape> @pl \x y z -> z y x
07:25 <lambdabot> flip (flip . flip id)
07:25 takuan joined
07:25 <jle`> it's called pointless because usually the results are unusable
07:26 <jle`> but in rare occasions the result might be more readable than the original
07:27 <kylefang> jle`: hahhah, but for it's really useful for learning the syntax.
07:27 <JavaSucksMan> @pl \stuff = foldr (&&) True $ zipWith (<) stuff (tail stuff)
07:27 <lambdabot> (line 1, column 8):
07:27 <lambdabot> unexpected "="
07:27 <lambdabot> expecting operator, pattern or "->"
07:27 <boxscape> there's also unpl
07:27 <boxscape> @unpl flip (flip . flip id)
07:27 <lambdabot> (\ x y y0 -> y0 y x)
07:27 <JavaSucksMan> @pl \stuff -> foldr (&&) True $ zipWith (<) stuff (tail stuff)
07:27 <lambdabot> foldr (&&) True . ap (zipWith (<)) tail
07:27 <jle`> for personal usage you can use it in a private query with lambdabot, using /msg lambdabot @pl blah
07:27 kritzcreek_ joined
07:27 <boxscape> (I'd recommend /query instead of /msg)
07:28 ragepandemic joined
07:28 <jle`> oh, i yes, i meant that, sorry
07:28 <kylefang> boxscape: how so?
07:29 <boxscape> kylefang: I prefer to have the conversation open in an extra tab, which query does with all irc clients I know, but msg doesn't (at least not with all clients)
07:30 <kylefang> boxscape: got it. :)
07:31 alfredo joined
07:31 sanett joined
07:32 <JavaSucksMan> yeah.. the point-free version looks more like a puzzle unless it's trivial
07:32 quchen joined
07:33 <JavaSucksMan> @unpl foldr (&&) True . ap (zipWith (<)) tail
07:33 <lambdabot> (\ x -> foldr (&&) True ((zipWith (<) >>= \ x1 -> tail >>= \ x2 -> return (x1 x2)) x))
07:33 <JavaSucksMan> hmm round-trip with pl and unpl is even worse ;-)
07:33 <jle`> @. unpl pl \stuff -> foldr (&&) True $ zipWith (<) stuff (tail stuff)
07:33 <lambdabot> (\ x -> foldr (&&) True ((zipWith (<) >>= \ x1 -> tail >>= \ x2 -> return (x1 x2)) x))
07:34 razi1 joined
07:34 <jle`> @. pl unpl foldr (+) 0 . map (*2)
07:34 <lambdabot> foldr (+) 0 . map (2 *)
07:35 louispan joined
07:35 <JavaSucksMan> yeah... that's trivial... try a function that uses it's parameter twice.
07:35 <jle`> usually (pl . unpl) is close to id, heh
07:35 <jle`> but in this case pl thought it was ok to rewrite (*2) as (2*)
07:35 sanett joined
07:36 <jle`> @. pl unpl foldr (&&) True . ap (zipWith (<)) tail
07:36 <lambdabot> foldr (&&) True . ((tail >>=) . (return .) =<< zipWith (<))
07:36 <jle`> welp so much for 'pl . unpl' being id
07:36 <JavaSucksMan> @pl \stuff -> foldr (&&) True $ zipWith (<) stuff (tail stuff) -- isSorted
07:36 <lambdabot> foldr (&&) True . ap (zipWith (<)) tail
07:37 piyush-kurur left
07:37 <boxscape> isn't foldr (&&) True just and?
07:37 <jle`> yes pl isn't too intelligent, it mostly does text subsitutions
07:37 <JavaSucksMan> :t and
07:37 <lambdabot> Foldable t => t Bool -> Bool
07:38 <JavaSucksMan> yeah... I'm a Haskell noob
07:38 halogenandtoast joined
07:38 <boxscape> You pick those library functions up over time :)
07:38 buoto joined
07:39 <JavaSucksMan> I'm starting to put '--' comments into my bash scripts.... I hate switching languages
07:40 <boxscape> that's what commenting plugins in editors are for :P
07:42 <halogenandtoast> Let's say I wanted to test this function shuffleDeck :: RandomGen gen => gen -> State Deck ()
07:43 <halogenandtoast> What would be the best way to do that?
07:43 mikeplus64 joined
07:43 mikeplus64 joined
07:43 <jle`> you can write property tests with quickcheck
07:43 <jle`> or do you mean like test interactively
07:43 <halogenandtoast> with something like quickcheck
07:43 <halogenandtoast> I'm not sure what I'd be testing for though
07:43 <jle`> you'd have to think of properties
07:44 <jle`> like, the size of the starting deck is equal to the size of the ending deck
07:44 Scip__ joined
07:44 <jle`> quickcheck will generate random decks and gens to test it with
07:44 <jle`> it also might be easier to unroll 'State Deck ()' into 'Deck -> Deck'
07:45 <jle`> but that's just execState :: State Deck () -> (Deck -> Deck) anyway
07:45 guiben joined
07:46 <jle`> imo 'State s ()' isn't a very useful way to offer an (s -> s), but i guess it depends on context
07:47 <halogenandtoast> I do that because of this
07:47 <halogenandtoast> ((hand1, hand2), deck) = flip runState initialDeck $ do
07:47 <halogenandtoast> shuffleDeck gen
07:47 <halogenandtoast> (,) <$> draw 7 <*> draw 7
07:48 <halogenandtoast> There might be a better way to do that.
07:48 <jle`> yeah, but you can convert a (Deck -> Deck) into a State Deck () pretty easily
07:48 <jle`> using modify :: (Deck -> Deck) -> State Deck ()
07:48 cultofmetatron joined
07:48 <halogenandtoast> Hmmm
07:48 <jle`> not a big deal though in the grand scheme of things
07:48 <halogenandtoast> I will try this out
07:49 <jle`> but haskell is pretty good at working with normal functions
07:49 <jle`> and it's easy to unwrap/wrap it into State if you need it
07:49 <jle`> if you're going to write a property test, you're going to be writing it on the unwrapped (Deck -> Deck) anyway
07:49 sanett_ joined
07:49 _sg joined
07:50 <jle`> (not a big deal, just a style thing. if you use the wrapped version more than the unwrapped one then there isn't anything wrong with exposing the wrapped version normally)
07:50 <halogenandtoast> jle`: Ah yeah it works, that is awesome
07:50 <halogenandtoast> did not know about modify
07:50 <halogenandtoast> just now learning how to use the State monad
07:50 <jle`> yup, modify is the inverse of execState in that they wrap/unwrap (s -> s)'s from State
07:51 <halogenandtoast> I originally didn't want to put that function in the state monad but didn't know about modify
07:51 <jle`> my general style is to leave things as unwrapped normal functions by default and wrap them/lift them at the usage site
07:52 <halogenandtoast> would you have draw as unwrapped?
07:52 guiben joined
07:52 <jle`> it also depends on how often you'd use draw in the unwrapped form
07:52 <jle`> in this case it looks like it's more useful as State Deck Card
07:53 <jle`> because how often do you want to use an explicit Deck -> (Card, Deck)
07:53 <halogenandtoast> Yeah I don't think I'll ever use it unwrapped
07:53 freusque joined
07:53 sanett joined
07:54 louispan joined
07:54 <jle`> but, it's good to be familiar with the transformation, and recognizing that the two representations are the same
07:54 raichoo joined
07:54 <halogenandtoast> Right
07:54 <jle`> modify (f . g) = modify g >> modify f
07:55 <jle`> which makes modify structure-preserving with respect to function composition
07:56 <halogenandtoast> thanks for the help jle` definitely added a new tool to my toolbox today
07:56 <jle`> no problem!
07:57 eduardm joined
07:57 freusque joined
07:59 thc202 joined
08:00 <halogenandtoast> I had a function I wanted to try to oneline, but I now wonder if maybe there is a better way? draw c = get >>= liftM2 (>>) (put . drop c) (return . take c)
08:00 <jle`> lol yes do not one-line that
08:01 <jle`> hm
08:01 <halogenandtoast> lol okay originally it was deck <- get; put $ drop c deck; return $ take c deck
08:01 <halogenandtoast> but on three lines
08:01 <jle`> draw c = state $ \d -> (take c d, drop c d)
08:01 <halogenandtoast> and the structure seemed so simple I thought I could one line it.
08:01 <jle`> you can think of 'state' as "modify + return"
08:01 <jle`> state lets you modify but also give a return value at the same time
08:02 bjz joined
08:02 <halogenandtoast> jle`: Awesome
08:02 <halogenandtoast> I don't like hlints suggestion for that though: Use &&& Found: \ d -> (take c d, drop c d) Why not: (take c Control.Arrow.&&& drop c)
08:03 <jle`> but the three line version is fine too
08:03 <jle`> yeah, i'm not too big of a fan with that
08:03 <ClaudiusMaximus> hlint should suggest splitAt instead!
08:04 takle joined
08:04 <jle`> &&&/*** makes the most sense when you're doing tuple manipulation (if at all), which doesn't really describe what's going on here
08:04 <halogenandtoast> splitAt is definitely the right way to go
08:04 xsrpmx joined
08:05 <halogenandtoast> ClaudiusMaximus: Thanks!
08:05 <halogenandtoast> Now it has become: draw c = state $ splitAt c
08:05 carlosdagos joined
08:05 <jle`> cute :)
08:05 <halogenandtoast> or just draw = state . splitAt
08:05 <jle`> now just think about which one will be easier for you to understand when you look at the code again in a month
08:06 xplat joined
08:06 <halogenandtoast> jle`: Sure, but I think the method name plus type signature give it away
08:06 <halogenandtoast> *function
08:06 ccomb joined
08:06 MoALTz joined
08:07 <halogenandtoast> I consider that one of Haskell's super powers
08:07 <jle`> s/understand/understand enough to modify
08:07 <halogenandtoast> jle`: True, I'm hoping it's so simple now that I never have to modify it (in this situation)
08:08 <halogenandtoast> But ideally all of my functions would be so small and as to do only one thing (when possible) that they won't often change
08:08 <jle`> fair, but yeah, it's always a tradeoff
08:08 <halogenandtoast> right now `state . splitAt` is pretty easy for me to understand and I can read it almost instantly
08:09 <halogenandtoast> I'll let you know in two weeks
08:09 <halogenandtoast> err 1 month
08:09 magneticduck joined
08:09 yellowj joined
08:09 <jle`> i'm rooting for you, of course :)
08:09 systadmin joined
08:09 <jle`> i just always try to program to a future me who is a little less inteligent than i am
08:09 uglyfigurine joined
08:10 <halogenandtoast> ha ha ha thanks jle` I definitely won't inline everything because at some point you fail to express what is happening
08:11 <halogenandtoast> Usually if I need `ap` of `liftM2` and friends I consider it not worth it
08:11 <halogenandtoast> s/of/or/
08:11 <halogenandtoast> because those don't translate to anything for me.
08:11 C-16 joined
08:12 FreeBirdLjj joined
08:13 hvn0413 joined
08:14 <halogenandtoast> I'm also on the fence for things like this: handFor = (playerHand .) . getPlayer
08:14 <halogenandtoast> Not sure if double dots are worth it to be point free
08:15 <halogenandtoast> type signature for that: getPlayer :: PlayerNumber -> GameState -> Player
08:15 <halogenandtoast> err
08:15 <halogenandtoast> handFor :: PlayerNumber -> GameState -> Hand
08:15 <jle`> i don't think anyone finds that more readable than handFor p = playerHand . getPlayer p
08:15 dfeuer joined
08:15 <jle`> or handFor p s = playerHand (getPlayer p s) even
08:16 <halogenandtoast> why not handFor p s = playerHand $ getPlayer p s
08:16 <jle`> some people introduce an operator f .: g = \x y -> f (g x y), so you could write it as handFor = playerHand .: getPlayer
08:17 <jle`> i don't think it's really worth it myself, heh, but .: is ubiquitous enough i suppose
08:17 <halogenandtoast> jle`: and if I have 3 arguments? .:⋮
08:18 <halogenandtoast> I haven't seen or used .: yet
08:18 <JavaSucksMan> when I'm in a bottom-up mood, I define ($$) = flip ($)
08:18 marcopullo joined
08:18 <jle`> JavaSucksMan: you're in luck, flip ($) is now in base
08:18 <jle`> as of ghc 7.10 or something
08:18 <JavaSucksMan> as what?
08:18 <jle`> (&)
08:19 <jle`> in Data.Function
08:19 <JavaSucksMan> great, now im going to get & and && confused (try reading that aloud)
08:20 <jle`> i wouldn't mind a flip fmap, like <&>, but i think there are some issues with picking the fixity, because a lot of libraries separately define <&> with mutually incompatible fixities
08:20 <JavaSucksMan> I think I saw the (&) in some code and wrote it off as one of those monad/arrow confusing operators im not yet ready for
08:20 <jle`> just mostly for the same reasin that 'for'/'forM' was useful
08:20 <halogenandtoast> JavaSucksMan: I've learned a long time ago to read "&&" as "boolean and"
08:22 <JavaSucksMan> my roommate has a weird one-sylable way of reading all of the ascii symbols... >>= is rang rang eek
08:23 detrumi joined
08:23 <halogenandtoast> rang for right angle? so I assume < is lang?
08:24 carlosdagos joined
08:24 louispan joined
08:24 <quchen> »>>« is pronounced »bi«, and »=« is pronounced »nd«.
08:24 <Unhammer> JavaSucksMan, is it this guy https://www.youtube.com/watch?v=8SkdfdXWYaI ?
08:25 watabou joined
08:25 <JavaSucksMan> yup... im too tired to dig out his whole glossary, and he's in argentina now
08:26 <JavaSucksMan> No... but I LOVE that talk! seen (or heard) it many times
08:26 <liste> quchen: strangely enough, the symbol for "ND" (no derivatives) in CC licensing is =: https://creativecommons.org/licenses/by-nd/3.0/
08:26 <quchen> Hah!
08:27 <JavaSucksMan> It's the guy who did patch-tag.... a no longer existing darcsden competitor
08:27 markus1189 joined
08:27 <Unhammer> mm, made me want to try too (but my hands got better after starting to use a real desk + chair + external monitor and working at an office with people who have lunch away from the computer)
08:28 grumble joined
08:29 <JavaSucksMan> Yeah... your chair is the most important piece of computer equipment you'll ever buy.
08:30 <JavaSucksMan> I'm actually working on a gestural programming language loosely inspired by ASL, and vastly inspired by that talk
08:30 <JavaSucksMan> or maybe its the other way around ;-)
08:30 <Unhammer> uhm
08:31 <Unhammer> sign language is cool and all, but there's a difference between signing as much as you talk, and signing as much as you code
08:32 mattyw joined
08:32 <Unhammer> https://eric.ed.gov/?id=EJ447185
08:33 <JavaSucksMan> Well I can't code as fast as I talk in either English or ASL, so I'm not sure if that's relevant
08:33 kolko joined
08:34 hvr joined
08:34 hvr joined
08:34 biglama joined
08:36 peterbec` joined
08:39 plugin joined
08:40 hvr joined
08:40 hvr joined
08:41 connrs joined
08:44 ragepandemic joined
08:46 Mortomes|Work_ joined
08:46 ramzifu joined
08:46 pylbrecht joined
08:48 tinkyholloway joined
08:48 <dmj`> JavaSucksMan: nice nick
08:48 connrs joined
08:49 <halogenandtoast> Are these different in any way (aside from syntax): liftM2 (+) (Just 1) Nothing and (+) <$> Just 1 <*> Nothing
08:49 cheesy joined
08:51 <dmj`> @src liftA
08:51 <lambdabot> liftA f a = pure f <*> a
08:51 <dmj`> @src liftA2
08:51 <lambdabot> liftA2 f a b = f <$> a <*> b
08:51 kagcc joined
08:51 mfukar joined
08:51 <halogenandtoast> so no
08:51 <dmj`> @src liftM2
08:51 <lambdabot> liftM2 f m1 m2 = do
08:51 <lambdabot> x1 <- m1
08:51 <lambdabot> x2 <- m2
08:51 <lambdabot> return (f x1 x2)
08:52 <dmj`> they’re equivalent, and liftM2 can probably be abolished, but it would break a lot of things
08:52 przembot joined
08:52 <halogenandtoast> Hmm the source of liftM2 makes no sense to me
08:53 <halogenandtoast> I can't see how (+) <$> Just 1 <*> Nothing would work
08:53 <halogenandtoast> x2 <- Nothing ??
08:53 <Cale> Yeah...
08:53 <Cale> That will result in the entire do-block becoming Nothing
08:53 <Cale> Nothing >>= f = Nothing
08:53 <Cale> Just x >>= f = f x
08:53 <dmj`> halogenandtoast: think of what it would look like unsugared
08:54 <halogenandtoast> OH
08:54 <halogenandtoast> herp derp
08:54 <dmj`> > do { x <- Just 1; y <- Nothing; pure (x + y) }
08:54 <lambdabot> Nothing
08:56 plugin joined
08:56 sanett joined
08:58 coot joined
08:59 <dmj`> halogenandtoast: I do think Maybe and Either are monads that often get neglected when it comes to monadic syntax, easier to resort to pattern matching.
09:00 przembot joined
09:00 <halogenandtoast> Yeah I could see that, I'll try to do my part to use them monadically.
09:00 buoto joined
09:00 <Cale> Well, using their Monad instance means throwing away information about what thing failed.
09:01 <Cale> Often you want to handle different failures differently.
09:01 <Cale> But when you don't care, it's rather nice.
09:01 louispan joined
09:02 dawehner joined
09:03 <dmj`> Yea, that’s a very good point.
09:03 <dmj`> > do { r1 <- lookup “foo” []; r2 <- lookup “bar” []; pure (r1, r2); }
09:03 <lambdabot> <hint>:1:19: error: lexical error at character '\8220'
09:04 <barrucadu> Those are some fancy quotes
09:04 jhrcek joined
09:04 coot_ joined
09:05 <dmj`> heh, this IRC client is a little too fancy
09:05 <dmj`> > do { r1 <- lookup "foo" []; r2 <- lookup "bar" []; pure (r1, r2) }
09:05 <lambdabot> Nothing
09:05 Guest73682 left
09:08 av joined
09:08 sanett joined
09:09 <halogenandtoast> If I wanted to make takeTurn :: PlayerNumber -> GameState -> IO GameState
09:09 ramzifu joined
09:09 <halogenandtoast> use the state monad what would the last type be
09:09 <halogenandtoast> Playerumber -> IO (State GameState ()) ?
09:10 <lpaste_> av pasted “type woes” at http://lpaste.net/353766
09:10 eduardm joined
09:10 <dmj`> halogenandtoast: at that point it might be best to use StateT s m a
09:11 <dmj`> and if PlayerNumber never changes
09:11 puregreen joined
09:11 jeltsch joined
09:11 <halogenandtoast> dmj`: PlayerNumber is PlayerOne | PlayerTwo and doesn't change
09:11 <Cale> If you're working in IO anyway, you might also just use an IORef
09:11 <dmj`> :t (undefined :: ReaderT Int (StateT String IO) ())
09:11 <lambdabot> ReaderT Int (StateT String IO) ()
09:12 <dmj`> halogenandtoast: does your game require multiple threads?
09:12 <av> Hi everyone, I need some help with this code: http://lpaste.net/353766
09:12 <mutsig> I read on hackage that "The foldM function is analogous to foldl". Is this an issuie if I pass a very large list to it? In the same way as foldl builds up a very large call stack.
09:12 mbw joined
09:12 <halogenandtoast> dmj`: Not yet...
09:13 <Cale> av: I'm confused about why you defined realToFrac'
09:13 <halogenandtoast> av: Is the phantom type b deliberate?
09:13 <av> The idea is to have a computation (here in calcT2) that can internally run with various types (think of a coprocessor such as OpenCL)
09:13 <Cale> Also, none of this is even doing any IO, why IO?
09:14 <halogenandtoast> Cale: takeTurn is in IO
09:14 <Cale> I'm referring to av's code
09:14 <halogenandtoast> oh
09:14 <av> now when I run "calcT2 (undefined :: Float)", I expect a different result from running "calcT2 (undefined :: Double)"
09:14 <av> why is that?
09:14 <Cale> huh?
09:15 <Cale> calcT2 doesn't even use its argument
09:15 <Cale> Why would you expect anything different?
09:16 <mbw> Could someone please explain to me how https://hackage.haskell.org/package/tagsoup-0.14.1/docs/Text-HTML-TagSoup.html#v:sections works? Unfortunately the example that introduces is it out of date, but you can still see it at work in https://github.com/ndmitchell/tagsoup/blob/master/TagSoup/Sample.hs#L91 . Should I be able to make sense of it from the haddock alone?
09:16 <halogenandtoast> dmj`: I'll look into StateT, Cale: I'll look into IORef and see which one wins out
09:16 <Cale> Changing the type b which goes unused elsewhere in its type signature also shouldn't cause any difference
09:16 <av> Cale: I use ScopedTypeVariables, so realToFrac' should take its type from the type of the unused argument, should it not?
09:16 <Cale> av: Oh, but you're not actually making use of the extension.
09:16 cspollard joined
09:16 <Cale> You need to explicitly forall the type variables you want scoped
09:17 <av> Cale: ah
09:17 marfoldi joined
09:17 tromp joined
09:18 <cspollard> is there any way to strictly modify an element of a boxed Vector?
09:18 kolko_ joined
09:18 <Cale> halogenandtoast: I would advise against using monad transformers unless you have a very clear plan for a new monad you're going to construct with them.
09:19 <Cale> halogenandtoast: They're good for expediently defining new monads where you're probably going to restrict the use of the operations they add, or at least, think about the API you're providing enough that you come up with something better than 'get' and 'put'
09:20 <halogenandtoast> Cale: yeah I'm pretty sure I'm not ready to create my own Monads just yet.
09:20 <halogenandtoast> or construct
09:20 juliench1rch joined
09:20 <halogenandtoast> I don't have the vision to see how it would be used yet.
09:21 <av> thanks guys, will try playing around a bit, must leave the desk for a while now
09:21 <Cale> av: There's a bunch of things you give up when you transform IO -- at the very least, you make forkIO and catching exceptions rather tricky.
09:21 marr joined
09:23 <Cale> There are things you can do to recover a bit with MonadBaseControl and such.
09:23 laz joined
09:23 <Cale> But also, the first monad transformer you put over IO is going to make you pay a bunch in syntactic noise by having to stick liftIO in a bunch of places.
09:24 gregman_ joined
09:24 <Cale> That might be fine, but vs. just passing around a parameter, it's not really much of an improvement.
09:25 fotonzade joined
09:26 tomphp joined
09:27 watabou joined
09:27 Rizy joined
09:27 xtreak joined
09:28 <Cale> There is an argument that if you're using StateT, then you can give parts of your computation types like (MonadState MyState m) => ... -> m (), where it's clear that those bits can't do IO, apart from what actions they may get as arguments. You can do that with an IORef as well though, by passing along actions for reading or writing your state to something polymorphic in a choice of monad.
09:29 <Cale> m MyState -> (MyState -> m ()) -> ... -> m ()
09:29 FreeBirdLjj joined
09:30 <Cale> Sorry, that'd probably want (Monad m) => ... on the front
09:30 <Cale> cspollard: I think you're just meant to ensure the thing you're writing is evaluated.
09:31 FreeBirdLjj joined
09:33 mmn80 joined
09:34 laxask joined
09:34 FreeBird_ joined
09:34 <halogenandtoast> Cale: thanks for your help, I think I'll just leave my code alone.
09:35 <lpaste_> halogenandtoast pasted “Game.hs” at http://lpaste.net/353767
09:35 <halogenandtoast> I would say ^^ isn't too bad
09:36 <halogenandtoast> What's kind of nice is my lib has no IO operations. Everything IO related is here in the main exe
09:36 nilof joined
09:37 <Cale> Yeah, personally I would just leave this until some problem with it needed solving
09:38 <halogenandtoast> Yeah I just keep feeling like I'm passing GameState around a lot
09:38 <halogenandtoast> and keep assuming it's a common pattern I should solve
09:39 systadmin joined
09:40 phaji joined
09:41 <Cale> If you're worried that you'll accidentally use the wrong, old GameState, then something like State is one possible solution to that.
09:41 takle joined
09:41 <Cale> But I do think it's a common mistake to jump to applying StateT to IO a little quickly
09:42 carlosdagos joined
09:43 Beetny joined
09:45 <dmj`> One annoyance with StateT, or any transformer is concurrency. When you forkIO or async, you escape into IO forever, forcing you to pass your state from the closure into the IO action of the newly forked thread
09:46 <dmj`> monad-control helps with that
09:47 hexagoxel joined
09:49 <Cale> Also, that might not even make sense -- because updates to the state on the other thread obviously aren't going to apply
09:50 <Cale> monad-control "helps", but sometimes the thing it does for you isn't actually what you want.
09:50 ventonegro joined
09:50 cultofmetatron joined
09:50 augur joined
09:51 takle joined
09:51 <halogenandtoast> dmj` Cale I assume the solution is to have the state only in one thread and have the other threads send messages to that thread
09:51 systadmin joined
09:51 <halogenandtoast> kind of like erlang mailboxes
09:53 <halogenandtoast> s/the solution/one solution/
09:53 CurryWurst joined
09:53 fizruk joined
09:53 <halogenandtoast> heading out to grab dinner thanks everyone
09:55 <dmj`> Cale: yea, it probably wouldn’t be as convenient for StateT as ReaderT, using lifted-base / lifted-async
09:55 ramzifu joined
09:57 zero_byte joined
09:57 mfukar_ joined
10:01 eatman joined
10:01 ocalm joined
10:04 mettekou joined
10:05 mbw joined
10:06 ub joined
10:06 <mbw> Say I have finally "figured it out" while in a ghci session, and now I want to write it into a source file. Is there a way to dump the current session history to a file or something like that?
10:09 <bartavelle> great, my haskell program gives random results now
10:10 <bartavelle> doesn't do any IO, all pure computation
10:10 <Cale> mbw: Not really, apart from going back through your history and copy/pasting things, which is why you should be writing definitions to a file from the outset, and only testing them in ghci
10:10 <cocreature> bartavelle: can you show us the code?
10:11 <bartavelle> cocreature, https://github.com/bartavelle/gamebooksolver
10:11 sanett joined
10:11 <mbw> This'll teach me :(
10:11 <bartavelle> I thought it was faulty cpu/ram, but it's the same on another computer
10:11 <bartavelle> I blame memoization + parallel
10:11 <bartavelle> which already caused me problems in the past
10:12 <cocreature> bartavelle: what do I need to do to reproduce the behavior?
10:12 <bartavelle> stack build && time .stack-work/install/x86_64-linux/lts-8.4/8.0.2/bin/gamebooksolver-solvebook02 +RTS -s -N8
10:13 <bartavelle> sometimes gives slightly different results (not always)
10:13 <bartavelle> it's pretty slow though :/
10:13 sanett joined
10:13 <cocreature> well executing an executable is IO, what’s the part that is pure and still produces different results?
10:14 mmo joined
10:14 <bartavelle> that's the executable https://github.com/bartavelle/gamebooksolver/blob/master/app/SolveBook02.hs
10:14 <bartavelle> it basically just computes "solution", and prints some data extracted from it
10:14 sphinxo joined
10:15 <bartavelle> all the IO is about printing
10:15 <cocreature> ah ok
10:15 acidjnk22 joined
10:16 <bartavelle> but yeah, I already witnessed <<loop>> when using "parallel" that would not happen without it, so I guess it's kind of hacky
10:17 <bartavelle> perhaps I should start using something that's more explicit
10:17 <Cale> That's... messed up
10:17 <Cale> par should never affect the result of your program
10:17 <liste> bartavelle: and no "unsafePerformIO" anywhere?
10:17 <bartavelle> liste: nope
10:17 <liste> or libraries that may use it (for eg FFI)
10:18 FreeBirdLjj joined
10:18 <bartavelle> liste: I don't think so? I don't think I even use bytestring
10:18 mrijkeboer joined
10:18 <cocreature> I would have suspected data-memocombinators but it looks fine
10:18 <Cale> data-memocombinators should be safe
10:19 <bartavelle> I fixed my <<loop>> issues by being a bit more strict at places, so I thought it was some sort of race with the thunks that are being evaluated at the same time
10:19 <bartavelle> didn't use memoization in that case
10:20 <Cale> Being more strict should never fix <<loop>>, it should only hasten it
10:20 <Cale> (or cause it)
10:20 fizbin joined
10:20 <cocreature> I can reproduce the problem
10:20 <bartavelle> well, parMap shouldn't cause <<loop>> either :)
10:20 <bartavelle> wow cool!
10:20 oish joined
10:21 <cocreature> but I’m not quite sure where to start looking for a bug.
10:21 mfukar_ left
10:21 mfukar_ joined
10:21 <bartavelle> I'm running it with -N1 to see if this happens too
10:22 <Cale> Is it this 0.48460975500424647 which should be different?
10:22 <bartavelle> that, and it sometimes also gives the result list in a slightly different order
10:22 <cocreature> yeah I saw both
10:22 xplat joined
10:22 <bartavelle> sometimes it just messes the score, and returns the same list, but as it's rounded I am unsure it's the same
10:23 <bartavelle> you might want to remove the casts to Double, and keep the Rational
10:23 <bartavelle> also I found my parMap problem, if that is of interest, unfortunately I can't share this code ...
10:24 <Cale> 0.516055644569007 hmm
10:25 <bartavelle> oh, nice error!
10:25 halogenandtoast joined
10:26 <jchia> How can I extract/obtain "{\"a\": {\"b\": 1, \"c\": 2}, \"e\": 4}" from "{\"a\": {\"b\": 1, \"c\": 2, \"d\": 3}, \"e\": 4}" using lens-aeson? Basically, drop all keys under "a" that are not in ["b", "c"].
10:27 <bartavelle> jchia, go
10:27 <bartavelle> jchia, gimme a sec
10:29 minn joined
10:31 Rizy joined
10:31 <bartavelle> jchia, I don't think I know how to do it just with lens, I have to add some HM in the mix :/
10:31 ragepandemic joined
10:31 tomus joined
10:31 xtreak joined
10:31 <jchia> bartavelle: HM? HashMap?
10:31 <bartavelle> yes
10:31 mfukar joined
10:31 <Cale> bartavelle: I tried replacing HashMap with Map, and haven't been able to cause it yet.
10:32 ebzzry joined
10:32 <bartavelle> argh
10:32 <Cale> I think there might be a bug in HashMap
10:32 <bartavelle> that's pretty bad if true, as it's so much faster
10:32 <Cale> That was the first thing which came to mind when I saw your imports.
10:32 <bartavelle> that would be a good catch though
10:32 <Cale> HashMap does all kinds of insane crap
10:33 <Cale> HM.insert uses reallyUnsafePtrEquality#
10:33 <cocreature> who would have thought that this is unsafe
10:33 <bartavelle> :))))
10:34 <bartavelle> jchia, key "a" . _Object %~ HM.filterWithKey (\k _ -> k `elem` ["b","c"]) btw, if you did not have it already
10:34 <bartavelle> alright, I'll try to move to Data.map
10:34 <bartavelle> err
10:34 <bartavelle> Map
10:34 <cocreature> but I kind of hoped that by now HashMap would be sufficiently battletested
10:35 jaspervdj joined
10:35 <bartavelle> I can't reproduce it with -N1, so it's almost certainly a race :(
10:35 locallycompact joined
10:35 <jchia> bartavelle: Thanks a lot. I'll try to find a way that is more lensy
10:35 <Cale> Possibly it only comes up in conjunction with par, or under heavy GC pressure
10:36 systadmin joined
10:36 <jchia> i.e. try to continue from "Object %~" and do without HM
10:36 <Cale> reallyUnsafePtrEquality# can give false negatives when the GC moves things around -- I imagine it can also give false positives, though that would be extremely unlikely.
10:36 peterbec` joined
10:36 mohsen_ joined
10:36 <bartavelle> jchia: yeah, but you'd have to do it at the right side of %~, and I don't think there's a toHashMapOf ?
10:37 <Cale> Maybe it really can't -- I remember hearing a reason why it shouldn't be able to
10:37 <Cale> (basically because if the GC moves something in the interim, it's going to be moving it to a memory location where nothing should have been just prior)
10:38 __main__ joined
10:38 <cocreature> I wish ghc-prim had better docs for these operations
10:39 OnkelTem joined
10:39 <bartavelle> anyway thanks Cale!
10:40 <bartavelle> I'll probably submit some sort of bug to unordered-containers, although I can't seem to reproduce it right now ...
10:40 merijn joined
10:40 xtreak joined
10:41 <bartavelle> jchia, you'll have more luck on #haskell-lens, although it might take some time
10:41 <jchia> bartavelle: OK
10:43 twanvl joined
10:43 ompaul joined
10:43 raichoo joined
10:43 zar joined
10:43 <Cale> Actually, and if it's not the reallyUnsafePtrEquality, it might have something to do with the unsafe updates to these arrays.
10:43 Raddamu joined
10:44 plugin joined
10:44 <bartavelle> I just want to do "HM.toList . HM.fromListWith (+)" really fast though, I tried the "discrimination" package, but it was much slower
10:44 <bartavelle> I'll test the Map solution for a while today
10:45 <cocreature> bartavelle: you could try throwing everything in a vector, applying an inplace sort and then storing the results in a data structure of your choice
10:45 x1ddos joined
10:46 dawehner joined
10:47 <bartavelle> humm
10:47 <bartavelle> yeah with Map program is twice as slow :(
10:47 <bartavelle> I'll go eating, perhaps I'll have an idea
10:48 <Cale> It didn't seem twice as slow for me...
10:48 ompaul_ joined
10:48 <Cale> 20.8s elapsed vs. 19.1s
10:49 <Cale> What did you do? :)
10:49 <Cale> Map is usually only marginally slower than HashMap in my experience anyway
10:49 systadmin joined
10:49 <merijn> But mutable vectors with in-place sort is always fast in my experience :p
10:49 <mmo> Hey :) If I write a GUI-Application for Ubuntu, would "gtk2hs" or "haskell-gi" be a better choice?
10:50 <Cale> mmo: The new version of gtk2hs is just called 'gtk' btw.
10:50 <Cale> mmo: What kind of GUI is it?
10:51 moongazer joined
10:51 netheranthem joined
10:51 <Cale> Personally, I would strongly consider using reflex-dom and compiling with ghc to get a native webkit application, just because I've been enjoying that so much when it comes to web applications.
10:52 <mmo> I just want to write a little Sudoku program with a graphical interface.
10:52 <Rembane> mmo: Gloss might do what you want.
10:52 <merijn> You could use a terminal UI using brick :)
10:53 <Cale> That's actually a great idea, and if you don't do it with reflex-dom, I probably will. Would make a good example application.
10:53 _sras_ joined
10:53 Rizy joined
10:53 <Cale> Plus, you compile it with ghcjs and you get a web page :)
10:54 <_sras_> How can I convert a LogStr (System.Log.FastLogger) to string....
10:54 <mmo> Ok. Thanks. I'll have a look at those things. On the github page of "gtk2hs" the refer to "haskell-gi" and say that it would be a better choice for new projects. However, there is not really a good documentation for "haskell-gi".
10:54 yoneda joined
10:55 <Cale> _sras_: I don't see that it's possible -- that's kinda miserable
10:55 CurryWurst joined
10:55 <Cale> oh
10:55 <Cale> fromLogStr :: LogStr -> ByteString
10:56 <_sras_> Cale: Where is that func?
10:56 <cocreature> _sras_: System.Log.FastLogger
10:56 <cocreature> https://hackage.haskell.org/package/fast-logger-2.4.10/docs/System-Log-FastLogger.html#v:fromLogStr
10:58 halogenandtoast joined
10:58 <_sras_> cocreature: Thanks. I was looking at an older version.
10:59 Sgeo joined
10:59 <_sras_> Cale: "I don't see that it's possible -- that's kinda miserable"...Why did you think so?
10:59 <Cale> Just didn't see that function
10:59 MarioBranco joined
10:59 <Cale> I'm not sure why
10:59 <cocreature> we really need to add some big red warning if you are looking at the docs for an older version of a package
11:00 <Cale> Well, I also didn't expect it to be ByteString
11:00 <Cale> also, the constructor for LogStr isn't exported, so if the library didn't provide fromLogStr, you would be stuck
11:01 eduardm joined
11:02 Snircle joined
11:03 buoto joined
11:03 ompaul_ joined
11:06 przembot joined
11:09 x1ddos joined
11:11 fendor joined
11:11 fendoer joined
11:12 <bartavelle> cocreature, I have a chrome extension for that :/
11:13 Raddamu joined
11:15 hylo joined
11:17 julienchurch joined
11:18 systadmin joined
11:18 doomlord joined
11:18 tromp joined
11:21 fendor joined
11:22 <bartavelle> Cale, running time went from 37s to 57s
11:22 <Cale> bartavelle: weird
11:22 <Cale> bartavelle: I didn't see much difference here
11:22 <bartavelle> that's very consistent with my usual observations, only IntMap compares favorably to HashMap
11:23 <bartavelle> Cale, you did just derive the needed Ord instances to make the change?
11:23 <Cale> yeah
11:23 <bartavelle> oh weird it's faster now oO
11:23 <bartavelle> went to 38s
11:23 <Cale> Maybe something else was running on your machine the first time?
11:23 raddamu2 joined
11:23 <bartavelle> most certainly
11:23 <bartavelle> also I run 2 cpus cores, with 6HT cores each, so perhaps locality has an effect
11:24 <bartavelle> as I run -N8
11:24 <Cale> I was running -N8 too as per your original command
11:24 <Cale> I should try -N16
11:24 <bartavelle> yeah now it's a pretty consistent 38s ... probably one of my VM was acting up
11:25 <bartavelle> I didn't observe better performance past -N8 though ... but anyway, I still have to make it a *lot* faster if I want to solve the whole book
11:26 <Cale> Yeah, seems like it's significantly worse for me
11:26 <bartavelle> I get peak performance between -N8 and -N12
11:27 <Cale> Heh, with -N7, it ran faster than the original HashMap one did at -N8
11:27 raddamu2 joined
11:27 <Cale> Probably just less contention with other junk running on my system
11:27 hvn0413 joined
11:28 <bartavelle> Oh, I thought I had it badd https://github.com/tibbe/unordered-containers/issues/68
11:28 alfredo joined
11:28 watabou joined
11:28 <bartavelle> on the other hand, I'd rather have a clean crash than data corruption
11:28 <Cale> lol
11:29 <Cale> I've never really been a great fan of hashing
11:29 <Cale> anyway
11:29 <Cale> (not that it has anything to do with why unordered-containers seems to be flaking out)
11:29 Raddamu joined
11:30 halogenandtoast joined
11:30 AndreasK joined
11:30 buoto joined
11:31 uglyfigurine joined
11:32 fendoer joined
11:34 merijn joined
11:34 JeanCarloMachado joined
11:36 silver joined
11:36 eduardm joined
11:37 <merijn> quchen: So, what needs to happen with your prettyprinter before it can be released/used?
11:38 peterbec` joined
11:48 dawehner joined
11:48 JeanCarloMachado joined
11:50 halogenandtoast joined
11:50 sdothum joined
11:51 a3Dman joined
11:52 ramzifu joined
11:55 epmvuj joined
11:55 freechips joined
11:56 petrus joined
11:58 <av> Cale: back at the keyboard now -- in case the IO stuff you wrote was directed my way: I use IO in this case because the real work I'm doing uses OpenCL, not for passing around a state.
11:59 mbw joined
12:01 danthemyth joined
12:02 doodlehaus joined
12:02 suls joined
12:02 <quchen> merijn: Politics! I want to take over maintainership of wl-pprint, and release my package as a major version bump (to 1.*). I’d then like to deprecate ansi-wl-pprint in favour of my wl-pprint-ansi, which builds ontop of wl-pprint (adding the ANSI dep). The modules are slightly breaking, but I’m providing drop-in compatibility layers for dead simple migration.
12:02 <quchen> wl-pprint seems to be used by older libraries, for the most part. I don’t expect many breakages there.
12:02 danthemyth joined
12:03 <quchen> And migrating away from the compatibility layers to the new library should be fairly easy as well.
12:03 <quchen> Well, not should, *is*. Transitioning the STGi to the new prettyprinter was a matter of a couple of minutes.
12:03 HoierM joined
12:03 danthemyth joined
12:04 oisdk joined
12:04 <mbw> Hello, I have another question. I've successfully slapped together some functions that recursively extract some links from a website. I use wreq to get the response bodies, and tagsoup to barbarically extract the links. However, this seems very inefficient to me. Wreq's get method is of type get :: String -> IO ByteString. I can process this ByteString with tagsoup to get another ByteString. But then I have
12:04 <mbw> to call 'get' again, which expects a string, so I have to unpack. This methodology seems to be seriously flawed. How are you supposed to recursively follow links with wreq?
12:05 ph88 joined
12:05 <Rembane> mbw: What makes it flawed?
12:05 <ph88> hi all
12:06 <phadej> quchen: http://packdeps.haskellers.com/reverse/ansi-wl-pprint vs
12:06 <phadej> quchen: yours wl-pprint-ansi
12:06 <ph88> does anyone know how i can resolve the type ambiguity in the type signature on line 105 ? https://bpaste.net/show/b7495fd638b0 above there is the ghci infered type, but i can not use that because the generics-eot package does not expose those types
12:07 pera joined
12:07 <phadej> quchen: and ansi-wl-pprint is maintained by edwardk, (though seems be a legacy of max bolingbroke)
12:07 <mbw> Rembane: All the convertions, and the memory allocations associated with each Char to get a String. The wreq tutorial shows a minimal example of a session, but the links they use are hardcoded Strings.
12:08 julienchurch joined
12:08 <cocreature> mbw: allocating space for a URL is really cheap compared to actually doing a web request, so I doubt you need to worry about this
12:08 <Rembane> mbw: I think the right approach is to code a whole application that does what you want it to do and then measure the memory allocation. GHC does quite a lot of interesting optimizations on the way.
12:08 <_sras_> Is there a typical usage example for System-Log-FastLogger?
12:08 <phadej> quchen: so please contact wl-pprint maintainer, and edward and try to figure out the friendly migration
12:08 <quchen> phadej: Yup, I talked to Edward and he seemed open to someone taking over maintainership
12:08 suls joined
12:09 <quchen> phadej: Sure, I tried contacting him a couple of times already, first time in December, and again around Feb. Didn’t receive any response. :-(
12:09 <mbw> It might be true that the time associated with the convertions is negligible compared to the requests. It just felt like I was doing something wrong...
12:09 hirp joined
12:09 <phadej> quchen: there seems activity in ~two monts ago: https://github.com/sinelaw/wl-pprint
12:10 <phadej> quchen: an issue in issue tracker would be great, to be an evidence "when the process started"
12:10 <cocreature> mbw: the fact that you constantly have to convert between various flavors of String, Text and ByteString is one of the worst parts of haskell but sadly it’s there
12:10 <quchen> phadej: The intended process is a public mail to haskell-cafe, as far as I know.
12:11 <phadej> quchen: well, that's too; but to reach people the all communications channel are good
12:11 c137 joined
12:11 <mbw> If I was doing it right, I would have to convert the ByteStrings to Text before parsing them, probably :/
12:11 c137 left
12:11 <quchen> phadej: In my happy place, I was hoping for Noam to tell me »yeah sure go ahead« ;-)
12:12 rotty_ joined
12:12 <quchen> phadej: I tried compiling a couple of revdeps against my package (or the compatibility layer) and they all worked fairly well, so I don’t even expect that much breakage
12:12 hirp joined
12:13 suls joined
12:14 <phadej> quchen: but, anyhow, please proceed with https://wiki.haskell.org/Taking_over_a_package so cafe&libraries mail would be a good start
12:15 <quchen> phadej: Yes, I should really get started
12:15 <phadej> and IIRC the timetable was 6 months of author's inactivity, dunno when and why that page says 2-6 week period (which is imho is rather small)
12:16 <phadej> at least I won't proceed with breaking changes, as there's an year disclaimer
12:16 hirp joined
12:16 ReflectZero joined
12:16 <phadej> about unconditional return of ownership
12:16 nomicflux joined
12:16 jhns joined
12:17 jhns left
12:17 <quchen> Yes, I know about that.
12:17 <quchen> But public support for the new package would be a huge help, and for getting that I need to get started. :-)
12:17 bjz_ joined
12:18 <phadej> what's wrong with ansi-wl-pprint?
12:18 yinn joined
12:18 <phadej> quchen: there is also annotated-wl-pprint and wl-pprint-annotated
12:18 ziyourenxiang joined
12:18 <phadej> so if you really want to make things nice, consider all those forks
12:19 <quchen> I know about many of them, yes.
12:19 tromp joined
12:19 c137 joined
12:19 <phadej> and obviously there are pretty; etc
12:19 c137 left
12:19 skeuomorf joined
12:20 <quchen> phadej: My version is merely a modernization of wl-pprint, addressing multiple things: 1. add extensive doc(test)s; 2. remove clashes with now-common operators such as <$>; 3. decouple the layout algorithm from the renderer (-> e.g. no ANSI dependency if you don’t use the colouring functions)
12:20 skapazzo joined
12:21 <quchen> And, as mentioned, it is mostly compatible, with the choice of a) a trivial compatibility drop-in, or b) a very simple migration.
12:21 <phadej> quchen: is it via annotations, like in annotated-wl-pprint?
12:21 c137 joined
12:21 <Clint> i would love for optparse-applicative to stop using ansi-wl-pprint
12:21 <quchen> No annotations, no. I don’t see their utility, and the number of reverse deps of ansi-wl-pprint seems to agree with me.
12:21 <quchen> Clint: Why?
12:22 <Clint> because it's incompatible with wl-pprint-terminfo
12:22 <quchen> What’s that
12:22 <phadej> :P
12:22 deepfire joined
12:22 theelous3 joined
12:22 <quchen> Jesus, the number of prettyprinters is horrible. (Which is why I don’t want to release my own as yet another one, but would rather use it to clean up.)
12:22 <phadej> quchen: colors are annotations
12:22 aib joined
12:23 <phadej> or is there something you cannot "colorize" with annotations?
12:23 <quchen> Everything can be colorized.
12:24 <quchen> Oh, and benefit #4: my package is extensible by other backends, for example I have an HTML prettyprinter backend.
12:24 <quchen> Try putting that onto ansi-wl-pprint.
12:24 <quchen> (This is what made me start the project in the first place, since I wanted to render STGi for the browser.)
12:24 <quchen> (And the terminal.)
12:25 eduardm joined
12:25 <phadej> quchen: annotated-wl-pprint can do that too, cannot it?
12:25 adeohluwa joined
12:25 <phadej> quchen: it's used for idris IIRC
12:25 <phadej> "ide"
12:26 hucksy_ joined
12:27 <phadej> https://wiki.haskell.org/wikiupload/4/4c/Hiw-2015-david-christiansen.pdf
12:27 c137 left
12:27 c137 joined
12:28 certainty joined
12:28 <phadej> quchen: don't get me wrong, I don't like current situation either; so it would be great to clean it up
12:28 c137 left
12:28 c137 joined
12:29 <quchen> I don’t understand the annotations, really. What’s a non-() example annotation?
12:29 <quchen> »Contains colours«? Why can’t the backend simply ignore colour directives when it does not support it (e.g. for plain text)?
12:30 watabou joined
12:30 c137 left
12:30 <phadej> quchen: you can write a backend which doesn't care about annotations (polymorphic one)
12:30 tobill joined
12:31 <phadej> but annotations can contain whatever semantic information; e.g. "type&kind of the expresion" represented by Doc
12:31 <phadej> so e.g. in HTML render you could put stuff into tooltips
12:31 <phadej> etc.
12:32 <quchen> Hm, okay. Might be worth thinking about.
12:32 Claudius1aximus joined
12:32 <quchen> The upside of piggybacking ontop of (ansi-)wl-pprint is adoption speed.
12:32 plugin joined
12:33 <quchen> The downside is that a one-size-(really!-)fits-all solution would be even nicer.
12:33 ragepandemic joined
12:33 <phadej> well, i'd like 'wl-pprint' and 'annotated-wl-pprint' merge (as pretty have both atm); and `ansi-wl-pprint` implemented on top of `annotated-wl-pprint`
12:34 <quchen> phadej: The result of that would be what I get when I add annotations to my module, I guess.
12:34 <quchen> But then we get new problems. For example, »red : Doc a -> Doc Colour«.
12:35 <quchen> But what if I want to add colour and type info to my Doc?
12:35 <quchen> So now we need type-level sets?
12:35 <quchen> <gh
12:35 <phadej> red :: HasColor a => Doc a -> Doc Colour
12:35 <phadej> red :: HasColor a => Doc a -> Doc a
12:35 <quchen> I see.
12:35 <_sras_> Is there an example of using System.Log.FastLogger somewhere? I cannot make sense of it from the Hackage docs alone.
12:36 <phadej> quchen: where HasColor could provide only setter, I guess
12:36 <quchen> phadej: The downside is that this makes the types more complicated again. Argh!
12:36 <quchen> But not by too much, at least.
12:36 <phadej> quchen: well, you can have ColouredDoc = Doc Colour
12:38 <phadej> an actually, wl-pprint-terminfo has: type TermDoc = Doc Effect
12:38 lep-delete joined
12:39 <phadej> quite impossible to think about useful stuff, which doesn't have Kmett's implementation too :P
12:39 dawehner_ joined
12:40 <quchen> Haha
12:41 <phadej> yet; I miss tabular layouts from pretty-printing libs
12:41 Lord_of_Life joined
12:41 <quchen> Anyway, I’ll think about this some more, and try not to go too public before it’s figured out
12:41 <quchen> Yes, so do I. But the WL algorithm doesn’t allow those
12:42 c137_ joined
12:42 <phadej> make a better algo; publish a paper; re-implement all the libs; ...; profit!
12:42 <quchen> Uhhh yeah
12:43 <phadej> I'd like a lib where sub-documents could be layoted using different algorithms; if global one isn't sufficient
12:44 kylefang joined
12:45 kylefang joined
12:47 mkoenig joined
12:47 oisdk joined
12:48 jud^ joined
12:48 asmyers joined
12:49 <_sras_> In the documentation page for FastLogger, it says that "file rotation is done on demand". What does it mean?
12:50 obijankenobi joined
12:51 c137 joined
12:52 c137 joined
12:54 oisdk joined
12:55 yinn joined
12:56 c137 joined
12:56 umib0zu joined
12:57 tromp joined
12:57 Sampuka joined
12:57 cpup joined
12:59 deepfire joined
12:59 sepp2k joined
13:00 Brando753-o_O_o joined
13:01 c137 joined
13:01 howdoi joined
13:04 BusFacto_ joined
13:07 ADG joined
13:07 <ADG> :)
13:07 ADG left
13:09 dsh joined
13:10 deepfire joined
13:10 leshow joined
13:10 yinn joined
13:12 Fairy joined
13:12 fendor joined
13:15 rekahsoft joined
13:16 doodlehaus joined
13:17 jomg joined
13:17 Fairy joined
13:17 kylefang joined
13:18 bydo joined
13:19 revtintin joined
13:19 doodlehaus joined
13:21 mmo left
13:22 c137 joined
13:23 stef204 joined
13:26 plutoniix joined
13:27 plugin joined
13:28 testtesttest joined
13:28 eSVG joined
13:30 <_sras_> Is there any way to make Servant log the handler that was used to service a Route?
13:30 KarboniteKream joined
13:31 watabou joined
13:31 moongazer joined
13:32 DataComputist joined
13:32 mson joined
13:33 ystael joined
13:33 Sh4rPEYE joined
13:33 nepiktaz joined
13:34 merijn joined
13:35 DataComputist joined
13:36 DataComputist joined
13:36 deepfire joined
13:36 DataComputist joined
13:37 DataComputist joined
13:37 ^jud joined
13:37 DataComputist joined
13:38 DataComputist joined
13:39 <mutsig> I'm working with a datatype of "StateT s (Reader r) a". Does switching the monads to "ReaderT r (State s) a" anything, or is it just a matter of taste?
13:40 peterbec` joined
13:40 Big_G joined
13:40 dawehner joined
13:41 piyush-kurur joined
13:42 przembot joined
13:43 eschnett joined
13:43 przembot joined
13:43 jsgrant- joined
13:44 oisdk joined
13:44 nepiktaz joined
13:44 oaaao joined
13:47 ebzzry joined
13:47 <c_wraith> mutsig: that particular pair of monads commute, so it's the same thing either way
13:48 <c_wraith> mutsig: But not all pairs of monads commute, so that's not a universal rule
13:48 <c_wraith> @unmtl StateT s (Reader r) a
13:48 <lambdabot> s -> r -> (a, s)
13:48 <c_wraith> @unmtl ReaderT r (State s) a
13:48 <lambdabot> r -> s -> (a, s)
13:49 <c_wraith> mutsig: as you can see, the only difference in the underlying data type caused by switching those around is what order the function arguments are in.
13:49 <c_wraith> mutsig: so there's no difference in that case.
13:49 <mutsig> c_wraith: I see. I suspected that, but didn't know for sure. Thanx for the explanation
13:49 al-damiri joined
13:50 ramzifu joined
13:51 christiandiloren joined
13:52 carlomagno joined
13:52 nopf joined
13:53 deepfire joined
13:53 mvr_ joined
13:54 kosorith joined
13:55 robkennedy joined
13:55 halogenandtoast joined
13:55 codesoup joined
13:55 kylefang joined
13:56 yogsototh joined
13:56 yellowj joined
13:57 coltfred joined
13:57 igniting joined
13:57 petrus joined
13:58 meba joined
13:58 cpennington joined
13:58 ChristopherBurg joined
13:59 dylukes joined
13:59 Lord_of_Life joined
14:02 jbuurlage joined
14:03 ddellacosta joined
14:03 pie__ joined
14:04 ddellacosta joined
14:04 `^_^v joined
14:05 ADG_ joined
14:07 harfangk joined
14:07 pi_____ joined
14:08 trism joined
14:10 tromp joined
14:11 cdg joined
14:11 bjz joined
14:12 dawehner joined
14:15 `^_^v joined
14:16 ebzzry joined
14:17 e14 joined
14:17 freusque joined
14:17 mbw joined
14:18 <mbw> My very first web-crawler with space-leak still uses less memory than firefox. What a great success!
14:18 chlong joined
14:18 sellout- joined
14:19 wraithm joined
14:19 _sg joined
14:20 danharaj joined
14:22 jeltsch joined
14:23 oisdk joined
14:24 ludat joined
14:25 Boomerang joined
14:25 benkard joined
14:25 <benzrf> heh
14:25 <benzrf> its not hard to use less memory than firefox
14:25 simukis__ joined
14:25 <benzrf> in fact i'd be hard pressed to use more
14:26 <* pi_____> kylefang
14:27 crobbins_ joined
14:27 gpbaran joined
14:27 MarioBranco joined
14:28 a5an0 joined
14:29 <quchen> I need a function to tick every N seconds. The simplest implementation is using threadDelay, but this depends on the scheduler’s mood. Is there a library with better timing guarantees?
14:29 cdg joined
14:29 <quchen> Example: »forever (threadDelay 1e6 >> putStrLn "tick")«.
14:30 <quchen> (By »tick«, I mean »execute some IO«)
14:31 insitu joined
14:31 sword865 joined
14:31 Khisanth joined
14:32 watabou joined
14:33 insitu joined
14:34 <c_wraith> quchen, what timing constraint do you have? start time or interval time?
14:34 <merijn> quchen: If threadDelay isn't going to cut it for you, you honestly are likely in much deeper shit than you think with scheduler delay :)
14:34 <merijn> quchen: hard realtime? soft realtime? do you care about jitter? do you care about drift?
14:35 c137 joined
14:35 <quchen> c_wraith merijn: Luckily, I don’t have any constraints. I just felt like my solution was a bit hacky. I guess for a simple game, you could say I have very soft real time requirements, but it’s just an example.
14:35 <quchen> Just wanted to make sure I wasn’t missing something obvious.
14:36 <merijn> quchen: Then your choice is probably 1) threadDelay or 2) go extremely hardcore
14:36 alx741 joined
14:37 <c_wraith> just use threadDelay then. there's a lot of complexity for little gain if you don't have hard requirements
14:37 <merijn> quchen: While, *in theory* you're at the scheduler's mood, in reality except for GC pauses there should be little getting in the way
14:37 <quchen> thanks c_wraith, but I think I’ll go with merijn’s »very hardcore« to implement my tutorialized pong clone.
14:37 <quchen> It seems like a good fit.
14:37 <quchen> Okay, no ;-)
14:37 <merijn> quchen: Also, to repeat my question from earlier: So what needs to be done before your prettyprinter before it can be distributed/used?
14:38 <quchen> merijn: I answered the question a couple of minutes later and talked with phadej a bit about it as well. Do you have the scrollback?
14:38 uglyfigurine joined
14:38 <quchen> Otherwise I’ll find it on ircbrowse for you
14:39 Rizy_ joined
14:39 alx741 joined
14:39 <c_wraith> the only way to get around the vagaries of GC stopping the world is by moving out of the haskell context entirely.
14:39 <merijn> quchen: no, I had to leave for a talk and I'm still too lazy to setup a bouncer xD
14:39 descender joined
14:40 <quchen> c_wraith: Yeah, like asking the OS to send a signal to Haskell every X seconds or something. ThreadDelay it is :-)
14:40 <quchen> merijn: Hold on.
14:40 mulk joined
14:41 <quchen> Ugh, IRCBrowse is broken!?
14:41 mulk joined
14:41 <merijn> quchen: Eh, sending a signal is how thread delay works :)
14:41 ramzifu joined
14:42 <merijn> quchen: Partly, the logging seems to work, but all the old things like user profiles, etc. seems broken
14:42 Apocalisp joined
14:42 mulk joined
14:42 <quchen> Logging tells me no new entries since Feb
14:42 alx741 joined
14:42 danza joined
14:42 <quchen> merijn: PM’d you
14:42 tom7942 joined
14:43 <mbw> Is GHC's GC concurrent by now?
14:43 alx741 joined
14:43 <merijn> mbw: Define what you mean by concurrent GC
14:43 <merijn> GHC has a parallel GC
14:44 <mbw> Then that's probably what I mean. I.e., the thing it was not, at the time Real World Haskell came out, so-to-say...
14:44 <quchen> RWH is 10 years old now :-/
14:45 <merijn> mbw: Ok, yeah, GHC still pauses all threads for GC, but it now does the GC in parallel using all threads
14:45 <quchen> Yes, it’s a stop-the-world GC.
14:46 takle joined
14:46 <mbw> Is this as good as it gets, or are there better alternatives that might actually be implemented in the forseeable future?
14:47 <mbw> I'm not a GC expert, so it's an honest question
14:47 <cocreature> mbw: I don’t think anybody is working on a new GC so in the near future there probably won’t be one
14:47 <merijn> quchen: I support phadej's comments. I would really like all the different pretty printing packages a little more consolidated and not breaking fmap, etc. :)
14:47 <merijn> mbw: The problem is there is not "optimal GC"
14:47 <cocreature> mbw: the main problem (in some areas) with GHC’s GC is if you have low latency requirements
14:47 <merijn> mbw: GC is about trade-offs, and GHC's design is pretty solid for most workloads
14:48 <dolio> mbw: It's not as good as it gets, but I wouldn't anticipate GHC becoming as good as it gets in the near future.
14:48 mulk joined
14:48 <quchen> merijn: Mine 1) uses Text; 2) doesn’t break fmap; 3) has lots of docs; 4) decouples the abstract layout from the renderer. It does not support annotations right now, although this would be an easy addition I believe.
14:48 <merijn> mbw: Here's a good intro: https://blog.plan99.net/modern-garbage-collection-911ef4f8bd8e#.1htv6xpl7
14:49 <quchen> merijn: If I add annotations, I wonder whether there’s anything left that people might miss.
14:49 <mbw> Are the discussions about alternative GC implementations more of an academic nature, or are there better implementations out there, for instance for Java or something?
14:49 <cocreature> quchen: Text and not breaking fmap is already sufficient to win me over :)
14:49 <merijn> quchen: Right now I'm using ansi-wl-pprint, since that's already a dependency via trifecta
14:49 <quchen> cocreature: And an HTML renderer :-)
14:49 <mbw> merijn: Thanks for the reference.
14:49 <dolio> mbw: There are definitely 'better' GCs out there.
14:49 <cocreature> quchen: neat, I haven’t needed that but it seems nice to have
14:50 <merijn> mbw: As you will see, GC design is not about making it better, but "what am I willing to trade for what?"
14:50 <dolio> There's a company whose product is a JVM with extremely low latency GC, for real-time-ish stuff.
14:50 <quchen> cocreature: https://quchen.github.io/ansi-wl-pprint-docdump/wl-pprint-1/Data-Text-Prettyprint-Doc.html
14:50 <dolio> Although extremely low latency might not always be what you want.
14:50 <cocreature> quchen: good luck with taking over maintenance!
14:50 <merijn> mbw: GHC's GC is optimised for throughput, that is, over a long running program the time spent GCing should be the smallest percentage of the time spent doing useful stuff
14:51 <merijn> mbw: But, to do this it's traded off jitter (that is, sometimes it pauses all programs for a longer time to do GC), which means if you want consistent short pauses, that screws you over
14:51 <cocreature> merijn: that’s easy, just don’t gc at all :)
14:51 <merijn> But if you care about "wasting the least time doing GC" it's ok
14:51 <merijn> cocreature: If you crash due to OOM you're not productive either ;)
14:52 <cocreature> merijn: the program was very productive while it was running!
14:52 mw joined
14:52 <dolio> Can't GHC do minor collections on a per-capability basis?
14:52 <merijn> mbw: Similarly, GHC's GC thrives if the set of non-garbage is relatively small. The more "non-garbage" the slower it becomes. But in general in Haskell most stuff actually turns into garbage quickly too
14:52 <dolio> And not stop everything?
14:52 <merijn> dolio: Yes
14:53 <merijn> Only major collections are stop the world
14:53 <dolio> Okay, right.
14:53 sbrg joined
14:53 <merijn> mbw: On the upside, the design of GHC also makes allocating memory *super cheap*, like, I doubt you could *ever* be faster than GHC at allocating memory
14:53 wraithm joined
14:53 <halogenandtoast> is there a function for lists to count matching elements. I don't see anything for (a -> Bool) -> [a] -> Int
14:53 <merijn> It's like 3-4 asm instructions or something
14:54 <cocreature> halogenandtoast: length . filter
14:54 <quchen> halogenandtoast: length . filter p
14:54 <merijn> halogenandtoast: combine length plus filter? :)
14:54 <Rembane> Hat-trick!
14:54 <halogenandtoast> I was hoping to do it in one pass...
14:54 <halogenandtoast> :(
14:54 <quchen> It *is* one pass :-)
14:54 <merijn> halogenandtoast: It does one pass!
14:54 <mbw> merijn: Does it boil down to alloca and a designated arena or something like that?
14:54 <merijn> halogenandtoast: Laziness!
14:54 <quchen> Fusion!
14:54 <cocreature> magic!
14:55 <halogenandtoast> whelp looks like I don't know Haskell very well
14:55 <merijn> halogenandtoast: The filter doesn't run until length starts traversing the list, so it's basically like JIT filtering the list for length :)
14:55 <quchen> halogenandtoast: The concept behind it is known as »list fusion«. It allows the compiler (based on internal library annotations) to rewrite multiple list traversals into a single one (or sometimes, even none at all).
14:55 <merijn> quchen: Even without fusion it would do a single traversal
14:56 <merijn> quchen: fusion just makes the traversal even cheaper
14:56 <quchen> merijn: Well, arguably. It would still dereference every cons cell twice without list fusion.
14:56 <merijn> quchen: Yes, but that's still much faster than traversing twice in a strict manner
14:56 <merijn> quchen: And a smaller working set of memory
14:56 <quchen> Because of locality?
14:56 <quchen> Hm, you’re right.
14:56 <merijn> quchen: Yeah
14:57 <quchen> Good point, actually! Never thought about it this way.
14:57 Aruro joined
14:57 <merijn> I mean, *not* allocating is better, but compared to strict it's already pretty good without fusion
14:57 plakband joined
14:59 doodlehaus joined
15:03 <merijn> quchen: Look on the bright side, you could become ultimate prettyprint Czar of Haskell if you reimplement everything on top of wl-pprint ;)
15:03 cyborg-one joined
15:03 <mbw> That reminds me of something I wanted to ask. Why do some/most/all/? of the http-client libraries' "get" functions return lazy ByteStrings for efficiency reasons, even though the binary blob resides in memory?
15:04 <quchen> merijn: I always wanted to be a Czar!
15:05 <halogenandtoast> Another fun question.. is there a good way to group list elements with something like groupBy, but have them in tuples with the value I used for equality? For example [(PlayerOne, [1,2]), (PlayerTwo, [3,4,5]), (PlayerOne, [6])] ?
15:05 <merijn> mbw: Why do you assume the binary blob resides in memory?
15:05 <Rembane> mbw: Chunked HTTP response I believe might be the culprit here.
15:05 <merijn> mbw: The way HTTP works you can start accessing the data before it's finished
15:05 raichoo joined
15:06 <Aruro> is there good tutorila and docs for HaRe? wiki page is 2014 hmm.
15:06 <merijn> mbw: Consider downloading a GB file or something, you can start processing the lazy BS before the file has finished downloading (you'll block when you exhaust the part downloaded, obviously)
15:06 FullyFunctional1 left
15:08 <danharaj> cstrahan: you should ANN your gochan lib on HN i want to see a language flame wa
15:08 <c_wraith> I still want to know how it compares to chp
15:09 <mbw> Ok that makes sense. I thought I read that the whole string resides in memory, in conjunction with wreq. But now I can't find it :/
15:09 <halogenandtoast> I guess I could maybe write my own func with `span` soehow
15:09 <halogenandtoast> *somehow
15:09 <danharaj> c_wraith: cool lib i'll have to read about it
15:11 <codedmart> Anyone know why if I use `default-extensions: OverloadedStrings` in my cabal file `ghc-mod` complains if I don't have the `OverloadedStrings` pragma in the file?
15:11 <cocreature> codedmart: maybe it ignores default-extensions?
15:12 <ph88> does anyone know how i can resolve the type ambiguity in the type signature on line 105 ? https://bpaste.net/show/b7495fd638b0 above there is the ghci infered type, but i can not use that because the generics-eot package does not expose those types
15:12 Cale joined
15:12 petermw joined
15:14 cdg_ joined
15:14 uglyfigurine joined
15:15 raynold joined
15:16 marsam joined
15:17 <codedmart> cocreature: Hmm... that seems really annoying.
15:18 sssilver joined
15:20 coltfred joined
15:20 petermw joined
15:20 <codedmart> cocreature: I see I can pass options to ghc-mod for ghc.
15:22 be5invis joined
15:22 plugin joined
15:23 doodleha_ joined
15:24 muesli4_ joined
15:26 <cocreature> ph88: I think you have some kind of logic error in your code. if you pass http://sprunge.us/XdHT to GHC it will tell you that you need something of type c, but "toEot value" has type "Eot b"
15:26 mounty joined
15:26 mkoenig joined
15:26 oisdk joined
15:27 <be5invis> In FTG we have: http://lpaste.net/353771 . but can we do this? http://lpaste.net/353773
15:27 psychicist__ joined
15:29 jsgrant- joined
15:29 <cocreature> ph88: if you think about it, your type signature is claiming that for any b and some mapper function on a you can produce a c. but there is nothing that relates a b and c
15:30 <be5invis> Pi and Sigma are both standard type-intro-elim triplets. They could be unified i think.
15:31 jsgrant joined
15:32 oisdk joined
15:33 dawehner joined
15:33 certainty joined
15:34 watabou joined
15:34 ramzifu joined
15:35 Boomerang joined
15:36 plugin joined
15:37 oaao joined
15:39 augur joined
15:40 phaji joined
15:41 plugin_ joined
15:41 peterbec` joined
15:42 detrumi joined
15:42 jmelesky joined
15:43 lukaramu joined
15:43 Kreest__ joined
15:45 phaji joined
15:46 cultofmetatron joined
15:46 sighingnow joined
15:49 raycoll joined
15:50 <dolio> be5invis: This is in your implementation? I've definitely factored the type former part into a 'binder' plus a lambda/pi/sigma tag before.
15:50 <dolio> I'm not sure intro and elim benefit from that sort of thing as much, though.
15:53 ragepandemic joined
15:54 petrus joined
15:55 mada joined
15:55 Wizek joined
15:59 jathan joined
15:59 aeroxam joined
15:59 <aeroxam> yosh
16:00 <aeroxam> I got Badwindow errors while using gloss. gloass-examples won't run either
16:00 <aeroxam> It happened after a reboot, I don't know what I changed exactly, but I tried changing drivers and it didn't fix it
16:01 <aeroxam> kinda bummed
16:01 <Cale> Which platform?
16:01 jsgrant joined
16:01 <Cale> Linux?
16:01 <aeroxam> yes
16:01 <aeroxam> void linux
16:02 Jacoby6000 joined
16:02 <Cale> does glxinfo | head tell you that you're using direct rendering with the driver that you expect?
16:02 nycs joined
16:03 <Aruro> anyone using hare here? there is video on youtube and it has much more features than current version
16:03 <Cale> The old haskell refactoring thing?
16:03 <Aruro> yes, video is 8 year old
16:03 <Cale> oh, wow, people are keeping it up to date now
16:03 <magthe> I'm looking for programming exercises for building a working knowledge of the various type classes, i.e. something like "Solve the following problem by constructing a Monoid: <problem description>." Is there something like that out there?
16:04 <Cale> Maybe it lost features along the way, I dunno
16:04 <Aruro> it has nice features like generalising, not simple import struggle
16:04 MarioBranco joined
16:04 <Aruro> yeah, seems lots of stuff got lost. actually most important ones :D
16:04 <aeroxam> http://lpaste.net/353779
16:04 <aeroxam> I don't see a driver reference
16:05 <Cale> server glx vendor string: SGI
16:05 <Cale> server glx vendor string: NVIDIA Corporation -- what it says on my machine
16:05 <aeroxam> !
16:05 <Cale> I'm guessing you don't have an SGI video card ;)
16:06 <aeroxam> Nope x)
16:06 moongazer joined
16:06 <c_wraith> software renderer, then?
16:06 <Cale> probably
16:06 plugin joined
16:07 mmn80 joined
16:08 <aeroxam> so my nouveau drivers aren't installed properly, hm
16:08 dbmikus joined
16:09 MarioBranco joined
16:09 <Cale> Look in your Xorg.0.log for lines containing (EE) (and the surrounding context)
16:09 conal joined
16:10 wraithm joined
16:11 juliench1rch joined
16:11 tromp joined
16:11 <aeroxam> oh boy
16:11 <aeroxam> II) LoadModule: "nv"
16:11 <aeroxam> [ 10.214] (WW) Warning, couldn't open module nv
16:11 <aeroxam> [ 10.214] (II) UnloadModule: "nv"
16:11 <aeroxam> [ 10.214] (II) Unloading nv
16:11 <aeroxam> [ 10.214] (EE) Failed to load module "nv" (module does not exist, 0)
16:11 <Cale> Well, that's a pretty nice clue
16:11 <Cale> That should probably be either nvidia or nouveau
16:12 <tabaqui1> I want to build many similar executables
16:12 <Cale> If you look in /etc/X11/xorg.conf you should find the Driver line
16:13 MarioBranco joined
16:13 <tabaqui1> but with one different string constant
16:13 kosorith joined
16:13 <tabaqui1> I think, ghc could compile them as dynamically linked
16:13 <aeroxam> I don't have a xorg.conf
16:13 hackebeilchen joined
16:13 <tabaqui1> with constant imported from other module as symbol
16:13 angelos joined
16:13 mulk joined
16:14 <tabaqui1> create a swarm of tiny libraries exporting this constant
16:14 <tabaqui1> and then link with 'em static
16:14 sellout- joined
16:14 <tabaqui1> maybe there is already some nice solution
16:15 <tabaqui1> without modifying binary data and messing with ld?
16:15 <tabaqui1> ah, and I have to do this with Windows too
16:15 <tabaqui1> later
16:15 cultofmetatron joined
16:15 <Cale> tabaqui1: Maybe use CPP?
16:16 <tabaqui1> Cale: CPP preprocessor?
16:16 ikke joined
16:16 <Cale> yeah
16:16 <tabaqui1> it works before compilation
16:16 fendor joined
16:16 <Cale> yes
16:16 <aeroxam> I'll try making one since obviously automatic conf doesn't work
16:16 <tabaqui1> but ghc compiles too long for me
16:16 <Cale> Have one module which has a big #ifdef
16:16 KarboniteKream joined
16:16 kattak joined
16:17 kattak left
16:17 <Cale> Make sure it's a separate Haskell module, so that you can keep the .o and .hi files from compiling everything else
16:17 Faucelme joined
16:17 Sonolin joined
16:17 <Cale> So all that ghc has to rebuild is that one thing, and then relink
16:17 <tabaqui1> I can't wait, while ghc makes 100 unique compilations
16:17 <Cale> hm?
16:18 meandi_2 joined
16:18 <tabaqui1> Cale: yeah, I thought like this before
16:18 <Cale> I mean, you compile everything else once, so you have .o and .hi files
16:18 <tabaqui1> but looks like "stack build" recompile smth
16:18 <Cale> and then you compile that one module with different CPP directives however many times
16:18 <tabaqui1> hmm
16:19 <Cale> and rebuild your main executable each time
16:19 <Cale> It's quite probable that stack won't just want to do this
16:20 <tabaqui1> *fix a string
16:20 <Cale> But I don't know stack all that well
16:20 <tabaqui1> > time stack build
16:20 <lambdabot> error:
16:20 <lambdabot> Variable not in scope: time :: t0 -> t1 -> terror: Variable not in scope...
16:20 <lambdabot> • Variable not in scope: build
16:20 <tabaqui1> stack build 3.12s user 0.32s system 98% cpu 3.498 total
16:20 <tabaqui1> 3 seconds
16:20 <Cale> Is that your whole project?
16:20 <tabaqui1> yep
16:20 <Cale> That's not bad
16:20 certainty joined
16:20 <Cale> How many different builds do you need to do?
16:21 b4ff3r joined
16:21 <tabaqui1> dunno, every incoming user should get different executable
16:21 <aeroxam> thanks for your help Cale, rebooting to see if the xorg.conf helps
16:22 <Cale> aeroxam: You just just be able to restart X
16:22 <Cale> aeroxam: but rebooting will work
16:22 <Cale> should just*
16:22 <Cale> tabaqui1: 100 builds * 3 seconds per build = 5 minutes
16:23 robotroll joined
16:23 <Cale> This discussion is already longer than 5 minutes ;)
16:23 <tabaqui1> Cale: boss said that 3 seconds is fine result
16:24 <tabaqui1> thx anyway
16:26 Yuras joined
16:26 osa1 joined
16:27 cultofmetatron joined
16:28 fizruk joined
16:28 merijn joined
16:29 e14 joined
16:29 cpup joined
16:29 <Phyx-> tabaqui1: for windows you could put the strings in a resource
16:29 <Phyx-> and emmbed the resource in the exe later
16:29 <Phyx-> so you don't have to ever recompile
16:29 <Phyx-> I don't know if linux has a similar thing
16:30 <merijn> Phyx-: Yes, it's trivial, even
16:31 KarboniteKream joined
16:31 Younder joined
16:31 <merijn> Lemme lookup how I did it...
16:33 <Phyx-> that should be a heck of a lot quicker than 3 seconds and less complicated
16:35 watabou joined
16:35 <merijn> ugh, I can't seem to find the repo that did this
16:36 <merijn> You can use ld to turn any file into a binary with a start, length, and end symbol
16:36 dan_f joined
16:36 buoto joined
16:36 certainty joined
16:37 thunderrd joined
16:39 <Claudius1aximus> merijn: i think i tried doing something similar using the assembler with incbin or so, but it's been years since i touched it https://code.mathr.co.uk/binembed
16:40 buoto joined
16:41 <ph88> cocreature, maybe b is also suppose to be c
16:42 phyrex1an joined
16:42 Apocalisp joined
16:43 kattak joined
16:44 KarboniteKream joined
16:44 buoto joined
16:44 Noldorin joined
16:45 IanKelling joined
16:46 fizruk joined
16:48 fendor joined
16:52 AndreasK joined
16:53 jeltsch left
16:55 osa1 joined
16:56 ragepandemic joined
16:57 gawen joined
16:58 <shapr> Is there some way to print the kind of something from a Haskell program?
16:58 yinn joined
16:58 inad922 joined
16:59 <Cale> shapr: hmm... maybe via the GHC API
16:59 <jle`> well, type erasure
16:59 <monochrom> No, I think kinds are really erased.
16:59 <jle`> but how often do you really work with dynamic kinds
16:59 <Cale> (well, surely you could look at what GHCi is doing)
17:00 <shapr> Ok is there a way I can fire up ghci with a command to execute?
17:00 whaletechno joined
17:00 zar joined
17:01 <Cale> ghc -e ":k Maybe"
17:01 <shapr> Cale: ah, that does it, thanks!
17:02 <shapr> ghc -XDataKinds https://gist.github.com/cotrone/1a486f6eb3a1be98c6bb9f2672813a96 -e ":kind! (FizzBuzz 100)"
17:02 raycoll joined
17:02 <shapr> tolt made a funny thing.
17:02 <monochrom> Wait, GHC now takes URLs too?!
17:03 <shapr> no, but that's the file to use
17:03 angelos joined
17:04 <monochrom> Every program attempts to expand until it can download from URLs. :)
17:06 <Taneb> shapr, wow
17:06 <shapr> hey, tolt wrote it.
17:06 Xanather joined
17:06 e14 joined
17:07 <shapr> definitely super-cute
17:07 <Taneb> tolt, wow
17:07 nbro joined
17:07 KarboniteKream joined
17:07 <nbro> hi
17:08 <nbro> I was reading this paper http://cheatsheet.codeslower.com/CheatSheet.pdf and at page 3 it’s defined the data type data Color = C { red, green, blue :: Int }
17:08 <nbro> then it’s said we can only match "green"
17:08 <nbro> why?
17:08 aeroxam joined
17:09 <davean> nbro: its showing you HOW to match only green
17:09 ragepandemic joined
17:09 <nbro> davean: "we can match on green only"
17:09 <davean> yes
17:10 <davean> we CAN
17:10 <davean> we don't HAVE to
17:10 <nbro> then that doesn’t seem to be a good description of what the author did
17:10 <davean> not we can ONLY
17:10 <davean> You're reading in things the text doesn't say
17:10 <shapr> I'd argue the text could be clearer.
17:11 <dolio> We can (match on green only).
17:11 <shapr> "We could write code that matches only on green, here's how."
17:11 <dolio> Not, we can (match on green) only.
17:11 uglyfigurine joined
17:11 mmachenry joined
17:11 <koala_man> submit a patch: https://github.com/m4dc4p/cheatsheet/blob/master/CheatSheet.lhs#L382
17:11 <nbro> shapr: I agree
17:11 uglyfigurine joined
17:12 <ph88> bbl
17:13 BlueRavenGT joined
17:15 oish_ joined
17:16 kshukla joined
17:16 aarvar joined
17:16 plugin joined
17:17 C-16 joined
17:17 przembot joined
17:18 wraithm joined
17:19 plugin_ joined
17:20 nbro left
17:26 TheVip799 joined
17:26 <TheVip799> Hiiii
17:26 plugin_ joined
17:27 Berra joined
17:30 <* dmwit> waves vaguely
17:30 plugin joined
17:31 laserpants joined
17:31 tsahyt joined
17:32 <tsahyt> hello. is there some tool to better view profiling output? a vim folding plugin would work too I guess
17:32 gawen joined
17:32 pera joined
17:32 <dmwit> threadscope?
17:32 <tsahyt> for reference, this file is some 15000 lines and navigating it becomes quite painful
17:32 <jle`> there's profiteur
17:32 <jle`> which i use mostly
17:33 <tsahyt> dmwit: I mean the .prof file you get when running with -p
17:33 plugin_ joined
17:33 <dmwit> ah
17:33 <MarcelineVQ> did you ask ghc? :> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html#profiling
17:33 <tsahyt> jle`: that looks interesting. I'll give it a shot
17:34 <dmwit> MarcelineVQ: I guess he's asking about tools that help with step 3 there.
17:34 <tsahyt> yep
17:34 dylukes joined
17:35 zcourts joined
17:36 watabou joined
17:36 wraithm joined
17:37 certainty joined
17:37 <MarcelineVQ> I mention it because the page suggests hp2any which is quite a compehensive suite, I don't know if it's been kept up to date though
17:37 aarvar joined
17:37 sdothum joined
17:38 <tsahyt> MarcelineVQ: but that's for heap profiles I think
17:38 gillesmajor joined
17:39 <dmwit> tsahyt: Let's see how many irrelevant profiling-related tools we, as a channel, can suggest for you. ;-)
17:39 <dmwit> We're up to two at least.
17:40 <tsahyt> actually profiteur is quite nice so far
17:40 gillesmajor left
17:40 <dmwit> two irrelevant tools, one good one =)
17:41 aeroxam joined
17:41 <aeroxam> hoy
17:41 <aeroxam> so
17:41 <aeroxam> it was stupid.
17:42 gillesmajor joined
17:42 <dmwit> tell it to read a book!
17:43 peterbec` joined
17:43 <aeroxam> I just needed to add the user to the video group
17:43 serendependy joined
17:43 <aeroxam> ...
17:43 andress joined
17:43 ragepandemic joined
17:44 <aeroxam> I still have the server glx vendor string : SGI and for some reason Xorg still tries to load nv...
17:44 <aeroxam> but it works now
17:44 <aeroxam> actually loads nouveau, so
17:45 <aeroxam> I don't understand why it became a necessity to become part of the group. probably a weird mesa upgrade
17:45 <MarcelineVQ> aeroxam: glad you figured it out
17:45 <aeroxam> thanks
17:45 <aeroxam> I love gloss so I was sad
17:45 jsgrant- left
17:45 andress left
17:45 wildlander joined
17:46 mizu_no_oto_work joined
17:47 robertkennedy joined
17:49 <AndreasK> tsahyt: It might be a side effect of my Engineering background but I used Excel and it worked reasonably well.
17:49 dawehner joined
17:49 kshukla joined
17:50 <AndreasK> tsahyt: But probably breaks as well over a certain size
17:50 <tsahyt> AndreasK: the main thing I was looking for is folding, and profiteur does that well
17:50 kadoban joined
17:51 <dmwit> :set foldmethod=indentation ;-)
17:51 aarvar joined
17:51 <dmwit> Oops, just indent.
17:51 <AndreasK> tsahyt: The github page looks nice. I need to remember that one for next time
17:52 zdenal joined
17:52 <tsahyt> dmwit: that also works
17:52 <tsahyt> but it doesn't give you such a nice visualization
17:52 e14 joined
17:52 <dmwit> yeah
17:52 plugin joined
17:53 FullyFunctional1 joined
17:55 SpinTensor joined
17:57 xkb joined
17:57 taksuyu joined
17:57 <xkb> hi
17:58 jomg joined
17:58 <xkb> I have a beginner question. I have a function like so `countPerMap :: Map.Map T.Text [[T.Text]] -> Map.Map T.Text (IO [Int])`. How do I actually make those IO actions into Ints?
17:58 plugin joined
17:58 <xkb> I know about `sequence` but I'm not quite sure how to use i
17:58 <xkb> it*
17:59 Swizec joined
17:59 <nitrix> xkb: Do you mean t :: IO [Int] -> [Int] ?
17:59 replay joined
17:59 <monochrom> Cannot. What happened to countPerMap such that it ended up with "Map Text (IO [Int])" at the end?
18:00 <sbrg> xkb: It would probably be better to write your function so that it gives you something like: Map Text [[Text]] -> Map Text [Int] and then use IO on the result of that when needed
18:00 <xkb> the Int in this case comes from a call to an external system
18:00 <monochrom> Overall you probably need to read my http://www.vex.net/~trebla/haskell/IO.xhtml
18:01 Jacoby6000_ joined
18:02 dylukes joined
18:02 <tsahyt> :t traverse
18:02 <lambdabot> (Applicative f, Traversable t) => (a -> f b) -> t a -> f (t b)
18:02 <tsahyt> umm no, that's not what I meant
18:02 <tsahyt> :t sequenceA
18:02 <lambdabot> (Applicative f, Traversable t) => t (f a) -> f (t a)
18:02 <nitrix> xkb: IS the goal to perform all the IO's at once?
18:02 hatboi joined
18:02 <jle`> it does one of those xkb you can use sequenceA to turn a map of IO actions into an IO action returning a map
18:02 <nitrix> xkb: Or keeping them unevaluated in your data structure until needed?
18:02 <jle`> oh sorry i started typing with something already in the buffer
18:02 <hatboi> 125 ** (1/3)
18:02 <hatboi> 4.999999999999999 :: Floating a => a
18:03 <jle`> sequenceA :: Map k (IO a) -> IO (Map k a)
18:03 <hatboi> how can i have precise calculations?
18:03 <shapr> yay! I got approval to write Haskell at work as long as I'm willing to port the code to Python if it goes into production.
18:03 <tsahyt> :t sequence (undefined :: Map Text (IO [Int])))
18:03 <lambdabot> error: parse error on input ‘)’
18:03 <monochrom> Use Rational.
18:03 <tsahyt> :t sequence (undefined :: Map Text (IO [Int]))
18:03 <lambdabot> error:
18:03 <lambdabot> Not in scope: type constructor or class ‘Map’
18:03 <lambdabot> Perhaps you meant ‘M.Map’ (imported from Data.Map)
18:03 <tsahyt> hmpf
18:03 <monochrom> Ah but Rational doesn't do **
18:03 <shapr> Now I just need to write a libtshark binding
18:03 <jle`> xkb: sequenceA executes all of the IO actions, and then assembles the results into a new map
18:03 <xkb> Ill paste the code of that function.. sec
18:03 <monochrom> or cube roots
18:04 <tsahyt> :t sequenceA (M.empty :: M.Map Text (IO [Int]))
18:04 <lambdabot> error:
18:04 <lambdabot> Not in scope: type constructor or class ‘Text’
18:04 <tsahyt> ok I give up with this now
18:04 <Cale> Is one part in a quadrillion not precise enough?
18:04 <jle`> where each key in the new map corresponds to the result of the IO action that the original key had
18:04 <lpaste_> xkb pasted “io actions” at http://lpaste.net/353784
18:04 <lpaste_> xkb pasted “io actions” at http://lpaste.net/353785
18:04 wraithm joined
18:04 <hatboi> so cube roots?
18:04 <xkb> twice ??
18:04 <xkb> weird
18:04 <hatboi> but what if i have really weird exponentials
18:04 <hatboi> i also noticed i can't do 125 ** (1%3)
18:05 <jle`> you probably want traverseWithKey
18:05 <nitrix> xkb: Do you want to run all these IO or to keep them unevaluated in your data structure until needed?
18:05 <xkb> where `getDiffNr` does an external call to github
18:05 <Cale> hatboi: Yeah, because the result would be Rational
18:05 <magneticduck> :t (1 % 3, (**))
18:05 <lambdabot> (Floating a, Integral a1) => (Ratio a1, a -> a -> a)
18:05 uglyfigurine joined
18:05 <xkb> In the end i need to run them and write them to a file
18:05 <jle`> xkb: mapWithKey :: (k -> a -> b) -> Map k a -> Map k b
18:05 <Tuplanolla> If you think Haskell being "mathematical" means that it can do algebraic manipulations, you're mistaken, hatboi.
18:05 <Cale> hatboi: and of course, in general, nth roots aren't going to be rational
18:05 <jle`> xkb: traverseWithKey :: (k -> a -> IO b) -> Map k a -> IO (Map k b)
18:05 dawehner joined
18:05 <xkb> ah nice
18:06 <monochrom> hatboi: http://hackage.haskell.org/package/cyclotomic will help you to some extent.
18:06 <xkb> at least that gives a map
18:06 <jle`> the result is an IO action that produces each value by executing the function
18:06 <hatboi> haskell does not aid with maths?
18:06 <jle`> aid in what way?
18:06 <hatboi> i thought it was better to use a functional language for precise calculations
18:06 <Tuplanolla> Not like Mathematica, no, hatboi.
18:06 <monochrom> No, Haskell is not Mathematica.
18:07 <monochrom> Haskell is just a programming language.
18:07 <Tuplanolla> Unfortunately, I may add.
18:07 <jle`> hatboi: your result is precise enough for most engineering applications
18:07 <hatboi> damn
18:07 <hatboi> :(
18:07 <Cale> hatboi: Did you want like, a number theoretical cube root which would fail when given 124 for instance, because it's not a cube?
18:07 silver_ joined
18:07 <monochrom> It pains me that people look at the math-like notation and think it actually has math semantics.
18:07 <hatboi> was planning on using it in my scientific work
18:07 <jle`> no bridges are going to collapse because 4.99999999999999999 was used instead of 5
18:07 <jle`> same for scientific work, too, for the most part
18:07 <Cale> If you just want to round the number differently, that's doable
18:07 <Cale> as part of the display
18:07 <jle`> * instead of 5.000000000000000, that is
18:07 raycoll joined
18:07 <Tuplanolla> SymPy would've fit Haskell so much better...
18:08 <Cale> > showFFloat (Just 4) (125 ** (1/3))
18:08 <lambdabot> <[Char] -> [Char]>
18:08 <Cale> > showFFloat (Just 4) (125 ** (1/3)) ""
18:08 <lambdabot> "5.0000"
18:08 <jle`> as a scientist, i rarely run into a situation where 4.999999999999999 caused issues in calculations while 5.000000000000 did not
18:08 <shapr> Tuplanolla: yeah, I've heard people complain about sympy some lately.
18:08 <Cale> Note that this is actually less precise than the 4.999999999999999
18:08 <jle`> looks like a classic rage quit
18:09 <cocreature> floats are known to cause rage
18:09 <Tuplanolla> I can't blame him.
18:09 dcoutts_ joined
18:09 <MarcelineVQ> what will topple bridges and crash mars landers are unit converersions which a type system is swell for
18:09 connrs joined
18:10 <tsahyt> is there even something like sympy for haskell?
18:10 <monochrom> Not very scientifically minded if real world facts they don't like lead to quitting.
18:10 cfricke joined
18:10 <tsahyt> on the surface it doesn't seem too hard to implement symbolic maths in Haskell
18:10 <tsahyt> but I may be underestimating the amount of work involved by several orders of magnitude, as usually
18:10 <Tuplanolla> It's complicated regardless of platform, tsahyt.
18:10 robkennedy joined
18:10 <tsahyt> Tuplanolla: but still haskell seems to be a good fit
18:11 <Tuplanolla> Reliable rule rewriting systems are really difficult to build and Risch integration is hell.
18:11 uglyfigurine joined
18:11 ertesx joined
18:11 <monochrom> Haskell makes the parsing easier. That's probably about it.
18:11 e14 joined
18:12 <tsahyt> hmm. I should look into that a bit I guess
18:12 dcoutts joined
18:12 <tsahyt> so many potential projects, so little time
18:12 t7 joined
18:12 <jle`> overload numerical operators give you a nice little dsl, but it doesn't really help with the algorithms
18:12 <jle`> but i guess purity/algebraic data types would probably help
18:12 <tsahyt> yeah the overloading is what I was thinking of
18:12 <jle`> s/i guess/i am guessing
18:13 <tsahyt> you could nicely integrate it with the rest of the language
18:13 <tsahyt> no integration pun intended
18:13 <jle`> can you imagine implementing anything symbolic without algebraic data types
18:13 oisdk joined
18:13 <jle`> what brave souls
18:13 <tsahyt> well I can imagine it. but I don't want to
18:13 <Tuplanolla> Risch integration in particular is my go-to suggestion for crushing the souls of beginners asking for project ideas.
18:14 castlelore joined
18:14 castlelore joined
18:14 raycoll joined
18:15 fresheyeball joined
18:16 <jle`> i wonder if there is any CAS in the works for haskell
18:16 connrs joined
18:17 <monochrom> There was a dream. It was even on sourceforge. I know because I was one of the 3 dreamers (I think it was 3).
18:17 <jle`> a dream in time gone by
18:17 <monochrom> And another dreamer was wli, if you remember her.
18:17 <monochrom> (I forgot her new nick.)
18:18 oish_ joined
18:18 e14 joined
18:18 meister_ joined
18:18 <tsahyt> what went wrong?
18:18 <monochrom> And yes it was back in the days when sourceforge was the cool site and github didn't even exist (nor git itself).
18:19 <monochrom> We all had our respective real lives.
18:19 raycoll joined
18:19 <c_wraith> that nick sounds really familiar.
18:19 <monochrom> And perhaps it didn't go wrong, it went right.
18:19 <c_wraith> I wonder where I knew her from.
18:20 <Tuplanolla> On the topic of algebra systems, it really annoys me how existing algebra systems represent functions as expressions without bound variables.
18:20 <Tuplanolla> It makes everything needlessly complicated, because renaming becomes a burden for the user.
18:20 <meister_> Wanna free spins on Starburst without depositing anything? Try your luck for free money 20 Free Spins on signing up http://bit.ly/2n6f4iA
18:20 meister_ left
18:21 <monochrom> None of the 3 of us actually knew how to do CAS, so it went right that we went on to do what we respectively knew how to.
18:23 <jle`> your journeys will all somehow eventually lead you back to doing CAS again, but this time with the perfect skillset to achieve it
18:24 <jle`> it will be a nice movie
18:24 wraithm joined
18:24 Gurkenglas joined
18:24 <MarcelineVQ> starring your favorite actor monochrom bemberbunch cabberette
18:24 <monochrom> "No. This is 3 movies."
18:25 <Tuplanolla> Which universities have programs for getting a doctorate in everything?
18:25 chrissl joined
18:26 SitiSchu joined
18:26 <jle`> do you mean like, a "Doctor of Everything", or every possible doctorate
18:26 Detrumi joined
18:27 <Tuplanolla> Whichever it is for honing a perfect skillset.
18:28 psychicist__ joined
18:28 SitiSchu joined
18:29 SitiSchu left
18:29 <sssilver> What's the point of Haskell in a world that already has Java?
18:30 <monochrom> No, Haskell came before Java.
18:30 <lassulus> ups
18:30 <sssilver> But now Java is a thing
18:30 <Taneb> sssilver, what's the point of gloves in a world that already has socks?
18:31 mrpavo joined
18:31 <Taneb> Java and Haskell are both programming languages, sure, but are very different in their design and purpose
18:31 <monochrom> Haskell has no points. :)
18:31 <tsahyt> judging by the developments in java 8, I'd say if nothing else Haskell at least serves as a blueprint for features to make java bearable
18:31 <sssilver> Taneb both have been around for long enough where we can nonambiguously establish which one is better
18:32 peterbec` joined
18:32 <tsahyt> sssilver: better for what
18:32 <sssilver> i.e. which one has won the hearts and minds of programmers around the world
18:32 <sssilver> tsahyt programming programs
18:32 <tsahyt> there is no single answer to that
18:32 <tsahyt> you need to be more specific
18:32 <monochrom> I don't like this debate. But Java won, you can stop now.
18:32 <Athas> Java achieved massive industrial support very early. The tools are much better. But maybe if Haskell had the same support, the tools would be *even* better.
18:33 <tsahyt> monochrom: Java only won the popularity contest.
18:33 animated joined
18:33 <tsahyt> but I agree, this debate is not going to lead anywhere
18:33 <sssilver> fine
18:33 <monochrom> tsahyt, you understand that I said that just to stop wasting time.
18:34 fotonzade joined
18:34 <monochrom> "You are both pretty, can I go home now?" (from Megamind)
18:35 <tsahyt> I thought so, but I also have a bad habit of getting way too deep into debates like this
18:36 <monochrom> http://www.vex.net/~trebla/haskell/cont.xhtml New data added.
18:36 IanKelling joined
18:36 watabou joined
18:37 nadirs joined
18:37 <tsahyt> unrelated, is there any performance data on extensible effects vs monad transformers?
18:38 <Athas> Is there a way to cut down on the profiling information produced by +RTS -p? I'm not sure exactly what I want, but given that it has produced a 100MiB report, maybe slightly coarser cost centres or some aggregation?
18:38 <Athas> Any tools to help analyse this file, maybe?
18:38 jbiesnecker joined
18:38 <Tuplanolla> I think John A De Goes talked about the existence of such data, but I don't have it, tsahyt.
18:38 <tsahyt> heh, I just asked a similar question an hour or so ago
18:39 ptek joined
18:39 <Tuplanolla> Scour his blog maybe.
18:39 <tsahyt> Athas: profiteur is a decent tool to browse the output
18:39 <MarcelineVQ> monochrom: a version of exercise 5 came up in #haskell-beginners yesterday, you were guessing the typeclass from base instead of an animal
18:39 <tsahyt> Athas: of course you can always just use manual cost centers instead
18:39 <MarcelineVQ> oh you were there, gosh I have a bad memory
18:39 <monochrom> :)
18:39 <Athas> tsahyt: I'd rather not use manual cost centres... this program is too large for this. I'll try profiteur.
18:41 <tsahyt> Athas: when you have a rough idea of what module you want to look at, you can have cost centers generated just for one module too
18:41 <cocreature> Athas: https://github.com/fpco/ghc-prof-flamegraph is also great
18:41 <tsahyt> it works somehow by disabling -fprof-auto in general and then enabling it for this particular module
18:41 <monochrom> The two were related. Before I saw the typeclass game, I was pondering on whether to include my animal exercise or not. After seeing the typeclass game, I decided "yes!".
18:41 mou joined
18:41 <Athas> tsahyt: oh really? Say I know which module is probably interesting. How do I get only cost centres from there?
18:41 Discovery joined
18:42 lilred joined
18:42 <tsahyt> it's been a while so my memory is a bit hazy about that. I remember putting {-# OPTIONS_GHC -fprof-auto #-} or something along those lines in the relevant module and disabling automatic cost centers via --ghc-options or something like that
18:42 mrpavo left
18:43 <lilred> I have a noob question about deriving Show: http://stackoverflow.com/questions/42935549/haskell-deriving-show-for-fix-types
18:43 <tsahyt> but it definitely did revolve around setting -fprof-auto as desired
18:43 animated joined
18:43 takle joined
18:43 eacameron joined
18:43 mrpavo joined
18:43 gypsydave5 joined
18:43 vydd joined
18:43 vydd joined
18:43 <tsahyt> Athas: this was also on 7.10.3 iirc. I think it should still work on GHC 8 though
18:44 <tsahyt> Athas: for finding out which module is probably interesting it might also pay to do a per module heap profile. -hm iirc. Allocs and time spent tend to correlate strongly in haskell programs
18:44 <lilred> How do I derive Show for types written with Fix?
18:45 tomboy64 joined
18:45 Deide joined
18:45 <adelbertc> I often hear that Eff/extensible-effects/Free-r only works for "algebraic effects" - does anyone have a pointer to a book or paper that outlines what exactly constitutes an "algebraic effect?" I have an intuition for what it is but I'm looking for something written down/something to point to
18:48 fizruk joined
18:48 <nitrix> adelbertc: As long as the inner Fix'ed type is Show'able, it should be doable.
18:48 <nitrix> lilred: ^ wrong person :D
18:48 <adelbertc> :-)
18:49 <lilred> nitrix: but see http://stackoverflow.com/questions/38958895/how-to-derive-instances-in-recursion-schemes
18:49 <lilred> nitrix: whoops wrong question: http://stackoverflow.com/questions/42935549/haskell-deriving-show-for-fix-types
18:49 iomonad joined
18:49 sphinxo joined
18:49 <nitrix> lilred: Same answer as what I just said.
18:49 <tsahyt> does lambdabot have a .seen command or something like that?
18:50 <geekosaur> no
18:50 <nitrix> lilred: T2 will need a Show instance.
18:50 <geekosaur> if the person you're looking for is registered with nickserv, you can "/ns info" their nick
18:50 <nitrix> lilred: Which means T1, which means T1F.
18:51 <lilred> nitrix: nitrix: but T1F already derives Show
18:51 <geekosaur> (or longer form, for clients that don't speak the short one: /msg nickserv info thenickhere)
18:52 <nitrix> lilred: Oh it's gotta be Show1 according to the error.
18:52 <lilred> nitrix: interesting, I´ve never heard of Show1.
18:53 cultofme_ joined
18:53 <nitrix> lilred: Me neither. It's to show type constructors I believe.
18:53 PennyNeko joined
18:54 <nitrix> liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
18:54 <nitrix> showsPrec function for an application of the type constructor based on showsPrec and showList functions for the argument type.
18:54 <nitrix> Looks painful.
18:54 <dolio> adelbertc: The informal idea would be that you can give a finitary, possibly first-order signature to the operations involved.
18:55 freechips joined
18:55 <dolio> Like, get : () => s ; put : s => ()
18:56 <lilred> nitrix: that´s a bit above my level to be honest
18:56 <nitrix> lilred: The stackoverflow guy helped you.
18:56 <nitrix> lilred: You can apparently use the package https://hackage.haskell.org/package/deriving-compat
18:56 dawehner joined
18:57 <lilred> nitrix: yeah, I saw that. But that uses Template Haskell, which I´ve never used. I´ll try to make it work
18:57 includeals joined
18:57 ner0x652 joined
18:57 includeals left
18:57 <lilred> nitrix: I see `compat` in the name, would it be reasonable to assume that there is some language extension which does this?
18:58 mstruebing joined
18:58 snowalpaca joined
18:58 <adelbertc> dolio: ah that's interesting
18:59 <nitrix> lilred: Normally it's a sign of people writing a compatibility layer to migrate the code to newer versions of GHC and not having code breakable on older versions.
18:59 <adelbertc> Seems like there's not a lot of written defiNitions of algebraic effects :/
18:59 <nitrix> lilred: Possibly deriving Show1 is something GHC supports now.
18:59 augur joined
19:00 <dolio> Where the signatures are in terms of some set of sorts characterizing the algebra. And would definitely not allow you to specify higher-order operations _on the algebra_.
19:00 marsam joined
19:01 <monochrom> Is "forkIO :: IO a -> IO a" an example of non-algebraic effect?
19:01 {emptyset} joined
19:01 <dolio> Probably.
19:02 <dolio> Although maybe there's some algebraic way of specifying concurrent behavior.
19:02 <dolio> Another example would be `censor :: (w -> w) -> Writer w a -> Writer w a`.
19:02 <nitrix> lilred: Let me see if I can implement it for fun.
19:03 troydm joined
19:03 egis joined
19:03 <lilred> nitrix: <3
19:05 <dolio> mplus wouldn't fit my definition either, and I'm not 100% certain if that's correct.
19:06 <dolio> But you may have to break it down to be algebraic.
19:08 zcourts_ joined
19:09 twanvl joined
19:11 _sras_ joined
19:11 ubsan_ joined
19:12 <nitrix> lilred: That's not trivial to implement.
19:12 oisdk joined
19:12 <lilred> nitrix: yeah, that´s what I´m finding out.
19:13 ompaul_ joined
19:13 <lilred> nitrix: I ditched F# for Haskell just for the recursion-schemes thing, but I might have to go back >_>
19:13 tromp joined
19:13 chlong joined
19:13 <nitrix> lilred: I'm gonna need a value to show as well to test it.
19:14 e14 joined
19:14 <nitrix> lilred: Do you have anything in mind of what the result should look like?
19:14 oish joined
19:14 caumeslasal joined
19:16 <lilred> nitrix: showing `Bar (Fix Foo)` should show something approximating `Bar Foo`, modulo maybe some line noise
19:16 <lilred> nitrix: whatever is simplest
19:17 nomotif joined
19:17 tag joined
19:18 <cocreature> is there some fundamental reason why ShortByteString provides basically no operations or has simply nobody taken the time to implement them?
19:18 Wizek joined
19:18 <nitrix> lilred: Filling type holes slowly :P
19:19 <lilred> nitrix: that sounds involved :o
19:19 takle joined
19:19 <nitrix> lilred: Fix has always been a mindfuck for me :P
19:19 <nitrix> Which is partly why I'm interested.
19:20 marsam joined
19:20 <lilred> Oi, I got it to work with the StackOverflow guy´s comment!!
19:20 takle joined
19:20 <lilred> nitrix: check it
19:20 <lilred> https://gist.github.com/lilred/0ef087ff1e5d7e51c2df6796456ee8ed
19:20 <lilred> nitrix: ^
19:21 rcat joined
19:21 <nitrix> Mhm :P
19:21 Einwq joined
19:21 <nitrix> I'm trying to implement it manually ahah
19:21 HoierM joined
19:21 <nitrix> I'm guessing there's a reason why this other package exists and reifies types :P
19:22 <lilred> nitrix: it´s a blessing IMO
19:22 BassSultan joined
19:22 <lilred> nitrix: maybe there´s a way to get around having to derive 4-5 classes for every data type, using the content here: https://www.reddit.com/r/haskell/comments/1kmods/patternsynonyms_ghc_trac/cbqk5t2/
19:23 <splanch> has anyone played with https://www.schoolofhaskell.com/user/edwardk/phoas
19:23 <nitrix> lilred: Yeah I'm indeed getting stuck. I have to Turn `T1F a` into `a`, but the type constructor is unhelpful since it's a phantom type.
19:23 <nitrix> lilred: *value constructor
19:24 <splanch> i'm not sure what we get out of profunctorish church/yoneda-encoding, because the monad instance ends up replacing ALL bound variables
19:24 <_sras_> What is the best way to make a wrapper monad for IO so that one cannot use arbitrary IO functions in it, but is instead forced to use a set of functions that run in the wrapper monad?
19:25 <nitrix> _sras_: newtype MyMonad a = IO a ?
19:25 <nitrix> _sras_: newtype MyMonad a = MyMonad { unwrapMonad :: IO a }
19:26 <nitrix> _sras_: In its own module, you don't export unwrapMonad.
19:26 <cocreature> ezyang: if you need another example of where backpack might be useful: ShortByteString vs ByteString
19:26 <_sras_> nitrix: doesn't that require making monad instances for MyMonad?
19:27 <nitrix> _sras_: You can derive Monad for your newtype.
19:27 <lyxia> splanch: I would also like to know. You can decide at the substitution site how/whether to replace a given variable though.
19:28 <lpaste_> splanch pasted “phoas” at http://lpaste.net/353787
19:28 <nitrix> _sras_: You'll need NewtypeDeriving extension.
19:28 <nitrix> _sras_: Or you could re-implement it if you want, it's just less noisy to use GHC's extension.
19:28 <_sras_> nitrix: Yes.
19:30 <_sras_> nitrix: GeneralizedNewtypeDeriving this one, right?
19:30 <nitrix> Yush.
19:30 sportanova joined
19:30 <nitrix> _sras_: As long as unwrapMyMonad is not exposed, and you don't provide a function `myMonadLiftIO :: IO () -> MyMonad ()`, people wont be able to lift arbitrary IO computation in the IO that your newtype is hiding.
19:31 dawehner joined
19:31 <nitrix> _sras_: They'll have to use your helper functions that can themselves perform IO, but that's all.
19:31 gfixler joined
19:31 <Tuplanolla> That's the wrong way around, nitrix.
19:31 <nitrix> Tuplanolla: Is it?
19:31 <Tuplanolla> The constructor must not be exposed, but the destructor may be.
19:32 <nitrix> o.o
19:32 mrpavo joined
19:32 <nitrix> Oh you're right.
19:32 <nitrix> Tuplanolla: https://github.com/nitrix/lspace/blob/master/src/Game.hs#L48
19:32 <nitrix> Tuplanolla: So this is flawed?
19:32 connrs joined
19:33 <splanch> lyxia: what do you mean decide at substitution site?
19:33 <splanch> @lyxia
19:33 <lambdabot> Unknown command, try @list
19:33 BusFact__ joined
19:33 <nitrix> Tuplanolla: Flawed in the sense someone could create an evil arbitrary Game computations and >>= with existing ones?
19:33 <Tuplanolla> You're not exposing `MkGameState` there, nitrix.
19:34 <Tuplanolla> That would require `GameState (..)` in the export list.
19:34 tiny_test joined
19:34 jbiesnecker joined
19:34 <lyxia> splanch: I mean, you're using a function variable -> term to substitute, not just a simple term which gets replaced inconditionally for every variable.
19:35 <Tuplanolla> The same applies to `Game`.
19:35 dfeuer joined
19:35 <dfeuer> Ping edwardk
19:35 <nitrix> Tuplanolla: I'm exporting the Game type and not the Game constructor? Game vs. Game(Game) ?
19:36 <Tuplanolla> Yes, nitrix.
19:36 <Tuplanolla> That's fine.
19:36 <nitrix> So I got it right, yet I'm explaining it wrong. That's unfortunate.
19:37 tag joined
19:37 watabou joined
19:38 <nitrix> _sras_: So don't export the MyMonad constructor then.
19:38 cyborg-one joined
19:38 <_sras_> nitrix: Yes.
19:43 <adelbertc> dolio: i did some digging around on Twitter, found https://www.microsoft.com/en-us/research/wp-content/uploads/2016/08/algeff-tr-2016-v2.pdf which in the first paragraph points to http://homepages.inf.ed.ac.uk/gdp/publications/alg_ops_gen_effects.pdf
19:43 BassSultan joined
19:44 sunnny joined
19:44 wraithm joined
19:45 <BassSultan> hi, maybe someone can help me - i am trying to overload predefined functions. i got an example here (including error msg from the compiler): http://pastebin.com/10RBaCMx , thanks for any help!
19:46 <lyxia> BassSultan: indent show.
19:47 <lyxia> BassSultan: what you wrote means an empty instance followed by a top-level definition of show, different from the type class show.
19:47 <BassSultan> oh god.. :D thats embarassing.
19:47 <lyxia> You're going to have other problems though...
19:48 <BassSultan> jeah, now i get another message: The first argument of a tuple should have kind ‘*’..
19:48 <lyxia> a Show instance is already defined for pairs
19:48 <lyxia> and Num Int is not a type
19:48 <lyxia> Num is a typeclass
19:48 <BassSultan> ok, obviously there is some stuff i dont get yet
19:49 ompaul_ joined
19:49 dan_f joined
19:51 <codedmart> Is there something in aeson or another package that I can get an array of all my data record fields as text?
19:51 plugin joined
19:52 <monochrom> I don't understand the question. But if the JSON already uses an array/list, then aeson already parses it into an array.
19:53 sleblanc` joined
19:54 <codedmart> monochrom: That is what I want the `Text` out of the toJSON `HM.HashMap Text Value`, but I don't want to have to pass anything to it other the the data type itself. I just want to be able to say `someFn User` and get back `["firstName", "lastName", ...].
19:54 <codedmart> Does that explain what I am looking for more?
19:54 henriksod joined
19:55 <lilred> is there some standardized way of composing type constructors?
19:55 dylukes joined
19:55 <Tuplanolla> There's `Data.Functor.Compose`, lilred.
19:55 umib0zu left
19:56 <Tuplanolla> I'm not sure if that's what you mean.
19:56 <lyxia> codedmart: By record do you mean a Haskell record, data User = User { firstName :: ..., lastName :: ... }, and you want to get the field names?
19:56 <lilred> Tuplanolla: I think that´s it, thanks!
19:56 animated joined
19:56 <lyxia> codedmart: that's something Generics can do , I don't know whether there's already a library for that
19:57 sleblanc` joined
19:58 JeanCarloMachado joined
20:01 <lilred> Tuplanolla: is there a way to perform that composition without using a newtype wrapper?
20:02 <Tuplanolla> I guess you could just type them out, lilred.
20:02 jbiesnecker joined
20:03 <Tuplanolla> @let type ComposeLike f g a = f (g a)
20:03 <lambdabot> Defined.
20:04 <Tuplanolla> > Just (Right 42) :: ComposeLike Maybe (Either ()) Int
20:04 <lambdabot> Just (Right 42)
20:04 <lilred> amazing, thanks!
20:04 <Tuplanolla> Why though?
20:04 <lilred> Tuplanolla: recursion scheme shenanigans. I´m trying to fix over a composition of two type constructors.
20:05 jbiesnecker joined
20:06 <lilred> Tuplanolla: whoops, that doesn´t work - type synonyms don´t support partial application -_-
20:07 <Tuplanolla> If you're working with `cata` or `ana`, then `Compose` should do what you expect.
20:07 balor joined
20:07 certainty joined
20:08 <Tuplanolla> There's an extension for making pattern matching on it nicer too.
20:08 <Tuplanolla> It was `ViewPatterns` or `PatternSynonyms`.
20:09 jbiesnecker joined
20:09 <lilred> Tuplanolla: yeah, I guess I´m gravitating towards pattern synonyms.
20:09 <Sornaensis> why pattern synonyms
20:10 halogenandtoast joined
20:10 <sbrg> lilred: but type syonyms can be partially applied types, if that helps
20:10 <lyxia> codedmart: http://lpaste.net/353789
20:11 ChaiTRex joined
20:12 chrissl joined
20:13 theelous3 joined
20:15 takle joined
20:16 zaquest joined
20:17 <codedmart> lyxia: Awesome thanks!
20:17 <codedmart> Sorry was at lunch
20:17 <codedmart> I need to dig into Generics more.
20:19 <shapr> I want a logo like those generic products that are only black and white with text that says "Haskell Generics"
20:19 anuxivm joined
20:20 replay joined
20:20 allenj12 joined
20:20 locallycompact joined
20:25 wraithm_ joined
20:25 <cocreature> can I get a Ptr Word8 to a MutableByteArray so I can memcpy my way to glory?
20:26 <splanch> apologies; i'm still failing to find a way to usefully >>= Rec TermF a b while staying parametric
20:27 <lilred> Grmbl, I keep running into problems that require more and more sophisticated type machinery. Now I´m looking for type-level lists. I might just switch to Coq.
20:27 <splanch> if we're parametric we can't discriminate variables? and if we're not, we can create exotic terms etc
20:28 chrissl joined
20:28 snowalpaca joined
20:28 <cocreature> ah I think copyAddrToByteArray might actually do what I want
20:29 richi238 joined
20:30 <balor> It looks like Haskell's facebook bindings are no-longer maintained (https://github.com/prowdsponsor/fb). Are there maintained bindings elsewhere?
20:30 <shapr> graphql?
20:32 <codedmart> lyxia: I haven't tried it yet, but lets say I have `data User = User {_id :: Text, _firstName :: Text}`, and I want it print it as `["id", "firstName"]`. Would I just need to do something similar to how aeson does it with modifiers?
20:33 <lyxia> yeah
20:33 <codedmart> OK cool thanks again.
20:33 <lyxia> yw
20:34 oisdk joined
20:34 shayan_ joined
20:36 jbiesnecker joined
20:37 grayjoc joined
20:38 mizu_no_oto_work joined
20:39 watabou joined
20:39 <ezyang> cocreature: Haha, yes! But ShortByteString really doesn't suport many ops
20:40 sportanova joined
20:40 <cocreature> ezyang: yep, but it should!
20:40 <cocreature> and once you get the primitives down the rest is just duplicated code
20:41 sportanova joined
20:41 <ezyang> I guess I'll add short ByteString to my CHART OF DOOM
20:42 <MarcelineVQ> the chart
20:42 moth joined
20:42 MarioBranco joined
20:42 <Tuplanolla> Can the type system run Doom yet?
20:43 <shapr> Vorpal: hello! Have you started learning Haskell?
20:43 <Tuplanolla> That better be what the chart is for.
20:43 ChaiTRex joined
20:44 ramzifu joined
20:44 tomboy64 joined
20:45 Unhammer joined
20:45 <lyxia> Tuplanolla: It doesn't handle floating point operations yet.
20:46 conal joined
20:47 <cocreature> surprisingly my implementation of packCString for ShortByteString doesn’t seem to segfault
20:47 plugin joined
20:47 bjz joined
20:48 <shapr> Vorpal: I recommend haskellbook.com or brent yorgey's Haskell course
20:48 chlong joined
20:49 tomboy64 joined
20:50 <lilred> What would be the best way to obtain a term-level integer from a type-level integer?
20:50 fizruk joined
20:50 <monochrom> knownNat
20:51 <BassSultan> just a quick question before i continue wasting my time: is it possible to include a type defined with "type Interval = (Double,Double)" into an instance declaration?
20:51 <monochrom> let me double-check
20:51 <monochrom> natVal and natVal'
20:51 <monochrom> It's in GHC.TypeLits again and you probably knew
20:52 <lilred> monochrom: I probably knew? :p
20:52 mrpavo joined
20:52 <cocreature> BassSultan: you need TypeSynonymInstances iirc but then it should work
20:52 <lilred> monochrom: I´m a Haskell noob, wandering in from the everything-but-Haskell world (including a bit of Coq)
20:52 <BassSultan> ok, thanks - let me google that :)
20:53 <balor> The docs in Hackage suggests `checkStatus` is in http-conduit, but the function appears to have disappeared from the latest version (https://hackage.haskell.org/package/http-conduit-2.2.3.1/docs/Network-HTTP-Conduit.html). Is this just a case that someone has forgotten to update the docs?
20:53 <monochrom> I recommend against starting Haskell from the dependent-type angle.
20:54 sportanova joined
20:54 <monochrom> Or the proof angle (same difference, what Curry and Howard said).
20:54 <cocreature> balor: looks like it, it’s called checkResponse now
20:54 <lilred> monochrom: I´m approaching from the generic traversal angle - scrap your boilerplate, recursion-schemes, etc
20:55 <balor> cocreature, ah, I see that now. Thanks.
20:55 ninegrid joined
20:55 jbiesnecker joined
20:55 <monochrom> There are type-level numbers in traversals?!
20:56 lithie joined
20:57 conal joined
20:57 <lilred> monochrom: I´m trying to figure out if I can get mutually recursive datatypes out of recursion-schemes, the connection with type-level numbers is actually pretty tenuous
20:57 <codedmart> lyxia: got another question as I try and understand all this. How hard is it to add the ability to list nested fields? Say I have `data User = User {name::Text, address::Address}; data Address = Address {street::Text, state::Text}` and have it print `["name", "address.street", "address.state"]`
20:57 jsgrant- joined
20:58 <codedmart> I don't fully understand what is going on in that code yet.
20:59 electrostat joined
20:59 <lilred> monochrom: know anything about using recursion-schemes for mutually recursive datatypes?
20:59 <monochrom> If I am given value-level "fix" and try to get a pair of mutually recursive values, I would implement it by one tuple and use fix for self-reference.
20:59 sportanova joined
21:00 <monochrom> And so if I wanted to do the type-level analogous thing, I would attempt "a type-level tuple" too. Except I don't know if it's actually doable in Haskell.
21:00 carlosdagos joined
21:00 danthemy_ joined
21:00 jsgrant- joined
21:02 <lilred> monochrom: and the variadic approach would use a type-level list, but those are ¨downstream¨ from type-level nats. Hence my interest in type-level nats :o)
21:03 peterbec` joined
21:03 <lilred> monochrom: type-level tuples are definitely possible.
21:03 <lilred> @let newtype (:*:) f g x y = Prod (f x y, g x y)
21:03 <lambdabot> Defined.
21:04 <lilred> monochrom: and then you can fix on that
21:04 wraithm joined
21:04 <lilred> monochrom: but then I´d like an ergonomic, variadic approach.
21:06 ChaiTRex joined
21:07 <dolio> That's not a type-level tuple. That's a product of two bifunctors.
21:08 <lilred> dolio: sorry :c
21:12 rcat joined
21:15 e14 joined
21:15 exferenceBot joined
21:16 balor joined
21:16 Itkovian joined
21:17 <shapr> Itkovian: you still writing Haskell?
21:17 <Itkovian> Seldomly
21:17 <Itkovian> Sadly
21:17 <shapr> ah, too bad
21:18 <shapr> I just got approval to write Haskell at this python shop, as long as I'm willing to port to Python if something goes into production.
21:18 <Itkovian> I mostly use it for small tools and solving programming contest questions
21:18 <Itkovian> sounds nice, but the porting might be ... difficult at times, no?
21:18 <shapr> could be, but I'll cross that bridge if I have to
21:19 <Itkovian> I guess the idea is that it runs so fabulously, they will want to keep the Haskell version?
21:19 <sbrg> just make sure the stuff you write is so good that it doesn't have to be ported ;)
21:19 <sbrg> exactly
21:19 <shapr> Yes, I am hoping for fabulous code.
21:19 <monochrom> Do write them the most continuation-passing, algebraic-typing Python that the world has ever seen!
21:19 <Itkovian> right now, I'm Pythoning and trying to add some go (since the tools we need have libs in go)
21:20 <shapr> yeah, we use Go here, it's okay
21:20 <Itkovian> wish I could have some Rust and Haskell as well
21:20 <sbrg> just tell them you ported it and set up an elaborate alias map that maps all commands from your python build tool to the appropriate stack commands
21:20 <monochrom> Err actually with continuation-passing you can probably scratch algebraic-typing.
21:21 christiandiloren joined
21:22 takle joined
21:22 balor joined
21:22 sportanova joined
21:22 <christiandiloren> I've got a yesod project I'm trying to get up and running but `stack test` seems to not see the module Settings. It gives me undefined symbols errors such as ..._Settings_appCopyright_closure since it is being referenced in one of the hamlet files. Any ideas?
21:23 <christiandiloren> I know that it is not getting that particular module since I removed references to a different function in Settings and then another one popped up immediately.
21:23 <geekosaur> you forgot to list the Settings module in the exported modules, probably
21:23 <geekosaur> or in other-modules if it's not supposed to be directly accessible
21:23 <christiandiloren> Well, it's actually already in there.
21:23 <christiandiloren> I wish that was the issue. :-)
21:24 <geekosaur> oh wait, test
21:24 djfo joined
21:24 <christiandiloren> Yes.
21:24 <geekosaur> make sure the package is listed as an explicit dependency of the test program?
21:24 <christiandiloren> I have the typical build-depends option listing the app properly.
21:25 <geekosaur> also, if that module is in an executable instead of the library, it needs to be moved to the library
21:25 <geekosaur> because modules that are part of executables are wired to that executable, not exposed for others, not even tests
21:26 erisco joined
21:26 <christiandiloren> Okay, I just tried adding it to the 'other-modules' key for the test target but it seems to not change anything.
21:26 <erisco> nothing kills my enthusiasm more than working with monads, ugh
21:26 <christiandiloren> BTW, how would I be able to tell if it is tied to an executable?
21:26 mmo joined
21:26 <shapr> erisco: poor guy, monads are fun!
21:27 <sbrg> christiandiloren: is it an executable target or a library target in your cabal file?
21:27 mmo left
21:27 <christiandiloren> library
21:27 <christiandiloren> I can post a gist of my cabal file if that might be helpful.
21:28 <sbrg> sure
21:28 <christiandiloren> https://gist.github.com/rcdilorenzo/2241b43fc0cd687a8fdef5f58fb1a490
21:28 <christiandiloren> Thanks, btw, for the assistance.
21:28 wraithm joined
21:29 Sose_ joined
21:29 <christiandiloren> The thing that's a bit odd is I have only modified the project slightly from its originally generated state.
21:30 <MarcelineVQ> which module contains Settings and/or appCopyright from your error
21:31 <christiandiloren> Settings is the module name.
21:33 <christiandiloren> I shouldn't have to do anything if `{-# Language CPP #-}` is at the top of the module, right?
21:34 <christiandiloren> I assume that just indicates to GHC that it has preprocessor statements in it.
21:34 pwnz0r joined
21:37 <Itkovian> shapr what tool/project are you going to hlorify?
21:37 a3Dman joined
21:37 <shapr> ha, hlorify?
21:38 <shapr> Itkovian: I want something like scapy, but I could be okay with an ffi wrapper around libwireshark
21:39 watabou joined
21:41 Koterpillar joined
21:41 <Itkovian> TIL
21:41 plugin joined
21:45 christiandiloren joined
21:46 <christiandiloren> I lost my connection but I resolved the issue.
21:46 <MarcelineVQ> what was the fix?
21:46 <christiandiloren> Apparently, rebooting sometimes solves issues.
21:47 <christiandiloren> Not that I intended to--I actually got a kernel panic from a different app. :-)
21:47 <monochrom> haha
21:47 <geekosaur> oh dear. that makes me wonder if you got memory corruption or something
21:47 <christiandiloren> A little bit creepy but I'm okay with that since it's fixed now. :-)
21:47 <monochrom> I say that they have the same hidden variable cause. Kernel file handling bug.
21:48 <christiandiloren> Thanks so much for the help, though. I've only come on the #haskell twice, and I've gotten excellent help both times.
21:48 <christiandiloren> Once I actually become more skilled with Haskell and Yesod, I'll be able to hopefully give back a little. :-)
21:49 <christiandiloren> monochrom: I'm actually sure which process it was. I write Objective-C for iOS and can read the stack traces on my Mac when it has problems. :-)
21:50 Itkovian joined
21:51 carlomagno joined
21:51 BlueRavenGT joined
21:52 wagle joined
21:52 hiratara joined
21:53 <erisco> I thought for MonadIO types you usually found a M a -> IO a function called "exec" or something
21:54 allenj12 joined
21:54 <Cale> runM
21:54 jbiesnecker joined
21:56 mda1 joined
21:56 <erisco> hrm, looking at Data.SBV and I don't see such a function
21:57 oisdk joined
21:57 <erisco> they have a function called "prove" which works for some things but not all
21:57 <erisco> they perhaps didn't design this part of the library so well, I don't know, it is strange
21:58 <erisco> they have Symbolic which is their MonadIO type, but then many functions which return IO
21:59 <erisco> whereas I'd expect everything to return Symbolic expect for a final runM or execute or whatever
21:59 <erisco> except
21:59 hiptobecubic joined
21:59 strykerkkd joined
21:59 Rainb joined
21:59 jsgrant joined
21:59 Lord_of_Life joined
21:59 wraithm joined
21:59 sportanova joined
22:00 <erisco> it seems they want you to drop out of Symbolic early and work in IO
22:00 JeanCarloMachado joined
22:00 <erisco> but practically this is a headache
22:01 JagaJaga joined
22:02 takuan joined
22:02 <erisco> because every time you have to start in Symbolic and funnel everything into one of the Symbolic A -> IO B functions
22:03 Edith joined
22:03 uglyfigurine joined
22:07 wraithm joined
22:07 Koterpillar joined
22:07 stef204 joined
22:09 fotonzade joined
22:09 uglyfigurine joined
22:11 ChaiTRex joined
22:12 <centril> I'm in the process of writing my bachelors thesis - and I'd like some inspiration from you guys... If possible, could you send me yours ?
22:12 Itkovian joined
22:14 tromp joined
22:15 <maerwald> write a better compiler than GHC
22:16 crobbins joined
22:18 <centril> maerwald: I already have a project - I need some inspiration for writing text ;)
22:18 <Tuplanolla> I have just what you need.
22:18 <maerwald> writing text?
22:19 <Tuplanolla> @google simon peyton jones to write a great paper
22:19 <lambdabot> Plugin `search' failed with: connect: does not exist (No route to host)
22:19 <* erisco> channels his energy towards centril
22:19 <Tuplanolla> @google simon peyton jones to write a great paper
22:19 <lambdabot> https://www.cis.upenn.edu/~sweirich/icfp-plmw15/slides/peyton-jones.pdf
22:20 <erisco> I haven't written much academically, but I started conversationally and then removed the conversational bits
22:20 <centril> Tuplanolla: oh, that's nice - SPJ is always a good source
22:20 <erisco> because I do not usually write in such a dry way
22:20 <centril> how neat, some comic sans...
22:20 <centril> :P
22:20 <Tuplanolla> There's a talk of it as well, if you prefer that, centril.
22:20 <Tuplanolla> @google simon peyton jones to write a great paper on youtube
22:20 <lambdabot> https://www.youtube.com/watch?v=g3dkRsTqdDA
22:21 <centril> Tuplanolla: <3
22:21 louispan joined
22:22 <maerwald> erisco: can you give us a sample?
22:23 <maerwald> I have a hard time imagining it
22:23 <maerwald> (except I see two guys rapping a haskell paper)
22:23 <erisco> of the transition between the two? no I don't have anything readily available
22:24 <Tuplanolla> Write a big blog post and correct the things your supervisors or reviewers complain about, maerwald.
22:24 <maerwald> Tuplanolla: what do you mean?
22:24 <erisco> but if you look at academic writing there is little fluff, flavour text, story telling
22:24 <Tuplanolla> (Not entirely serious.)
22:24 <erisco> but other writing tends to have those things to be interesting
22:25 <erisco> so I began by telling it like it was a story, then just removed the superfluous parts after
22:25 CurryWurst joined
22:25 <erisco> it is a more natural way for me to extract the ideas from my head
22:25 <maerwald> you mean you write more O'Reilly book style at first?
22:25 <erisco> yes, like I was writing it like a tutorial
22:26 <centril> erisco: so... did you write your content chronologically first ?
22:27 mettekou_ joined
22:27 tomphp joined
22:27 <erisco> I just told the story of my research, so yes, it was chronological
22:27 <centril> erisco: because a lot of the stuff going on in my brain is : "first I did this, then that, that was bad, so then I did this, and that was good, so I did more, etc."
22:27 <erisco> it happened to end up in the same order anyways but I suppose you could change it if necessary
22:28 <centril> erisco: right - so it is OK to write it like it is in my brain and not start with a non-chronological thing
22:28 <centril> thats good
22:28 <centril> now im happy again
22:28 uglyfigurine joined
22:30 lilred joined
22:31 wraithm joined
22:31 hiratara joined
22:31 <erisco> a rewrite you can do is "I tried this and found that" to "This resulted in that", and similar
22:32 zero_byte joined
22:33 fotonzade joined
22:33 <centril> erisco: ah, in editing ?
22:33 <erisco> if you really struggle removing the "I" then you can use "we"
22:33 <centril> "We" is fine - we decided that active is better than passive in our stuff
22:34 <maerwald> huh, I wasn't even allowed to use "We"
22:35 <erisco> when it is something pertaining to your subjectivity, I think it makes sense
22:35 <erisco> so if you arbitrated that active is better than passive it seems fine to say "we"
22:35 <Tuplanolla> These are the least important details.
22:35 <erisco> but otherwise you can just state the fact
22:36 <erisco> it is important when you're trying to figure out how to rewrite into an academic tone
22:37 <centril> erisco: right, so if we are talking about us specifically, then we use "we" - otherwise not
22:37 <centril> like: "we" is better than: "the group"
22:37 louispan joined
22:37 sportanova joined
22:38 certainty joined
22:38 <centril> erisco: So I guess it's fine if I just write about what we/I did and then you fix stuff in editing ?
22:39 lambda-11235 joined
22:39 <erisco> the only thing that matters is what you end up with
22:39 <centril> :P
22:40 TheVip799 joined
22:40 <erisco> that is how I started, and rewrote once I had my ideas down to come up with a final paper
22:40 jbiesnecker joined
22:41 snowlion_ joined
22:41 watabou joined
22:41 <centril> erisco: you did it alone ? our group has 6 members
22:41 <erisco> yes
22:42 <erisco> I haven't done group writing so I don't have any advice to offer
22:42 <centril> ah, still - it was really good advice
22:42 <okeuday_bak> within the IO monad, using the fail function wraps the string in "user error ()", there isn't any functional difference other than this when compared to using error directly, right?
22:43 <Tuplanolla> Suffer as other write dodgy LaTeX and 1000-character lines.
22:43 <centril> erisco: i've had a mental block about writing text for the report thinking that I can't just write it chronologically like a story - now it is kinda gone
22:43 <Tuplanolla> That's group writing for you.
22:44 <centril> Tuplanolla: hah - I'm not letting crap into my report... maybe I'll accept badly written code in pull requests for the bachelors project, but not the report ^^
22:44 <erisco> if there is a better organisation it will become more apparent once you can see all the key points written down
22:44 araujo joined
22:44 araujo joined
22:44 <centril> Tuplanolla: for our "planning report" we did like a complete review of it 10 times before sending it in
22:45 <centril> erisco: =)
22:45 <lyxia> > ((fail "" :: IO ()) `seq` (), (error "" :: IO ()) `seq` ()) -- okeuday_bak
22:45 <lambdabot> ((),*Exception:
22:45 <erisco> but like SPJ says in his slides, the paper should be designed to convey knowledge to others
22:45 skapazzo joined
22:45 <erisco> so introducing concepts before they are used, with examples, is a good idea
22:46 <okeuday_bak> lyxia: thanks
22:46 <centril> erisco: right - we got some practice with that in our planning report
22:47 Voldenet joined
22:47 Voldenet joined
22:47 moth joined
22:48 sigrlami joined
22:48 Gurkenglas_ joined
22:50 vydd joined
22:50 vydd joined
22:51 vydd joined
22:52 vydd joined
22:52 <centril> erisco: would you like to read it btw? maybe you can offer some advice?
22:52 ramzifu joined
22:54 kvda joined
22:56 JeanCarloMachado joined
23:00 <centril> Anyone else can ofc also read it if they so wish =)
23:01 ew_ joined
23:01 <ew_> hello
23:02 gabluc joined
23:02 <ew_> I'm having problems with quickchek
23:02 <ew_> quickcheck tells my property is failing and giving me the example
23:02 <ew_> but the example actually doesn't fail
23:03 <centril> ew_: if you can show us some relevant code we can more easily help you =)
23:03 <ew_> I'm preparing a pastie
23:03 <ew_> ;D
23:03 <ew_> thank you!
23:03 mettekou joined
23:03 <centril> ew_: oh, right =)
23:04 ccomb joined
23:05 mettekou_ joined
23:05 snowalpaca joined
23:05 snowalpaca joined
23:06 Tiberium_log_bot joined
23:06 <ew_> http://lpaste.net/9160497602586738688
23:06 KarboniteKream joined
23:07 <ew_> it is the first time I'm using QuickCheck in a project that is not very small
23:07 <ew_> So I may be doing something very silly
23:08 lambda-11235 joined
23:08 <codedmart> lyxia: Did you happen to see my previous question?
23:08 <codedmart> I don't know enough about generics yet to know if it is possible.
23:09 <ew_> centril: done
23:09 <ew_> I kinda was making the pastie, but hey, I don't have to keep my code secret
23:09 <ew_> it is BSD3 =D
23:09 <ertes> ew_: have you verified that mkGraph does actually do what you think it does?
23:10 <lyxia> codedmart: sorry I didn't see it, but I just found it now that you mention it.
23:10 <codedmart> Say I have `data User = User {name::Text, address::Address}; data Address = Address {street::Text, state::Text}` and have it print `["name", "address.street", "address.state"]`
23:10 <codedmart> Repeated @lyxia
23:10 <codedmart> Is that possible>
23:10 <codedmart> Is that possible?
23:10 <ew_> ertes: mkGraph is a pure function that creates the graph. And it is not my function. It is from Data.Graph.Inductive
23:10 <ertes> ew_: i.e. that (TG $ mkGraph [(0,"0"),(1,"}H\SOHB[\EOT{"),(7," \DLE\ETX\145"),(8,"Z\b")] [])) actually matches the test case that quickcheck reported
23:10 <codedmart> Basically to keep expanding nested data?
23:11 <lyxia> that looks feasible.
23:11 <codedmart> Where is the best place to read about all this or how I would go about it?
23:11 MrWoohoo joined
23:11 aarvar joined
23:11 <codedmart> This is all new and out of my realm at the moment
23:13 <lyxia> You can start learning about generics on the GHC.Generics documentation, it shows an example
23:14 <ertes> ew_: also why aren't you using the test case verbatim?
23:14 <ew_> test case verbatim?
23:14 hamishmack joined
23:14 <ph88^> Because a parser combinator-based program is generally slower than a parser generator-based program, Parsec is normally used for small domain-specific languages, while Happy is used for compilers such as GHC.[7] from https://en.wikipedia.org/wiki/Parsec_(parser) how come parser-combinator are slower? does this apply even to attoparsec ?
23:15 <ertes> ew_: the test case you gave to prop_self_equiv is not the same as the failing test case that quickcheck reported
23:15 <ertes> ph88^: they aren't slower… i think that's a misconception
23:15 <ertes> ph88^: parsec is slower
23:16 <ph88^> ertes, maybe the wikipedia page should be edited ?
23:16 <ertes> attoparsec is pretty fast, but still far from the optimum
23:16 <ew_> Uhm, it may be a mistake
23:16 <ph88^> how would you even write the optimum in haskell
23:16 <ertes> ph88^: have fun =)
23:16 <ew_> but it happends ith the same tests
23:16 <ph88^> i was using lemon before which generate special tables for gcc
23:17 <ertes> ph88^: here is a parser monad that is very close to the optimum: StateT ByteString Maybe
23:17 <lyxia> codedmart: I don't know where you can read about type-level literals, but perhaps you can make do with the bit I gave you.
23:17 <ertes> ph88^: here is another one (they're not the same): MaybeT (State ByteString)
23:17 <codedmart> lyxia: OK I will see if I can figure anything out.
23:17 <centril> ph88^: well, if you want optimum performance you should drop a lexer pass altogether to begin with... but then you get a parser that is totally unmanageable
23:17 <ew_> ertes: http://lpaste.net/353790
23:17 <centril> it's OK to pay some perf penalties for something that is well written and manageable
23:18 <centril> but there is a limit i guess
23:18 <ertes> ph88^: you can get even closer by distinguising non-consuming fails from consuming fails and recovering parsec's user-controlled backtracking (try)
23:19 Rizy joined
23:19 dougger joined
23:19 <ertes> ew_: again: verify that mkGraph actually agrees with its own result
23:19 <lyxia> codedmart: But I think here you need to: 1) modify the first instance (GFN (M1 S ... f)) to try and get the sub-fields recursively, if any. 2) write an instance for the K1 type. This will probably make more sense once you've gone through the GHC.Generics example.
23:20 <ertes> ew_: TG (mkGraph [(0,"eibl"),(1,"1"),(2,""),(8,"\250\SOH")] [(0,8,False)])
23:20 <ertes> *without* prop_self_equiv
23:20 uglyfigurine joined
23:21 bungoman joined
23:21 gabluc joined
23:23 mettekou joined
23:23 <ew_> it does
23:24 <ew_> but the problem now is quickcheck
23:24 benl23 joined
23:24 <ew_> when I run prop_self_equiv, it returns True
23:24 <ertes> ew_: it's unlikely to be quickcheck's fault though
23:24 <ew_> but QuickCheck fails for the same example
23:24 <ew_> Yes, I know
23:24 <ertes> ew_: for example sometimes Show instances aren't entirely honest… they might give the same string for values that are subtly different – supposedly an internal difference that somehow leaks through the API anyway
23:25 <ew_> Probably also not mkGraph, because its from fgl
23:25 <ew_> or maybe I'm using Arbitrary wrong
23:25 gpbaran joined
23:25 <ertes> that would only affect the quality of your test cases, not the correctness of the test
23:25 <dougger> Hi. Is anyone familiar with using servant-client to delete resources from a remote resource? In particular, I seem to need a content type for the DELETE verb when the remote resource returns no content.
23:26 <dougger> Code and error: http://lpaste.net/353791
23:26 athan joined
23:26 <lyxia> ew_: what type is prop_self_equiv
23:26 <lyxia> oh I didn't see the link
23:27 <ew_> ertes: show might be really a source of the problem
23:27 <ew_> ertes: but is there a way to get the example directly? without showing?
23:27 MrWoohoo joined
23:28 Reshi joined
23:28 <ertes> ew_: yes, but it's awkward: you can write a Show instance for TG that doesn't use G's Show instance, but unwraps the G (if fgl even allows that)
23:28 <ertes> so you see the internal representation instead of the nice mkGraph-based one
23:28 <ertes> but if that's the source of the problem, consider it an fgl bug
23:29 <ew_> uhm, this is probably my best bet now
23:29 <ew_> I'll try that
23:34 nomotif joined
23:34 <ew_> ertes: nope, show instance for mkGraph is fine
23:34 <codedmart> lyxia: Thanks again, I am going to try and take a stab at it tomorrow.
23:35 ludat joined
23:36 stoopkid joined
23:37 ebzzry joined
23:38 <ew_> ertes: I kinda fixed the problem.
23:38 boccato joined
23:38 jbiesnecker joined
23:39 magneticduck joined
23:39 <Koterpillar> lyxia: if I'm getting into generics, should I look at GHC.Generics, SYB/Uniplate, or both?
23:40 <ew_> it was a problem of the fgl arbitrary package
23:40 <lyxia> Koterpillar: GHC.Generics.
23:41 <Koterpillar> lyxia: are there cases where SYB et al. are more useful?
23:41 watabou joined
23:45 <lyxia> SYB is a bit simpler because it doesn't involve type class acrobatics.
23:45 sleffy joined
23:45 <ew_> ertes: sorry for being bitchy, thank you very, very much
23:45 <ew_> ertes: you saved me a few days of work
23:45 <ew_> ertes: gtg now
23:47 <lyxia> Koterpillar: I can't think of any good feature it has over Generics. SYB has a lot of unsafety, while being slower at the end.
23:47 <sleffy> Anyone know anything about trying to do monadic substitution, but with *two* distinct free variable types?
23:47 <Koterpillar> lyxia: thanks, that's helpful.
23:48 <sleffy> I've got basically a `Term a b` where `a` and `b` are two different types representing free variables and I'd like to be able to do substitution on each separately. Seems like I'd need some sort of bimonad to do so
23:50 crobbins joined
23:51 JeanCarloMachado joined
23:52 <lyxia> Koterpillar: another bad thing is it doesn't work with types as soon as they contain functions, IO, anything that doesn't look like a "data" type.
23:53 <Koterpillar> well, what can you do about those for a generic function anyway?
23:54 <lyxia> I mean, if you define a type with "data" you can at least peek at its constructors
23:54 ebzzry joined
23:55 tromp joined
23:55 storageJunkie joined
23:55 vydd joined
23:57 oisdk joined
23:58 suls joined